/* Shared screen UI. Print rules and business document geometry stay in the recovered stylesheet. */
@media screen {
  :root {
    --erp-bg: #f8fafc;
    --erp-surface: #fff;
    --erp-border: #dce4df;
    --erp-muted: #5d7063;
    --erp-primary: #04783e;
    --erp-primary-soft: #e8f4eb;
    --erp-group-bg: #f3f8f4;
    --erp-row-alt: #f3f8f4;
    --erp-control-border: #7b9182;
    --erp-danger: #a93636;
    --erp-danger-soft: #fbeaea;
    --erp-warning: #8f6b2d;
    --erp-warning-soft: #fff3d6;
    --erp-radius: 0.75rem;
    --erp-motion: cubic-bezier(0.22, 1, 0.36, 1);
    --accent-500: var(--erp-primary);
    --accent-600: var(--erp-primary);
    --accent-900: var(--erp-primary);
    --danger-500: var(--erp-danger);
    --gold-400: var(--erp-muted);
    --gold-500: var(--erp-warning);
    --surface-strong: var(--erp-surface);
    --surface-soft: var(--erp-surface);
    --line-soft: var(--erp-border);
    background: var(--erp-bg);
  }
  body { background: var(--erp-bg); background-attachment: scroll; }
  body::before { content: none; }
  :where(button, a, input, select, textarea, summary):focus-visible {
    outline: 2px solid var(--erp-primary);
    outline-offset: 2px;
  }
  :where(button, input, select, textarea) { font-size: 1rem; }
  .app-shell-root { padding: 1rem; }
  .app-shell-frame { max-width: 1600px; gap: 1rem; }
  .app-shell-content { gap: 1rem; }
  .app-shell-root .ink-title { font-family: inherit; font-weight: 600; }
  .app-shell-root :where(h1, h2, h3, strong) { font-weight: 600; }
  .app-shell-root :where(.paper-panel, .ui-subtle-card, .ui-note-card, .ui-customer-card) {
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .app-shell-root .ui-section-card { padding: 1.5rem; }
  .app-shell-root .section-card-header { gap: 1rem; margin-bottom: 1.5rem; padding: 1rem; border: 1px solid var(--erp-border); border-radius: 0.5rem; background: var(--erp-group-bg); }
  .app-shell-root .section-card-title { gap: 0.5rem; font-size: 1.25rem; line-height: 1.75rem; }
  .app-shell-root .ui-shell-sidebar {
    width: 15rem;
    flex-shrink: 0;
    min-height: calc(100dvh - 2rem);
    padding: 1rem;
    top: 1rem;
  }
  .ui-shell-sidebar nav { margin-top: 1.5rem; gap: 0.25rem; }
  .ui-shell-sidebar > div:first-child > p:last-child { line-height: 1.5; }
  .app-shell-root .ui-shell-header { min-height: 0; padding: 1rem 1.5rem; }
  .app-shell-root .ui-shell-header h2 { font-size: 1.5rem; line-height: 2rem; }
  .app-shell-root .ui-nav-link {
    border-radius: 0.5rem;
    min-height: 2.75rem;
    padding: 0.75rem;
    background: transparent;
    box-shadow: none;
    transition: background-color 300ms var(--erp-motion), color 300ms var(--erp-motion);
  }
  .app-shell-root .ui-nav-link:hover { transform: none; background: var(--erp-bg); }
  .app-shell-root .ui-nav-link-active {
    color: var(--erp-primary);
    background: var(--erp-primary-soft);
    border-color: var(--erp-primary-soft);
    box-shadow: none;
  }
  .app-shell-root .ui-user-badge { background: var(--erp-bg); border-radius: 0.5rem; box-shadow: none; }
  .app-shell-root .ui-user-badge-sidebar { margin-top: 1.5rem; padding: 0.75rem; }
  .app-shell-root .ui-user-badge-sidebar p { overflow-wrap: anywhere; letter-spacing: normal; }
  .ui-user-badge-icon, .ui-title-icon, .ui-section-heading-icon {
    background: var(--erp-primary-soft);
    color: var(--erp-primary);
    border-radius: 0.5rem;
    box-shadow: none;
  }
  .app-shell-root .production-workbench .ui-title-icon,
  .app-shell-root .production-detail-workbench .ui-section-heading-icon {
    background: var(--erp-primary-soft);
    color: var(--erp-primary);
    border-color: var(--erp-border);
    border-radius: 0.5rem;
  }
  .ui-title-icon svg, .ui-section-heading-icon svg, .ui-nav-link svg, .ui-button svg {
    flex-shrink: 0;
    stroke-width: 1.75;
  }
  .erp-skip-link { position: fixed; top: 0.5rem; left: 1rem; z-index: 100; transform: translateY(-200%); }
  .erp-skip-link:focus { transform: none; padding: 0.75rem; background: var(--erp-surface); border: 2px solid var(--erp-primary); }
  .ui-button, .production-workbench .ui-button {
    min-height: 2.75rem;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 600;
    letter-spacing: normal;
    cursor: pointer;
    transition: background-color 300ms var(--erp-motion), color 300ms var(--erp-motion), border-color 300ms var(--erp-motion), transform 300ms var(--erp-motion);
  }
  .ui-button:hover:not(:disabled) { transform: none; }
  .ui-button:active:not(:disabled) { transform: translateY(1px); }
  .ui-button:focus-visible { outline: 2px solid var(--erp-primary); outline-offset: 2px; box-shadow: none; }
  .ui-button-primary, .production-workbench .ui-button-primary, .login-panel .ui-button-primary {
    color: #fff;
    background: var(--erp-primary);
    border-color: var(--erp-primary);
    box-shadow: none;
  }
  .ui-button-primary:hover:not(:disabled), .production-workbench .ui-button-primary:hover:not(:disabled) { background: #24382b; border-color: #24382b; }
  .ui-button-secondary { color: var(--ink-800); background: var(--erp-surface); border-color: var(--erp-border); }
  .ui-button-accent { color: var(--erp-primary); background: var(--erp-primary-soft); border-color: var(--erp-border); }
  .ui-button-danger { color: var(--erp-danger); background: #fbeaea; border-color: #b34c3f38; }
  .ui-button-sm { min-height: 2rem; padding: 0.25rem 0.5rem; font-size: 0.875rem; }
  .ui-control, .ui-input-shell, .date-input-control,
  .production-workbench :is(.ui-control, .ui-input-shell, .date-input-control) {
    min-width: 0;
    min-height: 2.75rem;
    border: 1px solid var(--erp-control-border);
    border-radius: 0.5rem;
    background: var(--erp-surface);
    color: var(--ink-950);
    box-shadow: none;
    font-size: 0.875rem;
    line-height: 1.25rem;
  }
  .ui-control, .date-input-control { padding: 0.5rem 0.75rem; }
  .ui-input-shell { padding: 0 0.75rem; }
  .ui-input-shell input { padding: 0.5rem 0; font-size: 0.875rem; }
  :is(.ui-control, .date-input-control):focus-within,
  .ui-input-shell:focus-within {
    outline: 2px solid var(--erp-primary);
    outline-offset: 2px;
    border-color: var(--erp-primary);
    box-shadow: none;
  }
  .ui-control:disabled, .date-input-disabled { background: var(--erp-bg); color: var(--erp-muted); cursor: not-allowed; }
  .ui-form-title { font-size: 0.875rem; line-height: 1.25rem; font-weight: 600; }
  .ui-form-title > svg { flex-shrink: 0; color: var(--erp-primary); }
  .ui-control[aria-invalid="true"], .ui-input-shell:has(input[aria-invalid="true"]) { border-color: var(--erp-danger); background: var(--erp-danger-soft); }
  .ui-form-error { color: var(--erp-danger); font-size: 0.875rem; line-height: 1.25rem; }
  .ui-empty-state { padding: 1.5rem 1rem; }
  .ui-empty-state-icon { display: inline-flex; align-items: center; justify-content: center; padding: 0.75rem; border-radius: 0.5rem; background: var(--erp-primary-soft); color: var(--erp-primary); }
  .ui-empty-state-title { margin-top: 0.75rem; }
  .ui-empty-state-description { max-width: 36rem; margin: 0.5rem auto 0; overflow-wrap: anywhere; }
  .ui-empty-state-action { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; margin-top: 1rem; }
  .ui-empty-state-inline { padding: 1.5rem 1rem; color: var(--erp-muted); }
  .settings-restore-warning { padding: 0.75rem; border: 1px solid var(--erp-danger); border-radius: 0.5rem; background: var(--erp-danger-soft); color: var(--erp-danger); }
  .erp-order-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
  .erp-order-filters > * { min-width: 0; }
  .erp-order-entry { min-width: 0; }
  .erp-order-basics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
  .erp-form-group { min-width: 0; margin: 0; padding: 1rem; border: 1px solid var(--erp-border); border-radius: 0.75rem; background: var(--erp-group-bg); }
  .erp-form-group > legend { padding: 0 0.5rem; color: var(--erp-primary); font-size: 1rem; line-height: 1.5rem; font-weight: 600; }
  .erp-order-entry .order-items-stack { gap: 0.75rem; }
  .erp-order-add-row { display: flex; justify-content: flex-end; }
  .erp-order-entry .order-import-panel { padding: 1rem; border: 1px solid var(--erp-border); border-radius: 0.5rem; background: var(--erp-bg); box-shadow: none; }
  .erp-order-entry .order-import-panel-icon { background: var(--erp-primary-soft); color: var(--erp-primary); border-radius: 0.5rem; box-shadow: none; }
  .erp-order-entry .order-import-panel strong { font-size: 0.875rem; }
  .erp-order-entry .order-import-panel p { font-size: 0.875rem; line-height: 1.25rem; margin-top: 0.25rem; }
  .erp-order-entry .erp-order-total { padding: 1rem; background: var(--erp-surface); border: 1px solid var(--erp-border); color: var(--ink-950); border-radius: 0.75rem; box-shadow: none; }
  .erp-order-total-label, .erp-order-total-status { color: var(--erp-muted); }
  .erp-order-total-amount { color: var(--erp-primary); font-size: 1.5rem; line-height: 2rem; margin-top: 0.25rem; font-variant-numeric: tabular-nums; }
  .erp-order-total > div:last-child > a { background: var(--erp-surface); color: var(--ink-950); border-color: var(--erp-border); }
  .erp-order-total > div:last-child > button { background: var(--erp-primary); color: #fff; border-color: var(--erp-primary); }
  .app-shell-root .erp-item-editor { border: 1px solid var(--erp-border); border-radius: 0.75rem; background: var(--erp-surface); box-shadow: none; overflow: clip; }
  .erp-item-editor::before { content: none; }
  .erp-item-editor.is-expanded { border-color: var(--erp-primary); }
  .erp-item-header { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; background: var(--erp-group-bg); }
  .erp-item-editor.is-expanded > :is(.erp-item-header, .erp-production-item-heading) { background: var(--erp-primary-soft); }
  .erp-item-heading { flex: 1; min-width: 0; margin: 0; }
  .erp-item-toggle { width: 100%; min-height: 2.75rem; display: flex; align-items: center; gap: 0.75rem; text-align: left; cursor: pointer; border-radius: 0.5rem; }
  .erp-item-toggle:hover { color: var(--erp-primary); }
  .erp-item-heading-copy { flex: 1; min-width: 0; }
  .erp-item-editor .order-item-index { flex-shrink: 0; width: 2.5rem; height: 2.5rem; background: var(--erp-primary-soft); color: var(--erp-primary); border: 0; border-radius: 0.5rem; font-size: 0.875rem; font-weight: 600; box-shadow: none; }
  .erp-item-editor .order-item-title { display: block; max-width: none; white-space: normal; overflow-wrap: anywhere; font-size: 1rem; line-height: 1.5rem; font-weight: 600; }
  .erp-item-editor .order-item-subtitle { display: block; color: var(--erp-muted); font-size: 0.75rem; line-height: 1.25rem; margin-top: 0.25rem; font-weight: 400; }
  .erp-item-quantity-summary { white-space: nowrap; }
  .erp-item-attention { display: inline-block; margin-top: 0.25rem; color: var(--erp-warning); font-size: 0.75rem; line-height: 1rem; font-weight: 500; }
  .erp-item-toggle-label { flex-shrink: 0; color: var(--erp-primary); font-size: 0.75rem; font-weight: 500; }
  .erp-item-chevron { flex-shrink: 0; transition: transform 300ms var(--erp-motion); }
  .erp-item-chevron.is-open { transform: rotate(180deg); }
  .erp-item-header-actions { display: flex; align-items: center; gap: 0.75rem; }
  .erp-item-editor .order-item-total { min-width: 5rem; padding: 0; background: transparent; border: 0; border-radius: 0; font-variant-numeric: tabular-nums; }
  .erp-item-editor .order-item-total span { font-size: 0.75rem; }
  .erp-item-editor .order-item-total strong { font-size: 1rem; line-height: 1.5rem; }
  .erp-item-body { display: grid; gap: 1rem; padding: 1rem; }
  .erp-item-body[hidden] { display: none; }
  .erp-item-identity { display: grid; grid-template-columns: minmax(10rem, 1fr) minmax(0, 3fr); gap: 1rem; align-items: start; }
  .erp-item-editor .ui-form-title { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; line-height: 1.25rem; margin-bottom: 0.5rem; }
  .erp-item-editor .erp-item-identity .ui-form-title { line-height: 1.5rem; }
  .erp-item-editor .erp-item-name-field .ui-form-title { font-size: 1rem; line-height: 1.5rem; }
  .erp-item-name-field input { font-size: 1.125rem; line-height: 1.75rem; font-weight: 500; background: var(--erp-primary-soft); border-color: var(--erp-primary); }
  .erp-required-label { display: inline-flex; align-items: center; flex-shrink: 0; margin-inline-start: 0.375rem; padding: 0.125rem 0.375rem; border-radius: 0.25rem; background: var(--erp-danger-soft); color: var(--erp-danger); font-size: 0.75rem; line-height: 1rem; font-weight: 600; vertical-align: middle; white-space: nowrap; }
  .ui-form-title > .erp-required-label { margin-inline-start: 0; }
  .erp-item-numbers { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: 1rem; align-items: start; }
  .erp-field-hint, .erp-item-calculation { font-size: 0.75rem; line-height: 1.25rem; color: var(--erp-muted); margin-top: 0.25rem; }
  .erp-item-calculation { margin-top: -0.5rem; }
  .erp-item-advanced { border: 1px solid var(--erp-border); border-radius: 0.5rem; overflow: clip; }
  .erp-item-advanced > summary { background: var(--erp-group-bg); }
  .erp-item-advanced[open] > summary { border-bottom: 1px solid var(--erp-border); }
  .erp-item-advanced > summary { display: flex; align-items: center; gap: 0.75rem; min-height: 2.75rem; padding: 0.75rem; list-style: none; cursor: pointer; }
  .erp-item-advanced > summary::-webkit-details-marker { display: none; }
  .erp-item-advanced-title { flex-shrink: 0; font-size: 0.875rem; font-weight: 600; }
  .erp-item-advanced-title > span { margin-left: 0.5rem; color: var(--erp-muted); font-size: 0.75rem; font-weight: 400; }
  .erp-item-parameter-preview { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--erp-muted); font-size: 0.75rem; }
  .erp-item-advanced-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; padding: 0.75rem; }
  .erp-item-advanced-fields .erp-item-remark { grid-column: 1 / -1; }
  .erp-parameter-control { display: grid; gap: 0.5rem; }
  @media (width < 1024px) {
    .erp-order-basics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .erp-item-advanced-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }
  @media (width < 640px) {
    .erp-order-basics, .erp-item-identity { grid-template-columns: minmax(0, 1fr); }
    .erp-order-add-row .ui-button { width: 100%; }
    .erp-item-header { padding: 0.75rem; gap: 0.5rem; }
    .erp-item-toggle, .erp-item-header-actions { gap: 0.5rem; }
    .erp-item-toggle-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .erp-item-editor .order-item-total { min-width: 0; }
    .erp-item-editor .order-item-total strong { font-size: 0.875rem; line-height: 1.25rem; }
    .erp-item-body { padding: 0.75rem; }
    .erp-item-numbers, .erp-item-advanced-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
    .erp-item-pages-field { grid-column: 1 / -1; }
    .erp-order-total > div:last-child { width: 100%; }
    .erp-order-total > div:last-child > * { flex: 1; }
  }
  .app-shell-root .ui-data-table-shell, .production-workbench .ui-data-table-shell {
    border: 1px solid var(--erp-border);
    border-radius: 0.5rem;
    background: var(--erp-surface);
    box-shadow: none;
    overflow-x: auto;
  }
  .app-shell-root .ui-data-table th, .production-workbench .production-table th {
    color: var(--ink-700);
    background: var(--erp-primary-soft);
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 600;
    letter-spacing: normal;
    padding: 0.75rem;
  }
  .app-shell-root .ui-data-table td, .production-workbench .production-table td {
    font-size: 0.875rem;
    line-height: 1.25rem;
    padding: 0.75rem;
    border-color: var(--erp-border);
    font-variant-numeric: tabular-nums;
  }
  .app-shell-root .ui-data-table tbody tr:nth-child(even) { background: var(--erp-row-alt); }
  .order-list-table { min-width: 64rem; }
  .order-list-table th:nth-child(2), .order-list-table td:nth-child(2) { width: 12rem; }
  .order-list-table th:nth-child(7), .order-list-table td:nth-child(7) { width: 14rem; min-width: 14rem; }
  .table-row-index { background: var(--erp-bg); color: var(--erp-muted); border-radius: 0.25rem; font-weight: 500; }
  .app-shell-root .production-workbench {
    --production-accent: var(--erp-primary);
    --production-accent-soft: var(--erp-primary-soft);
    --production-line: var(--erp-border);
    --production-ink: var(--ink-950);
    --production-muted: var(--erp-muted);
    --production-warning: var(--erp-warning);
    --production-warning-soft: var(--erp-warning-soft);
    --production-danger: var(--erp-danger);
    --production-danger-soft: var(--erp-danger-soft);
    --production-success: var(--erp-primary);
    --production-success-soft: var(--erp-primary-soft);
  }
  .app-shell-root .production-workbench.ui-section-card { border-radius: var(--erp-radius); background: var(--erp-surface); }
  .production-workbench .section-card-title { font-size: 1.25rem; font-weight: 600; }
  .dashboard-flow-panel, .dashboard-flow-step, .dashboard-todo-item, .dashboard-settlement-card, .dashboard-quick-card {
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: 0.5rem;
    box-shadow: none;
    backdrop-filter: none;
  }
  .dashboard-flow-panel { padding: 0.75rem; }
  .dashboard-flow-panel { container-type: inline-size; }
  .dashboard-flow-grid { gap: 0.5rem; }
  @container (width < 48rem) {
    .dashboard-flow-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dashboard-flow-line { display: none; }
  }
  @container (width < 28rem) {
    .dashboard-flow-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }
  .dashboard-flow-step { padding: 0.75rem; min-height: 8rem; }
  .dashboard-flow-step::after { content: none; }
  .dashboard-flow-step-active { border-color: var(--erp-primary); }
  .dashboard-flow-line { top: 3.5rem; left: 1.5rem; width: calc(100% - 3rem); height: 1.5rem; color: var(--erp-border); background: none; pointer-events: none; }
  .dashboard-flow-step:hover, .dashboard-quick-card:hover, .stat-card-clickable:hover { transform: none; box-shadow: none; border-color: var(--erp-primary); }
  .dashboard-flow-step strong, .dashboard-settlement-card strong { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
  .dashboard-flow-step strong { font-size: 1.25rem; line-height: 1.75rem; }
  .erp-stat-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
  .erp-stat-heading > div:first-child { min-width: 0; flex: 1; }
  .erp-stat-value { margin-top: 0.75rem; font-size: 1.5rem; line-height: 2rem; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
  .erp-stat-icon { flex-shrink: 0; padding: 0.5rem; border-radius: 0.5rem; color: var(--erp-primary); background: var(--erp-primary-soft); }
  svg.lucide { stroke-width: 1.75; flex-shrink: 0; }
  .production-workbench :is(.production-priority, .production-status, .production-due-risk) { font-size: 0.75rem; line-height: 1rem; font-weight: 600; }
  .production-workbench :is(.production-priority, .production-status, .production-due-risk) { padding: 0.25rem 0.5rem; border-radius: 0.25rem; }
  .production-workbench :is(.production-status-active, .production-status-success, .production-due-risk-success) { color: var(--erp-primary); border-color: var(--erp-border); background: var(--erp-primary-soft); }
  .production-workbench :is(.production-priority-normal, .production-status-muted, .production-due-risk-stable, .production-due-risk-muted) { color: var(--erp-muted); border-color: var(--erp-border); background: var(--erp-bg); }
  .production-workbench .production-table td { color: var(--ink-800); }
  .production-workbench .production-table tbody tr:nth-child(even) { background: var(--erp-row-alt); }
  .production-workbench .production-table tbody tr:hover { background: var(--erp-primary-soft); }
  .production-workbench .production-cell-primary { font-weight: 600; }
  .dashboard-flow-footer { margin-top: 0.75rem; padding: 0.75rem; background: var(--erp-bg); border-radius: 0.5rem; }
  .dashboard-flow-step h3, .dashboard-flow-step p { font-size: 0.875rem; }
  .dashboard-todo-item-high { border-color: #b34c3f38; background: #fbeaea; }
  .login-page-shell { min-height: 100dvh; background: var(--erp-bg); }
  .login-page-shell::before, .login-page-shell::after { content: none; }
  .login-panel { background: var(--erp-surface); border: 1px solid var(--erp-border); border-radius: 1rem; box-shadow: 0 12px 28px #143e2214; backdrop-filter: none; }
  .login-title { font-size: 1.875rem; line-height: 2.25rem; font-weight: 600; }
  .login-brand h1 { font-size: 1.5rem; line-height: 2rem; font-weight: 600; }
  .login-kicker, .login-brand p { color: var(--erp-muted); }
  .settlement-drawer-backdrop { backdrop-filter: none; -webkit-backdrop-filter: none; }
  .settlement-drawer { background: var(--erp-surface); }
  .erp-confirm-dialog { width: min(30rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); overflow-y: auto; margin: auto; border: 1px solid var(--erp-border); border-radius: 0.75rem; background: var(--erp-surface); padding: 1.5rem; box-shadow: 0 16px 32px #073b1f29; color: var(--ink-950); }
  .erp-confirm-dialog::backdrop { background: #13201757; }
  .erp-confirm-dialog h2 { font-size: 1.25rem; line-height: 1.75rem; font-weight: 600; }
  .erp-confirm-dialog p { margin-top: 0.75rem; color: var(--ink-700); line-height: 1.75rem; overflow-wrap: anywhere; }
  .erp-confirm-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }
  .erp-mobile-menu { background: var(--erp-surface); border: 1px solid var(--erp-border); border-radius: var(--erp-radius); }
  .erp-mobile-menu-toggle { display: flex; align-items: center; gap: 0.75rem; min-height: 3rem; padding: 0.75rem 1rem; cursor: pointer; list-style: none; font-size: 0.875rem; font-weight: 600; }
  .erp-mobile-menu-toggle::-webkit-details-marker { display: none; }
  .erp-mobile-menu-current { margin-left: auto; color: var(--erp-primary); overflow-wrap: anywhere; }
  .erp-mobile-menu-glyph { flex-shrink: 0; }
  .erp-mobile-menu-glyph path { transform-origin: 12px 12px; transition: transform 300ms var(--erp-motion), opacity 300ms var(--erp-motion); }
  .erp-mobile-menu[open] .erp-menu-line-top { transform: translateY(5px) rotate(45deg); transform-origin: 12px 7px; }
  .erp-mobile-menu[open] .erp-menu-line-middle { opacity: 0; }
  .erp-mobile-menu[open] .erp-menu-line-bottom { transform: translateY(-5px) rotate(-45deg); transform-origin: 12px 17px; }
  .ui-mobile-nav { position: static; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; background: transparent; border: 0; border-radius: 0; padding: 0.5rem; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .ui-mobile-nav-link { min-width: 0; min-height: 2.75rem; display: flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.5rem; border-radius: 0.5rem; font-size: 0.875rem; }
  .ui-mobile-nav-link-active { color: var(--erp-primary); background: var(--erp-primary-soft); }
  @media (width <= 1180px) {
    .app-shell-root .production-workbench .ui-data-table-shell { border: 0; background: transparent; }
    .production-workbench .production-table tr { border: 1px solid var(--erp-border); border-radius: 0.5rem; }
    .production-workbench .production-table tbody tr:nth-child(even), .production-workbench .production-table tbody tr:hover { background: var(--erp-surface); }
    .production-workbench .production-table td::before { grid-area: 1 / 1; font-size: 0.75rem; line-height: 1.25rem; font-weight: 600; }
  }
  @media (width >= 1024px) { .erp-mobile-menu { display: none; } }
  @media (width < 1024px) {
    body { padding-bottom: 0; }
    .app-shell-root { display: flex; flex-direction: column; gap: 0.75rem; padding: 0.75rem; }
    .app-shell-frame { width: 100%; order: 1; min-height: 0; }
    .erp-mobile-menu { order: 0; }
    .app-shell-root .ui-shell-sidebar { display: none; }
    .app-shell-root .ui-shell-header { padding: 1rem; }
    .app-shell-root .ui-shell-header > div { flex-direction: row; align-items: center; }
    .ui-shell-header .ui-user-badge { display: none; }
    .dashboard-flow-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-flow-line { display: none; }
    .ui-button { width: auto; }
    .erp-order-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .erp-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }
  @media (width < 640px) {
    .app-shell-root .ui-section-card { padding: 1rem; }
    .app-shell-root .section-card-header { margin-bottom: 1rem; }
    .app-shell-root .ui-shell-header h2 { font-size: 1.25rem; line-height: 1.75rem; }
    .ui-shell-header > div > div:first-child > p { letter-spacing: normal; }
    .ui-control, .ui-input-shell input, .date-input-control, .login-panel .ui-input-shell input { font-size: 1rem; }
    .erp-order-filters > :first-child { grid-column: 1 / -1; }
    .erp-order-filters > :last-child { grid-column: 1 / -1; }
    .app-shell-root .stat-card-shell { padding: 1rem; }
    .erp-stat-heading .ui-kicker { letter-spacing: normal; }
    .erp-stat-icon { padding: 0.25rem; }
    .erp-stat-icon svg { width: 1rem; height: 1rem; }
    .stat-card-shell > p { margin-top: 0.75rem; font-size: 0.75rem; line-height: 1.25rem; }
    .dashboard-flow-step { min-height: 0; }
    .dashboard-flow-footer { align-items: stretch; }
    .ui-table-actions { gap: 0.5rem; }
  }
  @media (pointer: coarse) {
    .ui-button-sm, .ui-data-table .ui-button-sm { min-height: 2.75rem; }
  }
  /* Production follows the same form, list and item hierarchy as business orders. */
  .erp-prod-filter { display: grid; gap: 0.75rem; margin-bottom: 1rem; padding: 1rem; border: 1px solid var(--erp-border); border-radius: 0.75rem; background: var(--erp-bg); }
  .erp-prod-filter-primary { display: grid; grid-template-columns: minmax(12rem, 2fr) minmax(10rem, 1fr) auto; gap: 0.75rem; align-items: end; }
  .erp-prod-filter-primary > .ui-form-label { min-width: 0; }
  .erp-prod-filter-primary .ui-button { min-width: 6rem; }
  .erp-prod-filter .ui-input-shell { min-width: 0; display: flex; align-items: center; gap: 0.5rem; padding: 0 0.75rem; }
  .erp-prod-filter .ui-input-shell input { width: 100%; min-width: 0; min-height: 2.75rem; border: 0; outline: 0; background: transparent; }
  .erp-prod-more-filters { border-top: 1px solid var(--erp-border); }
  .erp-prod-more-filters > summary { min-height: 2.75rem; display: flex; align-items: center; gap: 0.75rem; cursor: pointer; list-style: none; font-size: 0.875rem; font-weight: 600; }
  .erp-prod-more-filters > summary::-webkit-details-marker { display: none; }
  .erp-prod-more-filters > summary small { min-width: 0; color: var(--erp-muted); font-size: 0.75rem; font-weight: 400; overflow-wrap: anywhere; }
  .erp-prod-more-filters > .erp-production-fields { padding: 0.5rem 0 0.75rem; }
  .erp-prod-filter-footer { display: flex; min-height: 2.75rem; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; color: var(--erp-muted); font-size: 0.875rem; }
  .erp-prod-clear { min-height: 2.75rem; padding: 0.5rem; color: var(--erp-primary); cursor: pointer; font-weight: 500; }
  .erp-prod-results { overflow: hidden; border: 1px solid var(--erp-border); border-radius: 0.75rem; background: var(--erp-surface); }
  .erp-prod-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
  .erp-prod-table th { padding: 0.75rem; border-bottom: 1px solid var(--erp-border); background: var(--erp-primary-soft); color: var(--erp-muted); text-align: left; font-size: 0.75rem; line-height: 1.25rem; font-weight: 600; }
  .erp-prod-table th:nth-child(1) { width: 23%; }
  .erp-prod-table th:nth-child(2) { width: 19%; }
  .erp-prod-table th:nth-child(3) { width: 19%; }
  .erp-prod-table th:nth-child(4) { width: 21%; }
  .erp-prod-table th:nth-child(5) { width: 18%; }
  .erp-prod-table td { min-width: 0; padding: 0.875rem 0.75rem; border-bottom: 1px solid var(--erp-border); vertical-align: middle; overflow-wrap: anywhere; font-size: 0.875rem; }
  .erp-prod-table tbody tr:last-child td { border-bottom: 0; }
  .app-shell-root .erp-prod-table tbody tr:nth-child(even) { background: var(--erp-row-alt); }
  .app-shell-root :is(.ui-data-table, .erp-prod-table) tbody tr:focus-within { background: var(--erp-primary-soft); }
  @media (hover: hover) {
    .app-shell-root :is(.ui-data-table, .erp-prod-table) tbody tr:hover { background: var(--erp-primary-soft); }
  }
  .erp-prod-table td > :is(strong, small, a) { display: block; max-width: 100%; }
  .erp-prod-table td > small { margin-top: 0.25rem; color: var(--erp-muted); font-size: 0.75rem; line-height: 1.25rem; }
  .erp-prod-number { color: var(--erp-primary); font-weight: 600; }
  .erp-prod-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem; }
  .erp-prod-table :is(.production-status, .production-priority, .production-due-risk) { display: inline-flex; min-height: 1.5rem; align-items: center; border: 1px solid var(--erp-border); border-radius: 0.375rem; padding: 0.125rem 0.5rem; font-size: 0.75rem; line-height: 1rem; font-weight: 600; }
  .production-workbench :is(.production-status-warning, .production-due-risk-warning) { color: var(--erp-warning); background: var(--erp-warning-soft); }
  .production-workbench :is(.production-status-danger, .production-due-risk-danger) { color: var(--erp-danger); background: var(--erp-danger-soft); }
  .erp-prod-table .erp-prod-row-actions { white-space: nowrap; }
  .erp-prod-row-actions .ui-button { display: inline-flex; min-height: 2.75rem; padding: 0.5rem; font-size: 0.875rem; }
  .erp-prod-delete { width: 2.75rem; margin-left: 0.25rem; border: 1px solid var(--erp-border); color: var(--erp-danger); }
  .erp-prod-more-rows { display: flex; justify-content: center; padding: 1rem; border-top: 1px solid var(--erp-border); }
  .erp-production-current { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin-bottom: 0.75rem; color: var(--erp-muted); font-size: 0.875rem; }
  .production-detail-workbench .production-print-document { display: block; }
  .production-detail-workbench .production-print-header { display: none; }
  .production-detail-workbench .production-print-overview { display: grid; grid-template-columns: minmax(12rem, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 0; margin: 0 0 1rem; overflow: hidden; border: 1px solid var(--erp-border); border-radius: 0.75rem; background: var(--erp-surface); }
  .production-detail-workbench .production-print-info-card { min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 0.25rem; padding: 0.75rem 1rem; border: 0; border-right: 1px solid var(--erp-border); }
  .production-detail-workbench .production-print-info-card:last-child { border-right: 0; }
  .production-detail-workbench .production-print-info-card > :is(span, em) { color: var(--erp-muted); font-size: 0.75rem; line-height: 1.25rem; font-style: normal; }
  .production-detail-workbench .production-print-info-card > strong { overflow-wrap: anywhere; font-size: 0.875rem; line-height: 1.25rem; }
  .production-detail-workbench form.no-print.erp-production-editor { display: block; margin: 0; }
  .erp-production-editor { min-width: 0; }
  .erp-production-anchors { position: sticky; top: 0.5rem; z-index: 3; display: flex; gap: 0.375rem; margin-bottom: 1rem; padding: 0.5rem; overflow-x: auto; border: 1px solid var(--erp-border); border-radius: 0.75rem; background: var(--erp-surface); }
  .erp-production-anchors a { min-height: 2.75rem; display: inline-flex; flex: 0 0 auto; align-items: center; padding: 0.5rem 0.75rem; border-radius: 0.5rem; color: var(--ink-800); font-size: 0.875rem; text-decoration: none; }
  .erp-production-anchors a:hover { background: var(--erp-primary-soft); color: var(--erp-primary); }
  .erp-production-section { min-width: 0; margin: 0 0 1.25rem; padding: 0 0 1.25rem; border-bottom: 1px solid var(--erp-border); scroll-margin-top: 5rem; }
  .erp-production-section-head { margin-bottom: 0.875rem; padding: 0.875rem 1rem; border: 1px solid var(--erp-border); border-radius: 0.5rem; background: var(--erp-group-bg); }
  .erp-production-section-head h3 { display: flex; align-items: center; gap: 0.5rem; margin: 0; font-size: 1.125rem; line-height: 1.5rem; }
  .erp-production-section-head h3 svg { color: var(--erp-primary); }
  .erp-production-section-head > p { margin: 0.375rem 0 0; color: var(--erp-muted); font-size: 0.875rem; line-height: 1.375rem; }
  .erp-production-fields { min-width: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.875rem 1rem; align-items: start; }
  .erp-production-fields > .ui-form-label { min-width: 0; }
  .erp-production-fields :is(.ui-control, .date-input-control) { width: 100%; min-width: 0; min-height: 2.75rem; }
  .erp-production-editor textarea { min-height: 5.5rem; resize: vertical; }
  .erp-production-editor .ui-form-error { margin: 0.25rem 0 0; color: var(--erp-danger); font-size: 0.75rem; line-height: 1.25rem; }
  .erp-production-item { margin-bottom: 0.5rem; }
  .erp-production-item-heading { margin: 0; background: var(--erp-group-bg); }
  .erp-production-item .erp-item-toggle { min-height: 4rem; padding: 0.5rem 0.75rem; }
  .erp-production-item .erp-item-name-field input { min-height: 3rem; font-size: 1.125rem; }
  .erp-production-item .erp-item-advanced-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .erp-production-switch { min-height: 2.75rem; display: inline-flex; align-items: center; gap: 0.625rem; cursor: pointer; font-weight: 500; }
  .erp-production-switch input { width: 1.125rem; height: 1.125rem; accent-color: var(--erp-primary); }
  .erp-production-outsourcing { margin-top: 0.75rem; }
  .erp-production-error { margin-bottom: 1rem; padding: 0.875rem 1rem; border: 1px solid var(--erp-danger); border-radius: 0.5rem; background: var(--erp-danger-soft); color: var(--erp-danger); scroll-margin-top: 5rem; }
  .erp-production-error:focus { outline: 2px solid var(--erp-danger); outline-offset: 2px; }
  .erp-production-error ul { display: grid; gap: 0.25rem; margin: 0.5rem 0 0; padding-left: 1.25rem; }
  .erp-production-error button { min-height: 2.75rem; color: inherit; text-align: left; text-decoration: underline; text-underline-offset: 0.15em; }
  .erp-production-save { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; padding-top: 0.25rem; }
  .erp-production-save-note { color: var(--erp-muted); font-size: 0.875rem; }
  .erp-production-chevron { flex-shrink: 0; transition: transform 300ms var(--erp-motion); }
  .erp-production-item.is-expanded > h4 .erp-production-chevron,
  .erp-item-advanced[open] > summary .erp-production-chevron { transform: rotate(180deg); }
  @media (width < 1280px) and (width >= 1024px) {
    .erp-prod-table th:nth-child(5) { width: 22%; }
    .erp-prod-table th:nth-child(1) { width: 21%; }
    .erp-prod-table th:nth-child(4) { width: 19%; }
    .erp-prod-table td { padding: 0.75rem 0.5rem; }
  }
  @media (width < 1200px) {
    .erp-production-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .production-detail-workbench .production-print-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .production-detail-workbench .production-print-info-card:nth-child(2n) { border-right: 0; }
  }
  @media (width < 760px) {
    .erp-prod-filter-primary { grid-template-columns: minmax(0, 1fr) auto; }
    .erp-prod-filter-primary > :first-child { grid-column: 1 / -1; }
    .erp-prod-results { border: 0; border-radius: 0; }
    .erp-prod-table, .erp-prod-table tbody { display: block; }
    .erp-prod-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .erp-prod-table tbody { display: grid; gap: 0.75rem; }
    .erp-prod-table tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; padding: 0.875rem; border: 1px solid var(--erp-border); border-radius: 0.75rem; }
    .erp-prod-table td { display: block; padding: 0; border: 0; }
    .erp-prod-row-id, .erp-prod-row-stage, .erp-prod-row-actions { grid-column: 1 / -1; }
    .erp-prod-row-id { padding-bottom: 0.5rem !important; border-bottom: 1px solid var(--erp-border) !important; }
    .erp-prod-row-id > strong { margin-top: 0.25rem; }
    .erp-prod-row-output > strong { font-size: 0.75rem; }
    .erp-prod-row-actions { display: flex !important; justify-content: flex-end; gap: 0.5rem; padding-top: 0.5rem !important; border-top: 1px solid var(--erp-border) !important; }
    .erp-prod-row-actions .ui-button { margin: 0; }
    .erp-production-item .erp-item-identity { grid-template-columns: minmax(0, 1fr); }
    .erp-production-item .erp-item-advanced-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .erp-production-anchors { position: static; flex-wrap: wrap; padding: 0.25rem; gap: 0; }
    .erp-production-anchors a { flex: 1 0 auto; justify-content: center; padding: 0.5rem; font-size: 0.75rem; }
    .erp-production-current > span:last-child { flex-basis: 100%; font-size: 0.75rem; }
    .production-detail-workbench .production-print-info-card { padding: 0.75rem; }
    .erp-production-save { align-items: stretch; flex-direction: column; }
    .erp-production-save > .ui-button { width: 100%; }
  }
  @media (width < 400px) {
    .erp-prod-filter { padding: 0.75rem; }
    .erp-production-fields { gap: 0.875rem 0.75rem; }
    .erp-production-fields .ui-form-title { font-size: 0.75rem; }
  }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  }
}

/* Application-wide screen contract. Keep document/print tables out of this layer. */
@media screen {
  :root { --accent-700: var(--erp-primary); --accent-800: var(--erp-primary); --accent-400: var(--erp-primary); }
  :is(.app-shell-root, .customer-portal-shell, .customer-mobile-shell, .driver-upload-page, .login-page-shell) {
    font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  }
  .app-shell-root :where([class*="rounded-2xl"], [class*="rounded-3xl"], [class*="rounded-[2"], [class*="rounded-[3"]) { border-radius: var(--erp-radius); }
  .app-shell-root :where([class*="shadow-"], [class*="backdrop-blur"]) { box-shadow: none; backdrop-filter: none; }
  :where(h1, h2, h3, h4) { text-wrap: balance; }
  .section-card-header > div:first-child { min-width: 0; }
  .section-card-header > :last-child { flex-shrink: 0; }
  .ui-form-label { min-width: 0; }
  .ui-form-title { margin-bottom: 0.5rem; }
  :is(.ui-control, .ui-input-shell) { max-width: 100%; }
  .ui-input-shell input { width: 100%; min-width: 0; }
  .ui-button:disabled { cursor: not-allowed; }
  .ui-form-success, .driver-upload-message { color: var(--erp-primary); background: var(--erp-primary-soft); border-radius: 0.5rem; padding: 0.75rem; }
  .erp-form-notice { padding: 0.75rem 1rem; border: 1px solid var(--erp-border); border-radius: 0.5rem; line-height: 1.5; overflow-wrap: anywhere; }
  .erp-form-notice-error { color: var(--erp-danger); border-color: var(--erp-danger); background: var(--erp-danger-soft); }
  .erp-payment-form { align-items: end; }
  .erp-state-illustration { width: 5rem; height: 5rem; margin: 0 auto; color: var(--erp-primary); }
  .erp-empty-state { display: grid; justify-items: center; padding: 2rem 1rem; }
  .erp-empty-state h3 { font-size: 1rem; font-weight: 600; line-height: 1.5rem; }
  .erp-empty-state p { font-size: 0.875rem; line-height: 1.5rem; max-width: 36rem; }
  .erp-loading { color: var(--erp-muted); font-size: 0.875rem; line-height: 1.5rem; gap: 0.75rem; align-items: center; justify-content: center; }
  .erp-loading-region { min-height: 16rem; display: flex; }
  .erp-loading-full { min-height: 100dvh; }
  .erp-loading-inline { display: inline-flex; gap: 0.5rem; padding: 0.375rem 0.625rem; border-radius: 0.375rem; background: var(--erp-primary-soft); color: var(--erp-primary); }
  .erp-loading-mark { width: 1.5rem; height: 1.5rem; flex-shrink: 0; color: var(--erp-primary); }
  .erp-loading-line { animation: erp-print-line 1.2s var(--erp-motion) infinite; }
  @keyframes erp-print-line { 0%, 100% { opacity: .3; transform: translateY(-1px); } 50% { opacity: 1; transform: translateY(1px); } }
  .erp-badge { display: inline-flex; align-items: center; min-height: 1.5rem; width: fit-content; max-width: 100%; padding: 0.125rem 0.5rem; border: 1px solid var(--erp-border); border-radius: 0.375rem; font-size: 0.75rem; line-height: 1.25rem; font-weight: 600; white-space: normal; }
  .erp-badge-primary, .erp-badge-success { color: var(--erp-primary); background: var(--erp-primary-soft); }
  .erp-badge-muted { color: var(--erp-muted); background: var(--erp-bg); }
  .erp-badge-warning { color: var(--erp-warning); background: var(--erp-warning-soft); }
  .erp-badge-danger { color: var(--erp-danger); background: var(--erp-danger-soft); }
  .erp-filter-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.75rem; align-items: end; padding: 1rem; margin-bottom: 1rem; border: 1px solid var(--erp-border); border-radius: 0.75rem; background: var(--erp-bg); }
  .erp-filter-field { min-width: 0; display: grid; gap: 0.5rem; font-size: 0.875rem; }
  .erp-filter-field .ui-form-title { margin: 0; }
  .erp-filter-field :is(.ui-control, .date-input-control) { width: 100%; }
  .erp-filter-field .ui-input-shell { display: flex; align-items: center; gap: 0.5rem; }
  .erp-filter-field .ui-input-shell input { min-height: 2.625rem; }
  .section-card-header > .erp-filter-bar { margin: 0; padding: 0; border: 0; background: none; grid-template-columns: minmax(12rem, 1fr) auto; }
  .erp-cell-label { display: none; }
  .erp-cell-value { display: contents; }
  .erp-responsive-table th { vertical-align: middle; }
  .erp-responsive-table td { overflow-wrap: anywhere; }
  .erp-modal { color: var(--ink-950); background: var(--erp-surface); padding: 0; border: 1px solid var(--erp-border); border-radius: 0.75rem; max-height: calc(100dvh - 2rem); width: min(40rem, calc(100vw - 2rem)); margin: auto; overflow: auto; }
  .erp-modal::backdrop { background: #13201780; }
  .erp-settlement-modal { margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(32rem, 100vw); max-width: 100vw; border-radius: 0; border: 0; border-left: 1px solid var(--erp-border); }
  .erp-settlement-modal .settlement-drawer { width: 100%; min-height: 100%; border: 0; box-shadow: none; padding: 1.25rem; background: var(--erp-surface); }
  .settlement-drawer-head h2 { color: var(--erp-muted); font-size: 0.875rem; line-height: 1.5rem; font-weight: 600; }
  .settlement-drawer-head strong { font-size: 1.25rem; line-height: 1.75rem; font-weight: 600; overflow-wrap: anywhere; }
  .settlement-drawer-summary > div { background: var(--erp-bg); border-color: var(--erp-border); border-radius: 0.5rem; }
  .settlement-drawer-summary span { font-weight: 500; letter-spacing: normal; }
  .settlement-drawer-actions { margin-top: 1rem; gap: 0.75rem; }
  .settlement-period-panel { background: var(--erp-bg); border-color: var(--erp-border); border-radius: 0.75rem; }
  .settlement-period-panel span { color: var(--erp-muted); letter-spacing: normal; font-weight: 500; }
  .settlement-period-steps em { color: var(--erp-primary); background: var(--erp-primary-soft); border-radius: 0.375rem; font-style: normal; font-weight: 500; }
  .settlement-date-shortcuts { border-radius: 0.5rem; background: var(--erp-bg); }
  .settlement-date-shortcuts button { min-height: 2.75rem; border-radius: 0.375rem; font-weight: 500; }
  .customer-portal-shell, .customer-mobile-shell, .driver-upload-page { background: var(--erp-bg); min-height: 100dvh; }
  :is(.customer-portal-shell, .customer-mobile-shell, .driver-upload-page) :is(h1, h2, h3, strong, dt, em) { font-weight: 600; font-style: normal; }
  .customer-portal-hero { padding: 1rem 1.5rem; }
  :is(.customer-portal-topbar, .customer-portal-progress-card, .customer-portal-panel, .customer-portal-stat-card, .customer-mobile-card, .driver-upload-card) { background: var(--erp-surface); border: 1px solid var(--erp-border); border-radius: 0.75rem; box-shadow: none; backdrop-filter: none; }
  .customer-portal-topbar { padding: 1.25rem; gap: 1rem; }
  .customer-portal-topbar h1 { font-size: 1.5rem; line-height: 2rem; font-weight: 600; overflow-wrap: anywhere; }
  .customer-portal-topbar h2 { font-size: 1.125rem; color: var(--erp-primary); font-weight: 600; }
  .customer-portal-progress-card { padding: 1.25rem; gap: 1.25rem; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.5fr); }
  .customer-portal-progress-copy h2 { font-size: 1.25rem; line-height: 1.75rem; font-weight: 600; }
  .customer-portal-progress-copy span, .customer-portal-panel-head span { color: var(--erp-muted); font-weight: 500; letter-spacing: normal; }
  .erp-progress-ring { position: relative; width: 7.5rem; height: 7.5rem; display: grid; place-content: center; text-align: center; color: var(--erp-primary); }
  .erp-progress-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; }
  .erp-progress-ring strong { font-size: 1.5rem; line-height: 2rem; font-variant-numeric: tabular-nums; }
  .erp-progress-ring span { color: var(--erp-muted); font-size: 0.75rem; line-height: 1.25rem; }
  .customer-portal-progress span { background: var(--erp-primary); }
  .customer-portal-progress-metrics > div { border-radius: 0.5rem; background: var(--erp-bg); padding: 0.75rem; }
  .customer-portal-progress-metrics strong { font-size: 1.5rem; font-weight: 600; line-height: 2rem; }
  .customer-portal-progress-metrics span { font-weight: 500; }
  .customer-portal-stat-card { min-height: 0; padding: 1rem; }
  .customer-portal-stat-head { margin-bottom: 0.75rem; }
  .customer-portal-stat-card strong { font-size: 1.5rem; line-height: 2rem; }
  .customer-portal-stat-icon, .customer-portal-item-index, .customer-portal-delivery-index, .driver-scan-icon { background: var(--erp-primary-soft); color: var(--erp-primary); border-radius: 0.5rem; box-shadow: none; }
  :is(.customer-portal-location-row, .customer-portal-delivery-row, .customer-portal-item-row, .customer-portal-detail-facts > div, .customer-portal-signature-box, .customer-portal-delivery-remark) { background: var(--erp-bg); border-color: var(--erp-border); border-radius: 0.5rem; box-shadow: none; }
  .customer-portal-location-bar span { background: var(--erp-primary); }
  .customer-portal-preview-badge, .customer-portal-year { border-radius: 0.5rem; min-height: 2.75rem; font-weight: 500; background: var(--erp-bg); border-color: var(--erp-border); color: var(--erp-primary); }
  .customer-portal-delivery-row { min-height: 2.75rem; }
  .customer-portal-delivery-row.is-active { background: var(--erp-primary-soft); border-color: var(--erp-primary); }
  .customer-mobile-hero { background: var(--erp-surface); }
  .customer-mobile-hero h1 { font-size: 1.5rem; line-height: 2rem; font-weight: 600; }
  .customer-mobile-info-grid > div, .customer-mobile-item, .customer-mobile-signature { border-color: var(--erp-border); border-radius: 0.5rem; background: var(--erp-bg); }
  .customer-mobile-actions :is(a, button), .customer-mobile-photo-close, .customer-portal-photo-close { min-height: 2.75rem; border-radius: 0.5rem; font-weight: 600; }
  .erp-modal:is(.customer-mobile-photo-viewer, .customer-portal-photo-viewer) { position: fixed; inset: 0; max-width: calc(100vw - 2rem); width: fit-content; min-width: min(20rem, calc(100vw - 2rem)); height: fit-content; background: var(--erp-surface); padding: 1rem; display: none; border-radius: 0.75rem; }
  .erp-modal:is(.customer-mobile-photo-viewer, .customer-portal-photo-viewer)[open] { display: grid; gap: 1rem; }
  .erp-modal :is(.customer-mobile-photo-close, .customer-portal-photo-close) { position: static; justify-self: end; background: var(--erp-bg); color: var(--ink-950); }
  .erp-modal img { max-height: calc(100dvh - 10rem); object-fit: contain; }
  .driver-upload-card { padding: 1.25rem; }
  .driver-upload-top h1 { font-size: 1.5rem; font-weight: 600; line-height: 2rem; }
  .driver-upload-top span { letter-spacing: normal; font-weight: 500; }
  .driver-upload-ghost, .driver-upload-secondary { min-height: 2.75rem; border-radius: 0.5rem; font-weight: 600; }
  .driver-scan-hero { background: var(--erp-bg); border-radius: 0.5rem; }
  .driver-scan-hero h2 { font-size: 1.125rem; font-weight: 600; line-height: 1.75rem; }
  .driver-delivery-card, .driver-photo-preview, .driver-upload-loading { border-radius: 0.5rem; border-color: var(--erp-border); background: var(--erp-bg); }
  .driver-delivery-status { border-radius: 0.375rem; background: var(--erp-primary-soft); font-weight: 600; }
  .driver-delivery-card strong { font-size: 1.25rem; font-weight: 600; }
  .driver-delivery-card :is(p, dt, dd) { font-weight: 400; }
  .driver-camera-button { background: var(--erp-primary); border-radius: 0.5rem; box-shadow: none; font-size: 1rem; font-weight: 600; cursor: pointer; }
  .driver-camera-button input { display: block; position: absolute; width: 1px; height: 1px; opacity: 0; }
  .driver-camera-button:focus-within { outline: 2px solid var(--erp-primary); outline-offset: 2px; }
  .login-panel { border-radius: 0.75rem; box-shadow: none; }
  .login-brand-mark { background: var(--erp-primary-soft); color: var(--erp-primary); box-shadow: none; border-radius: 0.75rem; }
  @media (width < 1024px) {
    .customer-portal-progress-card { grid-template-columns: minmax(0, 1fr) auto; }
    .customer-portal-progress-body { grid-column: 1 / -1; }
  }
  @media (width < 760px) {
    .section-card-header > :last-child { max-width: 100%; }
    .erp-filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0.75rem; }
    .erp-filter-bar > :first-child { grid-column: 1 / -1; }
    .section-card-header > .erp-filter-bar { width: 100%; grid-template-columns: minmax(0, 1fr) auto; }
    .section-card-header > .erp-filter-bar > :first-child { grid-column: auto; }
    .ui-data-table-shell:has(> .erp-responsive-table), .ui-data-table-shell:has(> div > .erp-responsive-table) { border: 0; background: transparent; overflow: visible; }
    .erp-responsive-table, .erp-responsive-table tbody { display: block; width: 100%; min-width: 0 !important; max-width: 100%; }
    .erp-responsive-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .erp-responsive-table tbody { display: grid; gap: 0.75rem; }
    .erp-responsive-table tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.875rem; padding: 0.875rem; border: 1px solid var(--erp-border); border-radius: 0.75rem; background: var(--erp-surface); }
    .app-shell-root .erp-responsive-table tbody td { display: block; width: auto !important; min-width: 0 !important; max-width: 100%; padding: 0; border: 0; text-align: left; white-space: normal; }
    .erp-responsive-table td.erp-cell-primary { grid-column: 1 / -1; padding-bottom: 0.75rem; border-bottom: 1px solid var(--erp-border); font-weight: 600; }
    .erp-responsive-table td.erp-cell-wide { grid-column: 1 / -1; }
    .erp-cell-label { display: block; color: var(--erp-muted); margin-bottom: 0.25rem; font-size: 0.75rem; line-height: 1rem; font-weight: 500; }
    .erp-cell-value { display: block; min-width: 0; overflow-wrap: anywhere; }
    .erp-cell-value :is(.ui-table-actions, .order-table-actions) { width: 100%; min-width: 0; white-space: normal; flex-wrap: wrap; justify-content: flex-start; }
    .erp-responsive-table .ui-button-sm { min-height: 2.75rem; }
    .customer-portal-hero { padding: 0.75rem; }
    .customer-portal-content { padding: 0 0.75rem 1rem; }
    .customer-portal-progress-card { padding: 1rem; gap: 0.75rem; }
    .customer-portal-topbar, .customer-portal-panel { padding: 1rem; }
    .customer-portal-progress-copy h2 { font-size: 1.125rem; }
    .customer-portal-progress-copy p { font-size: 0.875rem; }
    .erp-progress-ring { width: 6rem; height: 6rem; }
    .customer-portal-progress-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
    .customer-portal-progress-metrics > div { padding: 0.5rem; }
    .customer-portal-progress-metrics strong { font-size: 1.25rem; }
    .customer-portal-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
    .customer-portal-stat-head { gap: 0.5rem; }
    .customer-portal-stat-icon { width: 2rem; height: 2rem; }
    .driver-upload-card { border-radius: 0; border: 0; }
  }
  @media (prefers-reduced-motion: reduce) { .erp-loading-line { animation: none; } }
}
@media print { .erp-cell-label { display: none; } .erp-cell-value { display: contents; } .erp-modal { display: none !important; } }

/* Final shared screen corrections. Existing print rules remain authoritative. */
@media screen {
  .app-shell-root .ui-customer-card { display: grid; gap: 1rem; padding: 1rem; background: var(--erp-surface); }
  .customer-workbench { align-items: start; }
  .customer-workbench .section-card-header { flex-wrap: wrap; }
  .customer-workbench .section-card-header > div:first-child { flex: 1 1 15rem; }
  .customer-workbench .section-card-header > .erp-filter-bar { flex: 1 1 16rem; }
  .customer-info-grid { grid-template-columns: repeat(auto-fit, minmax(min(10rem, 100%), 1fr)); gap: 0.75rem; }
  .customer-info-item { padding: 0; border: 0; background: transparent; border-radius: 0; gap: 0.5rem; }
  .customer-info-item-wide { grid-column: 1 / -1; }
  .customer-info-label { color: var(--erp-muted); font-size: 0.75rem; line-height: 1rem; font-weight: 500; }
  .customer-info-value { font-size: 0.875rem; line-height: 1.5rem; font-weight: 500; }
  .customer-action-panel { flex: none; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 0.75rem; }
  .customer-action-summary { background: var(--erp-bg); border-color: var(--erp-border); border-radius: 0.375rem; font-size: 0.75rem; line-height: 1rem; font-weight: 500; }
  .customer-action-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; width: auto; }
  .customer-action-buttons .ui-button { min-height: 2.75rem; width: auto; }
  .app-shell-root .erp-responsive-table td > .erp-cell-value { display: contents; white-space: normal; }
  .app-shell-content .driver-upload-page { min-height: 0; padding: 1rem 0; }
  .app-shell-content .driver-upload-card { margin-inline: auto; }
  .order-print-document .production-print-title-block h1 { color: var(--erp-primary); }
  .order-print-document .production-print-no { gap: 0.5rem 1rem; }
  .order-print-document .production-print-no span { white-space: normal; overflow-wrap: anywhere; }
  @media (width < 760px) {
    .customer-workbench .section-card-header > div:first-child, .customer-workbench .section-card-header > .erp-filter-bar { flex-basis: auto; }
    .customer-action-panel { align-items: stretch; flex-direction: column; }
    .customer-action-summary { justify-content: flex-start; align-self: start; }
    .customer-action-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .customer-action-buttons .ui-button { width: 100%; }
    .app-shell-root .erp-responsive-table td > .erp-cell-value { display: block; white-space: normal; overflow-wrap: anywhere; }
    .erp-responsive-table td.erp-cell-wide { grid-column: 1 / -1; }
    .order-print-document .production-print-header { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
    .order-print-document .production-print-status-card { border: 1px solid var(--erp-border); border-radius: 0.5rem; background: var(--erp-bg); padding: 0.75rem; text-align: left; }
    .order-print-document .production-print-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); border: 0; gap: 0.75rem; }
    .order-print-document .production-print-info-card { border: 1px solid var(--erp-border); border-radius: 0.5rem; padding: 0.75rem; }
    .order-print-document .production-print-info-card :is(strong, em) { overflow-wrap: anywhere; }
    .order-print-document .production-print-info-card-strong strong { font-size: 1.125rem; }
  }
}
