:root {
  color-scheme: light;
  --red: #c91525;
  --red-dark: #9f0d1a;
  --red-soft: #fff0f2;
  --ink: #15171a;
  --ink-2: #2f3237;
  --muted: #6b7078;
  --line: #e4e6e9;
  --surface: #ffffff;
  --canvas: #f4f5f6;
  --success: #137a4a;
  --success-soft: #e9f7f0;
  --shadow: 0 14px 40px rgba(21, 23, 26, 0.08);
  --radius: 16px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body { min-height: 100vh; margin: 0; color: var(--ink); background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.is-hidden { display: none !important; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 32px; background: #f7f7f8; }
.login-card { width: min(460px, 100%); padding: 42px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 18px 50px rgba(21,23,26,.08); }
.login-brand, .brand { display: flex; align-items: center; gap: 11px; font-size: 1rem; font-weight: 900; letter-spacing: .16em; }
.brand-logo { display: block; width: 168px; height: 38px; object-fit: contain; object-position: left center; }
.brand-logo-login { width: 250px; height: 57px; }
.brand-logo-app { width: 174px; height: 40px; }
.brand-mark { width: 21px; height: 21px; display: inline-block; background: var(--red); box-shadow: inset -6px -6px 0 rgba(0,0,0,.12); transform: rotate(45deg); border-radius: 2px; }
.login-brand { justify-content: center; }
.login-copy { margin: 44px 0 34px; text-align: center; }
.eyebrow { margin: 0 0 8px; color: var(--red); font-size: .75rem; line-height: 1.4; letter-spacing: .16em; font-weight: 800; }
.login-copy > p:last-child { color: var(--muted); font-size: 1rem; line-height: 1.6; }

.stack-form { display: grid; gap: 19px; }
label { display: grid; gap: 8px; font-size: .875rem; line-height: 1.35; font-weight: 700; color: var(--ink-2); }
label small { color: var(--muted); font-weight: 500; }
input, select, textarea { width: 100%; border: 1px solid #d9dce0; border-radius: 10px; background: white; color: var(--ink); font-size: 1rem; padding: 12px 14px; outline: none; transition: border-color .15s, box-shadow .15s; }
input, select { min-height: 46px; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(201,21,37,.11); }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 76px; }
.password-toggle { position: absolute; top: 50%; right: 8px; min-width: 58px; min-height: 34px; padding: 5px 9px; transform: translateY(-50%); border: 0; border-radius: 7px; color: var(--red-dark); background: var(--red-soft); font-size: .78rem; font-weight: 800; cursor: pointer; }
.password-toggle:hover { background: #f8dadd; }
.password-toggle:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.password-toggle:disabled { opacity: .55; cursor: default; }
.form-error { min-height: 20px; margin: -4px 0 0; color: var(--red-dark); font-size: .875rem; line-height: 1.4; }
.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 9px; padding: 10px 17px; font-size: .9rem; font-weight: 750; cursor: pointer; transition: transform .12s, background .15s, border-color .15s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .55; pointer-events: none; }
.button svg { width: 18px; height: 18px; }
.button.primary { color: white; background: var(--red); box-shadow: 0 6px 16px rgba(201,21,37,.17); }
.button.primary:hover { background: var(--red-dark); }
.button.secondary { border-color: var(--line); background: white; }
.button.secondary:hover { background: #f8f8f9; }
.button.dark { background: var(--ink); color: white; }
.button.danger { background: var(--red); color: white; }
.button.small { min-height: 36px; padding: 7px 12px; font-size: .82rem; }
.button.wide { width: 100%; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 248px; z-index: 10; display: flex; flex-direction: column; padding: 31px 20px 20px; color: white; background: var(--ink); }
.sidebar .brand { margin: 1px 10px 48px; }
.sidebar-nav { display: grid; gap: 7px; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 13px; padding: 12px 14px; border: 0; border-radius: 9px; color: #aeb2b8; background: transparent; font-size: .92rem; font-weight: 650; text-align: left; cursor: pointer; }
.nav-item svg { width: 20px; height: 20px; }
.nav-item:hover { color: white; background: rgba(255,255,255,.06); }
.nav-item.active { color: white; background: var(--red); }
.sidebar-footer { position: relative; margin-top: auto; }
.account-button { width: 100%; display: grid; grid-template-columns: 38px 1fr 20px; align-items: center; gap: 10px; padding: 12px 10px; border: 0; border-top: 1px solid rgba(255,255,255,.1); color: white; background: transparent; text-align: left; cursor: pointer; }
.account-button > span:nth-child(2) { min-width: 0; display: grid; }
.account-button strong { overflow: hidden; text-overflow: ellipsis; font-size: .88rem; }
.account-button small { margin-top: 2px; color: #979ca5; font-size: .75rem; }
.account-button svg { width: 17px; color: #858a92; }
.avatar { width: 38px; height: 38px; display: inline-grid; place-items: center; border: 0; border-radius: 50%; color: white; background: var(--red); font-weight: 800; }
.account-menu { position: absolute; inset: auto 0 66px; overflow: hidden; padding: 5px; border: 1px solid rgba(255,255,255,.12); border-radius: 10px; background: #25282d; box-shadow: 0 12px 30px rgba(0,0,0,.35); }
.account-menu button { width: 100%; padding: 10px 12px; border: 0; border-radius: 6px; color: white; background: transparent; font-size: .84rem; text-align: left; cursor: pointer; }
.account-menu button:hover { background: rgba(255,255,255,.08); }

.main-content { grid-column: 2; width: 100%; max-width: 1640px; min-width: 0; padding: 50px clamp(28px, 4vw, 64px) 64px; }
.mobile-header, .mobile-nav { display: none; }
.mobile-account-wrap { position: relative; }
.mobile-account-menu { position: absolute; top: 46px; right: 0; z-index: 40; width: 190px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: white; box-shadow: var(--shadow); }
.mobile-account-menu > div { display: grid; gap: 2px; padding: 13px 14px; border-bottom: 1px solid var(--line); }
.mobile-account-menu strong { overflow: hidden; text-overflow: ellipsis; }
.mobile-account-menu small { color: var(--muted); }
.mobile-account-menu button { width: 100%; padding: 12px 14px; border: 0; color: var(--red-dark); background: white; font-weight: 750; text-align: left; cursor: pointer; }
.mobile-account-menu button:hover { background: var(--red-soft); }
.view { animation: fade-in .18s ease; }
@keyframes fade-in { from { opacity: .4; transform: translateY(3px); } }
.page-heading { min-height: 74px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.page-heading h1 { margin: 0; font-size: clamp(2rem, 3vw, 2.65rem); line-height: 1; letter-spacing: -.045em; }
.security-banner { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: -20px 0 30px; padding: 13px 16px; border: 1px solid #f4c8ce; border-radius: 10px; background: var(--red-soft); }
.security-banner div { display: grid; gap: 3px; }
.security-banner strong { font-size: .9rem; }
.security-banner span { color: #7d3a43; font-size: .82rem; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 1px 0 rgba(21,23,26,.025); }
.schedule-grid { display: grid; grid-template-columns: minmax(390px, .85fr) minmax(520px, 1.15fr); gap: 22px; align-items: start; }
.calendar-panel, .daily-panel { padding: 25px; }
.calendar-toolbar { display: grid; grid-template-columns: 38px 1fr 38px; align-items: center; margin-bottom: 23px; }
.calendar-toolbar h2 { margin: 0; font-size: 1.08rem; text-align: center; }
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: white; font-size: 1.6rem; cursor: pointer; }
.icon-button:hover { border-color: #c5c8cd; background: #f8f8f9; }
.weekday-row, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.weekday-row { margin-bottom: 6px; }
.weekday-row span { color: #969ba2; font-size: .64rem; font-weight: 800; letter-spacing: .05em; text-align: center; }
.calendar-day { position: relative; min-width: 0; aspect-ratio: 1; display: grid; place-items: center; border: 1px solid transparent; border-radius: 10px; background: transparent; cursor: pointer; }
.calendar-day .number { font-size: .88rem; font-weight: 650; }
.calendar-day.other-month { color: #b8bcc1; }
.calendar-day:hover { background: #f5f5f6; }
.calendar-day.today { border-color: #f0b5bd; color: var(--red); }
.calendar-day.selected { color: white; background: var(--ink); }
.calendar-day .day-count { position: absolute; bottom: 4px; min-width: 17px; height: 14px; display: grid; place-items: center; padding: 0 4px; border-radius: 8px; color: white; background: var(--red); font-size: .57rem; font-weight: 800; }
.calendar-day .day-count.complete { background: var(--success); }
.calendar-day.selected .day-count { outline: 2px solid var(--ink); }
.calendar-legend { display: flex; gap: 18px; margin-top: 20px; padding-top: 17px; border-top: 1px solid var(--line); color: var(--muted); font-size: .74rem; }
.calendar-legend span { display: flex; align-items: center; gap: 7px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.legend-dot.delivered { background: var(--success); }
.daily-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.daily-heading h2 { margin: 0; font-size: 1.25rem; letter-spacing: -.02em; }
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; overflow: hidden; margin: 22px 0 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--line); }
.stat { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 13px 15px; background: #fafafa; }
.stat span { color: var(--muted); font-size: .76rem; font-weight: 650; }
.stat strong { font-size: 1.05rem; }
.order-list { display: grid; gap: 9px; }
.order-card { position: relative; display: grid; grid-template-columns: minmax(112px,.9fr) minmax(130px,1.1fr) minmax(100px,.8fr) 72px; align-items: center; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 11px; transition: border .15s, background .15s; }
.order-card:hover { border-color: #cfd2d6; }
.order-card.delivered { background: #fbfcfb; }
.order-primary { min-width: 0; }
.order-primary strong { display: block; overflow: hidden; text-overflow: ellipsis; color: var(--red-dark); font-size: .95rem; }
.order-number-line { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.warehouse-readiness { display: inline-flex; align-items: center; width: fit-content; padding: 4px 8px; border-radius: 999px; font-size: .66rem; font-weight: 800; white-space: nowrap; }
.warehouse-readiness.ready { color: #176c49; background: #e8f5ee; }
.warehouse-readiness.not-ready { color: #a71927; background: #fdebed; }
.order-primary small, .order-detail small { display: block; margin-bottom: 3px; color: var(--muted); font-size: .68rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.order-detail { min-width: 0; font-size: .84rem; }
.order-detail span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-button { min-width: 106px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid #d6d9dd; border-radius: 20px; padding: 7px 10px; color: var(--muted); background: white; font-size: .72rem; font-weight: 750; cursor: pointer; }
.status-button .check { width: 18px; height: 18px; display: grid; place-items: center; border: 1.5px solid #bdc1c6; border-radius: 50%; font-size: .7rem; }
.status-button.delivered { border-color: #b7e1cd; color: var(--success); background: var(--success-soft); }
.status-button.delivered .check { border-color: var(--success); color: white; background: var(--success); }
.status-button:disabled { cursor: default; }
.order-card > .status-button { grid-column: 1 / 3; justify-self: start; }
.row-actions { display: flex; align-items: center; gap: 3px; }
.order-card > .row-actions { grid-column: 3 / 5; justify-self: end; }
.row-action { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 7px; color: var(--muted); background: transparent; cursor: pointer; }
.row-action:hover { color: var(--ink); background: #f0f1f2; }
.row-action.danger:hover { color: var(--red); background: var(--red-soft); }
.row-action svg { width: 16px; height: 16px; }
.row-action.evidence-action { position: relative; color: #777d84; background: #f0f1f2; }
.row-action.evidence-action.has-evidence { color: #2f7256; background: #eaf5ef; }
.row-action.evidence-action > span { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; display: grid; place-items: center; padding: 0 3px; border: 2px solid white; border-radius: 999px; color: white; background: #4f896c; font-size: .55rem; font-weight: 850; }
.row-action.password-action { color: var(--red-dark); background: var(--red-soft); }
.notes-line { grid-column: 1 / -1; margin: -2px 0 0; padding-top: 10px; border-top: 1px dashed #e5e6e8; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.empty-state { min-height: 260px; display: grid; place-items: center; align-content: center; gap: 8px; border: 1px dashed #d7dade; border-radius: 11px; text-align: center; }
.empty-icon { width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: 5px; border-radius: 50%; color: var(--red); background: var(--red-soft); font-size: 1.3rem; font-weight: 800; }
.empty-state h3 { margin: 0; font-size: 1rem; }
.empty-state p { max-width: 300px; margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.5; }

.search-panel { padding: 18px; }
.search-form { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 12px; }
.search-form svg { width: 22px; color: var(--muted); }
.search-form input { border: 0; box-shadow: none; padding-left: 0; font-size: 1rem; }
.search-form input:focus { box-shadow: none; }
.search-summary { margin: 22px 3px 12px; color: var(--muted); font-size: .86rem; }
.result-section-title { margin: 24px 3px 10px; font-size: 1rem; }
.warehouse-search-panel { margin-bottom: 22px; padding: 18px; }
.warehouse-locations { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.warehouse-locations button { min-height: 116px; display: grid; align-content: center; justify-items: start; gap: 3px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: white; text-align: left; cursor: pointer; transition: .15s ease; }
.warehouse-locations button:hover { border-color: #c3c6ca; transform: translateY(-1px); }
.warehouse-locations button.active { border-color: var(--red); box-shadow: 0 0 0 2px rgba(201,21,37,.1); }
.warehouse-locations span { color: var(--muted); font-size: .72rem; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.warehouse-locations strong { color: var(--red-dark); font-size: 2rem; line-height: 1; }
.warehouse-locations small { color: var(--muted); font-size: .72rem; }
.warehouse-orders-panel { padding: 24px; }
.warehouse-panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.warehouse-panel-heading h2 { margin: 0; font-size: 1.35rem; }
.warehouse-reorder-hint { margin: 7px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.4; }
.warehouse-order-list { display: grid; gap: 10px; }
.warehouse-order-card { position: relative; display: grid; grid-template-columns: 78px minmax(120px,1.1fr) minmax(72px,.55fr) minmax(95px,.7fr) minmax(95px,.8fr) minmax(110px,.9fr) auto; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--line); border-left: 4px solid var(--red); border-radius: 11px; background: white; transition: border-color .18s, box-shadow .18s, opacity .18s, transform .18s; }
.warehouse-order-card.ready { border-left-color: #4f896c; }
.warehouse-order-card.not-ready { border-left-color: #c91525; }
.warehouse-order-card.reorderable { border-color: #d7dade; border-left-color: var(--red); box-shadow: 0 2px 7px rgba(21,23,26,.04); }
.warehouse-order-card.reorderable.ready { border-left-color: #4f896c; }
.warehouse-order-card.is-dragging { opacity: .18; border-style: dashed; border-color: #9ba1a9; background: #f0f1f3; box-shadow: inset 0 0 0 2px rgba(21,23,26,.05); }
.warehouse-order-list.is-drag-active .warehouse-order-card:not(.is-dragging) { transition: transform .23s cubic-bezier(.2,.8,.2,1), border-color .18s, box-shadow .18s; }
.warehouse-order-card.drop-before::before,.warehouse-order-card.drop-after::after { content: ""; position: absolute; z-index: 4; left: 8px; right: 8px; height: 4px; border-radius: 999px; background: var(--red); box-shadow: 0 0 0 4px rgba(201,21,37,.1); pointer-events: none; }
.warehouse-order-card.drop-before::before { top: -8px; }
.warehouse-order-card.drop-after::after { bottom: -8px; }
.warehouse-drag-preview { position: fixed; z-index: 9999; left: -10000px; top: -10000px; margin: 0; opacity: .98; pointer-events: none; transform: rotate(.35deg) scale(1.025); transform-origin: center; border-color: #8f959d!important; background: #fff!important; box-shadow: 0 22px 46px rgba(21,23,26,.28),0 0 0 3px rgba(21,23,26,.08)!important; }
.warehouse-drag-preview.is-pointer-preview { left: 0; top: 0; }
.warehouse-drag-preview .warehouse-mobile-reorder { display: none!important; }
.warehouse-order-list.is-saving { pointer-events: none; opacity: .72; }
.warehouse-order-card small { display: block; margin-bottom: 4px; color: var(--muted); font-size: .62rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.warehouse-order-card strong { color: var(--red-dark); font-size: .9rem; }
.warehouse-order-card span:not(.warehouse-readiness) { font-size: .82rem; }
.pallet-pending { display: inline-block; color: #8a6415; font-size: .72rem!important; font-weight: 750; line-height: 1.25; }
.stat-note { color: #8a6415; font-size: .66rem; font-weight: 700; line-height: 1.2; }
.warehouse-position-control { display: flex; align-items: center; gap: 8px; min-height: 34px; }
.warehouse-position-number { min-width: 24px; color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 800; }
.warehouse-drag-handle { width: 34px; height: 34px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: #f7f7f8; cursor: grab; touch-action: none; }
.warehouse-drag-handle:hover, .warehouse-drag-handle:focus-visible { border-color: #bbbfc5; color: var(--ink); background: white; outline: none; }
.warehouse-drag-handle:active { cursor: grabbing; }
.warehouse-drag-handle svg { width: 20px; height: 20px; fill: currentColor; stroke: none; }
.warehouse-mobile-reorder { display: none; gap: 7px; }
.warehouse-mobile-reorder button { width: 42px; height: 42px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 9px; background: #f5f5f6; font-size: 1.15rem; font-weight: 800; }
.warehouse-row-actions { display: flex; gap: 5px; }
.warehouse-empty { padding: 42px 20px; border: 1px dashed var(--line); border-radius: 11px; text-align: center; }
.warehouse-empty h3, .warehouse-empty p { margin: 0; }
.warehouse-empty p { margin-top: 6px; color: var(--muted); font-size: .8rem; }
.table-panel { overflow: hidden; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 16px 18px; border-bottom: 1px solid var(--line); font-size: .84rem; text-align: left; vertical-align: middle; }
th { color: var(--muted); background: #fafafa; font-size: .69rem; letter-spacing: .06em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfcfc; }
.table-order { color: var(--ink); font-weight: 750; }
.table-actions { display: flex; justify-content: flex-end; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 20px; padding: 6px 9px; color: #8c5c12; background: #fff5df; font-size: .72rem; font-weight: 750; }
.status-pill.delivered { color: var(--success); background: var(--success-soft); }
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.user-cell { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.user-cell .avatar { width: 34px; height: 34px; font-size: .78rem; }
.role-pill { display: inline-flex; border-radius: 20px; padding: 6px 9px; color: var(--ink-2); background: #eff0f1; font-size: .72rem; font-weight: 750; text-transform: capitalize; }
.temporary-password { color: #9a5f08; font-size: .76rem; }

.section-tabs { width: fit-content; display: flex; gap: 5px; margin: -8px 0 22px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: #ebedef; }
.section-tabs button { min-height: 38px; padding: 8px 16px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: .84rem; font-weight: 750; cursor: pointer; }
.section-tabs button.active { color: var(--ink); background: white; box-shadow: 0 1px 4px rgba(21,23,26,.1); }
.audit-filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, .35fr) auto; align-items: end; gap: 14px; max-width: 920px; padding: 18px; }
.audit-filters label { min-width: 0; }
.audit-filters input, .audit-filters select { width: 100%; max-width: 100%; min-width: 0; }
.audit-search { grid-column: auto; }
.audit-filter-actions { display: flex; align-items: flex-end; justify-content: flex-end; gap: 8px; }
.audit-summary { margin: 18px 3px 11px; color: var(--muted); font-size: .82rem; }
.audit-list { display: grid; gap: 10px; }
.audit-entry { padding: 18px 20px; }
.audit-entry-meta { display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--muted); font-size: .76rem; }
.audit-user { color: var(--ink-2); font-weight: 750; }
.audit-user small { margin-left: 5px; color: var(--muted); font-size: .68rem; font-weight: 650; }
.audit-entry-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 12px; }
.audit-module, .audit-action, .audit-target { display: inline-flex; align-items: center; min-height: 25px; padding: 4px 9px; border-radius: 999px; font-size: .68rem; font-weight: 800; }
.audit-module { color: var(--red-dark); background: var(--red-soft); }
.audit-action { color: #345f4d; background: #eaf5ef; }
.audit-target { color: #525860; background: #f0f1f2; }
.audit-entry > p { margin: 12px 0 0; font-size: .87rem; line-height: 1.55; }
.audit-details { margin-top: 12px; border-top: 1px solid var(--line); }
.audit-details summary { width: fit-content; padding-top: 11px; color: var(--red-dark); font-size: .75rem; font-weight: 750; cursor: pointer; }
.audit-change-list { display: grid; gap: 7px; margin-top: 11px; }
.audit-change { display: grid; grid-template-columns: minmax(120px, .65fr) minmax(0, 1fr) 20px minmax(0, 1fr); align-items: center; gap: 9px; font-size: .76rem; }
.audit-change > strong { color: var(--muted); font-size: .68rem; letter-spacing: .025em; text-transform: uppercase; }
.audit-before, .audit-after { overflow-wrap: anywhere; padding: 8px 10px; border-radius: 7px; line-height: 1.4; }
.audit-before { color: #73555a; background: #fff4f5; }
.audit-after { color: #2f644e; background: #eff8f3; }
.audit-arrow { color: #9da1a7; text-align: center; }
.audit-empty { padding: 42px 20px; color: var(--muted); text-align: center; }
.audit-empty h3, .audit-empty p { margin: 0; }
.audit-empty p { margin-top: 6px; font-size: .8rem; }
.audit-pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; }
.audit-pagination span { min-width: 110px; color: var(--muted); font-size: .8rem; font-weight: 700; text-align: center; }

.backup-overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.backup-status-card { min-width: 0; display: grid; gap: 7px; padding: 19px 20px; }
.backup-status-card > span { color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.backup-status-card strong { overflow-wrap: anywhere; font-size: 1rem; }
.backup-status-card small { min-height: 17px; color: var(--muted); font-size: .74rem; }
.backup-result.success { color: var(--success); }
.backup-result.failed { color: var(--red-dark); }
.backup-result.running { color: #9a5f08; }
.backup-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 29px 0 14px; }
.backup-toolbar h2, .backup-toolbar p { margin: 0; }
.backup-toolbar h2 { font-size: 1.25rem; }
.backup-toolbar p { margin-top: 5px; color: var(--muted); font-size: .8rem; }
.backup-notice { margin-bottom: 14px; padding: 12px 14px; border: 1px solid #efd5a6; border-radius: 10px; color: #77551c; background: #fff9ec; font-size: .78rem; line-height: 1.5; }
.backup-list { display: grid; gap: 10px; }
.backup-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 15px 17px; }
.backup-file-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; color: var(--red-dark); background: var(--red-soft); }
.backup-file-icon svg { width: 21px; }
.backup-file-details { min-width: 0; display: grid; gap: 3px; }
.backup-file-details strong { font-size: .88rem; }
.backup-file-details span, .backup-file-details small { overflow: hidden; color: var(--muted); font-size: .74rem; text-overflow: ellipsis; white-space: nowrap; }
.backup-file-details small { font-size: .67rem; }
.backup-empty { padding: 38px 20px; color: var(--muted); text-align: center; }
.backup-empty h3, .backup-empty p { margin: 0; }
.backup-empty p { margin-top: 6px; font-size: .8rem; }

.modal { width: min(680px, calc(100% - 28px)); max-height: calc(100vh - 28px); padding: 0; border: 0; border-radius: 16px; background: transparent; box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(12,14,17,.62); backdrop-filter: blur(3px); }
.modal-card { overflow-y: auto; max-height: calc(100vh - 28px); padding: 28px; border-radius: 16px; background: white; }
.modal-card.compact { max-width: 500px; margin: auto; }
.modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.modal-heading h2 { margin: 0; font-size: 1.5rem; letter-spacing: -.035em; }
.close-button { width: 34px; height: 34px; border: 0; border-radius: 50%; color: var(--muted); background: #f1f2f3; font-size: 1.45rem; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.span-2 { grid-column: span 2; }
.upload-field { padding: 14px; border: 1px dashed #cdd0d5; border-radius: 10px; background: #fafafa; }
.upload-field input[type="file"] { min-height: 0; padding: 0; border: 0; background: transparent; box-shadow: none; }
.upload-field input[type="file"]::file-selector-button { margin-right: 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: white; font-weight: 700; cursor: pointer; }
.attachment-list { display: grid; gap: 8px; margin-bottom: 18px; }
.attachment-item { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; color: inherit; }
.attachment-item:hover { border-color: #c8cbd0; background: #fafafa; }
.attachment-details { min-width: 0; display: grid; gap: 3px; }
.attachment-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .84rem; }
.attachment-item small { color: var(--muted); font-size: .72rem; }
.attachment-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; color: var(--red); background: var(--red-soft); }
.attachment-icon svg { width: 17px; }
.attachment-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.attachment-action { min-height: 32px; display: inline-flex; align-items: center; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: white; font: inherit; font-size: .7rem; font-weight: 750; text-decoration: none; cursor: pointer; }
.attachment-action:hover { border-color: var(--red); color: var(--red-dark); background: var(--red-soft); }
.attachment-action.danger { color: var(--red-dark); }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
.attachment-empty { margin: 0; padding: 18px; border: 1px dashed var(--line); border-radius: 9px; color: var(--muted); font-size: .82rem; text-align: center; }
.attachment-empty.error { color: var(--red-dark); }
.upload-status { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; padding: 11px 13px; border: 1px solid transparent; border-radius: 9px; font-size: .82rem; font-weight: 750; line-height: 1.35; }
.upload-status:empty { display: none; }
.upload-status.uploading { color: #5f6670; border-color: #d8dbe0; background: #f6f7f8; }
.upload-status.success { color: #176a49; border-color: #b9dfcf; background: #edf8f3; }
.upload-status.success::before { content: "✓"; width: 22px; height: 22px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: white; background: #2f8b66; font-size: .75rem; }
.upload-status.error { color: var(--red-dark); border-color: #efb5bb; background: #fff1f2; }
@media (max-width: 640px) {
  .attachment-item { grid-template-columns: 34px minmax(0,1fr); }
  .attachment-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; }
.switch-row > span { display: grid; gap: 3px; }
.switch-row input { width: 42px; min-height: 24px; accent-color: var(--red); }
.confirm-card { max-width: 440px; margin: auto; text-align: center; }
.confirm-card h2, .confirm-card p, .confirm-card .eyebrow { width: 100%; text-align: center; }
.modal#confirm-dialog[open] { position: fixed; inset: 50% auto auto 50%; margin: 0; transform: translate(-50%, -50%); }
.confirm-icon { width: 48px; height: 48px; display: grid; place-items: center; margin: 0 auto 16px; border-radius: 50%; color: var(--red); background: var(--red-soft); font-weight: 900; }
.confirm-card h2 { margin: 0; font-size: 1.35rem; }
.confirm-card p { margin: 10px 0 0; color: var(--muted); font-size: .88rem; line-height: 1.55; }
.confirm-card .modal-actions { justify-content: center; }
.toast-region { position: fixed; right: 24px; bottom: 24px; z-index: 100; display: grid; gap: 9px; }
.toast { min-width: 260px; max-width: 380px; padding: 13px 16px; border-left: 4px solid var(--success); border-radius: 8px; color: white; background: var(--ink); box-shadow: 0 14px 35px rgba(0,0,0,.2); font-size: .86rem; animation: toast-in .18s ease; }
.toast.error { border-left-color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1380px) {
  .schedule-grid { grid-template-columns: 1fr; }
  .calendar-panel { width: 100%; max-width: 640px; }
  .order-card { grid-template-columns: minmax(100px,.8fr) 1fr 75px minmax(84px,.7fr) auto; }
}

@media (max-width: 1200px) {
  .search-results-table { overflow: visible; border: 0; background: transparent; }
  .search-results-table .table-wrap { overflow: visible; }
  .search-results-table table, .search-results-table tbody { display: block; width: 100%; }
  .search-results-table thead { display: none; }
  .search-results-table tr { display: block; overflow: hidden; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 12px; background: white; }
  .search-results-table td { display: grid; grid-template-columns: minmax(128px,.7fr) minmax(0,1.3fr); align-items: center; gap: 12px; min-height: 48px; padding: 12px 16px; border-bottom: 1px dashed var(--line); white-space: normal; }
  .search-results-table td:last-child { border-bottom: 0; }
  .search-results-table td::before { content: attr(data-label); color: var(--muted); font-size: .65rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
  .search-results-table .table-actions { justify-content: flex-start; }
}

@media (max-width: 1100px) {
  .users-table-panel { overflow: visible; border: 0; background: transparent; }
  .users-table-panel .table-wrap { overflow: visible; }
  .users-table-panel table, .users-table-panel tbody { display: block; width: 100%; }
  .users-table-panel thead { display: none; }
  .users-table-panel tr { display: block; overflow: hidden; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 12px; background: white; }
  .users-table-panel td { display: grid; grid-template-columns: minmax(110px,.7fr) minmax(0,1.3fr); align-items: center; gap: 12px; min-height: 48px; padding: 12px 16px; border-bottom: 1px dashed var(--line); white-space: normal; }
  .users-table-panel td:last-child { border-bottom: 0; }
  .users-table-panel td::before { content: attr(data-label); color: var(--muted); font-size: .65rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
  .users-table-panel .table-actions { justify-content: flex-start; gap: 8px; }
  .users-table-panel .row-action { width: 44px; height: 44px; border-radius: 10px; background: #f3f4f5; }
}

@media (max-width: 980px) and (min-width: 761px) {
  .warehouse-order-card { grid-template-columns: 74px repeat(3, minmax(0, 1fr)); }
  .warehouse-row-actions { grid-column: 2 / -1; justify-self: start; }
}

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

@media (max-width: 760px) {
  .login-screen { min-height: 100dvh; padding: 20px; background: white; }
  .login-card { width: 100%; padding: 28px 4px; border: 0; box-shadow: none; }
  .login-copy { margin: 58px 0 34px; }
  .app-shell { display: block; padding-bottom: 74px; }
  .sidebar { display: none; }
  .main-content { padding: 0 16px 35px; }
  .mobile-header { height: 68px; display: flex; align-items: center; justify-content: space-between; margin: 0 -16px 24px; padding: 0 18px; color: white; background: var(--ink); }
  .mobile-header .brand { font-size: .84rem; }
  .mobile-header .brand-mark { width: 17px; height: 17px; }
  .mobile-header .avatar { width: 35px; height: 35px; }
  .mobile-nav { position: fixed; inset: auto 0 0; z-index: 20; height: 68px; display: flex; justify-content: space-around; padding: 6px max(10px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(10px); }
  .mobile-nav button { min-width: 0; flex: 1 1 0; display: grid; place-items: center; gap: 2px; padding: 0 3px; border: 0; color: #858a91; background: transparent; font-size: .64rem; font-weight: 700; }
  .mobile-nav svg { width: 21px; height: 21px; }
  .mobile-nav button.active { color: var(--red); }
  .page-heading { min-height: 58px; margin-bottom: 20px; }
  .page-heading h1 { font-size: 2rem; }
  .page-heading .button { align-self: center; }
  .page-heading .button span { display: none; }
  .section-tabs { width: 100%; }
  .section-tabs button { flex: 1; }
  .audit-filters { width: 100%; min-width: 0; grid-template-columns: minmax(0, 1fr); gap: 12px; overflow: hidden; padding: 15px; }
  .audit-filters input[type="date"] { display: block; -webkit-appearance: none; appearance: none; }
  .audit-search { grid-column: auto; }
  .audit-filter-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .audit-entry { padding: 16px; }
  .audit-entry-meta { align-items: flex-start; flex-direction: column; gap: 5px; }
  .audit-change { grid-template-columns: 1fr; gap: 5px; }
  .audit-change > strong { margin-top: 5px; }
  .audit-arrow { transform: rotate(90deg); }
  .backup-toolbar { align-items: stretch; flex-direction: column; }
  .backup-toolbar .button { width: 100%; }
  .backup-row { grid-template-columns: 42px minmax(0, 1fr); }
  .backup-row .button { grid-column: 1 / -1; width: 100%; }
  .schedule-grid { gap: 14px; }
  .warehouse-locations { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .warehouse-locations button { min-height: 92px; padding: 14px; }
  .warehouse-order-card { grid-template-columns: 1fr 1fr; gap: 14px; }
  .warehouse-position { grid-column: 1 / -1; }
  .warehouse-position-control { justify-content: space-between; }
  .warehouse-order-list.is-reordering .warehouse-position-control { justify-content: flex-start; flex-wrap: wrap; }
  .warehouse-order-list.is-reordering .warehouse-mobile-reorder { display: flex; margin-left: auto; }
  .warehouse-order-list.is-reordering .warehouse-drag-handle { width: 42px; height: 42px; }
  .warehouse-row-actions { grid-column: 1 / -1; }
  .warehouse-row-actions .row-action { width: 44px; height: 44px; border-radius: 10px; background: #f3f4f5; }
  .calendar-panel, .daily-panel { padding: 16px; }
  .calendar-toolbar { margin-bottom: 17px; }
  .calendar-day { border-radius: 8px; }
  .calendar-day .day-count { bottom: 1px; transform: scale(.82); }
  .calendar-legend { margin-top: 13px; padding-top: 13px; }
  .stats-row { margin-top: 18px; }
  .stat { display: grid; gap: 4px; padding: 10px; }
  .stat strong { font-size: 1.1rem; }
  .order-card { grid-template-columns: 1fr 1fr; gap: 12px; padding: 16px; }
  .order-card .suburb-detail { grid-column: 2; grid-row: 1; }
  .order-card .driver-detail { grid-column: 1; grid-row: 2; }
  .order-card .pallet-detail { grid-column: 2; grid-row: 2; text-align: left; }
  .order-card .status-button { grid-column: 1 / -1; justify-self: start; }
  .order-card .row-actions { grid-column: 1 / -1; justify-self: start; gap: 10px; }
  .order-card .row-action { width: 44px; height: 44px; border-radius: 10px; background: #f3f4f5; }
  .order-card .row-action.danger { color: var(--red-dark); background: var(--red-soft); }
  .order-card .row-action svg { width: 20px; height: 20px; }
  .notes-line { grid-column: 1 / -1; }
  .security-banner { align-items: flex-start; margin: -7px 0 20px; }
  .security-banner span { display: none; }
  .search-panel { padding: 10px; }
  .search-form { grid-template-columns: 20px 1fr; }
  .search-form .button { grid-column: 1 / -1; }
  .table-panel { border-radius: 12px; }
  .search-results-table { overflow: visible; border: 0; background: transparent; }
  .search-results-table .table-wrap { overflow: visible; }
  .search-results-table table, .search-results-table tbody { display: block; width: 100%; }
  .search-results-table thead { display: none; }
  .search-results-table tr { display: block; overflow: hidden; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 12px; background: white; }
  .search-results-table td { display: grid; grid-template-columns: minmax(104px,.8fr) minmax(0,1.2fr); align-items: center; gap: 12px; min-height: 48px; padding: 12px 16px; border-bottom: 1px dashed var(--line); white-space: normal; }
  .search-results-table td:last-child { border-bottom: 0; }
  .search-results-table td::before { content: attr(data-label); color: var(--muted); font-size: .65rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
  .search-results-table .table-actions { justify-content: flex-start; }
  .users-table-panel { overflow: visible; border: 0; background: transparent; }
  .users-table-panel .table-wrap { overflow: visible; }
  .users-table-panel table, .users-table-panel tbody { display: block; width: 100%; }
  .users-table-panel thead { display: none; }
  .users-table-panel tr { display: block; overflow: hidden; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 12px; background: white; }
  .users-table-panel td { display: grid; grid-template-columns: minmax(92px,.7fr) minmax(0,1.3fr); align-items: center; gap: 12px; min-height: 48px; padding: 12px 16px; border-bottom: 1px dashed var(--line); white-space: normal; }
  .users-table-panel td:last-child { border-bottom: 0; }
  .users-table-panel td::before { content: attr(data-label); color: var(--muted); font-size: .65rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
  .users-table-panel .table-actions { justify-content: flex-start; gap: 8px; }
  .users-table-panel .row-action { width: 44px; height: 44px; border-radius: 10px; background: #f3f4f5; }
  th, td { padding: 13px 14px; white-space: nowrap; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .modal-card { padding: 22px 18px; }
  .modal-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .toast-region { right: 14px; bottom: 82px; left: 14px; }
  .toast { min-width: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
