/* Tabet Group · Order automation — design system (no build step, no external assets).
   One accent (indigo) for "your move" and selection; semantic colours only for status. */

:root {
  --bg: #f6f6f7;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --surface-3: #f4f4f5;
  --ink: #18181b;
  --ink-2: #3f3f46;
  --muted: #71717a;
  --faint: #a1a1aa;
  --line: #e4e4e7;
  --line-2: #efeff1;

  --accent: #4f46e5; --accent-hover: #4338ca; --accent-ink: #3730a3; --accent-bg: #eef2ff; --accent-line: #c7d2fe;
  --success: #047857; --success-solid: #10b981; --success-bg: #ecfdf5; --success-line: #a7f3d0;
  --warning: #b45309; --warning-solid: #f59e0b; --warning-bg: #fffbeb; --warning-line: #fde68a;
  --danger: #b91c1c; --danger-solid: #ef4444; --danger-bg: #fef2f2; --danger-line: #fecaca;
  --info: #0369a1; --info-solid: #0ea5e9; --info-bg: #f0f9ff; --info-line: #bae6fd;
  --violet: #6d28d9; --violet-bg: #f5f3ff; --violet-line: #ddd6fe;
  --neutral: #3f3f46; --neutral-bg: #f4f4f5; --neutral-line: #e4e4e7;

  --zv: #18181b; --fc: #db2777;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-xs: 0 1px 2px rgba(24, 24, 27, .04);
  --shadow: 0 1px 2px rgba(24, 24, 27, .04), 0 1px 1px rgba(24, 24, 27, .02);
  --shadow-lg: 0 16px 40px rgba(24, 24, 27, .10), 0 2px 8px rgba(24, 24, 27, .05);
  --font: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar: 232px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01"; font-variant-numeric: tabular-nums; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.012em; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 15px; font-weight: 620; }
h3 { font-size: 14px; font-weight: 620; }
p { margin: 0; }
.icon { flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: -.01em; }
.nowrap { white-space: nowrap; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sep { color: var(--line); margin: 0 2px; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(to right, var(--surface) calc(var(--sidebar) - 1px), var(--line) calc(var(--sidebar) - 1px), var(--line) var(--sidebar), var(--bg) var(--sidebar)); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 20px;
  background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px 14px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--ink);
  color: #fff; font-weight: 750; font-size: 14px; letter-spacing: -.02em; flex: none; }
.brand-name { display: block; font-weight: 650; font-size: 13.5px; line-height: 1.2; }
.brand-sub { display: block; font-size: 12px; color: var(--muted); line-height: 1.3; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint);
  padding: 0 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 8px; color: var(--ink-2);
  font-weight: 520; font-size: 13.5px; }
.nav a .icon { color: var(--faint); }
.nav a:hover { background: var(--surface-3); color: var(--ink); }
.nav a.active { background: var(--surface-3); color: var(--ink); font-weight: 600; }
.nav a.active .icon { color: var(--accent); }
.nav-count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent);
  color: #fff; font-size: 11.5px; font-weight: 650; display: grid; place-items: center; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.mode-card { display: block; border-radius: 10px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); }
.mode-card:hover { border-color: #d4d4d8; }
.mode-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 12.5px; }
.mode-text { font-size: 12px; color: var(--muted); margin-top: 2px; }
.mode-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.mode-review .mode-dot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.mode-auto .mode-dot { background: var(--success-solid); box-shadow: 0 0 0 3px var(--success-bg); }
.mode-shadow .mode-dot { background: #8b5cf6; box-shadow: 0 0 0 3px var(--violet-bg); }
.mode-paused { margin-top: 6px; display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--danger); }
.me { display: flex; align-items: center; gap: 10px; padding: 8px; border-top: 1px solid var(--line-2); padding-top: 12px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-bg);
  color: var(--accent-ink); font-weight: 650; font-size: 12.5px; flex: none; }
.me-text { flex: 1; min-width: 0; }
.me-name { display: block; font-weight: 600; font-size: 13px; line-height: 1.2; }
.me-role { display: block; font-size: 12px; color: var(--muted); text-transform: capitalize; }
.me form { margin: 0; }
.icon-btn { border: 0; background: transparent; color: var(--faint); padding: 6px; border-radius: 7px; cursor: pointer; display: grid; }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }

