/* ==========================================================================
   Fleet Operations — base styles
   Single stylesheet, no build step, no external dependencies.
   Mobile-first behaviour lives in the media queries at the bottom.
   ========================================================================== */

:root {
    --ink: #0f2438;
    --ink-2: #163049;
    --ink-3: #1d3c58;

    --paper: #f4f6f9;
    --card: #ffffff;
    --line: #dde5ec;
    --line-soft: #eaf0f5;

    --text: #1b2b3a;
    --muted: #63788c;

    --blue: #0b6e99;
    --blue-ink: #075985;
    --pale: #e9f5fb;

    --green: #12715b;
    --green-pale: #e8f6f1;
    --green-line: #b9e5d6;

    --amber: #9a6700;
    --amber-pale: #fdf6e3;
    --amber-line: #f0dfae;

    --red: #b42318;
    --red-pale: #fdf0ef;
    --red-line: #f3c7c3;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(15, 36, 56, .05), 0 10px 28px -22px rgba(15, 36, 56, .45);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--text);
    font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

code {
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: .92em;
    background: #eef3f7;
    color: #33475b;
    padding: 1px 5px;
    border-radius: 5px;
    word-break: break-word;
}

.right { text-align: right; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }

/* ---------- shell ---------- */

.shell {
    display: grid;
    grid-template-columns: 252px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    background: var(--ink);
    color: #e6eef5;
    padding: 22px 12px 24px;
    display: flex;
    flex-direction: column;
}

.brand { margin: 0 10px 22px; }
.brand strong { display: block; font-size: 17px; letter-spacing: -.2px; }
.brand span {
    display: block;
    margin-top: 5px;
    color: #8fb3ce;
    font-size: 11.5px;
    line-height: 1.4;
}

.nav-group + .nav-group { margin-top: 18px; }

.nav-label {
    font-size: 10px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #7c9db8;
    padding: 0 11px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 11px;
    margin: 1px 0;
    border-radius: var(--radius-sm);
    color: #d3e2ee;
    text-decoration: none;
    font-size: 13.5px;
}

.nav-item:hover { background: var(--ink-3); color: #fff; }
.nav-item.active { background: var(--blue); color: #fff; font-weight: 650; }
.nav-item.planned { color: #7e95a8; cursor: not-allowed; }

.nav-phase {
    font-style: normal;
    font-size: 10px;
    font-weight: 700;
    background: rgba(255, 255, 255, .09);
    color: #9fb6c8;
    padding: 1px 6px;
    border-radius: 999px;
}

.sidebar-foot {
    margin-top: auto;
    padding: 18px 11px 0;
    color: #6f8aa1;
    font-size: 11px;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.main-col {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ---------- topbar ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 15px 24px;
    background: rgba(244, 246, 249, .94);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--line);
}

.topbar-title { min-width: 0; }

.crumb {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--muted);
}

.topbar h1 {
    margin: 1px 0 0;
    font-size: 20px;
    letter-spacing: -.2px;
    color: var(--ink);
}

.topbar .subtitle {
    margin: 2px 0 0;
    font-size: 12.5px;
    color: var(--muted);
}

.topbar-meta {
    margin-left: auto;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.menu-btn {
    display: none;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink);
    border-radius: var(--radius-sm);
    padding: 8px 11px;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}

/* ---------- content ---------- */

main {
    padding: 22px 24px 8px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

footer {
    margin-top: auto;
    padding: 18px 24px 26px;
    color: var(--muted);
    font-size: 11.5px;
}

.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    min-width: 0;
}

.panel-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.panel h2 {
    margin: 0;
    font-size: 14.5px;
    letter-spacing: .01em;
    color: var(--ink);
}

.hint {
    margin: -4px 0 12px;
    font-size: 12.5px;
    color: var(--muted);
    max-width: 78ch;
}

.intro-copy h2 {
    margin: 12px 0 8px;
    font-size: 18px;
    letter-spacing: -.2px;
    color: var(--ink);
}

.intro-copy p { margin: 0 0 8px; max-width: 92ch; }
.intro-copy p:last-child { margin-bottom: 0; }

/* ---------- stats ---------- */

.stats {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 16px;
    min-width: 0;
}

.stat-label {
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}

.stat-value {
    margin: 4px 0 2px;
    font-size: 27px;
    font-weight: 800;
    letter-spacing: -.6px;
    color: var(--ink);
    line-height: 1.1;
}

.stat-note { font-size: 11.5px; color: var(--muted); }

/* ---------- layout helpers ---------- */

.split {
    display: grid;
    gap: 16px;
    grid-template-columns: 1.35fr 1fr;
    align-items: start;
}

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th, td {
    padding: 9px 10px;
    text-align: left;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: top;
}

th {
    font-size: 10.5px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #526176;
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafcfd; }

.empty-cell {
    padding: 22px;
    text-align: center;
    color: var(--muted);
}

.pending-row td { background: var(--amber-pale); }

/* ---------- key/value lists ---------- */

.keyvals {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 9px 14px;
    margin: 0;
    font-size: 13px;
}

.keyvals dt { color: var(--muted); }
.keyvals dd { margin: 0; min-width: 0; }

/* ---------- chips ---------- */

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 750;
    white-space: nowrap;
}

.chip.good { background: var(--green-pale); color: var(--green); }
.chip.warn { background: var(--amber-pale); color: var(--amber); }
.chip.bad { background: var(--red-pale); color: var(--red); }
.chip.neutral { background: #eef2f6; color: #42566a; }

/* ---------- feedback ---------- */

.flash {
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid var(--line);
    font-size: 13px;
    transition: opacity .4s ease;
}

.flash.success { background: var(--green-pale); border-color: var(--green-line); color: #0b5a47; }
.flash.error { background: var(--red-pale); border-color: var(--red-line); color: var(--red); }
.flash.warn { background: var(--amber-pale); border-color: var(--amber-line); color: #6d4c00; }
.flash.flash-out { opacity: 0; }

.notice {
    background: var(--amber-pale);
    border: 1px solid var(--amber-line);
    color: #6d4c00;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
}

/* ---------- roadmap ---------- */

.roadmap {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 11px;
}

.roadmap li {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 10px;
    font-size: 12.8px;
    color: #33475b;
}

.roadmap .step {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--pale);
    color: var(--blue-ink);
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 800;
}

.roadmap strong { color: var(--ink); }

/* ---------- buttons (used from Phase 1 onward) ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid transparent;
    background: var(--blue);
    color: #fff;
    border-radius: var(--radius-sm);
    padding: 9px 14px;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.btn:hover { background: #095c80; }
.btn.secondary { background: #e7eff5; color: #1e3a5f; border-color: var(--line); }
.btn.secondary:hover { background: #dbe7f0; }
.btn.danger { background: var(--red); }
.btn.small { padding: 6px 10px; font-size: 12px; }

/* ---------- mobile ---------- */

.scrim { display: none; }

@media (max-width: 1080px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
    .shell { grid-template-columns: minmax(0, 1fr); }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: 272px;
        z-index: 60;
        transform: translateX(-100%);
        transition: transform .2s ease;
    }

    .shell.nav-open .sidebar { transform: none; }

    .shell.nav-open .scrim {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 36, 56, .45);
        z-index: 50;
    }

    .menu-btn { display: inline-flex; }
    .topbar { padding: 12px 16px; }
    .topbar-meta { display: none; }
    main { padding: 16px; }
    footer { padding: 12px 16px 24px; }
}

@media (max-width: 560px) {
    .stats { grid-template-columns: minmax(0, 1fr); }
    .keyvals { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .keyvals dt { margin-top: 8px; }
    .topbar h1 { font-size: 18px; }
}

@media print {
    .sidebar, .topbar-meta, .menu-btn, footer { display: none !important; }
    .shell { display: block; }
    .panel { box-shadow: none; break-inside: avoid; }
}

/* ==========================================================================
   Master data: toolbar, forms, search, data-quality worklist
   ========================================================================== */

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 320px;
    min-width: 0;
}

.search-form input[type="search"] {
    flex: 1 1 auto;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 9px 11px;
    font: inherit;
    background: var(--card);
}

.search-form input[type="search"]:focus {
    outline: 2px solid #a9d9ed;
    border-color: var(--blue);
}

.btn.ghost {
    background: transparent;
    color: var(--muted);
    border-color: transparent;
    padding-left: 8px;
    padding-right: 8px;
}

.btn.ghost:hover { background: #eef3f7; color: var(--ink); }

.count {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 8px;
    border-radius: 999px;
    background: #eef2f6;
    color: #42566a;
    font-size: 11px;
    font-weight: 800;
    vertical-align: middle;
}

.empty-state {
    padding: 26px 18px;
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--line);
    border-radius: 10px;
    background: #fbfdfe;
}

.spacer-top { margin-top: 12px; }

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

.table-actions { text-align: right; white-space: nowrap; }

/* ---------- forms ---------- */

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px 16px;
}

.field { min-width: 0; }
.span-1 { grid-column: span 1; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-all { grid-column: 1 / -1; }

.form-section {
    margin-top: 6px;
    padding-top: 14px;
    border-top: 1px solid var(--line-soft);
}

.form-section:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.form-section span {
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--muted);
}

.field label {
    display: block;
    margin-bottom: 5px;
    font-size: 12.5px;
    font-weight: 700;
    color: #33475b;
}

.field .req { color: var(--red); font-weight: 800; }

.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid #cfdbe5;
    border-radius: var(--radius-sm);
    padding: 9px 10px;
    font: inherit;
    color: var(--text);
    background: var(--card);
}

