:root {
    --color-primary: #1f4e79;
    --color-accent: #2e86de;
    --color-success: #2ecc71;
    --color-warning: #f39c12;
    --color-danger: #e74c3c;
    --color-ink: #172033;
    --color-muted: #64748b;
    --color-border: #d9e2ec;
    --color-surface: #ffffff;
    --color-page: #f5f7fb;
    --shadow-soft: 0 14px 35px rgba(15, 23, 42, 0.08);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--color-page);
    color: var(--color-ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    background: #0f2238;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    color: #dbeafe;
    padding: 24px 18px;
}

.brand {
    align-items: center;
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
}

.brand-mark {
    align-items: center;
    background: var(--color-accent);
    border-radius: 8px;
    color: #ffffff;
    display: inline-flex;
    font-weight: 800;
    height: 40px;
    justify-content: center;
    width: 40px;
}

.brand-text {
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
}

.nav-list {
    display: grid;
    gap: 4px;
}

.nav-menu > summary {
    display: none;
}

.nav-section {
    color: rgba(219, 234, 254, 0.58);
    font-size: 11px;
    font-weight: 800;
    margin: 18px 10px 6px;
    text-transform: uppercase;
}

.nav-item {
    border-radius: 8px;
    color: #b7c8dc;
    display: block;
    padding: 10px 12px;
}

.nav-item[aria-current="page"],
.nav-item.active,
.nav-item:hover {
    background: rgba(255, 255, 255, 0.09);
    color: #ffffff;
}

.nav-item.disabled {
    color: rgba(219, 234, 254, 0.46);
    cursor: not-allowed;
}

.app-main {
    display: grid;
    grid-template-rows: auto 1fr;
    min-width: 0;
}

.topbar {
    align-items: center;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    min-height: 78px;
    padding: 16px 28px;
}

.topbar-actions {
    align-items: center;
    display: flex;
    gap: 12px;
}

.topbar h1 {
    font-size: 22px;
    line-height: 1.2;
    margin: 0;
}

.user-chip {
    display: grid;
    gap: 1px;
    text-align: right;
}

.user-chip span {
    font-size: 14px;
    font-weight: 700;
}

.user-chip small {
    color: var(--color-muted);
}

.topbar-label,
.eyebrow {
    color: var(--color-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    margin: 0 0 4px;
    text-transform: uppercase;
}

.environment-pill,
.badge {
    background: #eaf4ff;
    border: 1px solid #c9e2fb;
    border-radius: 999px;
    color: var(--color-primary);
    font-size: 12px;
    font-weight: 700;
    padding: 5px 10px;
}

.content {
    padding: 28px;
}

.pilot-banner {
    background: #fff7e6;
    border-bottom: 1px solid #f8d083;
    color: #8a5600;
    font-size: 13px;
    font-weight: 800;
    padding: 9px 28px;
}

.page-stack {
    display: grid;
    gap: 20px;
}

.page-stack > *,
.field,
.field-inline {
    min-width: 0;
}

.page-header {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
}

.page-header h1 {
    font-size: 26px;
    line-height: 1.2;
    margin: 0;
}

.hero-panel,
.status-panel,
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.hero-panel {
    padding: 30px;
}

.hero-panel h1 {
    font-size: 30px;
    line-height: 1.2;
    margin: 0 0 8px;
}

.hero-panel p:last-child,
.module-card p,
.status-panel p {
    color: var(--color-muted);
    margin: 0;
}

.module-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.module-card {
    align-items: flex-start;
    display: flex;
    justify-content: space-between;
    min-height: 130px;
    padding: 20px;
}

.module-card h2 {
    font-size: 17px;
    margin: 0 0 6px;
}

.card-header {
    border-bottom: 1px solid var(--color-border);
    padding: 16px 18px;
}

.card-header h2 {
    font-size: 16px;
    margin: 0;
}

.status-panel {
    padding: 28px;
}

.status-code {
    color: var(--color-danger);
    font-size: 13px;
    font-weight: 800;
}

.status-panel h1 {
    margin: 8px 0;
}

.debug-output {
    margin: 0;
    max-height: 420px;
    overflow: auto;
    padding: 18px;
    white-space: pre-wrap;
}

.auth-body {
    background: #eef4f9;
}

.auth-page {
    align-items: center;
    display: grid;
    min-height: 100vh;
    padding: 24px;
}

.login-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    margin: 0 auto;
    max-width: 430px;
    padding: 28px;
    width: 100%;
}

