:root {
  font-family: "Segoe UI Variable", "Microsoft YaHei", system-ui, sans-serif;
  color: #e7eefc;
  background: #0a1020;
  line-height: 1.55;
  --bg: #0a1020;
  --bg-deep: #070c18;
  --surface: rgba(17, 27, 50, .84);
  --line: rgba(145, 169, 211, .18);
  --line-strong: rgba(145, 169, 211, .32);
  --text: #e7eefc;
  --muted: #8e9bb7;
  --muted-strong: #b6c2d8;
  --primary: #83a4ff;
  --cyan: #5bd6e8;
  --success: #4bd4aa;
  --warning: #ffbd6a;
  --danger: #ff7891;
  --shadow: 0 24px 70px rgba(0, 0, 0, .25);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; display: grid; grid-template-columns: 252px minmax(0, 1fr); background: linear-gradient(135deg, var(--bg-deep) 0%, #0b1326 56%, #0d2033 100%); }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; background: linear-gradient(115deg, rgba(93, 118, 244, .08), transparent 34%, rgba(65, 201, 221, .06) 82%, transparent); }
a { color: var(--primary); text-underline-offset: 3px; }
a:hover { color: #a9bdff; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1, h2, h3 { color: var(--text); }
small { font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -80px; left: 16px; z-index: 10; padding: 12px 18px; color: #08111e; background: var(--cyan); }
.skip-link:focus { top: 12px; }

.sidebar { position: sticky; top: 0; height: 100dvh; z-index: 2; display: flex; flex-direction: column; padding: 24px 16px 18px; color: var(--muted-strong); background: rgba(8, 15, 31, .94); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; margin: 0 10px 30px; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text); }
.brand-mark { display: inline-grid; place-items: center; width: 42px; height: 42px; flex: 0 0 42px; color: #08111f; background: linear-gradient(145deg, #90a8ff, #55d9e8); border: 1px solid rgba(214, 239, 255, .48); border-radius: 13px; box-shadow: 0 10px 28px rgba(76, 140, 241, .26); font-weight: 900; letter-spacing: -.08em; }
.brand-copy { display: grid; gap: 2px; min-width: 0; }
.brand-copy strong { font-size: 17px; letter-spacing: .07em; }
.brand-copy em { color: var(--cyan); font-style: normal; font-weight: 500; }
.brand small { color: var(--muted); font-size: 11px; letter-spacing: .02em; }
.nav-heading { margin: 22px 12px 8px; color: #6f7f9e; font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.nav-link { position: relative; display: flex; align-items: center; min-height: 42px; gap: 10px; margin: 3px 0; padding: 10px 12px; color: #aebbd1; border: 1px solid transparent; border-radius: 10px; text-decoration: none; font-size: 13px; transition: border-color .18s ease, background .18s ease, color .18s ease, transform .18s ease; }
.nav-link::before { content: ""; width: 6px; height: 6px; flex: 0 0 6px; background: #52617d; border-radius: 2px; transition: background .18s ease, box-shadow .18s ease; }
.nav-link:hover { color: var(--text); background: rgba(80, 111, 190, .12); border-color: rgba(129, 162, 255, .16); transform: translateX(2px); }
.nav-link.active { color: var(--text); background: linear-gradient(100deg, rgba(81, 111, 223, .34), rgba(57, 182, 210, .12)); border-color: rgba(123, 164, 255, .34); box-shadow: inset 3px 0 0 var(--cyan), 0 8px 22px rgba(40, 90, 177, .12); font-weight: 700; }
.nav-link.active::before { background: var(--cyan); box-shadow: 0 0 12px rgba(91, 214, 232, .9); }
.sidebar :focus-visible { outline-color: var(--cyan); }
.sidebar-foot { display: grid; gap: 8px; margin-top: auto; padding: 16px 12px 0; color: #72809b; border-top: 1px solid var(--line); font-size: 11px; }
.sidebar-foot a { color: #a6b4ca; }
.sidebar-foot form { margin: 0; }
.logout-button { color: #a6b4ca; background: transparent; border: 0; padding: 0; cursor: pointer; text-decoration: none; font-size: 12px; }
.logout-button:hover { color: var(--cyan); }

.main { position: relative; z-index: 1; min-width: 0; max-width: 1680px; width: 100%; padding: 0 42px 48px; }
.topbar { position: sticky; top: 0; z-index: 3; display: flex; justify-content: space-between; gap: 20px; align-items: center; min-height: 92px; margin: 0 -42px 30px; padding: 18px 42px; background: rgba(10, 16, 32, .78); border-bottom: 1px solid var(--line); backdrop-filter: blur(18px); }
.topbar-main { min-width: 0; }
.topbar .eyebrow { margin: 0 0 4px; color: #7786a3; }
.topbar h1 { margin: 0; color: var(--text); font-size: clamp(24px, 2vw, 32px); line-height: 1.2; letter-spacing: -.03em; }
.topbar-user { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.system-state { display: inline-flex; align-items: center; gap: 7px; color: #91a0ba; font-size: 12px; }
.system-state i, .login-status i { display: inline-block; width: 7px; height: 7px; background: var(--success); border-radius: 50%; box-shadow: 0 0 13px rgba(75, 212, 170, .85); }
.user-chip { max-width: 220px; overflow-wrap: anywhere; padding: 8px 12px; color: #d8e4fa; background: rgba(107, 141, 227, .12); border: 1px solid rgba(132, 165, 247, .18); border-radius: 9px; font-size: 12px; }
.topbar-user .logout-button { padding: 8px 11px; color: #aebbd1; border: 1px solid var(--line); border-radius: 8px; background: rgba(14, 23, 43, .72); }
.topbar-user .logout-button:hover { color: var(--text); border-color: rgba(91, 214, 232, .4); background: rgba(91, 214, 232, .1); }
.eyebrow { color: #8fa0bf; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }

.hero { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 20px; padding: 28px 30px; background: linear-gradient(115deg, rgba(65, 85, 181, .72), rgba(27, 61, 105, .6) 58%, rgba(31, 115, 138, .38)); border: 1px solid rgba(123, 167, 255, .34); border-radius: 16px; box-shadow: var(--shadow); }
.hero h2 { margin: 5px 0 8px; font-size: clamp(22px, 2.2vw, 32px); line-height: 1.2; letter-spacing: -.03em; }
.hero p:last-child { margin: 0; color: #c3d0e8; }
.button-row, .form-actions, .actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.button, button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 9px 15px; color: #07111f; background: linear-gradient(110deg, var(--primary), var(--cyan)); border: 1px solid rgba(167, 212, 255, .44); border-radius: 9px; box-shadow: 0 8px 22px rgba(66, 125, 224, .2); cursor: pointer; text-decoration: none; font-size: 13px; font-weight: 800; white-space: nowrap; transition: transform .18s ease, box-shadow .18s ease, filter .18s ease; }
.button:hover, button:hover { color: #06101d; filter: brightness(1.08); box-shadow: 0 12px 28px rgba(66, 155, 224, .28); transform: translateY(-1px); }
.button.secondary, button.secondary { color: #c8d6f2; background: rgba(19, 31, 57, .78); border-color: var(--line-strong); box-shadow: none; }
.button.secondary:hover, button.secondary:hover { color: var(--text); background: rgba(51, 76, 132, .42); border-color: rgba(137, 176, 255, .46); }
.button:disabled, button:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.stats, .stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat, .stat-card, .panel { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 14px 42px rgba(0, 0, 0, .14); }
.stat, .stat-card { padding: 20px; }
.stat span, .stat small, .stat-card span { display: block; color: var(--muted); font-size: 12px; }
.stat strong, .stat-card strong { display: block; margin: 7px 0 2px; color: var(--text); font-size: 30px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat.warning strong { color: var(--warning); }
.danger { color: var(--danger); }
.grid.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.grid.two > .panel { margin-bottom: 0; }
.panel { overflow-x: auto; margin-bottom: 18px; padding: 22px; }
.panel h2, .panel h3 { margin: 0 0 13px; font-size: 17px; letter-spacing: -.01em; }
.panel-head, .section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.panel-head h2, .panel-head h3, .section-head h2, .section-head h3 { margin: 0; }
.panel-head a:not(.button), .section-head a:not(.button) { font-size: 12px; }
.panel > .panel, .panel > section.panel { background: rgba(10, 17, 33, .32); border-color: rgba(145, 169, 211, .13); box-shadow: none; }
.status-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 9px; }
.status-card { display: block; min-width: 0; padding: 13px; color: inherit; background: rgba(28, 42, 73, .58); border: 1px solid rgba(145, 169, 211, .12); border-radius: 10px; text-decoration: none; transition: background .16s ease, border-color .16s ease, transform .16s ease; }
.status-card:hover { color: inherit; background: rgba(73, 110, 194, .28); border-color: rgba(123, 167, 255, .38); transform: translateY(-1px); }
.status-grid b, .status-grid span { display: block; }
.status-grid b { color: var(--text); font-size: 22px; font-variant-numeric: tabular-nums; }
.status-grid span { color: var(--muted); font-size: 12px; }
.dashboard-status-panel { margin-bottom: 18px; }
.dashboard-status-panel .status-card { text-align: center; }
.dashboard-alert-list { display: grid; grid-template-columns: minmax(0, 1fr); }
.dashboard-alert-list .empty { grid-column: 1 / -1; }
.dashboard-alert-list .list-row { color: inherit; text-decoration: none; }
.dashboard-alert-list .list-row:hover { color: inherit; background: rgba(73, 110, 194, .12); }
.dashboard-alert-list .list-row > span { min-width: 0; overflow-wrap: anywhere; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid rgba(145, 169, 211, .12); }
.list-row span > * { display: block; }
.list-row small, td small { color: var(--muted); font-size: 11px; }
.list-row strong { white-space: nowrap; }
.dashboard-alert-list .alert-summary { display: flex; align-items: center; justify-content: flex-end; gap: 20px; flex-shrink: 0; }
.dashboard-alert-list .alert-badge { padding: 6px 11px; border: 1px solid currentColor; border-radius: 7px; font-size: 13px; white-space: normal; }
.alert-badge.warning { color: var(--warning); background: rgba(163, 112, 40, .12); }
.alert-badge.danger { background: rgba(146, 43, 70, .12); }
.alert-action { color: var(--primary); font-size: 12px; white-space: nowrap; }
.alert-action span { display: inline; }

.table-wrap { width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
table { width: 100%; border-collapse: collapse; color: var(--muted-strong); font-variant-numeric: tabular-nums; }
th, td { padding: 13px 12px; border-bottom: 1px solid rgba(145, 169, 211, .12); text-align: left; vertical-align: top; font-size: 13px; }
th { color: #8e9fbd; background: rgba(29, 43, 73, .52); font-size: 11px; font-weight: 700; letter-spacing: .05em; white-space: nowrap; }
td { min-width: 90px; max-width: 360px; overflow-wrap: anywhere; }
tbody tr { transition: background .16s ease; }
tbody tr:hover { background: rgba(91, 124, 220, .1); }
tbody tr:last-child td { border-bottom: 0; }
td a { display: inline-block; padding: 2px 0; }
.table-action { white-space: nowrap; }
.badge { display: inline-block; padding: 4px 9px; color: #a7d9ff; background: rgba(71, 141, 207, .2); border: 1px solid rgba(112, 190, 237, .24); border-radius: 999px; font-size: 11px; white-space: nowrap; }
.badge.muted { color: #a3adc0; background: rgba(121, 137, 165, .14); border-color: rgba(145, 169, 211, .16); }
.empty, .empty-state { padding: 32px 18px; color: var(--muted); text-align: center; }

.toolbar, .detail-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.filter-form, .toolbar form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.inventory-toolbar { flex-wrap: nowrap; gap: 12px; }
.inventory-toolbar .inventory-filter-form { flex: 1; flex-wrap: nowrap; gap: 12px; }
.inventory-filter-field { display: flex; align-items: center; gap: 8px; min-width: 0; }
.inventory-filter-field label { flex: 0 0 auto; color: var(--muted-strong); font-size: 12px; white-space: nowrap; }
.inventory-filter-search { flex: 1; }
.inventory-filter-form input, .inventory-filter-form select { min-height: 36px; padding: 7px 10px; font-size: 13px; }
.inventory-filter-form select { width: auto; }
.inventory-toolbar .button { min-height: 36px; padding: 7px 12px; }
.filter-form input { width: 280px; max-width: 100%; }
.filter-form select { width: auto; max-width: 230px; }
.filters { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; margin: 20px 0; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.filters .filter-field { flex: 0 1 220px; }
.filters .filter-search { flex: 1 1 340px; }
.filters label { display: block; margin-bottom: 6px; color: #aab8d0; font-size: 12px; }
.filters > a { padding: 10px 4px; white-space: nowrap; }

input, select, textarea { width: 100%; min-width: 0; min-height: 41px; padding: 9px 11px; color: var(--text); background: rgba(8, 15, 31, .64); border: 1px solid var(--line-strong); border-radius: 9px; }
input::placeholder, textarea::placeholder { color: #73809a; opacity: 1; }
input:focus, select:focus, textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(91, 214, 232, .13), 0 8px 26px rgba(20, 130, 184, .14); outline: none; }
option { color: var(--text); background: #111c34; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 18px; padding: 0; accent-color: var(--cyan); vertical-align: middle; }
.select-column { width: 42px; min-width: 42px; text-align: center; }
.inventory-table-panel { overflow: visible; }
.inventory-table-panel tr.is-selected { background: rgba(91, 214, 232, .08); }
.inventory-table-panel .select-column input { cursor: pointer; }
.bulk-toolbar { display: grid; gap: 12px; margin: -4px 0 16px; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.bulk-selection { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12px; }
.bulk-selection strong { color: var(--cyan); white-space: nowrap; }
.bulk-selection span { color: var(--muted); }
.bulk-fields { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.bulk-field { flex: 0 1 190px; min-width: 0; }
.bulk-field > label { display: block; margin-bottom: 6px; color: var(--muted-strong); font-size: 12px; }
.bulk-field input, .bulk-field select { width: 100%; min-height: 38px; padding: 8px 10px; font-size: 13px; }
.bulk-note-field { flex: 1 1 250px; }
.bulk-help { margin: 0; }
.inventory-table-panel [hidden] { display: none; }
.form-errors { margin: 0 0 10px; padding: 9px 12px; color: #ffd0d9; background: rgba(180, 52, 83, .18); border: 1px solid rgba(255, 120, 145, .3); border-radius: 8px; font-size: 12px; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
textarea { min-height: 110px; resize: vertical; }
.form-panel { max-width: 1050px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 22px; margin-bottom: 20px; }
.filters .filter-field, .field, .form-field { min-width: 0; }
.field > label, .form-field > label, .panel form > label, .form-grid > label { display: block; margin-bottom: 6px; color: #aab8d0; font-size: 12px; }
.panel label input:not([type="checkbox"]):not([type="radio"]), .panel label select, .panel label textarea { display: block; margin-top: 6px; }
.field-check { align-self: center; }
.field-check > label { display: inline; margin-left: 5px; }
.full-width { grid-column: 1 / -1; }
fieldset { min-width: 0; padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px; }
legend { padding: 0 6px; color: var(--muted-strong); font-size: 13px; }
fieldset label { display: block; padding: 5px 0; }
.help, .helptext { margin-top: 5px; color: var(--muted); font-size: 12px; }
.help ul, .helptext ul { margin: 5px 0; padding-left: 20px; }
.required, .field-error, .errorlist { color: var(--danger); }
.errorlist { margin: 6px 0; padding-left: 20px; font-size: 12px; }
.field-error .errorlist { padding: 0; list-style: none; }
.error, .message.error, .notice.error { margin-bottom: 18px; padding: 12px 16px; color: #ffc1c9; background: rgba(146, 43, 70, .2); border: 1px solid rgba(255, 120, 145, .35); border-radius: 10px; }
.message, .notice { margin-bottom: 18px; padding: 12px 16px; color: #a8eed6; background: rgba(49, 147, 124, .18); border: 1px solid rgba(75, 212, 170, .3); border-radius: 10px; }
.message.warning { color: #ffd89f; background: rgba(163, 112, 40, .2); border-color: rgba(255, 189, 106, .34); }
.muted-text, .muted { color: var(--muted); font-size: 13px; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 16px; flex-wrap: wrap; margin-top: 12px; padding-top: 16px; color: var(--muted); border-top: 1px solid var(--line); font-size: 12px; }
.pagination a { padding: 6px 4px; }
.permission-group { padding: 12px 0; border-top: 1px solid var(--line); }
.permission-group summary { color: var(--muted-strong); cursor: pointer; }
.permission-group li { font-size: 13px; overflow-wrap: anywhere; }
.staff-password-fields { margin: 0 0 20px; }
.staff-password-fields .form-grid { margin: 8px 0 4px; }
.staff-role-option { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 6px 0; }
.staff-role-option label { display: flex; align-items: center; gap: 9px; min-width: 0; overflow-wrap: anywhere; cursor: pointer; }
.staff-role-option input { flex: 0 0 18px; margin: 0; }
.permission-trigger { flex-shrink: 0; min-height: 34px; padding: 5px 10px; color: var(--primary); background: transparent; border-color: var(--line); box-shadow: none; font-size: 12px; font-weight: 500; }
.permission-trigger:hover { color: var(--text); background: rgba(73, 110, 194, .12); box-shadow: none; }
.permission-dialog .modal-head > div { min-width: 0; }
.permission-dialog { overflow: hidden; color-scheme: dark; }
.permission-dialog .modal-card { max-height: min(858px, calc(100dvh - 30px)); overscroll-behavior: contain; }
.permission-dialog .modal-close { flex: 0 0 38px; }
.permission-list { list-style: none; margin: 0; padding: 0; }
.permission-list li { padding: 10px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.permission-list small { display: block; color: var(--muted); }
.audit-detail { min-width: 250px; }
.narrow { max-width: 460px; }
.timeline { margin: 0; padding: 0 0 0 18px; border-left: 2px solid rgba(91, 214, 232, .34); list-style: none; }
.timeline > li, .timeline > div, .timeline > article { position: relative; padding: 0 0 20px 10px; }
.timeline > li::before, .timeline > div::before, .timeline > article::before { content: ""; position: absolute; left: -24px; top: 7px; width: 10px; height: 10px; background: var(--cyan); border: 2px solid #0d172a; border-radius: 50%; box-shadow: 0 0 12px rgba(91, 214, 232, .65); }
.timeline time, .timeline small { color: var(--muted); font-size: 12px; }
.timeline p { margin: 6px 0; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin: 16px 0; }
.photo-grid figure { min-width: 0; margin: 0; }
.photo-grid img { display: block; width: 100%; max-height: 250px; object-fit: contain; background: rgba(8, 15, 31, .6); border: 1px solid var(--line); border-radius: 9px; }
.photo-grid figcaption { margin-top: 5px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.scan-panel { max-width: 980px; }
.scan-form { display: flex; align-items: end; gap: 14px; max-width: 760px; }
.scan-form .form-field { flex: 1; }
.scan-form button { flex: 0 0 auto; }
.dashboard-scan { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.dashboard-scan label { flex: 0 0 auto; font-size: 13px; color: var(--muted-strong); }
.dashboard-scan input { flex: 1; }
.dashboard-scan button { flex: 0 0 auto; }
.link-button { appearance: none; color: var(--primary); background: transparent; border: 0; cursor: pointer; font-size: inherit; text-decoration: underline; text-underline-offset: 3px; }
.link-button:hover { color: #a9bdff; }
.compact-head { margin-bottom: 14px; }
.result-count { color: var(--muted); font-size: 12px; white-space: nowrap; }
.modal { width: min(720px, calc(100% - 28px)); max-height: min(860px, calc(100dvh - 28px)); padding: 0; color: var(--text); background: #101b32; border: 1px solid var(--line-strong); border-radius: 16px; box-shadow: 0 30px 100px rgba(0, 0, 0, .5); }
.modal::backdrop { background: rgba(3, 7, 16, .72); backdrop-filter: blur(5px); }
.modal-card { max-height: min(860px, calc(100dvh - 28px)); overflow-y: auto; padding: 26px; }
.modal-head { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.modal-head .eyebrow { margin: 0 0 4px; }
.modal-head h2 { margin: 0; font-size: 22px; }
.modal-close { width: 38px; height: 38px; padding: 0; color: var(--muted-strong); background: transparent; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; font-size: 24px; line-height: 1; }
.modal-close:hover { color: var(--text); border-color: var(--line-strong); background: rgba(91, 124, 220, .14); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.stage-form-shell { padding: 0; overflow: hidden; }
.stage-form-heading { display: flex; justify-content: space-between; align-items: start; gap: 20px; padding: 26px 28px 22px; border-bottom: 1px solid var(--line); }
.stage-form-heading h2 { margin: 0 0 6px; font-size: 24px; }
.stage-form-heading .eyebrow { margin: 0 0 5px; }
.stage-step { flex: 0 0 auto; padding: 7px 11px; color: #bdeeff; background: rgba(77, 161, 202, .15); border: 1px solid rgba(91, 214, 232, .28); border-radius: 999px; font-size: 12px; }
.stage-notice { display: flex; align-items: center; gap: 12px; margin: 22px 28px 0; }
.stage-notice strong { color: var(--text); white-space: nowrap; }
.stage-notice span { flex: 1; }
.stage-notice .button { flex: 0 0 auto; }
.stage-form { padding: 0 28px 28px; }
.stage-section { padding: 26px 0; border-bottom: 1px solid var(--line); }
.stage-section:last-of-type { border-bottom: 0; }
.stage-section-title { display: flex; gap: 13px; align-items: start; margin-bottom: 18px; }
.stage-section-title > span { display: inline-grid; place-items: center; width: 28px; height: 28px; flex: 0 0 28px; color: #08111f; background: linear-gradient(145deg, var(--primary), var(--cyan)); border-radius: 8px; font-size: 11px; font-weight: 800; }
.stage-section-title h3 { margin: 0 0 3px; font-size: 16px; }
.stage-section-title p { margin: 0; color: var(--muted); font-size: 12px; }
.stage-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 22px; }
.stage-field { min-width: 0; }
.stage-field.full-width { grid-column: 1 / -1; }
.stage-field > label, .stage-photo-upload > label { display: block; margin-bottom: 7px; color: #aab8d0; font-size: 12px; }
.stage-choice-group { margin: 0; padding: 0; border: 0; }
.stage-choice-group legend { margin-bottom: 7px; padding: 0; color: var(--muted-strong); font-size: 12px; }
.stage-choice-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.stage-choice-grid > div { min-width: 0; }
.stage-choice-grid label { display: flex; align-items: center; gap: 8px; min-height: 38px; margin: 0; padding: 7px 12px; color: var(--muted-strong); background: rgba(8, 15, 31, .45); border: 1px solid var(--line); border-radius: 7px; font-size: 13px; cursor: pointer; }
.stage-choice-grid label:has(input:checked) { color: var(--text); background: rgba(91, 214, 232, .1); border-color: rgba(91, 214, 232, .5); }
.stage-choice-grid input { flex: 0 0 18px; margin: 0; }
.stage-field textarea { min-height: 72px; }
.stage-handoff { padding: 14px 0; border-top: 1px solid var(--line); }
.stage-handoff summary, .order-note-editor summary { color: var(--muted-strong); font-size: 13px; cursor: pointer; }
.stage-handoff summary .muted, .order-note-editor summary .muted { margin-left: 10px; font-size: 12px; }
.stage-handoff[open] > .stage-field, .order-note-editor form { margin-top: 14px; }
.order-note-summary { display: flex; align-items: baseline; gap: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; }
.order-note-summary strong { flex: 0 0 auto; color: var(--muted-strong); font-weight: 500; }
.order-note-summary p { margin: 0; color: var(--text); }
.order-note-editor { margin-top: 10px; }
.order-note-editor button { margin-top: 12px; }
@media (max-width: 620px) {
  .dashboard-scan { flex-wrap: wrap; gap: 8px; }
  .dashboard-scan label { width: 100%; }
  .order-note-summary { display: block; }
  .order-note-summary p { margin-top: 6px; }
  .stage-handoff summary .muted, .order-note-editor summary .muted { display: block; margin: 4px 0 0; }
}
.stage-photo-upload { max-width: 650px; }
.stage-photo-upload input { padding: 8px; }
.stage-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-top: 22px; }

.login-page { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100dvh; padding: 26px; background: linear-gradient(135deg, #080e1d, #0b1428 52%, #0c2636); }
.login-shell { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(390px, .92fr); width: min(1140px, 100%); min-height: min(650px, calc(100dvh - 120px)); margin: 0 auto; overflow: hidden; background: rgba(11, 18, 36, .88); border: 1px solid rgba(128, 164, 240, .25); border-radius: 24px; box-shadow: 0 32px 110px rgba(0, 0, 0, .38); }
.login-brand { display: flex; flex-direction: column; justify-content: center; padding: 60px; background: linear-gradient(145deg, rgba(51, 73, 171, .9), rgba(35, 58, 130, .82) 58%, rgba(20, 101, 126, .68)); border-right: 1px solid rgba(169, 195, 255, .14); }
.login-brand-head { display: flex; align-items: center; gap: 13px; margin-bottom: 54px; }
.login-brand-head strong { display: block; margin-top: 2px; font-size: 19px; letter-spacing: .02em; }
.login-brand-head .brand-mark { color: #e9f6ff; background: rgba(232, 242, 255, .18); box-shadow: none; }
.login-kicker { color: #b9c8ff; font-size: 11px; }
.login-brand h1 { margin: 10px 0 18px; color: #f2f6ff; font-size: clamp(34px, 4.2vw, 52px); line-height: 1.08; letter-spacing: -.05em; }
.login-brand p:last-of-type { max-width: 490px; margin: 0; color: #d0dbf2; font-size: 16px; }
.feature-list { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 34px; }
.feature-list span { padding: 7px 11px; color: #d9e5ff; background: rgba(173, 194, 255, .13); border: 1px solid rgba(195, 214, 255, .18); border-radius: 999px; font-size: 11px; }
.login-status { display: inline-flex; align-items: center; gap: 8px; margin-top: auto; color: #bcebdc; font-size: 12px; }
.login-card { display: flex; flex-direction: column; justify-content: center; padding: 60px; background: rgba(10, 17, 34, .75); }
.login-card h2 { margin: 0 0 7px; font-size: 30px; letter-spacing: -.04em; }
.login-card > .muted { margin-top: 0; }
.login-challenge-card { width: min(520px, 100%); padding: clamp(24px, 5vw, 48px); border: 1px solid var(--line); border-radius: 18px; }
.login-form-title { margin: 28px 0 18px; font-size: 16px; }
.login-field { margin: 18px 0; }
.login-field label { display: block; margin-bottom: 7px; color: #b5c1d8; font-size: 12px; }
.login-submit { width: 100%; margin-top: 9px; }
.login-switch { margin: 18px 0 0; text-align: center; font-size: 13px; }
.login-card-single { width: min(520px, 100%); margin: auto; }
.login-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; font-size: 12px; }
.login-footer { margin: 18px auto 0; color: #66738d; text-align: center; font-size: 11px; }

.customer-site { display: block; min-height: 100dvh; background: linear-gradient(135deg, #080e1d, #0b1428 55%, #0c2232); }
.customer-header { display: flex; align-items: center; gap: 22px; padding: 18px max(24px, calc((100% - 1180px) / 2)); background: rgba(8, 15, 31, .88); border-bottom: 1px solid var(--line); }
.customer-header > a { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 16px; font-weight: 800; }
.customer-header > a::before { content: "FX"; display: inline-grid; place-items: center; width: 30px; height: 30px; color: #08111f; background: linear-gradient(145deg, var(--primary), var(--cyan)); border-radius: 9px; font-size: 10px; }
.customer-nav { display: flex; align-items: center; gap: 17px; flex-wrap: wrap; margin-left: auto; }
.customer-nav a { color: #aebbd1; text-decoration: none; font-size: 12px; }
.customer-nav a:hover { color: var(--cyan); }
.customer-nav form { margin: 0; }
.customer-nav button { min-height: 34px; padding: 6px 11px; color: #c7d3e9; background: transparent; border: 1px solid var(--line); box-shadow: none; font-size: 12px; }
.customer-main { width: min(1180px, 100%); margin: auto; padding: 38px 24px 70px; }
.customer-main h1 { margin: 0 0 24px; font-size: 31px; }
.customer-main a:not(.button) { color: var(--primary); }
.customer-main .narrow { max-width: 560px; }
.customer-form input, .customer-form textarea, .customer-form select { width: 100%; }
.customer-form label { margin-bottom: 6px; }
.customer-form .field { margin: 0 0 20px; }
.customer-form .helptext { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.customer-main :focus-visible, .customer-header :focus-visible { outline-color: var(--cyan); }
.customer-main td { overflow-wrap: anywhere; }
.customer-main .toolbar form { flex-wrap: wrap; }
.customer-main .toolbar input { max-width: 100%; }

@media (max-width: 1180px) {
  .main { padding-inline: 28px; }
  .topbar { margin-inline: -28px; padding-inline: 28px; }
  .sidebar { width: 226px; }
  body { grid-template-columns: 226px minmax(0, 1fr); }
  .login-brand, .login-card { padding: 48px; }
  .inventory-toolbar { flex-wrap: wrap; }
  .inventory-toolbar .inventory-filter-form { flex-wrap: wrap; flex-basis: 100%; }
  .inventory-filter-search { flex: 1 1 280px; }
}
@media (max-width: 920px) {
  .stats, .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .login-shell { grid-template-columns: 1fr; max-width: 640px; }
  .login-brand { min-height: 420px; border-right: 0; border-bottom: 1px solid rgba(169, 195, 255, .14); }
  .login-status { margin-top: 36px; }
}
@media (max-width: 760px) {
  body { display: block; }
  .sidebar { position: relative; width: 100%; height: auto; padding: 16px 18px 14px; }
  .brand { margin: 0 0 15px; }
  .sidebar nav { display: flex; gap: 5px; flex-wrap: wrap; }
  .staff-nav-group { display: flex; gap: 5px; flex-wrap: wrap; width: 100%; }
  .nav-heading { width: 100%; margin: 11px 4px 2px; }
  .nav-link { min-height: 37px; margin: 0; padding: 8px 10px; border-radius: 8px; font-size: 12px; }
  .nav-link::before { display: none; }
  .sidebar-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 13px; padding: 10px 4px 0; }
  .main { padding: 0 18px 35px; }
  .topbar { position: relative; margin: 0 -18px 22px; padding: 17px 18px; }
  .system-state { display: none; }
  .topbar-user { gap: 6px; }
  .topbar-user .logout-button { padding: 7px 9px; }
  .hero { align-items: flex-start; flex-direction: column; padding: 23px; }
  .inventory-filter-search { flex-basis: 100%; }
  .bulk-field { flex: 1 1 180px; }
  .bulk-note-field { flex-basis: 100%; }
  .dashboard-alert-list { grid-template-columns: 1fr; }
  .dashboard-alert-list .list-row { align-items: stretch; flex-direction: column; }
  .dashboard-alert-list .alert-summary { justify-content: space-between; flex-wrap: wrap; gap: 10px; }
  .grid.two { grid-template-columns: 1fr; }
  .panel { padding: 17px; }
  .form-grid { grid-template-columns: 1fr; }
  .scan-form { display: block; }
  .scan-form button { margin-top: 12px; }
  .stage-form-heading { padding: 22px 18px 18px; }
  .stage-form { padding-inline: 18px; }
  .stage-notice { align-items: flex-start; flex-direction: column; margin-inline: 18px; }
  .stage-notice strong { white-space: normal; }
  .stage-notice .button { width: 100%; text-align: center; }
  .stage-fields { grid-template-columns: 1fr; }
  .stage-field.full-width { grid-column: auto; }
  .stage-actions { align-items: stretch; flex-direction: column; }
  .stage-actions .button { width: 100%; }
  .modal-card { padding: 20px 17px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .button { width: 100%; text-align: center; }
  .login-page { padding: 14px; }
  .login-shell { min-height: auto; margin-top: 8px; border-radius: 18px; }
  .login-brand, .login-card { padding: 32px 24px; }
  .login-brand { min-height: 390px; }
  .login-brand-head { margin-bottom: 36px; }
  .customer-header { align-items: flex-start; flex-direction: column; padding: 15px 18px; }
  .customer-nav { gap: 12px; margin-left: 0; }
  .customer-main { padding: 28px 18px 55px; }
}
@media (max-width: 420px) {
  .main { padding-inline: 12px; }
  .topbar { margin-inline: -12px; padding-inline: 12px; }
  .topbar h1 { font-size: 24px; }
  .user-chip { max-width: 120px; }
  .stats, .stats-grid { grid-template-columns: 1fr; }
  .status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { padding: 18px; }
  .button-row .button, .actions .button { flex: 1; }
  .login-brand h1 { font-size: 37px; }
  .login-card { padding: 28px 20px; }
}
@media print {
  body { display: block; background: #f5f7fb; }
  .sidebar, .topbar, .toolbar, .form-actions, .button, .skip-link { display: none; }
  .main { max-width: none; padding: 0; }
  .panel, .table-wrap { overflow: visible; }
  .panel { break-inside: avoid; background: #fff; border-color: #d8e0eb; box-shadow: none; color: #172033; }
}
