/* Custodia: app shell. Fixed left sidebar with sections (collapsible to icons), a page header with the warehouse photo,
   tinted stat cards, pill filters. Green on near-white, light and dark themes. */
:root {
  --bg: #F6F8F7; --bg2: #FFFFFF; --surface: #FFFFFF; --surface2: #F3F6F4; --border: #E4EAE6; --border2: #D2DBD5;
  --text: #0E1B14; --text2: #46554C; --text3: #67766E;
  --accent: #16A34A; --accent-strong: #17613B; --accent-soft: #E7F5EC; --accent-ink: #14703F;
  --ok: #15803D; --ok-soft: #E7F6EC; --warn: #D97706; --warn-strong: #9A4A07; --warn-soft: #FDF1E3; --danger: #DC2626; --danger-soft: #FDECEC; --info: #2563EB; --info-soft: #EAF1FE;
  --violet: #7C5CE6; --violet-soft: #F1EEFD;
  /* stat-card tints: background, border, icon tile */
  --tg-bg: #F0F9F3; --tg-bd: #D6EEDD; --tg-ic: #1B7A43;
  --tb-bg: #F1F6FE; --tb-bd: #DCE7FB; --tb-ic: #4B8DF0;
  --to-bg: #FEF6EE; --to-bd: #F8E3CF; --to-ic: #F08A24;
  --tv-bg: #F6F3FE; --tv-bd: #E6DFFB; --tv-ic: #8B6CF0;
  --shadow-pro: 0 1px 2px rgba(16,40,28,.04), 0 6px 22px rgba(16,40,28,.05);
  --radius: 16px; --radius-sm: 10px; --sb-w: 272px;
  --hdr-a: #EAF3EE; --hdr-b: #F6F8F7;
  --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; --mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0A1310; --bg2: #0E1915; --surface: #111D18; --surface2: #15241E; --border: rgba(255,255,255,.08); --border2: rgba(255,255,255,.15);
  --text: #E7F0EA; --text2: #A9BAB0; --text3: #869A8F;
  --accent: #4ADE80; --accent-strong: #22C55E; --accent-soft: rgba(74,222,128,.12); --accent-ink: #6EE7A0;
  --ok: #4ADE80; --ok-soft: rgba(74,222,128,.12); --warn: #FBBF24; --warn-strong: #FCD34D; --warn-soft: rgba(251,191,36,.12); --danger: #F87171; --danger-soft: rgba(248,113,113,.12); --info: #93C5FD; --info-soft: rgba(147,197,253,.12);
  --violet: #B4A2FA; --violet-soft: rgba(180,162,250,.12);
  --tg-bg: rgba(74,222,128,.07); --tg-bd: rgba(74,222,128,.18); --tg-ic: #22A55A;
  --tb-bg: rgba(96,165,250,.07); --tb-bd: rgba(96,165,250,.18); --tb-ic: #4B8DF0;
  --to-bg: rgba(251,146,60,.07); --to-bd: rgba(251,146,60,.2); --to-ic: #F08A24;
  --tv-bg: rgba(167,139,250,.07); --tv-bd: rgba(167,139,250,.2); --tv-ic: #8B6CF0;
  --shadow-pro: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  --hdr-a: #0F1E18; --hdr-b: #0A1310;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14.5px/1.5 var(--font); }
a { color: var(--accent-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); font-size: .92em; }
.num { font-variant-numeric: tabular-nums; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- sidebar ---------- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sb-w); background: var(--bg2); border-right: 1px solid var(--border); z-index: 40; display: flex; flex-direction: column; transition: width .22s ease, transform .22s ease; }
.sb-head { padding: 18px 18px 14px; position: relative; }
.sb-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.sb-brand img { width: 44px; height: 44px; border-radius: 12px; flex: none; }
.sb-brand b { font-size: 21px; letter-spacing: -.02em; display: block; line-height: 1.1; }
.sb-brand small { display: block; font-size: 13px; color: var(--text3); font-weight: 500; margin-top: 1px; }
.sb-site { margin-top: 16px; width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 12px; font-size: 13px; font-weight: 500; color: var(--text); background: var(--surface); box-shadow: var(--shadow-pro); cursor: pointer; text-align: left; }
.sb-site:hover { border-color: var(--border2); }
.sb-site i { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.sb-site span { flex: 1; min-width: 0; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sb-site svg { width: 16px; height: 16px; color: var(--text3); }
.sb-menu { position: absolute; left: 18px; right: 18px; top: 100%; margin-top: -6px; z-index: 50; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 14px 40px rgba(16,40,28,.16); padding: 6px; max-height: 50vh; overflow: auto; }
.sb-menu .h { font-size: 11px; font-weight: 700; color: var(--text3); letter-spacing: .06em; text-transform: uppercase; padding: 8px 10px 4px; }
.sb-menu a { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: 13px; }
.sb-menu a:hover, .sb-menu a.on { background: var(--accent-soft); color: var(--accent-ink); }
.sb-toggle { position: absolute; right: -12px; top: 28px; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border2); background: var(--surface); color: var(--text2); cursor: pointer; display: grid; place-items: center; font-size: 13px; line-height: 1; box-shadow: var(--shadow-pro); }
.sb-nav { flex: 1; overflow-y: auto; padding: 4px 0 12px; scrollbar-width: thin; }
.nav-sec { font-size: 11.5px; font-weight: 600; color: var(--text3); letter-spacing: .07em; text-transform: uppercase; padding: 16px 26px 6px; }
.nav-item { display: flex; align-items: center; gap: 14px; margin: 1px 12px 1px 14px; padding: 9px 12px 9px 14px; border-radius: 10px; color: var(--text2); text-decoration: none; font-weight: 500; font-size: 14.5px; position: relative; min-height: 42px; }
.nav-item svg.i { width: 19px; height: 19px; stroke-width: 1.8; }
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav-item.on::before { content: ""; position: absolute; left: -14px; top: 6px; bottom: 6px; width: 4px; border-radius: 0 4px 4px 0; background: var(--accent-strong); }
.nav-item .badge { margin-left: auto; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 999px; font-size: 12px; font-weight: 700; display: grid; place-items: center; background: var(--danger-soft); color: var(--danger); }
.sb-foot { padding: 12px 14px; display: flex; align-items: center; gap: 12px; background: var(--surface2); border-top: 1px solid var(--border); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.sb-user { min-width: 0; flex: 1; }
.sb-user b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user small { color: var(--text3); font-size: 12px; }
.iconbtn { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; border: 1px solid var(--border); background: var(--surface); color: var(--text2); cursor: pointer; position: relative; flex: none; box-shadow: 0 1px 2px rgba(16,40,28,.05); }
.iconbtn:hover { color: var(--text); border-color: var(--border2); }
.iconbtn .dot { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); }

body.collapsed { --sb-w: 76px; }
body.collapsed .sb-c { display: none; }
body.collapsed .sb-head { padding: 18px 16px 14px; }
body.collapsed .nav-item { justify-content: center; padding: 10px; margin: 2px 12px; }
body.collapsed .nav-item.on::before { left: -12px; }
body.collapsed .nav-item .badge { position: absolute; top: 0; right: 0; min-width: 18px; height: 18px; padding: 0 4px; font-size: 10.5px; }
body.collapsed .sb-foot { flex-direction: column; }

/* ---------- page header: title, tools, the warehouse photo fading into the page ---------- */
.main { margin-left: var(--sb-w); min-height: 100vh; transition: margin .22s ease; display: flex; flex-direction: column; min-width: 0; }
.topbar { position: relative; z-index: 30; min-height: 128px; display: flex; align-items: flex-end; gap: 16px; padding: 22px 28px 14px; background: linear-gradient(180deg, var(--hdr-a), var(--hdr-b)); overflow: visible; }
.tb-photo { position: absolute; top: 0; height: 150px; left: var(--ph-l, 40%); width: 480px; background: url(img/warehouse.webp) center top / cover no-repeat; pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 22%, #000 80%, transparent), linear-gradient(180deg, #000 72%, transparent);
  -webkit-mask-composite: source-in; mask-image: linear-gradient(90deg, transparent, #000 22%, #000 80%, transparent), linear-gradient(180deg, #000 72%, transparent); mask-composite: intersect; }
:root[data-theme="dark"] .tb-photo { opacity: .55; }
.topbar h1 { font-size: 28px; line-height: 1.2; margin: 0; letter-spacing: -.02em; overflow-wrap: anywhere; }
.topbar .crumb { font-size: 15px; color: var(--text2); margin-top: 4px; max-width: 640px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.topbar .crumb:empty { display: none; }
.tb-title { min-width: 0; flex: 1; position: relative; padding-bottom: 6px; }
.tb-photo ~ .tb-title { max-width: min(600px, calc(var(--ph-l, 40%) + 40px)); }
.topbar.no-photo .tb-photo { display: none; }
.topbar.no-photo .tb-title { max-width: none; }
.tb-right { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; position: relative; align-self: flex-start; margin: 4px 0 0 auto; }
.tb-tools { display: flex; align-items: center; gap: 10px; position: relative; }
.tb-search { position: relative; }
.tb-search input, .tb-search input[type=search] { width: 320px; padding: 10px 52px 10px 40px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); min-height: 44px; font-size: 14px; box-shadow: 0 1px 3px rgba(16,40,28,.06); }
.tb-search svg { position: absolute; left: 13px; top: 13px; width: 18px; height: 18px; color: var(--text2); }
.tb-search kbd { position: absolute; right: 9px; top: 10px; font: 600 11.5px var(--font); color: var(--text2); background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 2px 7px; }
.tb-tools .iconbtn { width: 44px; height: 44px; border-radius: 12px; }
.me-av { width: 46px; height: 46px; border-radius: 50%; background: var(--accent-strong); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px; flex: none; text-decoration: none; }
:root[data-theme="dark"] .me-av { color: #062514; }
.role-sw { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text2); white-space: nowrap; }
.role-sw select { height: 40px; max-width: 280px; padding: 0 30px 0 12px; font-size: 13px; font-weight: 600; border-radius: 10px; border-color: var(--border); box-shadow: 0 1px 3px rgba(16,40,28,.06); }
@media (max-width: 1500px) { .tb-search input, .tb-search input[type=search] { width: 260px; } }
@media (max-width: 1280px) { .tb-search { display: none; } }
@media (max-width: 420px) { .role-sw select { max-width: 112px; } }
.demo-pill { font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--warn-strong); background: var(--warn-soft); padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.hamb { display: none; }
.content { padding: 8px 28px 28px; max-width: 1560px; width: 100%; flex: 1; outline: none; }
.foot { padding: 14px 28px; color: var(--text3); font-size: 12px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: space-between; }
.veil { display: none; }
.offline-bar { display: none; background: var(--warn-soft); color: var(--warn-strong); font-size: 13px; padding: 7px 28px; border-bottom: 1px solid var(--border); }
body.is-offline .offline-bar, body.has-queue .offline-bar { display: block; }
.page-tools { display: flex; justify-content: flex-end; align-items: center; gap: 14px; margin: -6px 0 14px; flex-wrap: wrap; font-size: 14px; font-weight: 500; }
.page-tools .when { display: inline-flex; align-items: center; gap: 8px; color: var(--text); }
.page-tools .when svg { width: 17px; height: 17px; color: var(--text2); }
.page-tools select { min-height: 40px; border-radius: 10px; font-weight: 600; font-size: 13px; padding: 0 30px 0 12px; }

@media (max-width: 1100px) { .tb-photo { display: none; } }
@media (max-width: 920px) {
  .sidebar { transform: translateX(-100%); width: 284px; box-shadow: 8px 0 30px rgba(0,0,0,.18); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .veil { display: block; position: fixed; inset: 0; background: rgba(10,25,18,.45); z-index: 35; }
  .sb-toggle { display: none; }
  .main { margin-left: 0; }
  .hamb { display: grid; }
  .topbar { min-height: 0; padding: 14px 16px 10px; gap: 10px; align-items: center; flex-wrap: wrap; }
  .topbar h1 { font-size: 21px; }
  .topbar .crumb { font-size: 13px; -webkit-line-clamp: 1; }
  .tb-title { order: 3; flex-basis: 100%; padding-bottom: 0; }
  .tb-right { margin: 0 0 0 auto; flex-direction: row; align-items: center; gap: 6px; align-self: center; }
  .role-sw > span { display: none; }
  .tb-tools { gap: 6px; }
  .tb-tools .iconbtn { width: 38px; height: 38px; }
  .me-av { display: none; }
  .role-sw select { height: 38px; }
  .content { padding: 6px 16px 20px; }
  body.collapsed .sb-c { display: initial; }
  body.collapsed .nav-item { justify-content: flex-start; padding: 9px 12px 9px 14px; margin: 1px 12px 1px 14px; }
}
@media (max-width: 520px) { .demo-pill { display: none; } }

/* notifications panel */
.panel { position: absolute; right: 0; top: 52px; width: min(380px, calc(100vw - 24px)); max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 14px 40px rgba(16,40,28,.18); z-index: 60; }
.panel h3 { margin: 0; padding: 12px 14px; font-size: 14px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.msg { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.msg.unread { background: var(--accent-soft); }
.msg .h { font-size: 11.5px; color: var(--text3); display: flex; gap: 6px; align-items: center; }
.msg b { display: block; margin: 2px 0; }
.ch { font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--surface2); color: var(--text2); text-transform: uppercase; letter-spacing: .03em; }

/* ---------- components ---------- */
h2 { font-size: 17px; margin: 22px 0 10px; letter-spacing: -.01em; }
h3 { font-size: 15.5px; margin: 0 0 8px; letter-spacing: -.01em; }
.lead { color: var(--text2); max-width: 820px; margin: 0 0 16px; }
.muted { color: var(--text3); }
.small { font-size: 12.5px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pro); padding: 20px 22px; }
.card.flush { padding: 0; overflow: hidden; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-h h3 { margin: 0; }
.card > h3:first-child, .card-h > h3, .card > .stack > h3:first-child, form.card > h3:first-child { font-size: 17.5px; font-weight: 700; letter-spacing: -.015em; }
/* a card title with its coloured icon and a subtitle, as on the overview */
.ct { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.ct > svg.i { width: 26px; height: 26px; margin-top: 1px; stroke-width: 2.2; }
.ct h3 { font-size: 20px; font-weight: 700; margin: 0; letter-spacing: -.02em; }
.ct p { margin: 2px 0 0; color: var(--text2); font-size: 14px; }
.ct.g > svg.i { color: var(--accent); } .ct.r > svg.i { color: var(--danger); } .ct.o > svg.i { color: var(--to-ic); } .ct.b > svg.i { color: var(--tb-ic); } .ct.v > svg.i { color: var(--tv-ic); }
.lnk { font-weight: 600; font-size: 14px; color: var(--info); text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
:root[data-theme="dark"] .lnk { color: var(--info); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
.split { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.grow { flex: 1; min-width: 0; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid var(--border2); background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer; text-decoration: none; font-size: 13.5px; white-space: nowrap; box-shadow: 0 1px 2px rgba(16,40,28,.05); }
.btn:hover { border-color: var(--text3); }
.btn.pri { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
:root[data-theme="dark"] .btn.pri { color: #052513; }
.btn.pri:hover { filter: brightness(1.08); }
.btn.bad { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 12.5px; }
.btn.lg { min-height: 50px; font-size: 15px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg.i { width: 16px; height: 16px; }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface2); color: var(--text2); white-space: nowrap; border: 1px solid var(--border); }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.chip.nodot::before { display: none; }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn-strong); border-color: transparent; }
.chip.bad { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.chip.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.chip.acc { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
/* priority from the SLA clock: overdue or escalated = high, due within a day = medium */
.prio { display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.prio.high { background: var(--danger-soft); color: var(--danger); }
.prio.medium { background: #FDF3D8; color: #8A5A00; }
.prio.low { background: var(--info-soft); color: var(--info); }
:root[data-theme="dark"] .prio.medium { background: rgba(251,191,36,.14); color: #FCD34D; }

label.f { display: block; font-size: 12.5px; font-weight: 600; color: var(--text2); }
label.f > input, label.f > select, label.f > textarea { display: block; width: 100%; margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=search], select, textarea {
  border: 1px solid var(--border2); border-radius: var(--radius-sm); padding: 8px 12px; background: var(--surface); min-height: 40px; font-weight: 400; color: var(--text); }
select { appearance: none; -webkit-appearance: none; padding-right: 32px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2367766E' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 15px; }
select[multiple] { background-image: none; padding-right: 12px; }
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible, .nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.fgrid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent-strong); }
.isearch { position: relative; }
.isearch svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text3); pointer-events: none; }
.isearch input { padding-left: 34px; width: 100%; border-color: var(--border); }

.seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 6px; }
.seg button { min-height: 48px; border: 1px solid var(--border2); background: var(--surface); border-radius: var(--radius-sm); font-weight: 600; cursor: pointer; padding: 6px; font-size: 13.5px; }
.seg button[aria-pressed=true] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.seg button.badopt[aria-pressed=true] { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
/* tabs and filters are pills everywhere (overview: All (3) · No point (1) …) */
.tabs, .pills { display: flex; gap: 8px; margin-bottom: 16px; overflow-x: auto; align-items: center; padding: 2px; scrollbar-width: none; }
.tabs button, .tabs a, .pills button, .pills a { border: 1px solid var(--border); background: var(--surface); padding: 6px 16px; border-radius: 999px; font-weight: 500; font-size: 13.5px; color: var(--text2); cursor: pointer; white-space: nowrap; text-decoration: none; min-height: 34px; display: inline-flex; align-items: center; gap: 6px; }
.tabs button:hover, .tabs a:hover, .pills button:hover, .pills a:hover { border-color: var(--border2); color: var(--text); }
.tabs .on, .pills .on { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; font-weight: 600; }
:root[data-theme="dark"] .tabs .on, :root[data-theme="dark"] .pills .on { color: #052513; }
.tabs .btn, .pills .btn { border-radius: var(--radius-sm); }

.tbl { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-weight: 500; color: var(--text2); background: var(--surface); font-size: 13px; white-space: nowrap; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
thead th { border-bottom-color: var(--border); }
tr:last-child td { border-bottom: 0; }
tbody tr.link { cursor: pointer; }
tbody tr.link:hover td { background: var(--surface2); }
td.r, th.r { text-align: right; }
td .sub { display: block; font-size: 12px; color: var(--text3); }
.card > .tbl > table th:first-child, .card > .tbl > table td:first-child { padding-left: 20px; }
.card > .tbl > table th:last-child, .card > .tbl > table td:last-child { padding-right: 20px; }
/* type tile in tables: tinted square with the exception's icon */
.tt { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.tt svg.i { width: 20px; height: 20px; }
.tt.o { background: var(--to-bg); color: var(--to-ic); border: 1px solid var(--to-bd); }
.tt.r { background: var(--danger-soft); color: var(--danger); }
.tt.b { background: var(--tb-bg); color: var(--tb-ic); border: 1px solid var(--tb-bd); }
.tt.v { background: var(--tv-bg); color: var(--tv-ic); border: 1px solid var(--tv-bd); }
.tt.g { background: var(--tg-bg); color: var(--tg-ic); border: 1px solid var(--tg-bd); }

/* ---------- stat cards (tinted, icon tile, sparkline, delta) ---------- */
.stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(206px, 100%), 1fr)); margin-bottom: 16px; }
.stats.five { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.stats.five > .stat:nth-child(-n+3) { grid-column: span 2; } .stats.five > .stat:nth-child(n+4) { grid-column: span 3; }
@media (min-width: 1500px) { .stats.five { grid-template-columns: repeat(5, minmax(0, 1fr)); } .stats.five > .stat { grid-column: auto !important; } }
@media (max-width: 920px) { .stats.five { grid-template-columns: repeat(auto-fit, minmax(min(206px, 100%), 1fr)); } .stats.five > .stat { grid-column: auto !important; } }
.stats.four { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
@media (min-width: 1240px) { .stats.four { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; padding: 18px 20px 16px; border-radius: var(--radius); border: 1px solid var(--tg-bd); background: var(--tg-bg); text-decoration: none; color: var(--text); box-shadow: var(--shadow-pro); min-width: 0; transition: transform .15s ease, box-shadow .15s ease; }
a.stat:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgba(16,40,28,.05), 0 12px 28px rgba(16,40,28,.08); }
.stat-ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--tg-ic); color: #fff; }
.stat-ic svg.i { width: 24px; height: 24px; stroke-width: 2; }
.stat .l::first-letter { text-transform: uppercase; }
.stat .l { font-size: 14px; font-weight: 500; color: var(--text); line-height: 1.3; padding-right: 4px; }
.stat .v { font-size: 34px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; margin-top: 4px; }
.stat .s { font-size: 14px; color: var(--text2); margin-top: 2px; }
.stat .s.bad { color: var(--danger); }
.stat-f { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; margin-top: 8px; color: var(--text2); }
.stat-f.up { color: var(--ok); } .stat-f.down { color: var(--danger); } .stat-f.good-down { color: var(--ok); }
.stat-f svg.i { width: 17px; height: 17px; }
.stat-f .muted { font-weight: 500; }
.stat .spark { position: absolute; right: 20px; top: 50px; width: 54px; height: 36px; }
.stat.has-ring { container-type: inline-size; }
@container (max-width: 250px) { .stat .ring { display: none; } .stat.has-ring .stat-f { padding-right: 0; } }
.stat .ring { position: absolute; right: 16px; top: 66px; width: 84px; height: 84px; }
.stat.has-ring .stat-f { padding-right: 70px; }
.stat.t-b { background: var(--tb-bg); border-color: var(--tb-bd); } .stat.t-b .stat-ic { background: var(--tb-ic); }
.stat.t-o { background: var(--to-bg); border-color: var(--to-bd); } .stat.t-o .stat-ic { background: var(--to-ic); }
.stat.t-v { background: var(--tv-bg); border-color: var(--tv-bd); } .stat.t-v .stat-ic { background: var(--tv-ic); }
.stat.t-w { background: var(--surface); border-color: var(--border); } .stat.t-w .stat-ic { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- overview layout ---------- */
.ov { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); }
@media (max-width: 1180px) { .ov { grid-template-columns: 1fr; } }
.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .ax { font-size: 12px; fill: var(--text2); font-family: var(--font); }
.chart .gl { stroke: var(--border); stroke-width: 1; }
.chart .tip { position: absolute; z-index: 2; pointer-events: none; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(16,40,28,.12); padding: 9px 12px; font-size: 12.5px; min-width: 138px; transform: translate(-50%, -100%); white-space: nowrap; }
.chart .tip b { display: block; margin-bottom: 4px; font-size: 13px; }
.chart .tip div { display: flex; align-items: center; gap: 8px; color: var(--text2); }
.chart .tip div span { margin-left: auto; color: var(--text); font-weight: 600; padding-left: 14px; }
.lg { display: flex; align-items: center; gap: 18px; font-size: 13.5px; color: var(--text2); flex-wrap: wrap; }
.lg i, .tip i, .dl i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; flex: none; }
.donut { display: grid; grid-template-columns: minmax(110px, 176px) minmax(0, 1fr); gap: clamp(14px, 2vw, 28px); align-items: center; }
.donut svg { width: 100%; height: auto; }
.dwrap { container-type: inline-size; }
@container (max-width: 420px) { .donut { grid-template-columns: 1fr; justify-items: center; } .donut svg { width: 170px; } .dl { width: 100%; } }
.dl > span:not(.p) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut .c1 { font-size: 30px; font-weight: 700; fill: var(--text); font-family: var(--font); }
.donut .c2 { font-size: 13px; fill: var(--text2); font-family: var(--font); }
.dl { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 14px 12px; min-width: 0; align-items: center; font-size: 14px; }
.dl b { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.dl span.p { color: var(--text2); text-align: right; min-width: 38px; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .donut { grid-template-columns: 1fr; justify-items: center; } .donut svg { width: 170px; } .dl { width: 100%; } }
.qa { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
.qa a { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); text-decoration: none; color: var(--text); min-height: 66px; box-shadow: 0 1px 2px rgba(16,40,28,.04); }
.qa a:hover { border-color: var(--border2); background: var(--surface2); }
.qa .qi { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--tb-bg); color: var(--tb-ic); flex: none; border: 1px solid var(--tb-bd); }
.qa .qi svg.i { width: 21px; height: 21px; }
.qa b { display: block; font-size: 14.5px; font-weight: 600; line-height: 1.25; }
.qa small { display: block; font-size: 12.5px; color: var(--text2); margin-top: 2px; }
.qa .chev { margin-left: auto; color: var(--text2); width: 18px; height: 18px; }
.qa a.pri { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.qa a.pri small, .qa a.pri .chev { color: rgba(255,255,255,.82); }
.qa a.pri .qi { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.18); }
.qa a.sap b { color: var(--info); }
:root[data-theme="dark"] .qa a.pri, :root[data-theme="dark"] .qa a.pri small, :root[data-theme="dark"] .qa a.pri .chev, :root[data-theme="dark"] .qa a.pri .qi { color: #052513; }
.tour { display: flex; align-items: center; gap: 14px; margin-top: 12px; padding: 14px 16px; border-radius: 12px; background: var(--tb-bg); border: 1px solid var(--tb-bd); }
.tour > svg.i { width: 26px; height: 26px; color: var(--info); }
.tour b { color: var(--info); font-size: 14.5px; display: block; }
.tour small { color: var(--text2); font-size: 12.5px; }
.tour .btn { margin-left: auto; color: var(--info); border-color: color-mix(in srgb, var(--info) 45%, transparent); }
@media (max-width: 520px) { .tour { flex-wrap: wrap; } .tour .btn { margin-left: 0; } }
.att-h { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 2px 0 14px; }
.att-h .pills { margin: 0; }
.att-h .isearch { width: min(240px, 100%); }
.idcell b { display: block; font-weight: 700; }
.idcell span { font-size: 12px; color: var(--text2); }

.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-pro); }
.kpi .l { font-size: 13px; color: var(--text2); font-weight: 600; }
.kpi .v { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .s { font-size: 12.5px; color: var(--text3); margin-top: 3px; }
.kpi .delta, .stat .delta { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--ok-soft); color: var(--ok); margin-left: 6px; vertical-align: 4px; }
.stat .delta { font-size: 13px; vertical-align: 8px; letter-spacing: 0; }
.kpi .delta.down, .stat .delta.down { background: var(--danger-soft); color: var(--danger); }
.meter { height: 7px; border-radius: 4px; background: var(--surface2); overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 10px; border-bottom: 1px solid var(--border); }
.bars .b { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; position: relative; }
.bars .col { width: 100%; max-width: 26px; background: var(--warn); border-radius: 5px 5px 0 0; position: relative; min-height: 0; }
.bars .col .f { position: absolute; left: 0; right: 0; bottom: 0; background: var(--accent); border-radius: 5px 5px 0 0; }
.bars .d { position: absolute; bottom: -18px; font-size: 10.5px; color: var(--text3); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text2); margin-top: 24px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.heat { display: grid; grid-template-columns: 36px repeat(24, minmax(0, 1fr)); gap: 2px; font-size: 10px; color: var(--text3); }
.heat i { aspect-ratio: 1; border-radius: 2px; background: var(--accent); }

.pkg { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); text-decoration: none; color: var(--text); min-height: 64px; }
.pkg:hover { border-color: var(--accent); }
.pkg .t { font-weight: 600; }
.pkg .m { font-size: 12.5px; color: var(--text3); }
.notice { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13.5px; border: 1px solid transparent; }
.notice.warn { background: var(--warn-soft); color: var(--warn-strong); }
.notice.bad { background: var(--danger-soft); color: var(--danger); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.info { background: var(--info-soft); color: var(--info); }
.empty { text-align: center; color: var(--text3); padding: 28px 12px; font-size: 13.5px; }
.skel { height: 14px; border-radius: 6px; background: var(--surface2); margin: 8px 0; }
@media (prefers-reduced-motion: no-preference) { .skel { background: linear-gradient(90deg, var(--surface2), var(--border), var(--surface2)); background-size: 200% 100%; animation: sh 1.2s infinite linear; } @keyframes sh { to { background-position: -200% 0; } } }

.tl { display: flex; margin: 10px 0 4px; }
.tl div { flex: 1; text-align: center; font-size: 11px; color: var(--text3); position: relative; padding-top: 18px; }
.tl div::before { content: ""; position: absolute; top: 5px; left: 50%; width: 10px; height: 10px; border-radius: 50%; background: var(--border2); transform: translateX(-50%); z-index: 1; }
.tl div::after { content: ""; position: absolute; top: 9px; left: -50%; width: 100%; height: 2px; background: var(--border2); }
.tl div:first-child::after { display: none; }
.tl div.done { color: var(--text); font-weight: 600; }
.tl div.done::before, .tl div.done::after { background: var(--accent); }
.tl div.cur::before { box-shadow: 0 0 0 4px var(--accent-soft); }
.vt { list-style: none; margin: 0; padding: 0; }
.vt li { position: relative; padding: 0 0 14px 22px; font-size: 13px; }
.vt li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.vt li::after { content: ""; position: absolute; left: 7.5px; top: 16px; bottom: 0; width: 1px; background: var(--border2); }
.vt li:last-child::after { display: none; }
.vt li.sys::before { background: var(--border2); }
.vt .h { font-size: 11.5px; color: var(--text3); }

.pickup { text-align: center; border: 2px dashed var(--accent); border-radius: var(--radius); padding: 14px; background: var(--accent-soft); }
.pickup .code { font: 700 30px/1.15 var(--mono); letter-spacing: .14em; color: var(--accent-ink); }
.qr { display: inline-block; padding: 8px; background: #fff; border-radius: 6px; margin-top: 8px; }
.qr img, .qr canvas { display: block; }
.checks { list-style: none; padding: 0; margin: 6px 0 0; font-size: 12.5px; }
.checks li { display: flex; gap: 8px; padding: 3px 0; }
.checks li b { min-width: 42px; }
.checks .x { color: var(--danger); } .checks .w { color: var(--warn-strong); } .checks .y { color: var(--ok); } .checks .i { color: var(--text3); }
.video { width: 100%; border-radius: 8px; background: #000; max-height: 52vh; }
.photo-prev { max-width: 170px; max-height: 130px; border-radius: 6px; border: 1px solid var(--border); display: block; margin-top: 6px; object-fit: cover; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 6px; }
.slot { border: 1px solid var(--border2); border-radius: 6px; padding: 6px 4px; text-align: center; font: 600 12px var(--mono); background: var(--surface); }
.slot.used { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.slot.L { grid-column: span 2; }
.slot small { display: block; font: 500 9.5px var(--font); color: var(--text3); }
.roster { display: grid; grid-template-columns: 110px repeat(7, minmax(0, 1fr)); gap: 4px; font-size: 12px; }
.roster .c { background: var(--surface2); border-radius: 6px; padding: 6px; min-height: 44px; }
.roster .c span { display: block; background: var(--accent-soft); color: var(--accent-ink); border-radius: 4px; padding: 1px 5px; margin-bottom: 3px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roster .c.gap { background: var(--danger-soft); }
.labels { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.label { border: 2px solid #0F172A; border-radius: 6px; padding: 12px; background: #fff; color: #0F172A; display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; break-inside: avoid; }
.label .big { font: 700 17px/1.2 var(--mono); }

/* login */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.auth-l { background: #0F3D27 url(img/warehouse.webp) right bottom / 70% auto no-repeat; background-blend-mode: soft-light; color: #E6F4EC; padding: 40px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-l h1 { font-size: 30px; line-height: 1.2; margin: 24px 0 12px; letter-spacing: -.02em; color: #fff; }
.auth-l p { color: #BFDCCB; max-width: 460px; }
.auth-l .flow { display: grid; gap: 8px; margin-top: 20px; font-size: 13.5px; }
.auth-l .flow span { display: flex; gap: 10px; align-items: center; }
.auth-l .flow b { width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,.12); display: grid; place-items: center; font-size: 12px; }
.auth-r { padding: 40px; display: flex; flex-direction: column; justify-content: center; max-width: 640px; }
.acct { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); }
.acct button { display: flex; gap: 10px; align-items: center; text-align: left; border: 1px solid var(--border2); background: var(--surface); border-radius: var(--radius-sm); padding: 9px 10px; cursor: pointer; min-height: 54px; }
.acct button:hover { border-color: var(--accent); }
.acct b { display: block; font-size: 13px; } .acct small { color: var(--text3); font-size: 11.5px; }
@media (max-width: 880px) { .auth { grid-template-columns: 1fr; } .auth-l { padding: 24px; } .auth-l .flow { display: none; } .auth-r { padding: 20px 16px 40px; } }

.toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-size: 13.5px; z-index: 80; max-width: calc(100vw - 32px); box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast.bad { background: var(--danger); color: #fff; }

@media print {
  .sidebar, .topbar, .foot, .noprint, .offline-bar { display: none !important; }
  .main { margin: 0; } body { background: #fff; color: #000; } .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #ccc; }
}

/* phones: stats become a compact two-column strip so the page's real work (scan, pickup code) stays near the top */
@media (max-width: 600px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
  .stat { grid-template-columns: 1fr; padding: 12px 14px; gap: 2px; border-radius: 14px; }
  .stat-ic { width: 30px; height: 30px; border-radius: 9px; }
  .stat-ic svg.i { width: 17px; height: 17px; }
  .stat .l { font-size: 12.5px; margin-top: 6px; }
  .stat .v { font-size: 24px; margin-top: 0; }
  .stat .s { font-size: 12px; }
  .stat .spark, .stat .ring, .stat-f { display: none; }
  .stats > .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media (max-width: 600px) { .stats.five { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stats.five > .stat:last-child { grid-column: 1 / -1 !important; } }

/* smart-locker kiosk: one tile per door */
.lockers { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.door { border: 1px solid var(--border); border-radius: 12px; padding: 14px 10px; text-align: center; background: var(--surface); display: flex; flex-direction: column; gap: 4px; min-height: 92px; justify-content: center; }
.door b { font-size: 20px; letter-spacing: .5px; }
.door small { color: var(--text3); font-size: 12px; }
.door.busy { background: var(--tb-bg, var(--surface2)); border-color: var(--tb-ic, var(--border2)); }
.door.open { background: var(--accent); border-color: var(--accent); color: #fff; animation: doorOpen .5s ease-out; }
.door.open small { color: #fff; }
@keyframes doorOpen { from { transform: perspective(400px) rotateY(0); } 50% { transform: perspective(400px) rotateY(-24deg); } to { transform: perspective(400px) rotateY(0); } }
@media (prefers-reduced-motion: reduce) { .door.open { animation: none; } }