.login-header {
    align-items: center;
    display: flex;
    gap: 14px;
    margin-bottom: 24px;
}

.login-header h1 {
    font-size: 22px;
    line-height: 1.2;
    margin: 0;
}

.form-stack {
    display: grid;
    gap: 16px;
}

.form-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-card {
    padding: 0;
}

.form-card .form-stack,
.checkbox-list,
.permission-grid {
    padding: 18px;
}

.form-card-wide,
.form-actions {
    grid-column: 1 / -1;
}

.field {
    display: grid;
    gap: 6px;
}

.field span {
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}

.field input,
.field select,
.field textarea {
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-ink);
    font: inherit;
    min-height: 42px;
    padding: 9px 11px;
    width: 100%;
}

.field textarea {
    resize: vertical;
}

.field-inline {
    min-width: 260px;
}

.filter-bar {
    align-items: end;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px;
}

.filter-bar > .field-inline {
    flex: 1 1 180px;
    min-width: min(100%, 170px);
}

.orders-filter > details {
    flex: 1 0 100%;
    min-width: 0;
}

.orders-extra-filters {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
    padding-top: 12px;
}

.orders-extra-filters > .field {
    min-width: 0;
}

.orders-filter summary,
.nav-menu > summary {
    cursor: pointer;
    font-weight: 700;
}

.button {
    align-items: center;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    justify-content: center;
    min-height: 40px;
    padding: 8px 13px;
}

.button-primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #ffffff;
}

.button-secondary,
.button-ghost {
    background: #ffffff;
    color: var(--color-primary);
}

.button-danger {
    background: var(--color-danger);
    border-color: var(--color-danger);
    color: #ffffff;
}

.button-small {
    font-size: 13px;
    min-height: 32px;
    padding: 5px 10px;
}

.button-full {
    width: 100%;
}

.alert {
    border-radius: var(--radius);
    border: 1px solid;
    font-weight: 700;
    padding: 12px 14px;
}

.alert-success {
    background: #edf9f2;
    border-color: #bce9cc;
    color: #17663a;
}

.alert-danger {
    background: #fff1f0;
    border-color: #fac4bd;
    color: #a93428;
}

.table-card {
    max-height: calc(100vh - 240px);
    overflow: auto;
}

.data-table {
    border-collapse: collapse;
    min-width: 860px;
    width: 100%;
}

.data-table th,
.data-table td {
    border-bottom: 1px solid var(--color-border);
    padding: 12px 14px;
    text-align: left;
    vertical-align: top;
}

.data-table th {
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    font-weight: 800;
    position: sticky;
    text-transform: uppercase;
    top: 0;
    z-index: 2;
}

.data-table td small {
    color: var(--color-muted);
    display: block;
    margin-top: 2px;
}

.table-actions {
    align-items: center;
    display: flex;
    gap: 8px;
}

.table-actions form {
    margin: 0;
}

.status-color-chip {
    align-items: center;
    color: #334155;
    display: inline-flex;
    gap: 7px;
    white-space: nowrap;
}

.status-color-chip span {
    background: var(--status-color, #64748b);
    border: 1px solid rgba(15, 23, 42, 0.14);
    border-radius: 999px;
    display: inline-block;
    height: 18px;
    width: 18px;
}

.color-input-row {
    align-items: center;
    display: flex;
    gap: 10px;
}

.color-input-row input[type="color"] {
    cursor: pointer;
    height: 38px;
    padding: 3px;
    width: 56px;
}

.empty-state {
    color: var(--color-muted);
    padding: 28px;
    text-align: center;
}

.status {
    border-radius: 999px;
    display: inline-flex;
    font-size: 12px;
    font-weight: 800;
    padding: 4px 9px;
    text-transform: capitalize;
}

.status-active {
    background: #eafaf0;
    color: #17663a;
}

.status-inactive {
    background: #f1f5f9;
    color: #475569;
}

.status-locked {
    background: #fff4de;
    color: #8a5600;
}

.status-ready {
    background: #eaf4ff;
    color: var(--color-primary);
}

.status-warning {
    background: #fff4de;
    color: #8a5600;
}

.status-danger {
    background: #fff1f0;
    color: #a93428;
}

.status-archived {
    background: #eef2f7;
    color: #475569;
}

.check-row {
    align-items: flex-start;
    display: flex;
    gap: 10px;
}

.check-row input {
    margin-top: 4px;
}

.check-row strong {
    display: block;
}

.check-row small {
    color: var(--color-muted);
    display: block;
}

.checkbox-list {
    display: grid;
    gap: 12px;
}

.permission-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.permission-group {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 14px;
}

.permission-group legend {
    color: var(--color-primary);
    font-weight: 800;
    padding: 0 6px;
}

.summary-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 18px;
}