.main { padding: 28px 40px 28px; min-width: 0; }
.container { max-width: 1280px; margin: 0 auto; }
.foot { margin-top: 40px; color: var(--faint); font-size: 12px; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-head p { margin-top: 4px; color: var(--muted); }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: nowrap; justify-content: flex-end; flex: none; }
.crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 12px; font-weight: 520; }
.crumb:hover { color: var(--ink); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 560 13px var(--font);
  cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-xs); transition: background .12s, border-color .12s, color .12s; }
.btn:hover { background: var(--surface-2); border-color: #d4d4d8; }
.btn .icon { color: var(--muted); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(79, 70, 229, .25); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary .icon, .btn-dark .icon { color: inherit; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: #27272a; border-color: #27272a; }
.btn-danger { color: var(--danger); }
.btn-danger .icon { color: inherit; }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger-line); }
.btn-ghost { box-shadow: none; border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; gap: 6px; }
.btn-lg { height: 40px; padding: 0 18px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; margin: 0; }

/* ---------- Cards & grid ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px;
  border-bottom: 1px solid var(--line-2); min-height: 52px; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-head .sub { color: var(--muted); font-size: 12.5px; }
.card-head a.sub { font-weight: 560; color: var(--accent); }
.card-head a.sub:hover { color: var(--accent-hover); }
.card-head .count { color: var(--faint); font-weight: 500; }
.card-body { padding: 16px 18px; }
.card-pad { padding: 18px; }
.grid { display: grid; gap: 20px; }
.grid-main { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.stack { display: flex; flex-direction: column; gap: 20px; }
.grid > *, .stack > * { min-width: 0; }
.divider { height: 1px; background: var(--line-2); margin: 14px 0; }

/* ---------- Stats strip ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 20px; overflow: hidden; }
.stat { display: block; padding: 16px 20px 18px; border-left: 1px solid var(--line-2); position: relative; transition: background .12s; }
.stat:first-child { border-left: 0; }
.stat:hover { background: var(--surface-2); }
.stat-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 540; font-size: 13px; }
.stat-label .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.stat-value { font-size: 30px; font-weight: 650; letter-spacing: -.025em; margin-top: 6px; line-height: 1.1; }
.stat-foot { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.stat.tone-accent .dot { background: var(--accent); }
.stat.tone-danger .dot { background: var(--danger-solid); }
.stat.tone-success .dot { background: var(--success-solid); }
.stat.tone-info .dot { background: var(--info-solid); }
.stat.hot.tone-accent .stat-value { color: var(--accent); }
.stat.hot.tone-danger .stat-value { color: var(--danger); }
.stat.hot::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; }
.stat.hot.tone-accent::after { background: var(--accent); }
.stat.hot.tone-danger::after { background: var(--danger-solid); }

/* ---------- Callouts ---------- */
.callout { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); margin-bottom: 20px; }
.callout .callout-ico { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex: none;
  background: var(--neutral-bg); color: var(--ink-2); }
