@font-face { font-family: "Ubuntu"; font-weight: 400; font-display: swap; src: url("../fonts/ubuntu-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Ubuntu"; font-weight: 500; font-display: swap; src: url("../fonts/ubuntu-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Ubuntu"; font-weight: 700; font-display: swap; src: url("../fonts/ubuntu-latin-700-normal.woff2") format("woff2"); }

:root {
  --bg: #f3f4f6; --card: #ffffff; --ink: #1f2933; --muted: #5f6b7a; --faint: #8a94a3; --line: #e2e6ea;
  --accent: #2f6b86; --accent-soft: #e8f1f5;
  --ok: #2f7a55; --ok-soft: #e7f4ed; --warn: #a86b12; --warn-soft: #fbf1e1; --bad: #b83232; --bad-soft: #fbeaea;
  --info: #3d5f9e; --info-soft: #ebf0f8;
  --radius: 10px; --side: 232px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Ubuntu", "Segoe UI", system-ui, sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 500; margin: 0; }
h2 { font-size: 16px; font-weight: 500; margin: 0 0 12px; }
h3 { font-size: 14px; font-weight: 500; margin: 16px 0 8px; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
code, .mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }

/* layout */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { background: #fff; border-right: 1px solid var(--line); padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { font-weight: 700; font-size: 15px; letter-spacing: .2px; padding: 0 10px 18px; }
.brand small { display: block; font-weight: 400; color: var(--faint); font-size: 12px; }
.nav a { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: 8px; color: var(--ink); margin-bottom: 2px; }
.nav a:hover { background: var(--bg); text-decoration: none; }
.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.nav .sec { color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; margin: 16px 10px 6px; }
.count { background: var(--warn); color: #fff; border-radius: 10px; font-size: 11px; padding: 0 7px; line-height: 18px; }
.side-foot { margin-top: auto; padding: 10px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }
.side-foot form { display: inline; }
.main { padding: 24px 32px 48px; max-width: 1360px; width: 100%; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.head p { margin: 4px 0 0; color: var(--muted); }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.card.accent { border-left: 4px solid var(--accent); }
.card.ok { border-left: 4px solid var(--ok); } .card.warn { border-left: 4px solid var(--warn); } .card.bad { border-left: 4px solid var(--bad); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .app { grid-template-columns: 1fr; } .side { position: static; height: auto; } .g2, .g3, .g4 { grid-template-columns: 1fr; } .main { padding: 16px; } }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; border-top: 3px solid var(--accent); }
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 22px; font-weight: 500; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat.ok { border-top-color: var(--ok); } .stat.warn { border-top-color: var(--warn); } .stat.bad { border-top-color: var(--bad); }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12px; }

/* tables */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-weight: 500; color: var(--muted); font-size: 12px; background: #fafbfc; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafbfc; }
td.wrap { max-width: 520px; }

/* badges, flashes */
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 500; background: var(--bg); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); } .badge.info { background: var(--info-soft); color: var(--info); }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; border: 1px solid transparent; }
.flash.success { background: var(--ok-soft); color: var(--ok); } .flash.error { background: var(--bad-soft); color: var(--bad); }
.flash.warning { background: var(--warn-soft); color: var(--warn); } .flash.info { background: var(--info-soft); color: var(--info); }

/* forms */
label { display: block; font-weight: 500; margin: 12px 0 4px; font-size: 13px; }
input[type=text], input[type=password], input[type=date], input[type=file], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #cfd5dc; border-radius: 8px; font: inherit; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { min-height: 80px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; } .row > * { flex: 1; min-width: 160px; }
.btn { display: inline-block; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: #fff; font: inherit; font-weight: 500; cursor: pointer; }
.btn:hover { filter: brightness(.95); text-decoration: none; }
.btn.ghost { background: #fff; color: var(--accent); } .btn.ok { background: var(--ok); border-color: var(--ok); } .btn.bad { background: var(--bad); border-color: var(--bad); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.linkbtn { background: none; border: none; color: var(--accent); font: inherit; cursor: pointer; padding: 0; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.filters select, .filters input { width: auto; min-width: 140px; }
.chips a { margin-right: 6px; }

/* pager */
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; color: var(--muted); font-size: 12px; flex-wrap: wrap; gap: 8px; }
.pager .pages a, .pager .pages span { display: inline-block; min-width: 30px; text-align: center; padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; margin-left: 4px; background: #fff; }
.pager .pages span.cur { background: var(--accent); color: #fff; border-color: var(--accent); }

/* misc */
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 6px 16px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; min-width: 0; }
.diff-add { background: var(--ok-soft); } .diff-del { background: var(--bad-soft); }
.chg { font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.login { max-width: 380px; margin: 12vh auto; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- insight pages ---------- */
.ins-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.ins-head h1 { display: flex; align-items: center; gap: 10px; }
.ins-head p { margin: 4px 0 0; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs a { padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.fbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; background: #fff; border: 1px solid var(--line);
        border-radius: var(--radius); padding: 10px 14px 12px; margin-bottom: 10px; }
.fbar .fgroup { display: flex; flex-direction: column; min-width: 0; }
.fbar label { margin: 0 0 3px; font-size: 11px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .4px; }
.fbar select, .fbar input { width: auto; max-width: 220px; padding: 6px 8px; font-size: 13px; }
.fbar select.set { border-color: var(--accent); background: var(--accent-soft); }
.fbar .actions { flex-direction: row; align-items: center; gap: 10px; }
.covline { display: flex; gap: 6px 18px; flex-wrap: wrap; color: var(--muted); margin: 0 2px 16px; }
.covline strong { color: var(--ink); font-weight: 500; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .kpis { grid-template-columns: 1fr; } }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi .label { color: var(--muted); font-size: 12px; }
.kpi .info { color: var(--faint); font-size: 11px; cursor: help; }
.kpi .value { font-size: 22px; font-weight: 500; margin: 2px 0; font-variant-numeric: tabular-nums; letter-spacing: -.2px; }
.kpi .foot { font-size: 12px; min-height: 18px; }
.delta { font-weight: 500; } .delta.good { color: var(--ok); } .delta.bad { color: var(--bad); }
.up { color: var(--ok); } .down { color: var(--bad); }
.ins-card { padding: 16px 18px; min-width: 0; }
/* a table with many columns takes the whole row, so it is never squeezed under its card edge */
.grid > .ins-card.wide { grid-column: 1 / -1; }
.table-wrap { max-width: 100%; }
td .btn.sm, td a.btn { white-space: nowrap; }
.card-title { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.card-title h2 { margin: 0; }
.table-wrap.scroll { max-height: 520px; overflow: auto; }
.table-wrap.scroll thead th { position: sticky; top: 0; z-index: 1; }
table.ins td, table.ins th { padding: 6px 10px; }
table.ins td { font-size: 13px; }
table.sortable th[data-dir="asc"]::after { content: " ▲"; font-size: 9px; }
table.sortable th[data-dir="desc"]::after { content: " ▼"; font-size: 9px; }
.sharebar { display: inline-block; width: 48px; height: 6px; background: #eef1f4; border-radius: 3px; margin-right: 6px; vertical-align: middle; overflow: hidden; }
.sharebar i { display: block; height: 100%; background: #2a78d6; border-radius: 3px; }
.obs ul { margin: 0; padding: 0; list-style: none; }
.obs li { padding: 8px 10px 8px 14px; border-left: 3px solid var(--info); background: #fafbfc; border-radius: 0 6px 6px 0; margin-bottom: 8px; }
.obs li.good { border-left-color: var(--ok); } .obs li.warn { border-left-color: var(--warn); } .obs li.bad { border-left-color: var(--bad); }
.note-card { background: var(--warn-soft); border-color: #f0dcb8; color: #6b4a12; padding: 10px 14px; }
.chart { width: 100%; }
body.loading .main > *:not(.ins-head):not(.tabs):not(.fbar) { opacity: .55; transition: opacity .15s; }
.g2-wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .g2-wide { grid-template-columns: 1fr; } }
.fbar [hidden] { display: none; }

.app > * { min-width: 0; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-decide { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-decide input[type=text] { width: 180px; padding: 4px 8px; font-size: 12px; }
.commit-box { border: 1px solid var(--line); border-radius: 8px; padding: 4px 14px 10px; margin-top: 14px; }
.commit-box legend { font-weight: 500; font-size: 13px; padding: 0 6px; }
.report table.ins td, .report table.ins th { font-size: 13px; }
@page { size: A4 landscape; margin: 8mm; }          /* default for wide tables; narrow reports set their own */
@media print {
  .sb, .tb, .toast, .flash.info, .side, .tabs, .fbar, .no-print, .ins-head .btn, .covline { display: none !important; }
  .app { display: block; } .main { padding: 0; max-width: none; } body { background: #fff; }
  .card { break-inside: avoid; border-color: #ccc; } .table-wrap.scroll { max-height: none; overflow: visible; }
}
table.ins td { white-space: nowrap; }
table.ins td.wrap { white-space: normal; }
/* wide tables: tighter cells so the last column (e.g. the Follow-up button) is never pushed out of the card */
.ins-card.wide table.ins td, .ins-card.wide table.ins th { padding: 6px 6px; }

/* ---------- sign-in screen ---------- */

/* ---------- sign-in: dispatch chart (left) and form (right) ---------- */
.lgx { height: 100vh; height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(360px, 1fr); background: #fff; }
.lgx-chart { position: relative; display: flex; flex-direction: column; padding: 34px 44px 28px; color: #0d2b2e;
  background-color: #eaf1ef;
  background-image: linear-gradient(#d9e5e2 1px, transparent 1px), linear-gradient(90deg, #d9e5e2 1px, transparent 1px);
  background-size: 40px 40px; background-position: -1px -1px; border-right: 1px solid #cfdcd8; overflow: hidden; min-height: 0; }
.lgx-brand { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.lgx-logo { display: inline-flex; width: 40px; height: 40px; border-radius: 9px; background: #0d2b2e; color: #fff; font-weight: 700; letter-spacing: 1px; align-items: center; justify-content: center; font-size: 14px; }
.lgx-copy { margin-top: clamp(16px, 5vh, 44px); max-width: 30em; }
.lgx-copy h2 { font-size: clamp(28px, 3.4vw, 42px); font-weight: 500; line-height: 1.12; letter-spacing: -.012em; margin: 0 0 14px; max-width: 14em; }
.lgx-copy p { margin: 0; font-size: 15px; line-height: 1.55; color: #3d5a5c; max-width: 27em; }
.lgx-mapwrap { position: relative; flex: 1 1 0; min-height: 0; margin-top: 8px; }
.lgx-map { position: absolute; inset: 0; width: 100%; height: 100%; }
.lgx-map .r { stroke-width: 4; } .lgx-map .r1 { stroke: #0d2b2e; stroke-width: 6; } .lgx-map .r2 { stroke: #0f5c63; stroke-width: 5; }
.lgx-map .r3 { stroke: #5f9a9a; } .lgx-map .r4 { stroke: #9bbfbd; }
.lgx-map .stops circle { fill: #fff; stroke: #0d2b2e; stroke-width: 3; }
.lgx-map .depot circle:first-child { fill: #fff; stroke: #0d2b2e; stroke-width: 6; } .lgx-map .depot circle:last-child { fill: #0d2b2e; }
.lgx-map .van { fill: #e8a317; stroke: #fff; stroke-width: 3; }
.lgx-key { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 0; margin: 6px 0 0; font-size: 12.5px; color: #3d5a5c; }
.lgx-key li { display: flex; align-items: center; gap: 8px; } .lgx-key i { display: inline-block; }
.k-depot { width: 14px; height: 14px; border-radius: 50%; border: 4px solid #0d2b2e; background: #fff; }
.k-route { width: 22px; height: 5px; border-radius: 3px; background: #0f5c63; }
.k-stop { width: 11px; height: 11px; border-radius: 50%; border: 2.5px solid #0d2b2e; background: #fff; }
.k-van { width: 13px; height: 13px; border-radius: 50%; background: #e8a317; }
.lgx-form { display: flex; align-items: center; justify-content: center; padding: 32px 28px; background: #fff; overflow-y: auto; min-height: 0; }
.lgx-card { width: 100%; max-width: 360px; }
.lgx-card h1 { font-size: 28px; font-weight: 500; letter-spacing: -.01em; margin: 0 0 2px; }
.lgx-co { margin: 0 0 20px; font-size: 13px; color: var(--muted); }
.lgx-card label { display: block; font-size: 13px; font-weight: 500; margin: 14px 0 5px; }
.lgx-card input[type=text], .lgx-card input[type=password] { width: 100%; padding: 11px 12px; font-size: 15px; border: 1px solid #b9c8c5; border-radius: 8px; background: #fff; }
.lgx-card input:focus-visible, .lgx-eye:focus-visible, .lgx-card .btn:focus-visible { outline: 3px solid #9fd0d3; outline-offset: 1px; border-color: #0f5c63; }
.lgx-card .flash { margin: 6px 0 0; }
.lg-btn { width: 100%; padding: 11px 16px; margin-top: 8px; font-size: 15px; background: #0d2b2e; border-color: #0d2b2e; color: #fff; border-radius: 8px; }
.lg-btn:hover { background: #0f5c63; border-color: #0f5c63; }
.lg-pw { position: relative; } .lg-pw input { padding-right: 64px !important; }
.lg-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: #0f5c63; font: inherit; font-size: 12.5px; cursor: pointer; padding: 4px 8px; }
.lg-caps { color: var(--warn); font-size: 12px; margin-top: 4px; }
.lg-foot { font-size: 12px; color: var(--muted); margin: 18px 0 0; }
@media (max-width: 860px) {
  .lgx { height: auto; min-height: 100vh; grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .lgx-chart { padding: 18px 20px; border-right: 0; border-bottom: 1px solid #cfdcd8; }
  .lgx-copy, .lgx-mapwrap, .lgx-key { display: none; }
  .lgx-form { align-items: flex-start; padding: 28px 20px 40px; }
}