.summary-grid div {
    background: #f8fafc;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    display: grid;
    gap: 2px;
    padding: 14px;
}

.summary-grid strong {
    color: var(--color-primary);
    font-size: 24px;
    line-height: 1;
}

.summary-grid span,
.helper-panel,
.import-errors {
    color: var(--color-muted);
}

.helper-panel {
    background: #f8fafc;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 12px;
}

.import-errors {
    border-top: 1px solid var(--color-border);
    padding: 14px 18px 18px;
}

.form-actions {
    align-items: center;
    display: flex;
    gap: 10px;
}

.padded-actions {
    padding: 0 18px 18px;
}

.metric-grid,
.detail-grid,
.action-grid,
.link-grid {
    display: grid;
    gap: 12px;
}

.metric-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-grid div,
.action-tile {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.metric-grid div {
    display: grid;
    gap: 4px;
    padding: 16px;
}

.metric-grid span,
.detail-grid span,
.action-tile span {
    color: var(--color-muted);
    font-size: 13px;
}

.metric-grid strong {
    color: var(--color-primary);
    font-size: 20px;
    line-height: 1.2;
}

.detail-grid,
.link-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 18px;
}

.detail-grid div {
    display: grid;
    gap: 4px;
}

.action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.action-tile {
    display: grid;
    gap: 10px;
    padding: 16px;
}

.action-tile button {
    justify-self: start;
}

.job-list {
    display: grid;
    gap: 12px;
    padding: 18px;
}

.job-row {
    background: #f8fafc;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    display: grid;
    gap: 8px;
    padding: 12px;
}