.callout .grow { flex: 1; min-width: 0; }
.callout-title { font-weight: 620; }
.callout-text { color: var(--muted); font-size: 13px; }
.callout-accent { background: var(--accent-bg); border-color: var(--accent-line); }
.callout-accent .callout-ico { background: #fff; color: var(--accent); }
.callout-accent .callout-text { color: #4338ca; }
.callout-warning { background: var(--warning-bg); border-color: var(--warning-line); }
.callout-warning .callout-ico { background: #fff; color: var(--warning); }
.callout-warning .callout-text { color: #92400e; }
.callout-danger { background: var(--danger-bg); border-color: var(--danger-line); }
.callout-danger .callout-ico { background: #fff; color: var(--danger); }
.callout-danger .callout-text { color: #991b1b; }
.callout-success { background: var(--success-bg); border-color: var(--success-line); }
.callout-success .callout-ico { background: #fff; color: var(--success); }
.callout-success .callout-text { color: #065f46; }
.callout-violet { background: var(--violet-bg); border-color: var(--violet-line); }
.callout-violet .callout-ico { background: #fff; color: var(--violet); }
.callout-violet .callout-text { color: #5b21b6; }
.callout-info { background: var(--info-bg); border-color: var(--info-line); }
.callout-info .callout-ico { background: #fff; color: var(--info); }
.callout-info .callout-text { color: #075985; }

/* ---------- Pills, badges ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 580; white-space: nowrap; background: var(--neutral-bg); color: var(--neutral); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-accent { color: var(--accent-ink); background: var(--accent-bg); }
.pill-accent .dot { background: var(--accent); }
.pill-success { color: var(--success); background: var(--success-bg); }
.pill-success .dot { background: var(--success-solid); }
.pill-warning { color: var(--warning); background: var(--warning-bg); }
.pill-warning .dot { background: var(--warning-solid); }
.pill-danger { color: var(--danger); background: var(--danger-bg); }
.pill-danger .dot { background: var(--danger-solid); }
.pill-info { color: var(--info); background: var(--info-bg); }
.pill-info .dot { background: var(--info-solid); }
.pill-violet { color: var(--violet); background: var(--violet-bg); }
.pill-neutral { color: var(--neutral); background: var(--neutral-bg); }
.pill-muted { color: var(--muted); background: var(--surface-3); }
.pill-muted .dot { background: var(--faint); }
.site { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px;
  font-weight: 560; white-space: nowrap; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); }
.site::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--zv); }
.site-fc::before { background: var(--fc); border-radius: 50%; }
.ful { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.ful .icon { color: var(--faint); }
.ful-pickup { color: var(--success); font-weight: 560; }
.ful-pickup .icon { color: var(--success); }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--surface-3);
  color: var(--ink-2); font-size: 12px; font-weight: 540; white-space: nowrap; }
.chip-dep { font-family: var(--mono); font-size: 11.5px; font-weight: 600; letter-spacing: 0; background: var(--surface);
  border: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px;
  font-weight: 620; white-space: nowrap; border: 1px solid; }
.tag-final { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.tag-week { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-line); }
.tag-15 { background: var(--success-bg); color: var(--success); border-color: var(--success-line); }
.badge-count { display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 999px;
  background: var(--surface-3); color: var(--muted); font-size: 11.5px; font-weight: 620; }
.tab.active .badge-count { background: var(--accent-bg); color: var(--accent-ink); }
.sim { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 5px; font-size: 11px; font-weight: 600;
  background: var(--violet-bg); color: var(--violet); vertical-align: 1px; }

/* ---------- Flash ---------- */
.flash { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; margin-bottom: 16px;
  border: 1px solid; font-weight: 540; font-size: 13.5px; }
.flash-success { background: var(--success-bg); border-color: var(--success-line); color: var(--success); }
.flash-warning { background: var(--warning-bg); border-color: var(--warning-line); color: var(--warning); }
.flash-danger { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }

/* ---------- Tabs / filters ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 0; flex-wrap: wrap;
  padding: 0 18px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 18px; flex-wrap: wrap; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 14px 0 12px; font-weight: 560; color: var(--muted);
  font-size: 13.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.seg { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--surface-3); gap: 2px; }
.seg a { padding: 4px 10px; font-size: 12.5px; font-weight: 560; color: var(--muted); border-radius: 6px; white-space: nowrap; }
.seg a:hover { color: var(--ink); }
.seg a.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(24, 24, 27, .08); }
.search { position: relative; }
.search input { height: 34px; width: 280px; padding: 0 12px 0 34px; border: 1px solid var(--line); border-radius: 8px;
  font: 13.5px var(--font); background: var(--surface); box-shadow: var(--shadow-xs); color: var(--ink); }
.search input:focus { outline: 2px solid var(--accent-line); border-color: var(--accent); }
.search .icon { position: absolute; left: 11px; top: 10px; color: var(--faint); }

/* ---------- Table ---------- */
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { text-align: left; font-size: 12px; font-weight: 560; color: var(--muted); padding: 10px 14px;
  border-bottom: 1px solid var(--line-2); white-space: nowrap; background: var(--surface-2); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; white-space: nowrap; }
.table th:first-child, .table td:first-child { padding-left: 18px; }
.table th:last-child, .table td:last-child { padding-right: 18px; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; transition: background .1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { font-weight: 620; font-size: 14px; }
.table .sub { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.table .chev { color: var(--faint); text-align: right; width: 28px; }
.table .wrap { white-space: normal; }
.table-plain tbody tr { cursor: default; }
.table-plain tbody tr:hover { background: transparent; }
.cell-status { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.cell-status .sub { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.order-cell .sub { display: flex; align-items: center; gap: 6px; }
.site-dot { width: 7px; height: 7px; border-radius: 2px; background: var(--zv); flex: none; }
.site-dot.fc { background: var(--fc); border-radius: 50%; }
.table-wrap { overflow-x: auto; }
.table tr.group td { background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--muted); padding-top: 8px; padding-bottom: 8px; letter-spacing: .02em; }
.route-cell { display: flex; align-items: center; gap: 6px; max-width: 240px; }
.route-cell .locs { overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-top: 1px solid var(--line-2);
  color: var(--muted); font-size: 13px; }
.pager .btns { display: flex; gap: 8px; align-items: center; }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 13px 18px; border-top: 1px solid var(--line-2); }
.list-item:first-child { border-top: 0; }
.list-item:hover { background: var(--surface-2); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { display: flex; align-items: center; gap: 8px; font-weight: 620; flex-wrap: wrap; }
.list-item .title .who { font-weight: 500; color: var(--ink-2); }
.list-item .meta { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; margin-top: 3px;
  white-space: nowrap; overflow: hidden; }
.list-item .meta .reason { overflow: hidden; text-overflow: ellipsis; }
.list-item .right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.list-item .when { color: var(--faint); font-size: 12px; white-space: nowrap; }
.list-item > .icon { color: var(--line); }
.list-item:hover > .icon { color: var(--muted); }
.ico-box { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: var(--neutral-bg); color: var(--ink-2); }
.ico-box.accent { background: var(--accent-bg); color: var(--accent); }
.ico-box.warning { background: var(--warning-bg); color: var(--warning); }
.ico-box.danger { background: var(--danger-bg); color: var(--danger); }
.ico-box.success { background: var(--success-bg); color: var(--success); }
.ico-box.violet { background: var(--violet-bg); color: var(--violet); }

/* ---------- Health ---------- */
.health { display: flex; flex-direction: column; padding: 6px 0; }
.health-row { display: flex; align-items: flex-start; gap: 12px; padding: 9px 18px; }
.health-row .grow { flex: 1; min-width: 0; }
.health-row .name { font-weight: 580; font-size: 13.5px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.health-row .state { font-size: 12px; font-weight: 560; }
.health-row .state.ok { color: var(--success); }
.health-row .state.pending { color: var(--warning); }
.health-row .state.bad { color: var(--danger); }
.health-row .detail { color: var(--muted); font-size: 12.5px; line-height: 1.4; margin-top: 1px; }
.hdot { width: 8px; height: 8px; border-radius: 50%; flex: none; margin-top: 7px; }
.hdot-ok { background: var(--success-solid); box-shadow: 0 0 0 3px var(--success-bg); }
.hdot-pending { background: var(--warning-solid); box-shadow: 0 0 0 3px var(--warning-bg); }
.hdot-bad { background: var(--danger-solid); box-shadow: 0 0 0 3px var(--danger-bg); }

/* ---------- Bar chart ---------- */
.chart { padding: 18px 18px 14px; }
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; align-items: end; height: 150px; }
.bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; min-width: 0; }
.bar .v { font-size: 12px; font-weight: 620; color: var(--ink-2); }
.bar .v.zero { color: var(--faint); font-weight: 500; }
.bar .col { width: 100%; max-width: 44px; display: flex; flex-direction: column; border-radius: 6px; overflow: hidden; min-height: 3px;
  background: var(--surface-3); }
.bar .col .seg-zv { background: var(--zv); }
.bar .col .seg-fc { background: var(--fc); }
.bar-labels { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; margin-top: 8px; text-align: center; }
.bar-labels div { font-size: 12px; color: var(--muted); line-height: 1.3; }
.bar-labels div b { display: block; font-weight: 560; color: var(--ink-2); }
.bar-labels div.today b { color: var(--accent); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; border-radius: 2px; background: var(--zv); }
.legend i.fc { background: var(--fc); border-radius: 50%; }

/* ---------- Feed ---------- */
.feed { display: flex; flex-direction: column; padding: 6px 0; }
.feed-item { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; padding: 8px 18px; font-size: 13px;
  align-items: start; }
.feed-item .msg { line-height: 1.45; color: var(--ink-2); }
.feed-item .msg a.ord { font-weight: 620; color: var(--ink); }
.feed-item .when { color: var(--faint); font-size: 12px; white-space: nowrap; }
.feed-item .who { color: var(--muted); font-size: 12px; }
.ev-ico { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--neutral-bg); color: var(--muted); }
.ev-accent { background: var(--accent-bg); color: var(--accent); }
.ev-success { background: var(--success-bg); color: var(--success); }
.ev-warning { background: var(--warning-bg); color: var(--warning); }
.ev-danger { background: var(--danger-bg); color: var(--danger); }

/* Activity page: day groups */
.day-group + .day-group { margin-top: 20px; }
.day-title { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 8px 2px; }
.log { display: flex; flex-direction: column; }
.log-row { display: grid; grid-template-columns: 64px 24px 92px minmax(0, 1fr) 110px; gap: 12px; align-items: center; padding: 10px 18px;
  border-top: 1px solid var(--line-2); font-size: 13.5px; }
.log-row:first-child { border-top: 0; }
.log-row .time { color: var(--muted); font-size: 12.5px; }
.log-row .ord { font-weight: 620; }
.log-row .ord.none { color: var(--faint); font-weight: 500; }
.log-row .msg { color: var(--ink-2); min-width: 0; }
.log-row .actor { color: var(--muted); font-size: 12.5px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-row .actor.person { color: var(--ink-2); font-weight: 560; }

/* ---------- Order header & stepper ---------- */
.order-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.order-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.order-title h1 { font-size: 26px; letter-spacing: -.02em; }
.order-meta { display: flex; align-items: center; gap: 6px 16px; color: var(--muted); margin-top: 8px; flex-wrap: wrap; font-size: 13px; }
.order-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.order-meta .icon { color: var(--faint); }
.stepper { display: grid; grid-template-columns: repeat(6, 1fr); padding: 16px 8px 14px; margin-bottom: 20px; }
.step { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 0 6px; min-width: 0; }
.step::before { content: ""; position: absolute; top: 11px; left: calc(-50% + 16px); right: calc(50% + 16px); height: 2px;
  background: var(--line); border-radius: 2px; }
.step:first-child::before { display: none; }
.step.done::before, .step.current::before, .step.blocked::before { background: var(--success-solid); }
.step-dot { position: relative; z-index: 1; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 1.5px solid var(--line); color: var(--faint); font-size: 11.5px; font-weight: 650; margin-bottom: 4px; }
.step.done .step-dot { background: var(--success-solid); border-color: var(--success-solid); color: #fff; }
.step.current .step-dot { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); box-shadow: 0 0 0 4px rgba(79, 70, 229, .10); }
.step.blocked .step-dot { border-color: var(--danger-solid); color: var(--danger); background: var(--danger-bg); box-shadow: 0 0 0 4px rgba(239, 68, 68, .10); }
.step.skipped .step-dot { border-style: dashed; }
.step-title { font-weight: 600; font-size: 12.5px; }
.step.todo .step-title, .step.skipped .step-title { color: var(--muted); font-weight: 540; }
.step-sub { font-size: 12px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Items & route ---------- */
.item { padding: 18px; border-top: 1px solid var(--line-2); }
.item:first-child { border-top: 0; }
.item-top { display: flex; gap: 16px; align-items: flex-start; }
.item-main { flex: 1; min-width: 0; }
.item-brand { font-size: 11px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.item-name { font-weight: 620; font-size: 15px; margin-top: 2px; letter-spacing: -.005em; }
.item-site { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.item-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.item-facts b { color: var(--ink); font-weight: 600; }
.item-facts .mono { color: var(--ink-2); }
.item-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; text-align: right; }
.why { font-size: 12px; color: var(--muted); max-width: 220px; }

.route-box { margin-top: 14px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface-2); padding: 12px 14px 14px; }
.route-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.route-label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-weight: 540; }
.route-result { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--accent-ink); }
.route-result .icon { color: var(--accent); }
.route-result.bad { color: var(--danger); }
.route-result.bad .icon { color: var(--danger); }
.route { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.hop { flex: 1 1 0; min-width: 0; border-top: 3px solid var(--line); padding-top: 9px; }
.hop-name { display: flex; align-items: baseline; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hop-rank { font-size: 11px; font-weight: 650; color: var(--faint); flex: none; }
.hop-stock { margin-top: 3px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.hop-stock b { font-size: 16px; font-weight: 650; color: var(--ink); letter-spacing: -.02em; margin-right: 3px; }
.hop-out { margin-top: 2px; font-size: 12px; font-weight: 560; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hop.taken { border-top-color: var(--accent); }
.hop.taken .hop-rank { color: var(--accent); }
.hop.taken .hop-out { color: var(--accent-ink); font-weight: 650; }
.hop.no_stock .hop-name, .hop.not_enough .hop-name { color: var(--muted); }
.hop.no_stock .hop-stock b, .hop.not_enough .hop-stock b { color: var(--faint); }
.hop.not_enough { border-top-color: #d4d4d8; }
.hop.safety { border-top-color: var(--warning-solid); }
.hop.safety .hop-out { color: var(--warning); }
.hop.not_reached { opacity: .55; }
.hop.unknown { border-top-style: dashed; border-top-color: #d4d4d8; }
.hop.unknown .hop-stock b { color: var(--faint); }
.issue { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; padding: 9px 12px; border-radius: 8px; font-size: 13px; }
.issue.block { background: var(--danger-bg); color: #991b1b; }
.issue.note { background: var(--warning-bg); color: #92400e; }
.issue .icon { margin-top: 2px; }

/* ---------- Outputs (email / whatsapp / sheet) ---------- */
.out { border-top: 1px solid var(--line-2); }
.out:first-of-type { border-top: 0; }
.out > summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 14px 18px; cursor: pointer; }
.out > summary::-webkit-details-marker { display: none; }
.out > summary:hover { background: var(--surface-2); }
.out .grow { flex: 1; min-width: 0; }
.out .t { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.out .t .to { font-weight: 500; color: var(--muted); }
.out .s { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.out .caret { color: var(--faint); transition: transform .15s; }
.out[open] .caret { transform: rotate(90deg); }
.out-body { padding: 0 18px 18px 64px; }
.mail { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.mail-meta { padding: 12px 14px; border-bottom: 1px solid var(--line-2); display: grid;
  grid-template-columns: 62px minmax(0, 1fr); row-gap: 6px; column-gap: 10px; font-size: 13px; align-items: baseline; }
.mail-meta .k { color: var(--faint); font-size: 12.5px; }
.mail-subject { font-weight: 650; font-size: 14px; }
.addr { display: inline-flex; padding: 0 7px; height: 21px; align-items: center; margin: 0 4px 3px 0; border-radius: 5px; background: var(--surface-3);
  font-size: 12px; color: var(--ink-2); }
.attach { display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px 5px 6px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 12.5px; font-weight: 560; background: var(--surface); margin-top: 2px; }
.attach:hover { border-color: #d4d4d8; background: var(--surface-2); }
.attach .pdf { width: 22px; height: 22px; border-radius: 5px; background: #dc2626; color: #fff; display: grid; place-items: center;
  font-size: 8.5px; font-weight: 800; letter-spacing: .02em; }
.mail-body { padding: 14px 16px; font-family: var(--font); font-size: 13.5px; white-space: pre-wrap; line-height: 1.65; margin: 0; color: var(--ink); }
.mail-tabs { display: flex; gap: 2px; padding: 8px 10px 0; }
.mail-tabs button { border: 0; background: transparent; padding: 5px 10px; border-radius: 6px; font: 560 12.5px var(--font);
  color: var(--muted); cursor: pointer; }
.mail-tabs button:hover { color: var(--ink); }
.mail-tabs button.active { background: var(--surface-3); color: var(--ink); }
.mail-frame { width: 100%; height: 520px; border: 0; background: #f4f4f5; display: block; }
.wa { background: #f0f2f5; border-radius: 10px; padding: 14px 16px 16px; }
.wa-group { font-size: 12px; color: #54656f; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; font-weight: 560; }
.wa-bubble { max-width: 560px; background: #d9fdd3; border-radius: 10px 10px 3px 10px; padding: 8px 11px 5px; margin-left: auto;
  box-shadow: 0 1px .5px rgba(11, 20, 26, .13); font-size: 13.5px; white-space: pre-wrap; line-height: 1.5; color: #111b21; }
.wa-bubble .wa-time { text-align: right; font-size: 11px; color: #667781; margin-top: 2px; }
.sheet-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.sheet { border-collapse: collapse; font-size: 12.5px; min-width: 100%; }
.sheet th { background: var(--surface-3); color: var(--ink-2); font-weight: 600; padding: 7px 10px; text-align: left; white-space: nowrap;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sheet td { padding: 8px 10px; border-right: 1px solid var(--line-2); white-space: nowrap; }
.sheet td.team { background: repeating-linear-gradient(-45deg, #fff, #fff 5px, #f6f6f7 5px, #f6f6f7 10px); }
.sheet-legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 8px; align-items: center; flex-wrap: wrap; }
.sheet-legend i { display: inline-block; width: 14px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px;
  border: 1px solid var(--line); }
.err { margin: 0 0 10px; padding: 8px 10px; border-radius: 8px; background: var(--danger-bg); color: #991b1b; font-size: 12.5px; }

/* ---------- Side panels ---------- */
.kv { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 9px 12px; font-size: 13px; }
.kv .k { color: var(--muted); }
.kv .v { min-width: 0; overflow-wrap: anywhere; }
.money-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.money-row.total { border-top: 1px solid var(--line-2); margin-top: 8px; padding-top: 10px; font-weight: 650; font-size: 15px; }
.money-row.cod { margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: var(--surface-3); }
.note-box { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; background: var(--warning-bg);
  color: #78350f; font-size: 13px; }
.note-box .icon { margin-top: 2px; color: var(--warning); }
.timeline { position: relative; padding: 12px 18px 14px; }
.tl { position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; padding: 6px 0; font-size: 13px; }
.tl::before { content: ""; position: absolute; left: 11px; top: 32px; bottom: -6px; width: 1.5px; background: var(--line-2); }
.tl:last-child::before { display: none; }
.tl .msg { color: var(--ink-2); line-height: 1.45; padding-top: 2px; }
.tl .when { color: var(--faint); font-size: 12px; }

/* ---------- Approve bar ---------- */
.approve { display: flex; align-items: center; gap: 16px; padding: 14px 16px 14px 18px; border-radius: var(--radius); margin-bottom: 20px;
  background: var(--surface); border: 1px solid var(--accent-line); box-shadow: 0 0 0 4px var(--accent-bg), var(--shadow); }
.approve .grow { flex: 1; min-width: 0; }
.approve .t { font-weight: 650; font-size: 14.5px; }
.approve .s { color: var(--muted); font-size: 13px; margin-top: 1px; }
.approve .counts { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.approve .counts span { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px;
  background: var(--surface-3); font-size: 12px; font-weight: 540; color: var(--ink-2); }
.approve .counts .icon { color: var(--muted); }

/* ---------- Rules page ---------- */
.rule-block { padding: 14px 18px 16px; border-top: 1px solid var(--line-2); }
.rule-block:first-of-type { border-top: 0; }
.rule-title { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-weight: 600; flex-wrap: wrap; }
.rule-title .faint { font-weight: 500; font-size: 12.5px; }
.rule-route .hop { padding-top: 8px; }
.rule-route .hop-stock { font-size: 11.5px; }
.rule-route .hop:first-child { border-top-color: var(--accent); }
.rule-route .hop:first-child .hop-rank { color: var(--accent); }
.policy { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; padding: 16px 18px 4px; }
.policy-card { padding: 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); }
.policy-card .when { font-size: 13px; color: var(--ink-2); margin-top: 10px; }
.example { padding: 12px 14px; background: var(--surface-2); border-radius: 10px; border: 1px solid var(--line-2); margin: 12px 0; }
.legend-box { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 6px; }

/* ---------- Connections ---------- */
.conn { display: flex; gap: 14px; padding: 16px 18px; border-top: 1px solid var(--line-2); }
.conn:first-of-type { border-top: 0; }
.conn .ico-box { width: 38px; height: 38px; border-radius: 10px; }
.conn .grow { flex: 1; min-width: 0; }
.conn .name { display: flex; align-items: center; gap: 8px; font-weight: 620; font-size: 14px; flex-wrap: wrap; }
.conn .detail { color: var(--muted); font-size: 13px; margin-top: 2px; }
.conn .needs { margin-top: 10px; padding: 9px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line-2);
  border-left: 3px solid var(--warning-solid); color: var(--ink-2); font-size: 12.5px; line-height: 1.5; }
.conn .needs b { color: var(--ink); }
.conn .needs .owner { display: block; margin-top: 3px; color: var(--muted); }
.conn .needs.info { border-left-color: var(--info-solid); }
.mode-pick { display: grid; grid-template-columns: 1fr; gap: 8px; }
.mode-opt { display: flex; gap: 12px; text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  cursor: pointer; font: inherit; color: inherit; align-items: flex-start; }
.mode-opt:hover:not([disabled]) { border-color: #d4d4d8; background: var(--surface-2); }
.mode-opt[disabled] { cursor: default; }
.mode-opt.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.mode-opt .radio { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid #d4d4d8; flex: none; margin-top: 2px; display: grid; place-items: center; }
.mode-opt.on .radio { border-color: var(--accent); }
.mode-opt.on .radio::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.mode-opt .t { display: flex; align-items: center; gap: 8px; font-weight: 620; }
.mode-opt .d { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* ---------- Empty / login ---------- */
.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 36px 18px; text-align: center; color: var(--faint); }
.empty .empty-ico { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); margin-bottom: 4px; }
.empty .empty-ico.ok { background: var(--success-bg); color: var(--success); }
.empty-title { color: var(--ink); font-weight: 620; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login { width: 100%; max-width: 380px; padding: 30px 28px 28px; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.login h1 { font-size: 20px; }
.login .lead { color: var(--muted); margin-top: 4px; font-size: 13.5px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.field label { font-weight: 560; font-size: 13px; }
.field input, textarea.input, select.input { height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px;
  font: 14px var(--font); background: var(--surface); color: var(--ink); }
textarea.input { height: 76px; padding: 9px 12px; width: 100%; resize: vertical; }
.field input:focus, textarea.input:focus { outline: 2px solid var(--accent-line); border-color: var(--accent); }
.login .btn { width: 100%; margin-top: 22px; }
.login .error { margin: 16px 0 0; }
.login-foot { text-align: center; color: var(--faint); font-size: 12px; margin-top: 16px; }

/* ---------- Dialog ---------- */
dialog { border: 0; border-radius: 14px; padding: 0; box-shadow: var(--shadow-lg); width: min(440px, 92vw); color: var(--ink); }
dialog::backdrop { background: rgba(24, 24, 27, .4); }
.dlg { padding: 20px; }
.dlg h3 { font-size: 16px; }
.dlg p { color: var(--muted); margin: 6px 0 14px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .grid-main { grid-template-columns: 1fr; }
  .main { padding: 24px 28px; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; background: var(--bg); }
  .sidebar { position: sticky; z-index: 5; height: auto; flex-direction: row; align-items: center; gap: 8px; padding: 10px 12px;
    border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .brand-text, .nav-label, .sidebar-foot { display: none; }
  .brand { padding: 0 4px 0 0; }
  .nav { flex-direction: row; gap: 2px; }
  .nav a { height: 32px; padding: 0 9px; font-size: 13px; white-space: nowrap; }
  .main { padding: 18px 16px; overflow-x: hidden; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line-2); }
  .stat-value { font-size: 26px; }
  .approve { flex-direction: column; align-items: stretch; }
  .head-actions { flex-wrap: wrap; justify-content: flex-start; }
  .order-title h1 { font-size: 22px; }
  .table { display: block; overflow-x: auto; }
  .list-item { padding: 12px 14px; gap: 10px; }
  .list-item > .icon, .list-item .ico-box { display: none; }
  .stepper { grid-template-columns: repeat(3, 1fr); row-gap: 16px; }
  .stepper .step:nth-child(4)::before { display: none; }
  .grid-2, .grid-3, .policy { grid-template-columns: 1fr; }
  .search, .search input { width: 100%; }
  .page-head, .order-head { flex-direction: column; align-items: stretch; }
  .item-top { flex-direction: column; gap: 10px; }
  .item-right { align-items: flex-start; text-align: left; flex-direction: row; gap: 8px; align-items: center; }
  .route { flex-direction: column; gap: 0; }
  .hop { border-top: 0; border-left: 3px solid var(--line); padding: 6px 0 6px 12px; display: grid; grid-template-columns: 1fr auto; column-gap: 10px; }
  .hop .hop-out { grid-column: 1 / -1; }
  .hop.no_stock .hop-out, .hop.not_reached .hop-out, .hop.not_enough .hop-out { display: none; }
  .hop-stock { text-align: right; }
  .hop.taken { border-left-color: var(--accent); }
  .hop.safety { border-left-color: var(--warning-solid); }
  .hop.unknown { border-left-style: dashed; }
  .rule-route .hop:first-child { border-left-color: var(--accent); }
  .out-body { padding: 0 14px 14px; }
  .log-row { grid-template-columns: 48px 24px minmax(0, 1fr); }
  .log-row .ord { grid-column: 3; grid-row: 1; }
  .log-row .msg { grid-column: 3; }
  .log-row .actor { display: none; }
  .bars, .bar-labels { gap: 6px; }
  .toolbar { padding: 0 14px; }
  .tabs { gap: 14px; overflow-x: auto; flex-wrap: nowrap; }
  .tab { white-space: nowrap; }
}
