/* Shared presentation layer. No data, role visibility or workflow changes. */
@media screen {
  :root {
    --navy: #243e80;
    --navy-deep: #192d59;
    --ink: #1c2d4e;
    --muted: #59677e;
    --line: #dfe5eb;
    --soft: #f3f5f6;
    --brand-lime: #d7f553;
    --brand-lime-hover: #c7e941;
    --brand-lime-soft: #f0f8d6;
    --brand-font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  }
  body { font-family: var(--brand-font); color: var(--ink); background: var(--soft); line-height: 1.5; }
  button, input, select, textarea { font-family: var(--brand-font); }
  :is(button,a,input,select,textarea,summary):focus-visible {
    outline: 3px solid var(--navy); outline-offset: 3px;
  }
  input::placeholder, textarea::placeholder { color: #68758a; opacity: 1; }
  input[type=checkbox], input[type=radio] { accent-color: var(--navy); }
  button:disabled { cursor: not-allowed; opacity: .55; }
  .content { background: var(--soft); padding-top: 30px; padding-bottom: 40px; min-width: 0; }
  .page, .panel, .toolbar > *, .panel-heading > *, .form-grid > *, .hr-hero > * { min-width: 0; }
  .topbar { gap: 20px; margin-bottom: 28px; }
  .topbar h1, .content:has(#reportsPage:not(.hidden)) .topbar h1 {
    font-family: var(--brand-font); font-size: clamp(24px,2.2vw,32px); font-weight: 700;
    line-height: 1.22; letter-spacing: -.8px; color: var(--ink);
  }
  .eyebrow.dark { color: var(--muted); font-size: 11px; letter-spacing: 1.5px; line-height: 1.5; }
  .page h2, .modal h2 { font-family: var(--brand-font); color: var(--ink); line-height: 1.35; letter-spacing: -.35px; }
  .panel h2, .discovery-hero h2, .admin-product-hero h2, .task-center-head h2,
  .procurement-hero h2, .hr-hero h2 { font-size: 20px; font-weight: 700; }
  .page h3 { font-family: var(--brand-font); line-height: 1.4; color: var(--ink); }
  .muted, .hero-copy { color: var(--muted); }
  .hero-copy { font-size: 14px; line-height: 1.6; }
  .panel, .market-card, .procurement-card, .product-card, .discovery-hero {
    border-color: var(--line); border-radius: 14px; background: #fff;
    box-shadow: 0 2px 4px rgba(25,45,89,.025);
  }
  .panel-heading { gap: 16px; flex-wrap: wrap; align-items: center; }
  .panel-heading p:not(.eyebrow), .admin-product-hero p:last-child,
  .task-center-head p:last-child, .discovery-hero > div > p:last-child,
  .procurement-hero > div > p:last-child { color: var(--muted); font-size: 13px; line-height: 1.65; }

  /* Consistent compact navigation; retain drawer and role-based visibility. */
  .sidebar { border-right: 1px solid var(--line); }
  .workspace-label { color: var(--muted); font-size: 10px; line-height: 1.5; }
  .sidebar .nav-item, .sidebar .nav-group-toggle { font-family: var(--brand-font); font-size: 14px; line-height: 1.35; color: var(--muted); font-weight: 600; border-radius: 9px; }
  .sidebar .nav-group-toggle { color: var(--ink); font-size: 13px; min-height: 42px; }
  .sidebar .nav-submenu .nav-item { min-height: 38px; padding-top: 9px; padding-bottom: 9px; }
  .sidebar .nav-item.active { color: var(--navy-deep); background: var(--brand-lime); box-shadow: none; }
  .sidebar .nav-item:hover:not(.active), .sidebar .nav-group-toggle:hover { background: #f0f3f6; color: var(--navy); }
  .sidebar .nav-group { margin: 0; padding: 0; }
  .sidebar .nav-count { background: var(--brand-lime); color: var(--navy-deep); font-size: 11px; min-width: 23px; }
  .sidebar-bottom { border-color: var(--line); padding-top: 12px; }
  .profile-chip strong { color: var(--ink); font-size: 13px; }
  .profile-chip small { color: var(--muted); font-size: 11px; }
  .role-preview { color: var(--muted); font-size: 12px; }
  .role-preview select { font-size: 12px; color: var(--ink); }

  /* Primary actions use the lime accent; dangerous actions remain red. */
  .primary-button, .primary-button.small {
    min-height: 42px; padding: 10px 16px; border: 1px solid transparent;
    border-radius: 9px; background: var(--brand-lime); color: var(--navy-deep);
    box-shadow: none; font-size: 13px; font-weight: 700; line-height: 1.4;
  }
  .primary-button:hover:not(:disabled) { background: var(--brand-lime-hover); box-shadow: 0 2px 5px rgba(25,45,89,.1); }
  .secondary-button { min-height: 40px; padding: 9px 14px; border: 1px solid #ccd5e0; border-radius: 9px; background: #fff; color: var(--navy); font-size: 13px; font-weight: 600; line-height: 1.4; box-shadow: none; }
  .secondary-button:hover:not(:disabled) { background: #f2f5fa; border-color: #a8b7ce; }
  .table-action { min-height: 34px; padding: 7px 10px; border-radius: 7px; font-size: 12px; font-weight: 600; color: var(--navy); background: #edf1f7; }
  .table-action:hover { background: #dfe7f3; }
  .table-action.danger, .primary-button.danger, .secondary-button.danger { color: #a82036; background: #fff0f2; border-color: #efc7ce; }
  .table-action.danger:hover, .primary-button.danger:hover, .secondary-button.danger:hover { background: #ffe1e6; }
  .text-action, .link-button, .table-link { color: var(--navy); font-size: 13px; font-weight: 600; }
  .close-button { flex-shrink: 0; width: 36px; height: 36px; background: #edf1f5; color: var(--muted); }
  .toolbar, .toolbar-actions, .hr-actions, .admin-product-hero, .procurement-hero { flex-wrap: wrap; gap: 12px; }
  .toolbar-actions { min-width: 0; }
  .search, .admin-filter { max-width: 100%; height: 42px; color: var(--ink); font-size: 14px; border-color: #ccd5e0; background: #fff; }
  .segmented, .product-section-tabs, .detail-tabs, .category-filters, .package-filters {
    background: #e9edf0; border-radius: 10px; padding: 4px; gap: 4px; max-width: 100%;
  }
  .segmented button, .product-section-tabs button, .detail-tabs button,
  .category-filters button, .package-filters button {
    min-height: 36px; padding: 8px 12px; font-family: var(--brand-font); font-size: 13px; font-weight: 600; color: var(--muted); line-height: 1.35;
  }
  .segmented button.active, .product-section-tabs button.active, .detail-tabs button.active,
  .category-filters button.active, .package-filters button.active { background: #fff; color: var(--navy); box-shadow: 0 1px 4px #192d5912; }
  #orderStatusFilters { flex-wrap: wrap; }
  .status-pill, .catalog-status { font-size: 11px; font-weight: 700; padding: 5px 9px; line-height: 1.4; }
  .status-pill.active, .catalog-status.active { color: #226045; background: #e8f5ed; }
  .status-pill.frozen { color: #526079; background: #edf0f5; }

  /* Readable records and financial matrices. Horizontal scrolling stays inside tables. */
  .table-panel { max-width: 100%; border-color: var(--line); }
  .table-panel th { padding: 15px 18px; font-size: 11px; font-weight: 700; letter-spacing: .65px; color: var(--muted); background: #f6f8fa; }
  .table-panel td { padding: 17px 18px; font-size: 13px; line-height: 1.5; color: var(--ink); border-color: #e6eaf0; }
  .table-panel td strong { font-size: 14px; font-weight: 600; line-height: 1.45; }
  .table-panel td small { font-size: 12px; color: var(--muted); line-height: 1.5; }
  .table-panel tbody tr:hover { background: #f7faf2; }
  .customer-location { gap: 2px; }
  .customer-location strong { font-size: 13px !important; }
  #priceListsPanel > .panel-heading { display: flex; align-items: flex-start; }
  #priceListsPanel > .panel-heading > div:first-child { flex: 1 1 100%; }
  #priceListsPanel > .panel-heading p:not(.eyebrow) { max-width: 850px; margin-bottom: 0; }
  #matrixCurrencyControls { flex-wrap: nowrap; }
  .pricing-currency-controls { gap: 5px; }
  .pricing-currency-controls button { min-height: 38px; padding: 8px 15px; font-size: 13px; font-weight: 600; border-color: #cbd5e2; }
  .pricing-currency-controls button.active { background: var(--navy); border-color: var(--navy); color: #fff; }
  .price-list-settings { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; margin: 24px 0; }
  .price-list-settings article { grid-template-columns: 36px minmax(0,1fr) minmax(0,1fr); padding: 15px; gap: 12px 10px; background: #f7f9fa; border-color: var(--line); }
  .price-list-settings article > strong { width: 34px; height: 40px; border-radius: 8px; font-size: 16px; background: var(--brand-lime); color: var(--navy-deep); }
  .price-list-settings label { min-width: 0; color: var(--muted); font-size: 12px; font-weight: 600; }
  .price-list-settings input { min-width: 0; height: 40px; font-size: 14px; color: var(--ink); padding: 8px; background: #fff; border-color: #ccd5e0; }
  .pricing-matrix-wrap { overflow: auto; max-width: 100%; max-height: 65vh; border: 1px solid var(--line); border-radius: 11px; }
  .pricing-matrix { width: 100%; border-collapse: separate; border-spacing: 0; }
  .pricing-matrix th, .pricing-matrix td { padding: 13px 12px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; background: #fff; }
  .pricing-matrix th { position: sticky; top: 0; z-index: 2; background: #f0f3f6; color: var(--navy); }
  .pricing-matrix th:first-child, .pricing-matrix td:first-child { position: sticky; left: 0; z-index: 1; min-width: 210px; max-width: 260px; box-shadow: 1px 0 var(--line); }
  .pricing-matrix th:first-child { z-index: 3; }
  .pricing-matrix th small, .pricing-matrix td small { display: block; color: var(--muted); font-size: 12px; line-height: 1.45; margin-top: 4px; }
  .pricing-matrix td > input { height: 40px; padding: 8px 10px; font-size: 14px; color: var(--ink); border-color: #ccd5e0; font-variant-numeric: tabular-nums; }
  .pricing-matrix .matrix-show { margin-top: 8px; font-size: 12px; color: var(--muted); gap: 7px; }
  .customer-price-board { max-width: 100%; }
  .price-customer-column header strong, .price-customer-column article strong { font-size: 13px; color: var(--ink); }
  .price-customer-column small, .price-customer-column p { color: var(--muted); font-size: 12px; }
  .admin-product-row { padding-top: 17px; padding-bottom: 17px; }
  .admin-product-row strong { font-size: 14px; line-height: 1.45; }
  .admin-product-row small { font-size: 12px; line-height: 1.5; color: var(--muted); }
  .admin-product-hero > div { min-width: 0; }
  .admin-product-hero .toolbar-actions { flex: 1 1 400px; justify-content: flex-end; }
  .upload-inline { position: relative; overflow: hidden; cursor: pointer; }
  .upload-inline input[type=file] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
  .upload-inline:focus-within { outline: 3px solid var(--navy); outline-offset: 3px; }

  /* One font and number hierarchy across all departments. */
  .stat-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .stat-card, .admin-kpis article, .task-kpis article, .lead-kpis article, .hr-kpis article { border-color: var(--line); border-radius: 13px; }
  .stat-card strong, .admin-kpis strong, .task-kpis strong, .lead-kpis strong, .hr-kpis strong { font-family: var(--brand-font); font-size: 28px; font-weight: 700; letter-spacing: -.6px; font-variant-numeric: tabular-nums; color: var(--navy-deep); }
  .stat-card p, .admin-kpis span, .task-kpis span, .lead-kpis span, .hr-kpis span { font-size: 13px; color: var(--muted); }
  .stat-card small, .admin-kpis small, .task-kpis small, .lead-kpis small, .hr-kpis small { font-size: 12px; line-height: 1.5; color: var(--muted); }
  .stat-card.navy { background: var(--navy-deep); }
  .stat-card.navy strong { color: #fff; }
  .stat-card.navy p, .stat-card.navy small { color: #dde5f6; }
  .stat-card.accent { background: var(--brand-lime-soft); border-color: #dce7ba; }
  .stat-card.accent strong { color: var(--navy-deep); }
  .market-card h3 { font-size: 18px; }
  .market-card p, .market-metrics small, .market-card-top, .discovery-status small { color: var(--muted); font-size: 12px; }
  .market-metrics strong { color: var(--ink); font-size: 13px; }
  .market-card.active-market { box-shadow: inset 0 3px var(--brand-lime); }
  .supplier-query-card { border-color: var(--line); background: #f7f9fa; }
  .supplier-query-card h3, .supplier-query-card strong { color: var(--ink); }
  .hr-hero { background: var(--navy-deep); border-radius: 14px; }
  .hr-hero h2 { font-family: var(--brand-font); color: #fff; }
  .hr-hero p { color: #dce5f4; font-size: 13px; line-height: 1.65; }
  .hr-hero .eyebrow { color: var(--brand-lime); }
  .hr-hero .secondary-button:hover { background: #ffffff25; color: #fff; }
  .hr-actions { justify-content: flex-end; }
  .employee-mobile { background: linear-gradient(180deg,var(--navy-deep) 0 190px,var(--soft) 190px); }
  .employee-mobile header h2 { font-family: var(--brand-font); color: #fff; }
  .qr-scan-button { background: var(--brand-lime); color: var(--navy-deep); }
  .employee-summary strong { font-family: var(--brand-font); }
  .work-order-top h2 { font-size: 17px; overflow-wrap: anywhere; }
  .work-order-top p, .work-order-meta small { font-size: 12px; color: var(--muted); }
  .work-order-meta strong { font-size: 13px; }
  .work-order-meta { background: #f3f6f8; gap: 14px; padding: 16px; }
  .sample-request-card small, .sample-request-card p { font-size: 12px; color: var(--muted); }
  .sample-request-card h3 { font-size: 16px; }
  .sample-workflow { flex-wrap: wrap; }
  .sample-workflow span { font-size: 11px; color: var(--muted); }
  .sample-workflow span.done { color: var(--navy-deep); background: var(--brand-lime-soft); }
  .sample-card-items span { font-size: 12px; color: var(--ink); }
  .sample-card-items strong { font-size: 13px; }
  .task-card small, .task-card p, .procurement-card small { color: var(--muted); font-size: 12px; }

  /* Forms stay within their containers; selects retain their native arrow. */
  .modal { color: var(--ink); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 80px #14254233; }
  .modal::backdrop { background: #14254266; backdrop-filter: blur(3px); }
  .modal-heading { gap: 16px; margin-bottom: 22px; }
  .modal h2 { font-size: 22px; }
  .modal :is(label,.form-grid label,.employee-order-line label,.sample-item-row label,.nutrition-form-grid label,.order-edit-row label,.procurement-line label) { font-size: 13px; color: #40516e; line-height: 1.5; font-weight: 600; min-width: 0; }
  .modal :is(input:not([type=checkbox]):not([type=radio]):not([type=file]),select,textarea) { font-family: var(--brand-font); font-size: 14px; color: var(--ink); max-width: 100%; min-width: 0; border: 1px solid #cbd5e2; border-radius: 8px; background-color: #fff; background-image: none; box-sizing: border-box; }
  .modal :is(input:not([type=checkbox]):not([type=radio]):not([type=file]),select) { min-height: 42px; }
  .modal input[readonly] { background-color: #edf2f7; color: var(--navy); }
  .modal .form-section-title span { font-size: 13px; }
  .modal .form-section-title small, .modal .security-note { font-size: 12px; color: var(--muted); }
  .modal .form-section-title { gap: 10px; flex-wrap: wrap; }
  .modal-actions { gap: 10px; flex-wrap: wrap; padding-top: 18px; }
  .employee-order-line, .sample-item-row, .order-edit-row { background: #f7f9fb; border-color: var(--line); }
  .empty-state, .empty-table { color: var(--muted); font-size: 13px; line-height: 1.6; }
  .empty-state strong { color: var(--ink); font-size: 15px; }
  .empty-state p { color: var(--muted); font-size: 13px; }

  /* Reports remain neutral and data-led, with the same brand accents. */
  .content:has(#reportsPage:not(.hidden)) { background: var(--soft); }
  #reportsPage { color: var(--ink); }
  .report-kpis { border-radius: 12px; overflow: hidden; border-color: var(--line); }
  .report-kpis > button, .report-kpis > div { background: #fff; color: var(--ink); display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; container-type: inline-size; }
  .report-kpis > button.selected { background: var(--brand-lime-soft); box-shadow: inset 0 3px var(--brand-lime); }
  .report-kpis strong { font-weight: 700; font-size: clamp(18px,10cqi,28px); white-space: nowrap; overflow-wrap: normal; max-width: 100%; overflow-x: auto; }
  .report-controls select, .report-controls input { border: 1px solid #cbd5e2; border-radius: 8px; padding: 7px 10px; height: 42px; }
  .report-tabs button.active { border-color: var(--navy); color: var(--navy); }
  .report-table-wrap { border: 1px solid var(--line); border-radius: 12px; background: #fff; }
  .report-table-wrap th { color: var(--muted); font-weight: 600; }
  #reportRefresh { border-radius: 8px; min-height: 38px; }

  @media (max-width: 1250px) {
    .price-list-settings { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .hr-hero { flex-direction: column; align-items: stretch; }
    .hr-actions { justify-content: flex-start; }
  }
  @media (max-width: 800px) {
    .stat-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .topbar { flex-wrap: wrap; gap: 12px; }
    .market-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .admin-product-hero { align-items: flex-start; }
    .admin-product-hero .toolbar-actions { justify-content: flex-start; flex-basis: 100%; }
    .work-order-meta { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .hr-actions { flex-direction: row; }
    .pricing-matrix th:first-child, .pricing-matrix td:first-child { min-width: 160px; max-width: 180px; }
  }
  @media (max-width: 600px) {
    .content { padding: 20px 16px 32px; }
    .topbar h1 { font-size: 24px; }
    .top-actions { flex-wrap: wrap; gap: 10px; max-width: 100%; }
    .panel { padding: 18px; }
    .table-panel { padding: 0; }
    .toolbar, .toolbar-actions, .customer-filter-controls { flex-wrap: wrap; }
    .toolbar-actions { width: 100%; }
    .toolbar-actions .search { flex: 1 1 150px; min-width: 0; width: auto; }
    .segmented { overflow-x: auto; }
    .segmented button { flex-shrink: 0; }
    .price-list-settings, .market-grid { grid-template-columns: minmax(0,1fr); }
    .price-list-settings article { padding: 14px; }
    .price-list-settings input, .pricing-matrix input:not([type=checkbox]), .search, .admin-filter,
    .modal :is(input:not([type=checkbox]):not([type=radio]):not([type=file]),select,textarea),
    .report-controls select, .report-controls input { font-size: 16px; }
    .primary-button, .primary-button.small, .secondary-button { min-height: 44px; }
    .table-action { min-height: 38px; }
    .hr-actions { flex-direction: column; align-items: stretch; width: 100%; }
    .hr-kpis, .lead-kpis, .task-kpis, .admin-kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .hr-kpis article, .lead-kpis article, .task-kpis article, .admin-kpis article { padding: 14px; }
    .admin-product-row { grid-template-columns: 42px minmax(0,1fr); padding: 15px 18px; }
    .admin-product-thumb { width: 40px; height: 40px; }
    .admin-product-row .admin-row-actions { grid-column: 2; flex-wrap: wrap; }
    .admin-product-row .catalog-status { grid-column: 2; justify-self: start; }
    .admin-product-list { margin-left: -18px; margin-right: -18px; }
    .modal .nutrition-form-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .modal h2 { font-size: 20px; }
    .modal .form-grid { grid-template-columns: minmax(0,1fr); }
    .modal .employee-order-line { grid-template-columns: minmax(0,1fr); }
    .modal .employee-order-line > * { min-width: 0; }
  }
  @media (prefers-reduced-motion: reduce) {
    .sidebar, .primary-button, .secondary-button, .nav-item { transition: none; }
  }
}
