:root {
  --ink: #1f2933;
  --muted: #64748b;
  --surface: #ffffff;
  --canvas: #f4f6f8;
  --line: #d9e0e7;
  --navy: #17324d;
  --blue: #1769aa;
  --green: #23805c;
  --yellow: #f0c34e;
  --orange: #e68132;
  --red: #c94040;
  --shadow: 0 10px 26px rgba(23, 50, 77, .08);
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); font: 15px/1.5 system-ui, -apple-system, Segoe UI, sans-serif; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.site-header { position: sticky; top: 0; z-index: 50; min-height: 68px; padding: 10px 24px; display: flex; align-items: center; gap: 24px; color: white; background: var(--navy); }
.brand { color: white; font-weight: 750; display: flex; align-items: center; gap: 10px; font-size: 18px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 44px; height: 44px; overflow: hidden; border: 2px solid rgba(255,255,255,.75); border-radius: 10px; background: white; box-shadow: 0 3px 10px rgba(0,0,0,.2); }
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: cover; }
.quick-search { flex: 1; max-width: 540px; display: flex; }
.quick-search input { flex: 1; border: 0; border-radius: 7px 0 0 7px; padding: 10px 12px; }
.quick-search button { border: 0; padding: 0 16px; border-radius: 0 7px 7px 0; color: white; background: var(--blue); font-weight: 700; }
.user-menu { margin-left: auto; display: flex; gap: 12px; align-items: center; }
.link-button { color: white; border: 0; background: none; text-decoration: underline; cursor: pointer; }
.setup-menu { position: relative; }
.setup-menu summary { list-style: none; cursor: pointer; color: white; font-weight: 700; }
.setup-menu summary::-webkit-details-marker, .reports-nav summary::-webkit-details-marker { display: none; }
.nav-popover { position: absolute; z-index: 20; min-width: 210px; background: white; border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 8px; overflow: hidden; }
.top-popover { top: calc(100% + 12px); right: 0; }
.nav-popover a { display: block; padding: 10px 14px; color: var(--ink); }
.nav-popover a:hover { background: #eef5fa; text-decoration: none; }
.sidebar { position: fixed; z-index: 40; top: 68px; bottom: 0; left: 0; width: 220px; overflow-y: auto; padding: 18px 12px; background: white; border-right: 1px solid var(--line); }
.workflow-nav { display: flex; flex-direction: column; gap: 4px; }
.workflow-nav > a, .reports-nav > summary, .report-links a { display: block; padding: 10px 12px; border-radius: 7px; color: var(--ink); font-weight: 700; cursor: pointer; }
.workflow-nav a:hover, .reports-nav > summary:hover { background: #eef5fa; text-decoration: none; }
.workflow-nav a.active { color: var(--blue); background: #e5f1f9; }
.nav-divider { height: 1px; margin: 9px 8px; background: var(--line); }
.reports-nav > summary { list-style: none; }
.reports-nav > summary::after { content: "›"; float: right; transition: transform .15s ease; }
.reports-nav[open] > summary::after { transform: rotate(90deg); }
.report-links { margin-top: 3px; padding-left: 10px; }
.report-links a { padding: 8px 12px; color: #465565; font-size: 14px; font-weight: 600; }
.page-shell { width: min(1420px, calc(100% - 36px)); margin: 0 auto; padding: 26px 0 60px; }
.authenticated .page-shell { width: auto; max-width: 1420px; margin: 0 24px 0 244px; }
.breadcrumbs { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; color: var(--muted); font-size: 14px; }
.breadcrumbs a { font-weight: 650; }
.page-heading, .section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.page-heading { margin-bottom: 22px; }
.section-heading { margin: 34px 0 12px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(26px, 4vw, 38px); line-height: 1.1; }
h2 { margin-bottom: 0; font-size: 21px; }
h3 { margin-bottom: 0; font-size: 23px; }
.eyebrow { margin-bottom: 4px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 750; }
.muted, small { color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.summary-card { padding: 18px 20px; display: flex; flex-direction: column; background: white; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); }
.summary-card:hover { border-color: var(--blue); text-decoration: none; }
.summary-card strong { font-size: 30px; color: var(--navy); }
.dashboard-heading { min-height: 120px; align-items: center; }
.dashboard-title-group { display: flex; align-items: center; gap: 16px; }
.dashboard-mascot { flex: 0 0 auto; pointer-events: none; }
.dashboard-mascot img { display: block; width: auto; height: 120px; border-radius: 12px; filter: drop-shadow(0 8px 12px rgba(23,50,77,.14)); }
.rack-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 16px; }
.rack-card { padding: 18px; background: white; border: 1px solid var(--line); border-left: 6px solid var(--green); border-radius: 12px; box-shadow: var(--shadow); }
.rack-card.state-yellow { border-left-color: var(--yellow); }
.rack-card.state-orange { border-left-color: var(--orange); }
.rack-card.state-red, .rack-card.state-over { border-left-color: var(--red); }
.rack-card-header { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.capacity-number { text-align: right; display: flex; flex-direction: column; }
.capacity-number strong { font-size: 24px; }
.capacity-track { position: relative; height: 14px; margin: 15px 0; overflow: hidden; border-radius: 999px; background: #e8edf1; }
.capacity-fill { display: block; height: 100%; background: var(--green); }
.marker { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(0,0,0,.45); }
.marker.m50 { left: 50%; }.marker.m75 { left: 75%; }.marker.m99 { left: 99%; }
.dashboard-chart-grid { display: grid; grid-template-columns: repeat(3, minmax(280px, 1fr)); gap: 16px; }
.dashboard-chart-card, .storage-chart-report { padding: 16px; background: white; border: 1px solid var(--line); border-top: 5px solid var(--green); border-radius: 11px; box-shadow: var(--shadow); break-inside: avoid; }
.dashboard-chart-card.state-yellow, .storage-chart-report.state-yellow { border-top-color: var(--yellow); }
.dashboard-chart-card.state-orange, .storage-chart-report.state-orange { border-top-color: var(--orange); }
.dashboard-chart-card.state-red, .dashboard-chart-card.state-over, .storage-chart-report.state-red, .storage-chart-report.state-over { border-top-color: var(--red); }
.storage-chart-report { margin-bottom: 24px; padding: 20px; }
.utilization-chart { position: relative; height: 300px; margin-top: 12px; }
.compact-chart { height: 215px; }
.chart-scale { position: absolute; z-index: 3; top: 8px; bottom: 36px; left: 0; width: 38px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; color: var(--muted); font-size: 10px; }
.chart-plot { position: absolute; top: 8px; right: 5px; bottom: 36px; left: 44px; border-bottom: 1px solid #63717e; background: repeating-linear-gradient(to top, transparent 0, transparent calc(20% - 1px), #e5e9ed 20%); }
.chart-threshold { position: absolute; z-index: 1; right: 0; left: 0; border-top: 3px solid; }
.chart-threshold span { position: absolute; right: 2px; bottom: 2px; padding: 0 3px; background: rgba(255,255,255,.86); font-size: 9px; font-weight: 750; }
.threshold-50 { bottom: 40%; color: #c7b900; }
.threshold-75 { bottom: 60%; color: #e68132; }
.threshold-99 { bottom: 79.2%; color: #d52b2b; }
.chart-columns { position: absolute; z-index: 2; inset: 0; display: flex; gap: 7px; align-items: flex-end; }
.chart-column { position: relative; flex: 1 1 0; min-width: 22px; height: 100%; }
.chart-bar { position: absolute; right: 14%; bottom: 0; left: 14%; height: clamp(2px, calc(var(--value) * .8%), 100%); border-radius: 4px 4px 0 0; background: #1f6f91; }
.overall-column .chart-bar { background: var(--navy); }
.chart-bar.state-yellow { background: #d2b424; }.chart-bar.state-orange { background: var(--orange); }.chart-bar.state-red, .chart-bar.state-over { background: var(--red); }
.chart-bar.unknown-bar { height: 2px; background: #9aa7b2; }
.chart-value { position: absolute; z-index: 3; right: -8px; bottom: clamp(5px, calc(var(--value) * .8% + 4px), calc(100% - 18px)); left: -8px; text-align: center; color: #155978; font-size: 10px; font-weight: 750; white-space: nowrap; }
.overall-column .chart-value { color: var(--navy); }
.chart-label { position: absolute; right: -8px; bottom: -29px; left: -8px; overflow: hidden; text-align: center; text-overflow: ellipsis; font-size: 10px; font-weight: 700; white-space: nowrap; }
.chart-caption { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.pivot-rack-row td { padding: 8px 12px; background: var(--navy); color: white; font-size: 14px; font-weight: 750; }
.storage-map-pivot th:first-child { width: 130px; }
.storage-map-pivot th:last-child, .storage-map-pivot td:last-child { width: 100px; text-align: right; }
.pivot-job-list { display: flex; flex-wrap: wrap; gap: 2px 5px; }
.pivot-job-list a { font-weight: 650; }
.shelf-mini-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; }
.shelf-mini { padding: 9px; display: flex; flex-direction: column; border-radius: 8px; background: #eef7f3; border: 1px solid #d6ebe2; }
.shelf-mini.state-yellow { background: #fff8dc; border-color: #f3dc86; }
.shelf-mini.state-orange { background: #fff0e4; border-color: #efb685; }
.shelf-mini.state-red, .shelf-mini.state-over { background: #fde9e9; border-color: #e99c9c; }
.shelf-mini.state-unknown { background: #eef1f4; border-color: #cfd7df; }
.action-row { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.button { display: inline-block; border: 1px solid #aeb9c4; border-radius: 7px; background: white; color: var(--ink); padding: 9px 14px; font-weight: 700; cursor: pointer; }
.button:hover { text-decoration: none; border-color: var(--blue); }
.button.primary { background: var(--blue); color: white; border-color: var(--blue); }
.button.danger { background: var(--red); color: white; border-color: var(--red); }
.button.small { padding: 5px 9px; font-size: 13px; }
.table-wrap { overflow: auto; background: white; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: #465565; background: #eef2f5; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
tbody tr:last-child td { border-bottom: 0; }
.form-card { max-width: 760px; padding: 22px; }
.configuration-card { padding: 20px; }
.configuration-card .compact { margin: 0 0 18px; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 16px; }
.field-group label { display: block; margin-bottom: 5px; font-weight: 700; }
.field-group input, .field-group select { width: 100%; border: 1px solid #aeb9c4; border-radius: 7px; padding: 9px 10px; background: white; color: var(--ink); font: inherit; }
.checkbox-group { align-self: end; padding-bottom: 9px; }
.checkbox-group label { display: inline; margin-right: 8px; }
.checkbox-group input { width: auto; }
.configuration-table input, .configuration-table select { min-width: 110px; width: 100%; border: 1px solid #aeb9c4; border-radius: 6px; padding: 8px; background: white; font: inherit; }
.configuration-table td:first-child input { min-width: 90px; }
.configuration-table .checkbox-cell { text-align: center; vertical-align: middle; }
.configuration-table .checkbox-cell input { min-width: 0; width: 18px; height: 18px; }
.sticky-actions { position: sticky; bottom: 0; z-index: 10; margin-top: 18px; padding: 14px; background: rgba(244, 246, 248, .96); border-top: 1px solid var(--line); }
.stacked-form > div { margin-bottom: 15px; }
.stacked-form label { display: block; margin-bottom: 5px; font-weight: 700; }
.stacked-form .checkbox { width: auto; }
.form-control, .stacked-form input, .stacked-form select, .stacked-form textarea { width: 100%; border: 1px solid #aeb9c4; border-radius: 7px; padding: 9px 10px; background: white; color: var(--ink); font: inherit; }
.helptext { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; }
.errorlist { color: #9e2424; font-weight: 700; }
.message-stack { margin-bottom: 18px; }
.message { margin-bottom: 8px; padding: 11px 14px; border-radius: 7px; background: #e9f4fb; border: 1px solid #b9d8ec; }
.message.success { background: #e7f6ef; border-color: #a9dbc7; }
.message.warning { background: #fff6d9; border-color: #efd276; }
.message.error { background: #fde9e9; border-color: #e99c9c; }
.capacity-warning { max-width: 900px; margin-bottom: 18px; padding: 17px 20px; border: 2px solid var(--red); border-radius: 10px; background: #fff1f1; }
.capacity-warning h2 { margin-bottom: 10px; color: #9e2424; }
.critical-alert { animation: alert-pulse 1.8s ease-in-out infinite; }
@keyframes alert-pulse { 50% { box-shadow: 0 0 0 5px rgba(201,64,64,.12); } }
.auth-card { width: min(440px, 100%); margin: 7vh auto; padding: 28px; }
.page-search { max-width: none; }
.details-grid { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; margin: 0; }
.details-grid dt { font-weight: 750; }.details-grid dd { margin: 0; }
.warning-badge { display: block; width: fit-content; margin-top: 3px; padding: 2px 6px; border-radius: 999px; background: #fff0e4; color: #8b4814; font-size: 11px; font-weight: 750; }
.status-badge { display: inline-block; width: fit-content; padding: 3px 8px; border-radius: 999px; background: #e8edf1; color: #465565; font-size: 12px; font-weight: 750; white-space: nowrap; }
.status-pending, .status-planned, .status-released, .status-in_transit { background: #fff6d9; color: #745800; }
.status-partially_received { background: #fff0e4; color: #8b4814; }
.status-active, .status-received { background: #e7f6ef; color: #176443; }
.forecast-summary { margin-top: 16px; padding: 16px 18px; display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.forecast-summary > div { display: flex; align-items: center; gap: 12px; }
.forecast-summary .eyebrow { margin: 0; }
.selection-summary { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: -4px -4px 18px; padding: 14px; border-radius: 8px; background: #eef5fa; }
.selection-summary .eyebrow { width: 100%; margin: 0; }
.batch-error { margin-bottom: 18px; padding: 16px 18px; border: 2px solid var(--red); border-radius: 10px; background: #fff1f1; color: #842828; }
.batch-error h2 { margin-bottom: 8px; }
.batch-error p:last-child { margin-bottom: 0; }
.batch-card { padding: 18px; }
.batch-job-locations { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.batch-job-locations span { padding: 4px 9px; border-radius: 999px; background: #e8f1f8; color: var(--navy); font-size: 13px; font-weight: 700; }
.batch-table select, .batch-table input { width: 100%; min-width: 190px; border: 1px solid #aeb9c4; border-radius: 7px; padding: 9px 10px; background: white; color: var(--ink); font: inherit; }
.batch-table input[type="number"] { min-width: 90px; }
.batch-table th:last-child, .batch-table td:last-child { width: 1%; white-space: nowrap; }
.batch-table .link-button { color: var(--red); font-weight: 700; }
.delete-field { display: none; }
.batch-details { display: grid; gap: 7px; margin-top: 18px; }
.batch-details > label:first-child { font-weight: 700; }
.batch-details textarea { width: 100%; border: 1px solid #aeb9c4; border-radius: 7px; padding: 9px 10px; font: inherit; }
.batch-acknowledgement { display: flex; gap: 8px; align-items: center; margin-top: 7px; }
.batch-acknowledgement input { width: 18px; height: 18px; }
.inline-archive { display: flex; gap: 7px; }
.inline-archive input { min-width: 220px; border: 1px solid #aeb9c4; border-radius: 7px; padding: 7px 9px; }
.report-rack { margin-bottom: 22px; padding: 16px; border: 1px solid var(--line); border-left: 6px solid var(--green); border-radius: 10px; background: white; break-inside: avoid; }
.report-rack.state-yellow { border-left-color: var(--yellow); }.report-rack.state-orange { border-left-color: var(--orange); }.report-rack.state-red, .report-rack.state-over { border-left-color: var(--red); }
.report-rack table { margin-top: 12px; }
.report-legend { margin-top: 18px; color: var(--muted); }
.empty-shelf { color: var(--muted); }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
@media (prefers-reduced-motion: reduce) { .critical-alert { animation: none; } }
@media (max-width: 900px) {
  .site-header { padding: 10px 14px; flex-wrap: wrap; }
  .quick-search { order: 3; flex-basis: 100%; max-width: none; }
  .sidebar { position: static; width: auto; padding: 8px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .workflow-nav { min-width: max-content; flex-direction: row; align-items: center; }
  .nav-divider { width: 1px; height: 28px; margin: 0 7px; }
  .reports-nav { position: relative; }
  .report-links { position: absolute; z-index: 25; top: 42px; left: 0; min-width: 190px; padding: 6px; background: white; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
  .authenticated .page-shell { width: min(100% - 28px, 1420px); margin: 0 auto; }
  .summary-grid { grid-template-columns: 1fr; }
  .rack-grid { grid-template-columns: 1fr; }
  .dashboard-chart-grid { grid-template-columns: 1fr; }
  .dashboard-mascot { display: none; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .forecast-summary, .forecast-summary > div { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
@media print {
  @page { size: landscape; margin: .45in; }
  body { background: white; font-size: 10pt; }
  .no-print { display: none !important; }
  .page-shell { width: 100%; margin: 0; padding: 0; }
  .card, .rack-card, .table-wrap, .storage-chart-report { box-shadow: none; break-inside: avoid; }
  .storage-chart-report { page-break-after: always; }
  .storage-chart-report:last-of-type { page-break-after: auto; }
  a { color: black; text-decoration: none; }
}