.field textarea { resize: vertical; min-height: 74px; }

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: 2px solid #a9d9ed;
    border-color: var(--blue);
}

.field .help {
    margin-top: 4px;
    font-size: 11.5px;
    color: var(--muted);
    line-height: 1.4;
}

.field label.check {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-weight: 600;
    font-size: 13px;
    color: #33475b;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fbfdfe;
    cursor: pointer;
}

.field label.check input {
    width: auto;
    margin: 2px 0 0;
    accent-color: var(--blue);
}

.form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 8px;
    border-top: 1px solid var(--line-soft);
    margin-top: 4px;
}

/* ---------- data quality ---------- */

.mini-stats {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
    margin-top: 6px;
}

.mini-stat {
    display: block;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fbfdfe;
    text-decoration: none;
    color: inherit;
}

.mini-stat:hover { border-color: #b9d7e8; background: var(--pale); }

.mini-value {
    display: block;
    font-size: 20px;
    font-weight: 800;
    color: var(--ink);
    line-height: 1.15;
}

.mini-label {
    display: block;
    font-size: 11px;
    color: var(--muted);
    font-weight: 650;
}

.issue-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}

.issue-card.is-clear { background: #fcfffd; }

.issue-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.issue-head h2 { font-size: 14px; }

.issue-samples {
    margin: 8px 0 0;
    padding: 10px 12px 10px 26px;
    background: #fbfdfe;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    color: #33475b;
    max-height: 190px;
    overflow-y: auto;
}

.issue-samples li + li { margin-top: 3px; }

@media (max-width: 1080px) {
    .mini-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .issue-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .span-1, .span-2, .span-3, .span-all { grid-column: 1 / -1; }
    .mini-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ==========================================================================
   Weekly follow-up: meters, usage cards, odometer summary
   ========================================================================== */

.inline-label {
    font-size: 12.5px;
    font-weight: 700;
    color: #33475b;
    white-space: nowrap;
}

.meter-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 6px;
}

.meter { min-width: 0; }

.meter-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 6px;
}

