/* ===========================================================
   Shamba Bora Console — admin mockup
   =========================================================== */
:root {
  --bg: #f5f3ec;
  --surface: #ffffff;
  --surface-2: #faf8f2;
  --surface-3: #f1eee5;
  --border: #e7e2d4;
  --border-2: #d9d3c2;
  --text: var(--ink-900);
  --text-2: var(--ink-500);
  --text-3: var(--ink-400);
  --accent: var(--forest-700);
  --accent-strong: var(--forest-800);
  --accent-soft: var(--forest-50);
  --side-bg: var(--forest-950);
  --side-text: #dfe9e2;
  --side-muted: #8fa99a;
  --chart-1: #22774f;
  --chart-area: rgba(34, 119, 79, .12);
  --chart-cmp: #a8b3ab;
  --chart-grid: #ece8dd;
  --chart-tick: #8a978e;
  --tt-bg: #13221a;
  --tt-text: #f4f1e8;
  --shadow-card: 0 1px 2px rgba(19, 34, 26, .04), 0 1px 1px rgba(19, 34, 26, .03);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b1410;
  --surface: #111d17;
  --surface-2: #15231c;
  --surface-3: #1a2a22;
  --border: #213229;
  --border-2: #2c4136;
  --text: #e7eee9;
  --text-2: #a2b3a8;
  --text-3: #75897c;
  --accent: #6cc795;
  --accent-strong: #3b9467;
  --accent-soft: rgba(108, 199, 149, .1);
  --side-bg: #07100c;
  --chart-1: #5cbf8a;
  --chart-area: rgba(92, 191, 138, .14);
  --chart-cmp: #55685c;
  --chart-grid: #1d2c24;
  --chart-tick: #6f8477;
  --tt-bg: #e7eee9;
  --tt-text: #0b1410;
  --good: #6fd39b; --good-bg: rgba(111, 211, 155, .12);
  --warn: #f2c14e; --warn-bg: rgba(242, 193, 78, .12);
  --bad: #f2917c;  --bad-bg: rgba(242, 145, 124, .12);
  --info: #79b8e0; --info-bg: rgba(121, 184, 224, .12);
  --shadow-card: none;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1410; --surface: #111d17; --surface-2: #15231c; --surface-3: #1a2a22;
    --border: #213229; --border-2: #2c4136; --text: #e7eee9; --text-2: #a2b3a8; --text-3: #75897c;
    --accent: #6cc795; --accent-strong: #3b9467; --accent-soft: rgba(108, 199, 149, .1); --side-bg: #07100c;
    --chart-1: #5cbf8a; --chart-area: rgba(92, 191, 138, .14); --chart-cmp: #55685c; --chart-grid: #1d2c24; --chart-tick: #6f8477;
    --tt-bg: #e7eee9; --tt-text: #0b1410;
    --good: #6fd39b; --good-bg: rgba(111, 211, 155, .12); --warn: #f2c14e; --warn-bg: rgba(242, 193, 78, .12);
    --bad: #f2917c; --bad-bg: rgba(242, 145, 124, .12); --info: #79b8e0; --info-bg: rgba(121, 184, 224, .12);
    --shadow-card: none; color-scheme: dark;
  }
}
/* Mini-app tints in dark mode: derive from each app's ink colour */
:root[data-theme="dark"] .app-icon { background: color-mix(in srgb, var(--a-fg) 26%, transparent); color: color-mix(in srgb, var(--a-fg) 45%, #fff); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .app-icon { background: color-mix(in srgb, var(--a-fg) 26%, transparent); color: color-mix(in srgb, var(--a-fg) 45%, #fff); } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font-sans); font-size: 14px; line-height: 1.5;
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
h1, h2, h3, h4, p { margin: 0; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; font-weight: 600; color: var(--text); letter-spacing: .01em; }
[data-lucide], svg.lucide { width: 18px; height: 18px; stroke-width: 1.9; flex: none; }
.muted { color: var(--text-2); }

/* ---------- App icons (sizes) ---------- */
.app-icon.lg { width: 48px; height: 48px; border-radius: 14px; }
.app-icon.lg svg { width: 22px; height: 22px; }
.app-icon.sm { width: 34px; height: 34px; border-radius: 10px; }
.app-icon.sm svg { width: 17px; height: 17px; }
.app-icon.xs { width: 28px; height: 28px; border-radius: 8px; }
.app-icon.xs svg { width: 14px; height: 14px; }
.app-icon.xxs { width: 22px; height: 22px; border-radius: 6px; }
.app-icon.xxs svg { width: 12px; height: 12px; stroke-width: 2.2; }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 14px;
  padding: 18px 14px; background: var(--side-bg); color: var(--side-text); overflow-y: auto; scrollbar-width: thin; scrollbar-color: #1f3a2c transparent;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.side-brand img { border-radius: 10px; box-shadow: 0 0 0 1px rgba(255,255,255,.1); }
.side-brand span { font-size: 17px; font-weight: 600; line-height: 1.1; }
.side-brand b { font-weight: 800; margin-left: 2px; }
.side-brand small { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--sun); margin-top: 2px; }
.org { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 12px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.07); text-align: left; color: inherit; }
.org:hover { background: rgba(255,255,255,.08); }
.org-av { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--sun); color: var(--forest-950); font-weight: 800; font-size: 11px; }
.org-txt { flex: 1; display: grid; line-height: 1.25; }
.org-txt b { font-size: 13px; }
.org-txt small { font-size: 11.5px; color: var(--side-muted); }
.org [data-lucide] { width: 15px; height: 15px; color: var(--side-muted); }
.side-nav { flex: 1; display: grid; align-content: start; gap: 2px; }
.nav-g { padding: 16px 10px 6px; font-size: 10.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--side-muted); opacity: .8; }
.nav-i { display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 10px; border-radius: 10px; font-size: 13.5px; font-weight: 600; color: #c4d4ca; transition: background .15s, color .15s; }
.nav-i:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-i > span:nth-child(2) { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-i [data-lucide], .nav-i svg { width: 17px; height: 17px; }
.nav-i.on { background: rgba(242, 193, 78, .12); color: #fff; box-shadow: inset 2px 0 0 var(--sun); }
.nav-i.on > svg { color: var(--sun); }
.nav-i em { font-style: normal; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: rgba(255,255,255,.08); color: #c4d4ca; }
.nav-app { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--a-bg); color: var(--a-fg); flex: none; }
.nav-app svg { width: 12px !important; height: 12px !important; stroke-width: 2.2; }
.live { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #4cc77f; box-shadow: 0 0 0 0 rgba(76,199,127,.6); animation: pulse 2s infinite; flex: none; vertical-align: middle; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(76,199,127,0); } 100% { box-shadow: 0 0 0 0 rgba(76,199,127,0); } }
.side-foot { display: grid; gap: 10px; }
.side-help { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 12px; background: rgba(242,193,78,.08); border: 1px solid rgba(242,193,78,.15); }
.side-help > svg { color: var(--sun); }
.side-help div { display: grid; line-height: 1.3; }
.side-help b { font-size: 13px; }
.side-help small { font-size: 11.5px; color: var(--side-muted); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 8px 4px 2px; border-top: 1px solid rgba(255,255,255,.07); }
.side-user > div { flex: 1; display: grid; line-height: 1.3; }
.side-user b { font-size: 13px; }
.side-user small { font-size: 11.5px; color: var(--side-muted); }
.side-user .icon-btn { color: var(--side-muted); }
.side-user .icon-btn:hover { background: rgba(255,255,255,.06); color: #fff; }

.av { display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%; background: hsl(var(--h) 50% 84%); color: hsl(var(--h) 45% 22%); font-size: 11.5px; font-weight: 800; letter-spacing: .02em; }
:root[data-theme="dark"] .av { background: hsl(var(--h) 30% 26%); color: hsl(var(--h) 60% 86%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .av { background: hsl(var(--h) 30% 26%); color: hsl(var(--h) 60% 86%); } }
.side .av { background: hsl(var(--h) 40% 30%); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
  height: 64px; padding: 0 28px; background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border);
}
.burger { display: none; }
.search { position: relative; flex: 1; max-width: 520px; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); color: var(--text-3); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 14px; }
.search input::placeholder { color: var(--text-3); }
kbd { font: 600 11px var(--font-sans); padding: 2px 7px; border-radius: 6px; border: 1px solid var(--border-2); color: var(--text-3); white-space: nowrap; }
.search-pop { position: absolute; top: 46px; left: 0; right: 0; display: none; padding: 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 20px 50px -20px rgba(0,0,0,.35); color: var(--text); max-height: 420px; overflow: auto; }
.search-pop.on { display: block; }
.search-pop p { padding: 8px 10px 4px; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.search-pop p.none { text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 500; padding: 14px 10px; }
.search-pop a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; font-weight: 600; font-size: 13.5px; }
.search-pop a:hover { background: var(--surface-3); }
.search-pop a small { margin-left: auto; color: var(--text-3); font-weight: 500; font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.env { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px; margin-right: 6px; border-radius: 999px; border: 1px solid var(--border); font-size: 12px; font-weight: 700; color: var(--text-2); }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; color: var(--text-2); transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.has-dot::after { content: ""; position: absolute; top: 9px; right: 10px; width: 7px; height: 7px; border-radius: 50%; background: #e0583d; box-shadow: 0 0 0 2px var(--bg); }
.av-top { margin-left: 6px; width: 34px; height: 34px; }

.view { padding: 28px 28px 64px; outline: 0; display: grid; gap: 20px; align-content: start; max-width: 1480px; width: 100%; }

/* ---------- Page head ---------- */
.ph { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; padding-bottom: 4px; }
.ph-l { display: flex; align-items: center; gap: 14px; }
.ph h1 { font-family: var(--font-serif); font-weight: 500; font-size: 30px; letter-spacing: -.02em; line-height: 1.15; font-variation-settings: "opsz" 144; }
.ph p { color: var(--text-2); font-size: 14px; margin-top: 2px; display: flex; align-items: center; gap: 8px; }
.ph-r { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 10px; font-weight: 700; font-size: 13.5px; white-space: nowrap; transition: background .15s, border-color .15s, transform .15s; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn [data-lucide], .btn svg { width: 16px; height: 16px; }
.btn-ghost { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--border-2); background: var(--surface-2); }
.btn-primary { background: var(--forest-800); color: #fff; border: 1px solid var(--forest-800); }
.btn-primary:hover { background: var(--forest-700); }
:root[data-theme="dark"] .btn-primary { background: var(--sun); color: var(--forest-950); border-color: var(--sun); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary { background: var(--sun); color: var(--forest-950); border-color: var(--sun); } }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn:not(:has(span)) { padding: 0; width: 38px; }
.btn-sm:not(:has(span)) { width: 30px; }
.link-btn { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; color: var(--accent); white-space: nowrap; }
.link-btn svg { width: 15px; height: 15px; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }

.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--border); }
.seg button { height: 30px; padding: 0 12px; border-radius: 8px; font-size: 13px; font-weight: 700; color: var(--text-2); }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ---------- Grid & cards ---------- */
.grid { display: grid; gap: 16px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 20px; box-shadow: var(--shadow-card); min-width: 0; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush > .card-h { padding: 18px 20px 14px; margin: 0; }
.card-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-h h3 { font-size: 15.5px; font-weight: 800; letter-spacing: -.01em; }
.card-h p { font-size: 12.5px; color: var(--text-2); margin-top: 2px; display: flex; align-items: center; gap: 7px; }
.hint { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); }
.hint svg { width: 14px; height: 14px; }
.foot-note { margin-top: 14px; font-size: 12px; color: var(--text-3); }

/* KPI */
.kpi { display: grid; gap: 8px; padding: 18px 18px 16px; }
.kpi-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.kpi-ic { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.kpi-ic svg { width: 16px; height: 16px; }
.kpi-v { font-size: 26px; font-weight: 800; letter-spacing: -.025em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--text-3); }
.kpi-alert { border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); background: linear-gradient(180deg, var(--bad-bg), var(--surface) 70%); }
.delta { display: inline-flex; align-items: center; gap: 2px; padding: 1px 7px 1px 4px; border-radius: 999px; font-weight: 800; font-size: 12px; }
.delta svg { width: 14px; height: 14px; stroke-width: 2.4; }
.delta.up { background: var(--good-bg); color: var(--good); }
.delta.dn { background: var(--bad-bg); color: var(--bad); }

/* Badges (status: colour + dot + label, never colour alone) */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-good { background: var(--good-bg); color: var(--good); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-bad { background: var(--bad-bg); color: var(--bad); }
.b-info { background: var(--info-bg); color: var(--info); }
.b-neutral { background: var(--surface-3); color: var(--text-2); }
.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 7px; background: var(--surface-3); border: 1px solid var(--border); font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; }

/* ---------- Charts ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; overflow: visible; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin: -4px 0 10px; font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.sw { display: inline-block; width: 14px; height: 3px; border-radius: 2px; background: var(--chart-1); flex: none; }
.sw.s-cmp { background: repeating-linear-gradient(90deg, var(--chart-cmp) 0 4px, transparent 4px 6px); }
.c-grid { stroke: var(--chart-grid); stroke-width: 1; }
.c-tick { fill: var(--chart-tick); font-size: 11px; font-family: var(--font-sans); font-variant-numeric: tabular-nums; }
.c-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.c-line.s1 { stroke: var(--chart-1); }
.c-line.s-cmp { stroke: var(--chart-cmp); stroke-dasharray: 4 4; }
.c-area.s1 { fill: var(--chart-area); }
.c-end { fill: var(--chart-1); stroke: var(--surface); stroke-width: 2; }
.c-cross { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 3 3; }
.c-dot { stroke: var(--surface); stroke-width: 2; }
.c-dot.s1 { fill: var(--chart-1); }
.c-dot.s-cmp { fill: var(--chart-cmp); }
.c-hit, .c-hitbar { cursor: crosshair; }
.c-bar { fill: var(--chart-1); opacity: .78; transition: opacity .15s; }
.c-bar.is-last { opacity: 1; }
.c-bar.dim { opacity: .3; }
.tbl-toggle { margin-top: 10px; color: var(--text-3); font-size: 12px; }
.chart-table { margin-top: 10px; max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: 12px; }

.tt {
  position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; min-width: 160px;
  padding: 10px 12px; border-radius: 12px; background: var(--tt-bg); color: var(--tt-text);
  font-size: 12.5px; box-shadow: 0 14px 34px -10px rgba(0,0,0,.4); opacity: 0; transition: opacity .12s;
}
.tt.on { opacity: 1; }
.tt b { display: block; margin-bottom: 4px; font-size: 12px; opacity: .8; }
.tt-row { display: flex; align-items: center; gap: 8px; }
.tt-row em { margin-left: auto; padding-left: 14px; font-style: normal; font-weight: 800; font-variant-numeric: tabular-nums; }

/* HTML bar lists */
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 11px; }
.hbars li { display: grid; grid-template-columns: auto minmax(0, 1.2fr) minmax(0, 1fr) 44px; align-items: center; gap: 10px; cursor: default; }
.hbars-plain li { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) 44px; }
.hb-l { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-bar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.hb-bar i { display: block; height: 100%; border-radius: 4px; background: var(--chart-1); }
.hbars li:hover .hb-bar i { filter: brightness(1.12); }
.hbars b { text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; }

/* Meters */
.meter { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 999px; background: var(--chart-1); }
.meter.m-warn i { background: var(--warn); }
.meter.m-bad i { background: var(--bad); }
.meter.m-info i { background: var(--info); }
.caps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.caps-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.caps-top span { font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.inline-meter { display: flex; align-items: center; gap: 10px; min-width: 130px; }
.inline-meter .meter { flex: 1; }
.inline-meter span { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { position: sticky; top: 0; padding: 10px 16px; text-align: left; font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.tbl .c { text-align: center; }
.tbl .act { width: 1%; text-align: right; }
.tbl .empty { text-align: center; padding: 40px; color: var(--text-3); }
.tbl-sm td, .tbl-sm th { padding: 8px 12px; font-size: 12.5px; }
.clickable { cursor: pointer; }
.row-go { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: var(--text-3); }
.clickable:hover .row-go { background: var(--accent-soft); color: var(--accent); }
.row-acts { display: flex; gap: 6px; justify-content: flex-end; }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person > div { display: grid; line-height: 1.3; min-width: 0; }
.person b { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person small { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbl .person > div { min-width: auto; }
.tbl .person b, .tbl .person small { overflow: visible; }
.stack { display: grid; line-height: 1.35; }
.stack b { font-weight: 700; }
.stack small { font-size: 12px; color: var(--text-3); }
.app-chip { display: inline-flex; align-items: center; gap: 7px; padding: 3px 9px 3px 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.app-stack { display: flex; }
.app-stack .app-icon { margin-left: -5px; box-shadow: 0 0 0 2px var(--surface); }
.app-stack .app-icon:first-child { margin-left: 0; }
.flag, .ok { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; }
.flag { color: var(--bad); }
.ok { color: var(--good); }
.flag svg, .ok svg { width: 15px; height: 15px; }
.sla { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.sla.bad { color: var(--bad); }
.sla svg { width: 14px; height: 14px; }
.tx-type { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.tx-type svg { width: 15px; height: 15px; color: var(--text-3); }
.amt-in { color: var(--good); }
.amt-out { color: var(--text); }
.matrix td:first-child { font-weight: 600; }
.yes { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: var(--good-bg); color: var(--good); }
.yes svg { width: 14px; height: 14px; stroke-width: 2.6; }
.no { color: var(--text-3); }

/* Toolbar & pager */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.input { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; min-width: 260px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-3); }
.input:focus-within { border-color: var(--accent); }
.input input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
.select { height: 38px; padding: 0 34px 0 12px; border-radius: 10px; background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23869389' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 10px center / 16px no-repeat; border: 1px solid var(--border); appearance: none; font-weight: 600; font-size: 13.5px; }
.toolbar-count { margin-left: auto; font-size: 12.5px; color: var(--text-3); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.pager div { display: flex; gap: 6px; }

/* Lists */
.lots-mini { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lots-mini li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.lots-mini li > div:first-child { display: grid; line-height: 1.35; min-width: 0; }
.lots-mini b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lots-mini small { font-size: 12px; color: var(--text-3); }
.lm-r { display: grid; justify-items: end; gap: 4px; }
.timer { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.timer.urgent { background: var(--bad-bg); color: var(--bad); }
.alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.alerts li { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.alerts li > svg { width: 34px; height: 34px; padding: 8px; border-radius: 10px; }
.alerts li > div { flex: 1; display: grid; line-height: 1.35; min-width: 0; }
.alerts b { font-size: 13px; }
.alerts small { font-size: 12px; color: var(--text-3); }
.a-bad > svg { background: var(--bad-bg); color: var(--bad); }
.a-warn > svg { background: var(--warn-bg); color: var(--warn); }
.a-info > svg { background: var(--info-bg); color: var(--info); }
.a-good > svg { background: var(--good-bg); color: var(--good); }
.sync, .roster, .recon, .rain { list-style: none; margin: 0; padding: 0; display: grid; }
.sync li, .roster li, .recon li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.sync li:last-child, .roster li:last-child, .recon li:last-child { border: 0; }
.sync li > div { display: grid; line-height: 1.35; }
.sync b { font-size: 13px; }
.sync small { font-size: 12px; color: var(--text-3); }
.ro-r { display: grid; justify-items: end; gap: 3px; }
.ro-r small { font-size: 11.5px; color: var(--text-3); }
.recon span { flex: 1; font-weight: 600; }
.recon b { font-variant-numeric: tabular-nums; font-size: 13px; }
.rain { gap: 16px; }
.rain-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 7px; }
.rain-top span { color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.rain-bar { position: relative; height: 10px; border-radius: 999px; background: var(--surface-3); }
.rain-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--info); }
.rain-bar i.near { background: var(--warn); }
.rain-bar i.trig { background: var(--bad); }
.rain-bar s { position: absolute; top: -4px; bottom: -4px; width: 2px; border-radius: 2px; background: var(--text); }
.trig-note { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--bad); }
.trig-note svg { width: 13px; height: 13px; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.steps li { display: grid; gap: 4px; min-width: 62px; font-size: 11px; font-weight: 700; color: var(--text-3); }
.steps li::before { content: ""; height: 5px; border-radius: 3px; background: var(--surface-3); }
.steps li.done::before { background: var(--chart-1); }
.steps li.done { color: var(--text-2); }
.steps li.now::before { background: linear-gradient(90deg, var(--chart-1) 50%, var(--surface-3) 50%); }
.steps li.now { color: var(--text); }

/* Warehouses */
.store { display: grid; gap: 12px; }
.store header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.store h3 { font-size: 15px; font-weight: 800; }
.store header p { font-size: 12.5px; color: var(--text-3); }
.store-cap { display: flex; align-items: baseline; gap: 10px; }
.store-cap b { font-size: 28px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.store-cap span { font-size: 12.5px; color: var(--text-3); }
.store footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.store footer small { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-3); }
.store footer small svg { width: 14px; height: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* Kanban */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(250px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 6px; }
.kcol { display: grid; gap: 10px; align-content: start; padding: 12px; border-radius: 18px; background: var(--surface-3); border: 1px solid var(--border); }
.kcol > header { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 4px; }
.kcol > header > span { font-size: 12px; font-weight: 800; color: var(--text-3); }
.kcard { display: grid; gap: 10px; padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-card); }
.kc-top { display: flex; justify-content: space-between; align-items: center; }
.plate { padding: 2px 7px; border-radius: 5px; background: var(--sun); color: #1b1b1b; font-size: 11px; font-weight: 800; letter-spacing: .04em; border: 1px solid #c89b2c; }
.kc-route { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13.5px; }
.kc-route svg { width: 14px; height: 14px; color: var(--text-3); }
.kc-route span:last-child { color: var(--accent); }
.kc-prog { display: grid; gap: 5px; }
.kc-prog small { font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.kc-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.kc-meta span { display: inline-flex; align-items: center; gap: 4px; }
.kc-meta svg { width: 13px; height: 13px; color: var(--text-3); }
.kc-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.kc-foot .av { width: 26px; height: 26px; font-size: 10px; }
.kc-foot .person b { font-size: 12.5px; }
.kc-foot .person small { font-size: 11px; }
.kc-foot > small { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--text-3); font-weight: 600; white-space: nowrap; }
.kc-foot > small svg { width: 13px; height: 13px; color: var(--good); }

/* Auctions */
.lots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.lot { display: grid; gap: 10px; transition: opacity .2s; }
.lot header { display: flex; justify-content: space-between; align-items: center; }
.lot h3 { font-size: 16px; font-weight: 800; letter-spacing: -.01em; }
.lot > p { font-size: 12.5px; color: var(--text-3); margin-top: -6px; }
.lot-bid { display: flex; justify-content: space-between; align-items: flex-end; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.lot-bid div { display: grid; line-height: 1.3; }
.lot-bid div:last-child { text-align: right; }
.lot-bid small { font-size: 11.5px; color: var(--text-3); }
.lot-bid b { font-size: 20px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.lot-bid span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.lot-foot { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--text-3); font-weight: 600; }
.lot-acts { display: flex; gap: 8px; }
.lot-acts .btn { flex: 1; }
.lot.paused { opacity: .6; }
.lot.paused .timer { background: var(--warn-bg); color: var(--warn); }

/* Tractor fleet */
.fleet-c { display: flex; align-items: center; gap: 14px; }
.fleet-c > div { display: grid; line-height: 1.2; }
.fleet-c b { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.fleet-c small { font-size: 13px; color: var(--text-2); }
.fc-ic { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; }
.fc-ic svg { width: 22px; height: 22px; }
.f-good { background: var(--good-bg); color: var(--good); }
.f-info { background: var(--info-bg); color: var(--info); }
.f-warn { background: var(--warn-bg); color: var(--warn); }

/* Mini App Manager */
.apps-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.app-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.app-card { display: grid; gap: 16px; transition: opacity .2s, filter .2s; }
.app-card.off { opacity: .62; }
.app-card.off .app-icon { filter: grayscale(1); }
.app-card header { display: flex; align-items: center; gap: 12px; }
.app-card header > div { flex: 1; min-width: 0; }
.app-card h3 { font-size: 15px; font-weight: 800; }
.app-card header p { font-size: 12.5px; color: var(--text-3); }
.app-card dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.app-card dt { font-size: 11.5px; color: var(--text-3); }
.app-card dd { margin: 0; font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; }
.ro-top { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; }
.app-card footer { display: flex; justify-content: space-between; align-items: center; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--border-2); transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s var(--ease); }
.switch input:checked + span { background: var(--forest-600); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }
.preview { position: sticky; top: 84px; }
.pv-label { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; color: var(--text-2); margin-bottom: 10px; }
.pv-label svg { width: 15px; height: 15px; }
.pv-phone { padding: 10px; border-radius: 40px; background: linear-gradient(145deg, #1f2a24, #0a100d); box-shadow: 0 30px 60px -30px rgba(0,0,0,.5); }
.pv-screen { height: 560px; border-radius: 31px; overflow: hidden; background: var(--cream-100); color: var(--ink-900); }
.pv-head { padding: 34px 16px 16px; border-radius: 0 0 24px 24px; background: var(--forest-800); color: var(--cream-50); display: grid; gap: 2px; }
.pv-head small { font-size: 9.5px; font-weight: 800; letter-spacing: .08em; opacity: .8; }
.pv-head b { font-size: 16px; font-weight: 800; }
.pv-head span { display: flex; align-items: center; gap: 7px; margin-top: 10px; height: 34px; padding: 0 12px; border-radius: 11px; background: #fff; color: var(--ink-400); font-size: 12px; }
.pv-head span svg { width: 14px; height: 14px; color: var(--ink-700); }
.pv-sec { display: flex; justify-content: space-between; padding: 14px 16px 8px; }
.pv-sec b { font-size: 13.5px; font-weight: 800; }
.pv-sec span { font-size: 11px; font-weight: 700; color: var(--forest-700); }
.pv-list { display: grid; gap: 7px; padding: 0 12px; }
.pv-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 13px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.04); animation: pvIn .3s var(--ease); }
@keyframes pvIn { from { opacity: 0; transform: translateY(-4px); } }
.pv-item > div { flex: 1; display: grid; line-height: 1.25; min-width: 0; }
.pv-item b { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-item small { font-size: 10px; color: var(--ink-500); }
.pv-item > svg { width: 20px; height: 20px; padding: 4px; border-radius: 50%; background: var(--forest-50); color: var(--forest-800); }
/* phone preview keeps light-mode app colours */
.pv-screen .app-icon { background: var(--a-bg) !important; color: var(--a-fg) !important; }

/* ---------- Drawer ---------- */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(5, 15, 10, .45); opacity: 0; pointer-events: none; transition: opacity .25s; }
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 70; width: min(460px, 100%); display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--border); box-shadow: -30px 0 60px -30px rgba(0,0,0,.35); transform: translateX(100%); transition: transform .3s var(--ease); }
.drawer.on { transform: none; }
.drawer-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.drawer-h h3 { font-size: 17px; font-weight: 800; min-width: 0; }
.drawer-h .av { width: 40px; height: 40px; font-size: 13px; }
.d-title-app { display: inline-flex; align-items: center; gap: 10px; }
.drawer-b { flex: 1; overflow-y: auto; padding: 20px; }
.drawer-f { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
.drawer-f:empty { display: none; }
.d-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.d-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.d-stats div { padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); display: grid; }
.d-stats small { font-size: 11.5px; color: var(--text-3); }
.d-stats b { font-size: 15px; font-variant-numeric: tabular-nums; }
.d-h { margin: 22px 0 10px; font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.d-dl { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0; }
.d-dl dt { font-size: 12px; color: var(--text-3); }
.d-dl dd { margin: 0; font-weight: 700; }
.d-apps { display: flex; flex-wrap: wrap; gap: 6px; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li { position: relative; display: flex; gap: 12px; padding-bottom: 16px; }
.timeline li:not(:last-child)::before { content: ""; position: absolute; left: 10px; top: 26px; bottom: 2px; width: 2px; background: var(--border); }
.timeline li > div { display: grid; line-height: 1.35; }
.timeline b { font-size: 13px; font-weight: 600; }
.timeline small { font-size: 12px; color: var(--text-3); }

/* Forms */
.form { display: grid; gap: 16px; }
.form label > span, .form legend { display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.field { width: 100%; height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); outline: 0; }
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select.field { appearance: none; background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23869389' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 10px center / 16px no-repeat; padding-right: 34px; }
.field-pre { display: flex; align-items: center; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); overflow: hidden; }
.field-pre em { font-style: normal; padding: 0 12px; font-weight: 700; color: var(--text-3); }
.field-pre .field { border: 0; background: transparent; box-shadow: none; }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form fieldset { border: 0; padding: 0; margin: 0; }
.chk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.chk { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.chk input { order: 3; margin-left: auto; accent-color: var(--forest-700); }
.chk span { margin: 0 !important; color: var(--text) !important; font-size: 12.5px !important; }
.chk-line { display: flex; align-items: center; gap: 10px; font-size: 13px; cursor: pointer; }
.chk-line input { accent-color: var(--forest-700); width: 16px; height: 16px; }
.chk-line span { margin: 0 !important; font-weight: 600 !important; color: var(--text) !important; }
.form-note { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--info-bg); color: var(--info); font-size: 12.5px; font-weight: 600; }
.form-note.warn { background: var(--warn-bg); color: var(--warn); }
.form-note svg { width: 16px; height: 16px; margin-top: 1px; }
.drop { display: grid; justify-items: center; gap: 4px; padding: 26px; border-radius: 14px; border: 1.5px dashed var(--border-2); background: var(--surface-2); text-align: center; }
.drop svg { width: 26px; height: 26px; color: var(--accent); margin-bottom: 4px; }
.drop small { font-size: 12px; color: var(--text-3); }
.sum-box { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sum-box div { padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); display: grid; }
.sum-box small { font-size: 11.5px; color: var(--text-3); }
.sum-box b { font-size: 15px; }
.range { width: 100%; accent-color: var(--forest-600); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-chk { position: relative; cursor: pointer; }
.chip-chk input { position: absolute; opacity: 0; }
.chip-chk span { display: inline-flex !important; align-items: center; height: 30px; padding: 0 12px; margin: 0 !important; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); font-size: 12.5px !important; font-weight: 600 !important; color: var(--text-2) !important; }
.chip-chk input:checked + span { background: var(--forest-800); border-color: var(--forest-800); color: #fff !important; }
.chip-chk input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }

/* Toasts */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 16px 11px 12px; border-radius: 12px; background: var(--tt-bg); color: var(--tt-text); font-weight: 600; font-size: 13.5px; box-shadow: 0 16px 40px -12px rgba(0,0,0,.45); animation: toastIn .3s var(--ease); transition: opacity .3s, transform .3s; }
.toast.out { opacity: 0; transform: translateY(8px); }
.toast svg { width: 18px; height: 18px; }
.t-good svg { color: #4cc77f; } .t-warn svg { color: var(--sun); } .t-bad svg { color: #ef7d63; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

/* ===========================================================
   Desktop-only console: always renders the full desktop layout.
   Narrow windows scroll horizontally instead of collapsing.
   =========================================================== */
html, body { min-width: 1280px; }
.burger { display: none !important; }
