/* QuietVolt admin panel. Colours follow quietvolt.in: forest green from the logo's Q, bright green from its V. */
:root {
  --bg: #f4f7f2;
  --surface: #ffffff;
  --surface-soft: #f6f9f5;
  --line: #dde8da;
  --line-soft: #e9f0e7;
  --ink: #0e2a19;
  --muted: #4d6455;
  --green: #6cd23f;          /* fills and decoration only */
  --green-text: #2c8a27;     /* readable green for text on white */
  --forest: #0f3d22;
  --forest-deep: #0a2414;
  --forest-active: #1c4a2d;
  --danger: #b42318;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(14, 42, 25, .05), 0 10px 28px -18px rgba(14, 42, 25, .28);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
a:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 8px; }
code { font-size: 13px; }

.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Layout */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.main { min-width: 0; padding: 32px clamp(20px, 3vw, 40px) 48px; }

/* Sidebar */
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 22px;
  padding: 20px 14px;
  background: var(--forest-deep); color: #d5e4d7;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px; color: #fff; text-decoration: none; }
.brand img { display: block; border-radius: 10px; }
.brand span { display: flex; flex-direction: column; line-height: 1.2; }
.brand strong { font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.brand small { color: #9fb8a6; font-size: 13px; }

.nav { display: flex; flex: 1; flex-direction: column; gap: 2px; }
.nav-section { margin: 18px 12px 6px; color: #7f9a87; font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: #d5e4d7; font-size: 14.5px; font-weight: 600; text-decoration: none;
}
.nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-link.active { background: var(--forest-active); color: #fff; }
.nav-link.active .ico { color: var(--green); }

.account { display: grid; grid-template-columns: 36px minmax(0, 1fr); align-items: center; gap: 10px 12px; padding: 14px 8px 2px; border-top: 1px solid rgba(255, 255, 255, .1); }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: #1f8a3d; color: #fff; font-weight: 800; }
.account-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; color: #fff; }
.account-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account small { color: #9fb8a6; font-size: 12.5px; }

/* Page header */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-head h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.sub { max-width: 70ch; margin: 4px 0 0; color: var(--muted); }

/* Cards and tiles */
.card { padding: 20px 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.card + .card { margin-top: 20px; }
.card h2 { margin: 0 0 6px; font-size: 17px; font-weight: 700; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 12px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.card-head p { margin: 0; color: var(--muted); font-size: 13.5px; }
.card-foot { margin: 14px 0 0; color: var(--muted); font-size: 13px; }
.empty p { max-width: 65ch; margin: 0; color: var(--muted); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.tile { padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.tile-label { margin: 0; color: var(--muted); font-size: 14px; font-weight: 600; }
.tile-value { margin: 8px 0 0; font-size: 28px; font-weight: 800; letter-spacing: -.02em; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 20px; align-items: start; }
.grid-2 > .card + .card { margin-top: 0; }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 10px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
.table thead th {
  border-bottom-color: var(--line); background: var(--surface-soft);
  color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.table tbody th { font-weight: 700; }
.table tbody tr:last-child > * { border-bottom: 0; }
.num { font-variant-numeric: tabular-nums; text-align: right !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); }

.pill { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; background: #eef6ea; color: var(--green-text); font-size: 13px; font-weight: 700; }
.pill.evAuto { background: #fff1e3; color: #a14f00; }
.pill.evBikeTaxi { background: #ffece6; color: #b8400b; }
.pill.evCab { background: #e6f4fb; color: #0b6a84; }

/* Settings shown as label + value rows */
.rules { margin: 0; }
.rules > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.rules > div:last-child { border-bottom: 0; }
.rules dt { font-weight: 600; }
.rules dt small { display: block; color: var(--muted); font-size: 13px; font-weight: 500; }
.rules dd { margin: 0; text-align: right; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; }
}

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label, .label { font-size: 13.5px; font-weight: 700; }
.field small { color: var(--muted); font-size: 12.5px; }
.input, .field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  color: var(--ink); font: inherit;
}
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--green); outline-offset: 0; border-color: var(--green-text); }
.input.num-input { width: 110px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.input[aria-invalid="true"] { border-color: var(--danger); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); font: 700 14px/1.2 var(--font); cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--surface-soft); }
.btn:disabled { opacity: .55; cursor: default; }
.btn:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.btn-primary { border-color: var(--forest); background: var(--forest); color: #fff; }
.btn-primary:hover { background: var(--forest-active); }
.btn-danger { color: var(--danger); }
.btn-small { padding: 6px 10px; font-size: 13px; }
.btn-quiet { border-color: transparent; background: transparent; color: #d5e4d7; }
.btn-quiet:hover { background: rgba(255, 255, 255, .08); color: #fff; }

.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; }
.status { margin: 0; font-size: 13.5px; }
.status.ok { color: var(--green-text); font-weight: 600; }
.status.error { color: var(--danger); font-weight: 600; }

.switch { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; cursor: pointer; }
.switch input { width: 20px; height: 20px; accent-color: var(--forest); }

.tag { display: inline-flex; padding: 2px 8px; border-radius: 999px; background: var(--surface-soft); color: var(--muted); font-size: 12px; font-weight: 700; }
.tag.off { background: #fdecea; color: var(--danger); }
.tag.ok { background: #eef6ea; color: var(--green-text); }


.account .btn-quiet { grid-column: 1 / -1; justify-self: start; padding: 6px 10px; font-size: 13px; }

/* Sign-in page */
.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 24px; background: linear-gradient(180deg, var(--forest-deep), var(--forest)); }
.auth-card { width: min(100%, 420px); padding: 28px; border-radius: 20px; background: #fff; box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .5); }
.auth-card .brand { margin-bottom: 18px; padding: 0; color: var(--ink); }
.auth-card .brand small { color: var(--muted); }
.auth-card h1 { margin: 0 0 6px; font-size: 22px; font-weight: 800; }
.auth-card .sub { margin-bottom: 20px; }
.auth-card .btn-primary { width: 100%; padding: 12px 16px; }

.gap-top { margin-top: 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Fare tables and timetables */
.section-head { margin: 32px 0 16px; }
.section-head h2 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 20px; align-items: start; }
.grid-3 > .card + .card { margin-top: 0; }
.table.steps th, .table.steps td { padding: 8px 6px; }
.table.steps .input.num-input { width: 96px; }
.table.compact th, .table.compact td { padding: 10px 6px; }
.table.compact .num, .table.compact .pill { white-space: nowrap; }
.btn-icon { width: 34px; height: 34px; padding: 0; font-size: 20px; line-height: 1; }
.pill.bus { background: #fdf3d8; color: #7a5200; }
.pill.train { background: #efeafb; color: #5a3eaa; }
.pill.metro { background: #e8effd; color: #1f4fbf; }
.tag.warn { background: #fff4d6; color: #7a5200; }
.table-scroll { overflow-x: auto; }
.table td small { display: block; margin-top: 2px; font-size: 12.5px; }
.rules dd small { display: block; margin-top: 2px; font-size: 12.5px; }
.table-scroll > .table { min-width: 820px; }

/* Tree planting batches */
.small-gap { margin: 0 0 8px; font-size: 13.5px; }
.pill.batch-planned { background: #fff1e3; color: #a14f00; }
.pill.batch-planted { background: #eef6ea; color: var(--green-text); }
.pill.batch-growing { background: #e3f4f1; color: #0b6b5e; }
.back-link { display: inline-block; margin-bottom: 8px; color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; }
.back-link:hover { color: var(--ink); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-top: 16px; }
.photo-grid figure { margin: 0; }
.photo-grid img { display: block; width: 100%; aspect-ratio: 4 / 3; border-radius: 12px; background: var(--surface-soft); object-fit: cover; }
.photo-grid figcaption { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; font-size: 13px; }
.photo-grid figcaption .btn { align-self: flex-start; }
.field-note { margin: -4px 0 14px; color: var(--muted); font-size: 13px; }

/* "hidden" wins over display rules such as .field and .form-row. */
[hidden] { display: none !important; }

/* Charts: one hover and focus tooltip each, hairline grids, thin marks. */
.chart { position: relative; }
.chart svg { display: block; }
.chart-tip {
  position: absolute; z-index: 5; display: flex; flex-direction: column; min-width: 120px; max-width: 300px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: var(--shadow);
  font-size: 12.5px; line-height: 1.35; pointer-events: none;
}
.chart-tip strong { font-size: 14px; }
.chart-tip span { color: var(--muted); }
.chart .grid { stroke: var(--line-soft); stroke-width: 1; }
.chart .baseline { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart .value { fill: var(--ink); font-size: 12px; font-weight: 700; }
.chart .hit { fill: transparent; }
.chart .bar { fill: var(--green-text); }
.chart .col:hover .bar { fill: var(--green); }
.chart .scale line { stroke: var(--muted); stroke-width: 2; }
.table-view { margin-top: 12px; }
.table-view summary { color: var(--muted); font-size: 13.5px; font-weight: 700; cursor: pointer; }
.table-view .table { margin-top: 8px; }
.loading { opacity: .55; transition: opacity .15s; }

/* Overview */
.month-pick { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 700; }
.month-pick .input { width: auto; }
.tile-note { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.mode-bars { margin: 0; padding: 0; list-style: none; }
.mode-row { display: grid; grid-template-columns: 112px minmax(0, 1fr) 84px; align-items: center; gap: 12px; padding: 7px 6px; border-radius: 8px; }
.mode-row:hover, .mode-row:focus-visible { background: var(--surface-soft); outline: none; }
.mode-row:focus-visible { box-shadow: 0 0 0 2px var(--green); }
.mode-name { font-size: 14px; font-weight: 600; }
.mode-track { height: 16px; }
.mode-bar { display: block; height: 100%; min-width: 2px; border-radius: 0 4px 4px 0; background: var(--green-text); }
.mode-row:hover .mode-bar, .mode-row:focus-visible .mode-bar { background: var(--green); }
.mode-value { font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.queue-preview { margin: 0; padding: 0; list-style: none; }
.queue-preview li { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.queue-preview li:last-child { border-bottom: 0; }
.queue-preview a { font-weight: 700; text-decoration: none; }
.queue-preview a:hover { text-decoration: underline; }
.queue-preview small { display: block; color: var(--muted); font-size: 13px; }
.corridors { display: grid; grid-template-columns: minmax(0, 3fr) minmax(260px, 2fr); gap: 20px; align-items: start; }
.map-bg { fill: var(--surface-soft); stroke: var(--line); }
.corridor-hit { stroke: transparent; stroke-linecap: round; }
.corridor-line { stroke: var(--green-text); stroke-linecap: round; opacity: .8; }
.corridor:hover .corridor-line, .corridor.active .corridor-line { stroke: var(--forest); opacity: 1; }
.map-dot { fill: var(--forest); stroke: #fff; stroke-width: 2; }
.map-badge circle { fill: #fff; stroke: var(--forest); stroke-width: 1.5; }
.map-badge text { fill: var(--ink); font-size: 11px; font-weight: 800; }
.map-label { fill: var(--ink); font-size: 12px; font-weight: 700; paint-order: stroke; stroke: var(--surface-soft); stroke-width: 4px; stroke-linejoin: round; }
.corridor-list { margin: 0; padding: 0; list-style: none; }
.corridor-list li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 8px; }
.corridor-list li.active { background: var(--surface-soft); }
.corridor-list li.empty-row { display: block; }
.corridor-list strong { display: block; font-size: 14px; }
.corridor-list small { color: var(--muted); font-size: 12.5px; }
.rank { display: grid; place-items: center; width: 24px; height: 24px; border: 1.5px solid var(--forest); border-radius: 50%; font-size: 11px; font-weight: 800; }
@media (max-width: 1100px) { .corridors { grid-template-columns: minmax(0, 1fr); } }

/* Review queue and trip detail */
.review-layout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 20px; align-items: start; }
.review-layout > .card + .card { margin-top: 0; }
.review-layout .table-scroll > .table { min-width: 420px; }
.review-list tbody tr[data-id] { cursor: pointer; }
.review-list tbody tr[data-id]:hover { background: var(--surface-soft); }
.review-list tbody tr.selected { background: #eef6ea; }
.review-list a { text-decoration: none; }
.review-list th small { display: block; margin-top: 2px; font-size: 12.5px; font-weight: 500; }
.pills { display: flex; flex-wrap: wrap; gap: 4px; }
.pill.check { padding: 2px 8px; background: #fff4d6; color: #7a5200; font-size: 12px; }
.pill.status-flagged { background: #fff4d6; color: #7a5200; }
.pill.status-rejected { background: #fdecea; color: var(--danger); }
.pill.status-cancelled, .pill.status-inProgress { background: var(--surface-soft); color: var(--muted); }
.detail-who { margin: 0 0 14px; }
.checks { display: grid; gap: 8px; margin: 0 0 16px; padding: 0; list-style: none; }
.checks li { padding: 10px 12px; border-radius: 10px; background: #fff8e6; }
.checks strong { display: block; font-size: 14px; }
.checks span { color: var(--muted); font-size: 13px; }
.trace-bg { fill: var(--surface-soft); stroke: var(--line); }
.trace-zone { fill: rgba(108, 210, 63, .12); stroke: rgba(44, 138, 39, .4); stroke-width: 1; }
.trace-plan { fill: none; stroke: #bcdcb0; stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; }
.trace-gps { fill: none; stroke: var(--forest); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.trace-left-out { fill: #fff; stroke: var(--danger); stroke-width: 1.5; }
.trace-end { fill: var(--forest); stroke: #fff; stroke-width: 2; }
.trace-hover { fill: var(--green); stroke: #fff; stroke-width: 2; pointer-events: none; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 12.5px; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend .legend-note { font-style: italic; }
.key { display: inline-block; flex: none; }
.key.plan { width: 18px; height: 6px; border-radius: 3px; background: #bcdcb0; }
.key.gps { width: 18px; height: 2px; background: var(--forest); }
.key.left-out { width: 9px; height: 9px; border: 1.5px solid var(--danger); border-radius: 50%; }
.key.zone { width: 12px; height: 12px; border: 1px solid rgba(44, 138, 39, .4); border-radius: 50%; background: rgba(108, 210, 63, .12); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 20px; margin: 18px 0 0; }
.facts dt { color: var(--muted); font-size: 12.5px; font-weight: 700; }
.facts dd { margin: 2px 0 0; font-weight: 600; }
.decision { min-width: 0; margin: 18px 0 0; padding: 16px 0 0; border: 0; border-top: 1px solid var(--line-soft); }
.decision textarea { resize: vertical; }
.btn-danger:hover { background: #fdecea; }
@media (max-width: 1200px) { .review-layout { grid-template-columns: minmax(0, 1fr); } }

/* Users, Trips and Reports */
.page-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.page-actions .status { max-width: 40ch; text-align: right; }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 14px; }
.filters .field { flex: 0 1 180px; }
.filters .field.grow { flex: 1 1 240px; }
.list-count { margin: 0 0 8px; color: var(--muted); font-size: 13.5px; font-weight: 600; }
.table th a, .table td a { font-weight: 700; text-decoration: none; }
.table th a:hover, .table td a:hover { text-decoration: underline; }
.table th small { display: block; margin-top: 2px; font-size: 12.5px; font-weight: 500; }
.table a.quiet-link { color: var(--muted); font-weight: 600; }
.table td > .pill + small { margin-top: 4px; }
.warn-text { color: #7a5200; font-weight: 600; }
.pill.user-blocked { background: #fdecea; color: var(--danger); }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.pager p { margin: 0; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.pager-buttons { display: flex; gap: 8px; }
.chip-row { margin: 0 0 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 12px; border-radius: 999px; background: #eef6ea; color: var(--green-text); font-size: 13.5px; font-weight: 700; }
.chip-clear { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; font: 700 16px/1 var(--font); cursor: pointer; }
.chip-clear:hover { background: rgba(44, 138, 39, .14); }
.chip-clear:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.range-pick { display: flex; flex-wrap: wrap; gap: 12px; }
.range-pick label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; }
.range-pick .input { width: auto; }
.card-tools { display: flex; align-items: center; gap: 10px; }
.report-table tfoot th, .report-table tfoot td { border-top: 2px solid var(--line); border-bottom: 0; font-weight: 800; }
.report-table tbody th { font-weight: 600; white-space: nowrap; }
.table.compact.report-table thead th.num { white-space: normal; }
.filters .field input, .filters .field select { min-height: 44px; }