.meter-label strong { color: var(--ink); font-size: 13px; }

.progress {
    height: 8px;
    border-radius: 999px;
    background: #e8eef4;
    overflow: hidden;
}

.progress-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--green);
    transition: width .25s ease;
}

.progress-fill.warn { background: var(--amber); }

.inline-list {
    margin: 8px 0 0;
    padding-left: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 18px;
    font-size: 12.5px;
}

.inline-list li { margin: 0; }

.odometer-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fbfdfe;
}

.odometer-summary > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.odometer-summary strong { color: var(--ink); font-size: 14px; }

.usage-card {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px;
    background: #fbfdfe;
    margin-bottom: 12px;
}

.usage-card:last-child { margin-bottom: 0; }

.usage-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.usage-head strong { color: var(--ink); font-size: 13.5px; }

.usage-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 10px;
}

.usage-card .field label { font-size: 11.5px; }

.computed {
    margin: 8px 0 0;
    min-height: 16px;
    font-variant-numeric: tabular-nums;
}

.btn[disabled] {
    opacity: .45;
    cursor: not-allowed;
}

.btn-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

@media (max-width: 1080px) {
    .meter-row, .usage-grid, .odometer-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .meter-row, .usage-grid, .odometer-summary { grid-template-columns: minmax(0, 1fr); }
}

/* ==========================================================================
   Requests: filter bar and status timeline
   ========================================================================== */

.filter-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
    flex: 1 1 auto;
    min-width: 0;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 130px;
}

.filter-field.grow { flex: 1 1 220px; min-width: 180px; }

.filter-field label {
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--muted);
}

.filter-field input,
.filter-field select {
    border: 1px solid #cfdbe5;
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font: inherit;
    background: var(--card);
    color: var(--text);
    width: 100%;
}

.filter-field input:focus,
.filter-field select:focus {
    outline: 2px solid #a9d9ed;
    border-color: var(--blue);
}

.timeline {
    list-style: none;
    margin: 0;
    padding: 4px 0 0 4px;
}