.job-row-heading {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.job-row-title {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.job-row span,
.job-row small {
    color: var(--color-muted);
}

.job-stop-form {
    flex-shrink: 0;
    margin: 0;
}

.job-row-complete {
    border-color: #bce9cc;
}

.job-row-failed {
    border-color: #fac4bd;
}

.job-row-cancelling {
    border-color: #f8d083;
}

.job-row-cancelled {
    border-color: #cbd5e1;
}

.progress-track {
    background: #e2e8f0;
    border-radius: 999px;
    height: 9px;
    overflow: hidden;
}

.progress-track span {
    background: var(--color-accent);
    display: block;
    height: 100%;
    transition: width 0.25s ease;
    width: 0;
}

.compact-stack {
    display: grid;
    gap: 5px;
}

.mini-pill {
    background: #eef2f7;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    color: #334155;
    display: inline-flex;
    font-size: 12px;
    font-weight: 700;
    margin: 2px 4px 2px 0;
    padding: 3px 8px;
}

.mini-pill-live {
    background: #eafaf0;
    border-color: #bce9cc;
    color: #17663a;
}

.mini-pill-removed {
    background: #fff4de;
    border-color: #f8d083;
    color: #8a5600;
}

.variation-summary {
    max-width: 360px;
}

.variation-summary summary {
    color: var(--color-primary);
    cursor: pointer;
    font-weight: 800;
}

.variation-list {
    display: grid;
    gap: 6px;
    margin-top: 8px;
}

.variation-item {
    border-left: 3px solid var(--color-border);
    padding-left: 8px;
}

.variation-item-removed {
    opacity: 0.72;
}

.sync-layout {
    display: grid;
    gap: 20px;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
}

.sync-action-buttons {
    flex-wrap: wrap;
}

.sync-action-buttons .button {
    min-width: 150px;
}

.sync-log-list {
    display: grid;
    gap: 10px;
    max-height: 420px;
    overflow: auto;
    padding: 18px;
}

.sync-log {
    border-left: 3px solid var(--color-border);
    display: grid;
    gap: 3px;
    padding-left: 10px;
}

.sync-log small {
    color: var(--color-muted);
}

.sync-log span {
    color: var(--color-ink);
}

.sync-log-error {
    border-left-color: var(--color-danger);
}

.sync-log-warning {
    border-left-color: var(--color-warning);
}

.sync-log-info {
    border-left-color: var(--color-accent);
}

.log-panel {
    display: grid;
    gap: 8px;
    max-height: 360px;
    overflow: auto;
    padding: 16px;
}

.log-panel code {
    display: block;
    white-space: pre-wrap;
}

.monitoring-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.monitoring-grid .data-table {
    min-width: 480px;
}

.muted {
    color: var(--color-muted);
}

.orders-filter-actions {
    align-items: center;
    align-self: end;
    min-height: 40px;
}

.orders-loading {
    color: var(--color-muted);
    font-size: 13px;
    font-weight: 800;
}

.orders-metrics {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.orders-table-card {
    max-height: calc(100vh - 280px);
}

.orders-table {
    min-width: 1100px;
}

.production-components-table {
    min-width: 1650px;
}

.orders-qty-cell {
    min-width: 180px;
}

.orders-physical-totals {
    max-height: 280px;
}

.export-panel-body {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 18px;
}

.export-panel-body form {
    margin: 0;
}

.pagination-bar {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.pagination-actions {
    align-items: center;
    display: flex;
    gap: 8px;
}

.raw-json-summary {
    max-width: none;
    padding: 18px;
}

code {
    background: #eef2f7;
    border-radius: 6px;
    color: #334155;
    font-size: 13px;
    padding: 2px 5px;
}

.production-actions-panel .export-panel-body,
.production-bulk-toolbar form,
.production-row-actions,
.print-sheet-heading {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.production-filter {
    position: sticky;
    top: 12px;
    z-index: 5;
}

.production-bulk-toolbar {
    padding: 12px;
}

.production-table-card,
.production-total-card,
.print-sheet-group {
    overflow-x: auto;
}

.order-packing-page {
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
    gap: 16px;
}

.order-packing-page .filter-bar {
    display: grid;
    grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)) auto;
}

.order-packing-page .form-actions {
    grid-column: auto;
    flex-direction: row;
    flex-wrap: wrap;
}

.order-packing-page .field,
.order-packing-page input,
.order-packing-page select,
.order-packing-page [data-order-packing-content] {
    min-width: 0;
}

.order-packing-page [data-packing-message]:empty { display: none; }

.packing-order {
    background: var(--color-surface);
    border-top: 2px solid var(--color-border);
    margin-block: 12px 24px;
    overflow-wrap: anywhere;
}

.packing-order-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 20px;
    padding: 14px 16px;
}

.packing-order-identity { flex: 1 1 220px; min-width: 0; }
.packing-order-header h2 { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 17px; margin: 0; }
.packing-order-header h2 a { color: var(--color-primary); text-decoration: underline; }
.packing-order-header small,
.packing-table small { display: block; color: var(--color-muted); font-size: 12px; font-weight: 400; }
.packing-state-ready { color: #166534; }
.packing-state-waiting { color: #854d0e; }

.packing-table {
    min-width: 0;
    table-layout: fixed;
}

.packing-table th,
.packing-table td {
    padding: 7px 16px;
    overflow-wrap: anywhere;
}

.packing-table th {
    position: static;
    text-transform: none;
}

.packing-table thead th:nth-child(2) { width: 5rem; text-align: right; }
.packing-table thead th:nth-child(3) { width: 34%; }
.packing-table tbody th:not([colspan]) { background: transparent; font-size: inherit; color: inherit; font-weight: 600; }
.packing-table .packing-photo th { background: #eef2f7; color: var(--color-ink); font-size: 14px; }
.packing-photo small { margin-top: 2px; }
.packing-quantity { text-align: right !important; font-weight: 700; font-variant-numeric: tabular-nums; }
.packing-empty { padding: 18px 0; color: var(--color-muted); }
.packing-pagination .pagination-bar { flex-wrap: wrap; }

@media screen and (max-width: 1180px) {
    .order-packing-page .filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media screen and (max-width: 560px) {
    .order-packing-page .filter-bar > .field:first-child { grid-column: 1 / -1; }
    .packing-table th, .packing-table td { padding-inline: 8px; }
    .packing-table thead th:nth-child(2) { width: 3rem; }
    .packing-table thead th:nth-child(3) { width: 40%; }
    .packing-order-header { padding-inline: 8px; }
}

@media print {
    .packing-order-header, .packing-photo { break-after: avoid; }
    .packing-table { font-size: 11px; }
    .packing-table tr { break-inside: avoid; }
}

.production-table th,
.production-table td,
.print-sheet-table th,
.print-sheet-table td {
    white-space: nowrap;
}

.production-table td:nth-child(12),
.print-sheet-table td:nth-child(2) {
    min-width: 220px;
    white-space: normal;
}

.supplier-summary-page .print-sheet-table td:nth-child(3) {
    min-width: 0;
    white-space: normal;
}

/* Keep this operational table inside its grid track instead of widening the page. */
.supplier-summary-page {
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
}

.supplier-summary-page > *,
.supplier-summary-page [data-supplier-summary-content] > * {
    min-width: 0;
}

.supplier-summary-page .filter-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

.supplier-summary-page .production-filter {
    position: static;
}

.supplier-summary-page .field-inline,
.supplier-summary-page .field select,
.supplier-summary-page .field input {
    min-width: 0;
    max-width: 100%;
}

.supplier-summary-page .form-actions,
.supplier-summary-page .page-header,
.supplier-summary-page .topbar-actions {
    flex-wrap: wrap;
}

.supplier-summary-page .form-actions {
    justify-content: flex-start;
}

.supplier-summary-page .metric-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
}

.supplier-summary-page .print-sheet-table {
    min-width: 0;
    table-layout: fixed;
}

.supplier-summary-page .print-sheet-table th,
.supplier-summary-page .print-sheet-table td {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
}

.supplier-summary-page .print-sheet-table th:nth-child(1) { width: 23%; }
.supplier-summary-page .print-sheet-table th:nth-child(2) { width: 21%; }
.supplier-summary-page .print-sheet-table th:nth-child(3) { width: 46%; }
.supplier-summary-page .print-sheet-table th:nth-child(4) { width: 10%; }

.supplier-summary-page .supplier-item-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    align-items: start;
}

.supplier-summary-page .supplier-item-action-form,
.supplier-summary-page .supplier-item-pill {
    min-width: 0;
    max-width: 100%;
    width: 100%;
}

.supplier-summary-page .supplier-item-pill {
    justify-content: space-between;
    border-radius: 8px;
}

.supplier-summary-page .supplier-item-details {
    min-width: 0;
    overflow-wrap: anywhere;
}

.supplier-summary-page .supplier-item-pill strong {
    flex-shrink: 0;
}

@media screen and (max-width: 640px) {
    .supplier-summary-page .print-sheet-table thead {
        display: none;
    }

    .supplier-summary-page .print-sheet-table,
    .supplier-summary-page .print-sheet-table tbody,
    .supplier-summary-page .print-sheet-table tr,
    .supplier-summary-page .print-sheet-table td {
        display: block;
        width: 100%;
    }

    .supplier-summary-page .print-sheet-table tr {
        border-bottom: 2px solid var(--color-border);
        padding: 8px 0;
    }

    .supplier-summary-page .print-sheet-table td {
        border: 0;
        padding: 6px 14px;
    }

    .supplier-summary-page .print-sheet-table td::before {
        content: attr(data-label);
        display: block;
        color: var(--color-muted);
        font-size: 12px;
        font-weight: 700;
        margin-bottom: 4px;
    }
}

.supplier-print-sheet .print-sheet-table td:nth-child(4) {
    min-width: 180px;
}

.print-sheet-status-form {
    display: inline-flex;
    margin: 0;
}

.print-sheet-status-button {
    align-items: center;
    background: var(--status-bg, #eff6ff);
    border: 1px solid var(--status-border, #bfdbfe);
    border-radius: 999px;
    color: var(--status-color, #1d4ed8);
    display: inline-flex;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    min-height: 30px;
    padding: 5px 10px;
    white-space: nowrap;
}

button.print-sheet-status-button {
    cursor: pointer;
}

button.print-sheet-status-button:hover {
    border-color: #1f4e79;
    box-shadow: 0 3px 10px rgba(31, 78, 121, 0.14);
}

button.print-sheet-status-button:focus-visible {
    outline: 3px solid rgba(31, 78, 121, 0.24);
    outline-offset: 2px;
}

.print-sheet-status-button.is-final {
    background: var(--status-bg, #dcfce7);
    border-color: var(--status-border, #86efac);
    color: var(--status-color, #166534);
}

.print-sheet-status-button.is-stopped {
    background: var(--status-bg, #fee2e2);
    border-color: var(--status-border, #fecaca);
    color: var(--status-color, #991b1b);
}

.print-sheet-status-button.is-working {
    opacity: 0.72;
    pointer-events: none;
}

.supplier-status-metrics {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.supplier-status-metric {
    border-color: var(--status-border, var(--color-border));
}

.supplier-status-metric strong {
    color: var(--status-color, var(--color-primary));
}

.supplier-status-metric.is-final strong {
    color: var(--status-color, #166534);
}

.supplier-item-action-form {
    display: inline-flex;
    margin: 0;
}

.supplier-item-list {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.supplier-item-pill {
    align-items: center;
    background: #f8fafc;
    border: 1px solid #dbe3ee;
    border-radius: 999px;
    color: #334155;
    display: inline-flex;
    font: inherit;
    gap: 10px;
    min-height: 42px;
    padding: 5px 5px 5px 12px;
    text-align: left;
}

button.supplier-item-pill {
    cursor: pointer;
}

button.supplier-item-pill:hover {
    border-color: #1f4e79;
    box-shadow: 0 3px 10px rgba(31, 78, 121, 0.14);
}

button.supplier-item-pill:focus-visible {
    outline: 3px solid rgba(31, 78, 121, 0.24);
    outline-offset: 2px;
}

.supplier-item-pill.is-actionable {
    background: #fff7ed;
    border-color: #fed7aa;
}

.supplier-item-pill.is-final {
    background: #ecfdf5;
    border-color: #86efac;
    color: #14532d;
}

.supplier-item-pill.is-working {
    opacity: 0.72;
    pointer-events: none;
}

.supplier-item-details {
    display: inline-flex;
    flex-direction: column;
    gap: 3px;
}

.supplier-item-name {
    font-weight: 700;
    line-height: 1.1;
}

.supplier-stage-list {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
}

.supplier-stage-pill {
    background: var(--status-bg, #eef2f7);
    border: 1px solid var(--status-border, #dbe3ee);
    border-radius: 999px;
    color: var(--status-color, #475569);
    font-size: 11px;
    line-height: 1;
    padding: 3px 6px;
}

.supplier-stage-pill.is-active {
    background: var(--status-bg, #eff6ff);
    border-color: var(--status-border, #bfdbfe);
    color: var(--status-color, #1d4ed8);
}

.supplier-stage-pill.is-final {
    background: var(--status-bg, #dcfce7);
    border-color: var(--status-border, #86efac);
    color: var(--status-color, #166534);
}

.supplier-item-pill strong {
    align-items: center;
    background: #1f4e79;
    border-radius: 999px;
    color: #ffffff;
    display: inline-flex;
    font-size: 12px;
    justify-content: center;
    min-width: 26px;
    padding: 3px 7px;
}

.production-row-actions select,
.production-bulk-toolbar select,
.production-actions-panel select,
.export-panel-body input,
.export-panel-body select {
    min-height: 36px;
}

.production-total-table {
    max-width: 560px;
}

.packaging-metrics {
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.packaging-table {
    min-width: 1280px;
}

.packaging-table td:nth-child(4),
.packaging-table td:nth-child(5),
.packaging-checklist-table td:nth-child(6) {
    min-width: 220px;
    white-space: normal;
}

.packaging-row-actions {
    align-items: flex-start;
}

.packaging-row-actions form {
    display: flex;
    gap: 8px;
}

.packaging-detail-page .detail-grid {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
    padding: 0;
}

.packaging-detail-page .detail-card {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 18px;
}

.packaging-checklist-table {
    min-width: 1180px;
}

.print-sheet-heading {
    justify-content: space-between;
}

.print-sheet-heading h2 {
    font-size: 16px;
}

.statistics-filter {
    flex-wrap: wrap;
}

.statistics-filter .field-inline {
    flex: 1 1 180px;
    min-width: 170px;
}

.statistics-filter-actions {
    align-self: end;
}

.statistics-export-panel {
    box-shadow: none;
}

.statistics-loading {
    justify-self: start;
}

.statistics-card-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.statistics-metric {
    box-shadow: var(--shadow-soft);
    display: grid;
    gap: 5px;
    min-height: 118px;
    padding: 16px;
}

.statistics-metric span,
.statistics-metric small {
    color: var(--color-muted);
}

.statistics-metric span {
    font-size: 13px;
    font-weight: 800;
}

.statistics-metric strong {
    color: var(--color-primary);
    font-size: 22px;
    line-height: 1.15;
}

.statistics-chart-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.statistics-chart-card-wide {
    grid-column: 1 / -1;
}

.statistics-chart {
    display: grid;
    gap: 10px;
    min-height: 240px;
    padding: 16px;
}

.statistics-bar-row {
    align-items: center;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(110px, 170px) minmax(120px, 1fr) minmax(76px, auto);
}

.statistics-bar-row > span {
    color: #334155;
    font-size: 13px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.statistics-bar-row > strong {
    color: var(--color-ink);
    font-size: 13px;
    text-align: right;
}

.statistics-bar-track {
    background: #e8eef5;
    border-radius: 999px;
    height: 12px;
    overflow: hidden;
}

.statistics-bar-track i {
    background: linear-gradient(90deg, #2e86de, #2ecc71);
    border-radius: inherit;
    display: block;
    height: 100%;
}

.statistics-report-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.statistics-report-grid > .card:first-child {
    grid-column: 1 / -1;
}

.statistics-table-wrap {
    display: grid;
    gap: 14px;
    max-height: 520px;
    overflow: auto;
    padding: 16px;
}

.statistics-table-wrap h3 {
    color: var(--color-primary);
    font-size: 14px;
    margin: 0;
}

.statistics-mini-table {
    font-size: 13px;
    min-width: 560px;
}

.statistics-mini-table th,
.statistics-mini-table td {
    padding: 9px 10px;
}

@media print {
    body {
        background: #fff;
    }

    .sidebar,
    .topbar,
    .print-hidden,
    .flash-stack {
        display: none !important;
    }

    .app-shell,
    .app-main {
        display: block;
    }

    .content {
        padding: 0;
    }

    .card,
    .table-card {
        border: 0;
        box-shadow: none;
    }

    .print-sheet-group {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .data-table th {
        position: static;
    }
}

@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: 0;
        padding: 16px;
    }

    .sidebar .brand {
        margin-bottom: 10px;
    }

    .nav-menu > summary {
        display: list-item;
        padding: 8px 0;
    }

    .nav-section {
        grid-column: 1 / -1;
    }

    .nav-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .module-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-grid,
    .permission-grid,
    .monitoring-grid,
    .summary-grid,
    .metric-grid,
    .orders-metrics,
    .statistics-card-grid,
    .statistics-chart-grid,
    .statistics-report-grid,
    .detail-grid,
    .action-grid,
    .sync-layout,
    .link-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .content,
    .hero-panel,
    .status-panel {
        padding: 18px;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
        padding: 16px 18px;
    }

    .topbar-actions,
    .page-header,
    .filter-bar,
    .form-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .production-filter {
        position: static;
    }

    .filter-bar > .field-inline,
    .orders-filter > details {
        flex-basis: auto;
    }

    .statistics-bar-row {
        grid-template-columns: 1fr;
    }

    .statistics-bar-row > strong {
        text-align: left;
    }

    .user-chip {
        text-align: left;
    }

    .module-grid,
    .nav-list {
        grid-template-columns: 1fr;
    }

    .module-card {
        min-height: 112px;
    }
}
