/* Gate Watch additions on top of style.css + dashboard.css */
:root {
  /* material colours: chart-only, kept apart from status pills */
  --m-sand: #D4A65A; --m-soil: #8B5E3C; --m-crushed_stone: #9CA3AF; --m-stones: #6B7280; --m-bricks: #C2410C;
  --m-cement_bags: #A8A29E; --m-iron_rods: #475569; --m-coal: #1F2937; --m-covered: #3B82F6; --m-empty: #E5E7EB;
  --m-other: #A78BFA; --m-cant_see: #CBD5E1;
  --box-truck: #FACC15; --box-load: #2DD4BF; --box-plate: #F472B6;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --m-coal: #0B0F14; --m-empty: #374151; --m-cant_see: #475569; } }
:root[data-theme="dark"] { --m-coal: #0B0F14; --m-empty: #374151; --m-cant_see: #475569; }

.kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* gate log rows */
.grow { display: grid; grid-template-columns: 132px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line); cursor: pointer; }
.grow:hover { background: var(--bg); }
.grow.new { animation: flash 2.4s ease-out; }
.grow.done { opacity: .62; }
.pthumb { width: 132px; height: 52px; border-radius: 8px; overflow: hidden; background: var(--bg); border: 1px solid var(--line); }
.pthumb img { width: 100%; height: 100%; object-fit: cover; }
.plate { font-family: var(--mono); font-weight: 700; font-size: 17px; letter-spacing: .04em; display: inline-flex; align-items: center; gap: 8px; }
.plate.big { font-size: 26px; }
.plate .q { color: var(--muted); font-weight: 600; }
.grow .meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.grow .why { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.dir { font-size: 11px; font-weight: 800; letter-spacing: .06em; border-radius: 6px; padding: 1px 6px; border: 1px solid var(--line-2); color: var(--ink-2); }
.dir.out { border-color: var(--ink-2); background: var(--ink); color: var(--card); }
.mat { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: 14px; }
.mat::before { content: ""; width: 12px; height: 12px; border-radius: 4px; background: var(--c, var(--m-other)); box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.grow .right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.grow .right small { color: var(--muted); font-size: 13px; }

/* needs-you queue */
.need { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; }
.need:first-of-type { margin-top: 10px; }
.need b { font-size: 14px; }
.need span { font-size: 13px; color: var(--muted); grid-column: 1 / -1; }
.need .pill { align-self: start; }
.allclear { padding: 14px 0 4px; color: var(--muted); font-size: 14px; }

/* snapshot with boxes */
.snap { position: relative; border-radius: 12px; overflow: hidden; background: #000; }
.snap img { width: 100%; height: auto; }
.snap .bx { position: absolute; border: 2.5px solid var(--bc); border-radius: 4px; pointer-events: none; }
.snap .bx em { position: absolute; left: -2.5px; bottom: 100%; background: var(--bc); color: #111; font: 700 12px/1.5 "Figtree", sans-serif; font-style: normal; padding: 0 6px; border-radius: 4px 4px 4px 0; white-space: nowrap; }
.snap .bx.below em { bottom: auto; top: 100%; border-radius: 0 4px 4px 4px; }
.snap .bx.truck { --bc: var(--box-truck); } .snap .bx.truck em { bottom: auto; top: 100%; border-radius: 0 4px 4px 4px; } .snap .bx.load { --bc: var(--box-load); } .snap .bx.plate { --bc: var(--box-plate); }
.snap .stamp { position: absolute; left: 10px; top: 10px; background: rgba(0,0,0,.62); color: #fff; font: 600 12px/1.4 var(--mono); padding: 4px 8px; border-radius: 6px; }
.snap .verdict { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.snap .verdict span { background: rgba(0,0,0,.66); color: #fff; font-size: 13px; font-weight: 700; padding: 5px 10px; border-radius: 8px; }
.snap .verdict span.bad { background: #B42318; } .snap .verdict span.warn { background: #B45309; } .snap .verdict span.ok { background: #15803D; }

/* drawer bits */
.pbig { display: grid; grid-template-columns: 160px 1fr; gap: 14px; align-items: center; }
.pbig img { width: 160px; border-radius: 8px; border: 1px solid var(--line); }
.reads { font-size: 13px; color: var(--muted); margin-top: 4px; }
.reads code { font-family: var(--mono); color: var(--ink-2); }
.fix { display: flex; gap: 8px; margin-top: 12px; }
.fix input { flex: 1; min-height: 44px; border: 1px solid var(--line-2); border-radius: 10px; padding: 0 12px; font: 700 16px var(--mono); letter-spacing: .04em; text-transform: uppercase; background: var(--card); color: var(--ink); }
.prob { display: grid; grid-template-columns: 120px 1fr 44px; gap: 10px; align-items: center; font-size: 14px; margin: 6px 0; }
.prob i { display: block; height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; }
.prob i b { display: block; height: 100%; background: var(--c, var(--accent)); border-radius: 4px; }
.prob span:last-child { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.kv3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kv3 div { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.kv3 small { display: block; color: var(--muted); font-size: 12px; }
.kv3 b { font-size: 15px; }
.passc { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 4px; font-size: 14px; }
.passc .h { display: flex; justify-content: space-between; gap: 8px; }
.flagl { display: flex; flex-direction: column; gap: 8px; }
.flagl .f { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; }
.flagl .f.bad { background: var(--bad-soft); color: var(--bad); } .flagl .f.warn { background: var(--warn-soft); color: var(--warn); }
.flagl .f.ok { background: var(--ok-soft); color: var(--ok); }

/* gate camera view */
.gate-live { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; margin-top: 8px; }
.cam-card { padding: 14px; }
.cam-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.live-badge { font-size: 11px; font-weight: 800; color: #fff; background: #DC2626; border-radius: 5px; padding: 1px 7px; letter-spacing: .06em; }
.strip { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 10px; }
.strip button { border: 2px solid transparent; padding: 0; border-radius: 8px; overflow: hidden; cursor: pointer; background: none; position: relative; min-height: 44px; }
.strip button.on { border-color: var(--accent); }
.strip img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.strip small { position: absolute; left: 4px; bottom: 4px; background: rgba(0,0,0,.65); color: #fff; font: 600 11px var(--mono); padding: 1px 5px; border-radius: 4px; }

/* vehicles table */
table.vt { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.vt th { text-align: left; color: var(--muted); font-size: 12px; font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line); }
table.vt td { padding: 12px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
table.vt tr:hover td { background: var(--bg); cursor: pointer; }
table.vt .plate { font-size: 15px; }

/* rules */
.rule { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 16px 20px; border-top: 1px solid var(--line); align-items: center; }
.rule:first-child { border-top: 0; }
.rule b { font-size: 15px; }
.rule p { margin: 0; font-size: 13px; color: var(--muted); grid-column: 1; }
.rule .cnt { grid-column: 1; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.sw { position: relative; width: 48px; height: 28px; grid-row: 1 / span 3; grid-column: 2; }
.sw input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.sw i { position: absolute; inset: 0; background: var(--line-2); border-radius: 14px; transition: background .18s ease-out; }
.sw i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .18s ease-out; }
.sw input:checked + i { background: var(--accent); }
.sw input:checked + i::after { transform: translateX(20px); }
.sw input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.note { margin: 14px 2px; }

/* accuracy */
.note-card { margin-bottom: 18px; font-size: 14px; color: var(--ink-2); }
.note-card p { margin: 0 0 8px; } .note-card p:last-child { margin: 0; }
.real-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-top: 12px; }
.rcard { overflow: hidden; }
.rcard .snap { border-radius: 0; }
.rcard .body { padding: 12px 14px 14px; display: grid; gap: 6px; font-size: 14px; }
.rcard .line { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.rcard .line span { color: var(--muted); }
.rcard a { font-size: 13px; }
.res { font-weight: 700; } .res.ok { color: var(--ok); } .res.no { color: var(--bad); } .res.na { color: var(--muted); font-weight: 600; }

@media (max-width: 1100px) { .gate-live { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .grow { grid-template-columns: 96px minmax(0, 1fr); gap: 12px; padding: 12px 16px; }
  .pthumb { width: 96px; height: 40px; }
  .grow .right { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; }
  .plate { font-size: 16px; } .plate.big { font-size: 22px; }
  .strip { grid-template-columns: repeat(3, 1fr); }
  .pbig { grid-template-columns: 1fr; } .pbig img { width: 100%; max-width: 260px; }
  .kv3 { grid-template-columns: 1fr 1fr; }
  table.vt thead { display: none; }
  table.vt, table.vt tbody, table.vt tr, table.vt td { display: block; width: 100%; }
  table.vt tr { padding: 10px 16px; border-top: 1px solid var(--line); }
  table.vt td { border: 0; padding: 2px 0; }
  .snap .bx em { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { .grow.new { animation: none; } .sw i, .sw i::after { transition: none; } }
html, body { overflow-x: clip; }
.drawer:not(.on) { visibility: hidden; transition: transform .22s ease-in, visibility 0s .22s; }
.main { min-width: 0; }
@media (max-width: 820px) { .bar-r .btn.sm { padding: 0 10px; } .chips { max-width: 100%; } }
.foot-pref{color:var(--muted);text-decoration:none;font-size:12px}.foot-pref:hover{color:var(--accent)}