.timeline-item {
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr);
    gap: 10px;
    padding-bottom: 16px;
    position: relative;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-marker {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--blue);
    margin-top: 5px;
    position: relative;
    z-index: 1;
}

.timeline-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 15px;
    bottom: 0;
    width: 1px;
    background: var(--line);
}

.timeline-head {
    display: flex;
    gap: 8px;
    align-items: baseline;
    flex-wrap: wrap;
    margin-bottom: 2px;
}

.timeline-body { min-width: 0; }

@media (max-width: 640px) {
    .filter-form { flex-direction: column; align-items: stretch; }
    .filter-field { min-width: 0; }
}

.compact-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
}

.compact-list li {
    padding: 7px 10px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
    background: #fbfdfe;
    font-size: 12.5px;
}

.compact-list a { font-weight: 700; }

/* ==========================================================================
   Exceptions
   ========================================================================== */

.row-action {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.row-action select,
.row-action input {
    border: 1px solid #cfdbe5;
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    font: inherit;
    font-size: 12px;
    background: var(--card);
    color: var(--text);
}

.row-action select { min-width: 108px; }
.row-action input { min-width: 120px; flex: 1 1 120px; }

.exception-table td { vertical-align: top; }
.exception-table td:nth-child(2) { max-width: 460px; }

@media (max-width: 860px) {
    .row-action { flex-direction: column; align-items: stretch; }
    .exception-table td:nth-child(2) { max-width: none; }
}

/* ==========================================================================
   Reports
   ========================================================================== */

.report-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.report-card {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 16px 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: inherit;
}

.report-card:hover { border-color: #b9d7e8; background: var(--pale); }
.report-card strong { color: var(--ink); font-size: 14px; }
.report-card span { color: var(--muted); font-size: 12.5px; line-height: 1.45; }

tfoot td {
    border-top: 2px solid var(--line);
    font-weight: 750;
    background: #f8fafc;
}

@media (max-width: 860px) {
    .report-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ==========================================================================
   Charts, pager and touch sizing
   ========================================================================== */

.chart-wrap {
    margin: 4px 0 16px;
    padding: 8px 6px;
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    background: #fbfdfe;
    overflow-x: auto;
}

.chart {
    display: block;
    width: 100%;
    min-width: 460px;
    height: auto;
}

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line-soft);
}

@media (max-width: 640px) {
    /* 16px inputs stop mobile browsers zooming the page on focus. */
    input, select, textarea { font-size: 16px; }

    .btn { min-height: 44px; }

    main { padding: 12px; }

    .topbar { padding: 10px 12px; }

    .panel { padding: 14px; }

    .stat-value { font-size: 23px; }

    .chart { min-width: 400px; }
}

/* ==========================================================================
   Sign in and first-run setup
   ========================================================================== */

.auth-body {
    background: var(--ink);
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
}

.auth-shell {
    width: 100%;
    max-width: 420px;
}

.auth-brand {
    text-align: center;
    color: #e6eef5;
    margin-bottom: 18px;
}

.auth-brand strong { display: block; font-size: 20px; letter-spacing: -.3px; }
.auth-brand span { display: block; margin-top: 5px; color: #8fb3ce; font-size: 12px; }

.auth-card {
    background: var(--card);
    border-radius: 14px;
    padding: 24px 22px;
    box-shadow: 0 18px 40px -24px rgba(0, 0, 0, .6);
}

.auth-card h1 { font-size: 19px; margin: 0 0 6px; color: var(--ink); }
.auth-card .muted { margin-bottom: 16px; }

.auth-form { display: grid; gap: 13px; }
.auth-form .btn { width: 100%; justify-content: center; }

.auth-foot {
    text-align: center;
    color: #7c9db8;
    font-size: 11px;
    margin-top: 16px;
}

.sidebar-user {
    margin-bottom: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .06);
}

.sidebar-user strong { display: block; font-size: 12.5px; color: #fff; }
.sidebar-user span { display: block; font-size: 11px; color: #9fb6c8; }

/* ==========================================================================
   Primary-task strip and live filtering
   ========================================================================== */

.action-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 16px 18px;
    border: 1px solid #b9d7e8;
    border-left: 4px solid var(--blue);
    border-radius: var(--radius);
    background: linear-gradient(180deg, #f4fbfe 0%, #ffffff 100%);
    box-shadow: var(--shadow);
}

.action-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.action-copy strong { font-size: 15px; color: var(--ink); }

.action-eyebrow {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--blue);
}

/* A quiet hint that the list refreshes itself. */
form[data-live-filter] input[data-live-input] {
    padding-right: 30px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23879bad' d='M11.7 10.3a6 6 0 1 0-1.4 1.4l3.3 3.3 1.4-1.4-3.3-3.3zM6.5 10.5a4 4 0 1 1 0-8 4 4 0 0 1 0 8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 9px center;
    background-size: 13px 13px;
}

@media (max-width: 640px) {
    .action-strip { flex-direction: column; align-items: stretch; }
    .action-strip .btn-row .btn { flex: 1 1 auto; justify-content: center; }
}

/* Primary tabs sit directly under the brand, with no heading. */
.nav-group.tabs {
    margin-bottom: 6px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, .10);
}

.nav-group.tabs .nav-item {
    font-weight: 650;
    font-size: 14px;
}

/* ==========================================================================
   Batch fuel distribution: one hub, several riders, one save
   ========================================================================== */

.quick-fill {
    display: flex;
    gap: 14px;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 12px 14px;
    margin-bottom: 14px;
    border: 1px dashed #b9d7e8;
    border-radius: 10px;
    background: #f7fcff;
}

.quick-fill-inputs { display: flex; gap: 12px; flex: 1 1 340px; }
.quick-fill-inputs .field { flex: 1 1 0; min-width: 0; }

.dist-list { display: grid; gap: 10px; }

.dist-row {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--card);
}

.dist-row:has(input[type="checkbox"]:checked) {
    border-color: #b9d7e8;
    background: #f7fcff;
}

.dist-pick { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.dist-pick input { width: auto; accent-color: var(--blue); }
.dist-pick strong { display: block; font-size: 13px; color: var(--ink); }

.dist-inputs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.dist-inputs .field label { font-size: 10.5px; margin-bottom: 3px; }
.dist-inputs .field input { padding: 7px 8px; }

@media (max-width: 1080px) {
    .dist-row { grid-template-columns: minmax(0, 1fr); }
    .dist-inputs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .dist-inputs { grid-template-columns: minmax(0, 1fr); }
    .quick-fill { flex-direction: column; align-items: stretch; }
    .quick-fill-inputs { flex-direction: column; }
}

/* ==========================================================================
   Mobile: stacked list rows, sticky form actions, app-like touch targets
   ========================================================================== */

@media (max-width: 700px) {
    /* Tables become readable cards instead of a sideways scroll. */
    .table-wrap thead { display: none; }

    .table-wrap tbody tr {
        display: block;
        border: 1px solid var(--line);
        border-radius: 10px;
        padding: 8px 12px;
        margin-bottom: 10px;
        background: var(--card);
    }

    .table-wrap tbody td {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 14px;
        border: 0;
        padding: 3px 0;
        text-align: right;
    }

    .table-wrap tbody td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        font-size: 10.5px;
        font-weight: 800;
        letter-spacing: .05em;
        text-transform: uppercase;
        color: var(--muted);
        text-align: left;
    }

    .table-wrap tbody td[data-label=""]::before,
    .table-wrap tbody td:not([data-label])::before { content: ''; }

    .table-wrap tbody td.table-actions {
        justify-content: flex-end;
        padding-top: 8px;
        border-top: 1px solid var(--line-soft);
        margin-top: 6px;
    }

    .table-wrap tbody td.table-actions::before { content: ''; }

    .table-wrap tfoot tr { display: block; }
    .table-wrap tfoot td { display: flex; justify-content: space-between; border: 0; }

    /* Keep the save action reachable on long forms. */
    .form-actions-sticky {
        position: sticky;
        bottom: 0;
        z-index: 15;
        padding: 10px 0;
        margin-top: 8px;
        background: rgba(244, 246, 249, .97);
        border-top: 1px solid var(--line);
        backdrop-filter: blur(6px);
    }

    .form-actions-sticky .btn { flex: 1 1 auto; justify-content: center; min-height: 46px; }

    /* Denser chrome so more of the screen is the work itself. */
    .topbar h1 { font-size: 17px; }
    .crumb { display: none; }
    .stat { padding: 12px 14px; }
    .panel { padding: 14px 13px; border-radius: 10px; }
}


/* ==========================================================================
   Receipts: product cards and the read-only detail view
   ========================================================================== */

.product-card {
    display: block;
    text-decoration: none;
    color: inherit;
}

.product-card:hover { border-color: #b9d7e8; }

.product-card.is-selected {
    border-color: var(--blue);
    box-shadow: 0 0 0 2px rgba(11, 110, 153, .18);
}

.small-heading {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 16px 0 6px;
}

.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.file-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 10px;
}

.flash.warning { background:#fdf6e3; border-color:#f0dfae; color:#7a5a12; }
