:root {
    --ink: #162823;
    --muted: #63736e;
    --green: #173e36;
    --green-2: #236052;
    --lime: #d7ec9a;
    --cream: #f5f3ea;
    --paper: #fffef9;
    --line: #dce2dc;
    --orange: #c96a3a;
    --red: #a64135;
    --shadow: 0 18px 50px rgba(24, 55, 47, .08);
}

* { box-sizing: border-box; }
html { background: var(--cream); }
body { margin: 0; color: var(--ink); background: radial-gradient(circle at 90% 0, #e5efd2 0, transparent 26rem), var(--cream); font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: inherit; }
button, input { font: inherit; }

.topbar { height: 76px; padding: 0 clamp(20px, 4vw, 64px); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 28px; border-bottom: 1px solid rgba(23, 62, 54, .12); background: rgba(255, 254, 249, .86); backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; gap: 11px; align-items: center; text-decoration: none; width: max-content; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: var(--lime); background: var(--green); font-weight: 850; font-size: 15px; letter-spacing: -.04em; }
.brand strong, .brand small { display: block; }
.brand strong { line-height: 1.15; letter-spacing: -.02em; }
.brand small { color: var(--muted); font-size: 11px; line-height: 1.25; }
.brand .brand-version { margin-top: 2px; color: #899590; font-size: 9px; font-weight: 750; letter-spacing: .04em; }
.topbar nav { display: flex; background: #edf0e9; padding: 4px; border-radius: 12px; }
.topbar nav a { padding: 9px 18px; border-radius: 9px; text-decoration: none; font-weight: 700; color: var(--muted); }
.topbar nav a.active { color: #fff; background: var(--green); box-shadow: 0 5px 14px rgba(23, 62, 54, .2); }
.db-state { justify-self: end; color: var(--muted); font-size: 12px; font-weight: 700; }
.db-state span { width: 8px; height: 8px; display: inline-block; margin-right: 7px; border-radius: 50%; background: #55a66f; box-shadow: 0 0 0 4px #dcecdf; }

.shell { width: min(1480px, calc(100% - 40px)); margin: 34px auto 80px; }
.hero { padding: 36px 40px; min-height: 185px; display: flex; align-items: center; justify-content: space-between; gap: 36px; color: #fff; border-radius: 24px; background: linear-gradient(120deg, #153931 0%, #225b4e 70%, #2d6c5c 100%); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; width: 350px; height: 350px; border: 70px solid rgba(215, 236, 154, .09); border-radius: 50%; right: -110px; top: -180px; }
.hero > * { position: relative; z-index: 1; }
.hero.compact { min-height: 160px; }
.hero h1 { margin: 5px 0 10px; font-size: clamp(29px, 4vw, 46px); line-height: 1.05; letter-spacing: -.045em; }
.hero p { max-width: 720px; margin: 0; color: #d6e4df; font-size: 16px; }
.eyebrow { color: #b5d573; font-weight: 850; font-size: 11px; letter-spacing: .13em; text-transform: uppercase; }
.hero-metric { min-width: 180px; padding: 22px; border: 1px solid rgba(255,255,255,.18); border-radius: 18px; background: rgba(255,255,255,.08); }
.hero-metric strong, .hero-metric span { display: block; }
.hero-metric strong { font-size: 34px; letter-spacing: -.04em; }
.hero-metric span { color: #c9d7d2; font-size: 12px; }

.notice, .partial-warning { margin: 0 0 20px; padding: 15px 18px; border-radius: 14px; }
.notice.success { color: #174d35; background: #dff2e4; border: 1px solid #b9ddc3; }
.notice.danger { color: #742d24; background: #fae5df; border: 1px solid #edc2b8; }
.partial-warning { color: #61361d; background: #fff1d5; border: 1px solid #efd39e; }
.partial-warning h2 { margin: 0 0 5px; font-size: 18px; }
.partial-warning p { margin: 0; }
.partial-warning ul { margin-bottom: 0; }

.stat-grid { margin: 20px 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-grid article { min-height: 118px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255, 254, 249, .9); box-shadow: 0 8px 30px rgba(30, 55, 47, .035); }
.stat-grid span, .stat-grid small, .stat-grid strong { display: block; }
.stat-grid span { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.stat-grid strong { margin: 6px 0 2px; font-size: 28px; line-height: 1.1; letter-spacing: -.035em; }
.stat-grid small { color: #87928e; }
.stat-grid .money { color: #fff; background: var(--green); border-color: var(--green); }
.stat-grid .money span, .stat-grid .money small { color: #bcd0c9; }

.upload-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 0 0 24px; }
.upload-card { min-height: 390px; display: grid; grid-template-columns: 48px 1fr; grid-template-rows: auto 1fr; gap: 0 16px; padding: 25px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: var(--shadow); }
.upload-card .card-number { grid-row: 1 / 3; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; color: var(--green); background: #edf1e7; font-weight: 850; }
.upload-card h2 { margin: 0 0 6px; font-size: 21px; letter-spacing: -.02em; }
.upload-card p { margin: 0 0 18px; color: var(--muted); }
.upload-card form { display: flex; flex-direction: column; }
.file-drop { min-height: 124px; display: grid; place-content: center; text-align: center; padding: 18px; border: 1.5px dashed #a9bbb5; border-radius: 15px; background: #f7f8f3; cursor: pointer; transition: .18s ease; }
.file-drop:hover, .file-drop.has-file { border-color: var(--green-2); background: #edf5ee; transform: translateY(-1px); }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-drop strong { color: var(--green); }
.file-drop span { color: #899590; font-size: 12px; }
.confirm { display: flex; gap: 9px; align-items: flex-start; margin: 13px 0 17px; color: var(--muted); font-size: 12px; }
.confirm input { margin-top: 3px; accent-color: var(--green); }
button, .button { border: 0; border-radius: 11px; padding: 11px 17px; color: #fff; background: var(--green); font-weight: 800; cursor: pointer; text-decoration: none; text-align: center; transition: .18s ease; }
button:hover, .button:hover { background: var(--green-2); transform: translateY(-1px); }
.delete-import-form { margin: 0; }
button.delete-button { padding: 6px 10px; color: var(--red); border: 1px solid #e4b9b2; background: #fff7f5; font-size: 11px; white-space: nowrap; }
button.delete-button:hover { color: #fff; border-color: var(--red); background: var(--red); }
.upload-card button { width: 100%; margin-top: auto; }
.accent-card { border-color: #bdd09d; background: linear-gradient(150deg, #fffef9, #f3f8e8); }
.disabled-card { opacity: .72; background: #eff0eb; }
.coming-soon { align-self: end; padding: 34px 18px; text-align: center; color: #7a8682; border: 1px dashed #bdc7c3; border-radius: 15px; font-weight: 800; }

.panel { margin-top: 20px; padding: 25px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.panel-heading h2 { margin: 2px 0 0; font-size: 22px; letter-spacing: -.025em; }
.panel .eyebrow { color: var(--green-2); }
.text-link { color: var(--green-2); font-weight: 800; text-decoration: none; }
.button.secondary { color: var(--green); background: var(--lime); white-space: nowrap; }
.button.secondary:hover { background: #e3f2b4; }
.table-wrap { overflow: auto; border: 1px solid #e3e7e2; border-radius: 13px; }
.table-wrap.tall { max-height: 650px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
th { padding: 11px 13px; color: #60706b; background: #f0f2ec; text-align: left; text-transform: uppercase; letter-spacing: .045em; font-size: 10px; position: sticky; top: 0; z-index: 2; white-space: nowrap; }
td { padding: 11px 13px; border-top: 1px solid #e8ebe7; vertical-align: top; }
tbody tr:hover td { background: #fafbf6; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.money-cell { color: #176448; font-weight: 800; }
.pill { padding: 4px 8px; border-radius: 999px; font-size: 9px; font-weight: 900; letter-spacing: .08em; background: #e6ebe6; }
.pill.activity { color: #285848; background: #daf0e2; }
.pill.gps { color: #3b5391; background: #e3e9fa; }
.pill.toll { color: #9a4b29; background: #f8e4d8; }
.empty { color: var(--muted); }
.table-note { color: var(--muted); font-size: 12px; }

.report-hero { align-items: flex-end; }
.period-form { min-width: 470px; display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 10px; padding: 16px; border-radius: 15px; background: rgba(255,255,255,.1); }
.period-form label { color: #cbd9d4; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.period-form input { width: 100%; display: block; margin-top: 5px; padding: 10px; color: var(--ink); border: 0; border-radius: 9px; background: #fff; }
.period-form button { color: var(--green); background: var(--lime); white-space: nowrap; }
.wide-panel { padding: 20px; }
.report-table { min-width: 1350px; }
.confidence { padding: 4px 7px; border-radius: 8px; color: #3e6257; background: #e2eee8; white-space: nowrap; }
.exceptions { border-color: #edc7b5; }
.count-badge { min-width: 32px; height: 32px; display: grid; place-items: center; color: #fff; background: var(--orange); border-radius: 50%; font-weight: 800; }
.empty-state { margin: 24px 0; padding: 70px 20px; text-align: center; border: 1px dashed #b9c5c0; border-radius: 22px; background: rgba(255,255,255,.46); }
.empty-state h2 { margin: 10px 0 4px; }
.empty-state p { margin: 0; color: var(--muted); }
.empty-icon { width: 50px; height: 50px; display: grid; place-items: center; margin: auto; border-radius: 50%; color: var(--green); background: var(--lime); font-size: 24px; font-weight: 900; }

.app-footer {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 5px;
    padding: 22px 28px 18px;
    color: #87918e;
    font-size: 12px;
}
.footer-note { text-align: center; }
.footer-credit { justify-self: center; }
.footer-credit a { color: inherit; font-weight: 700; text-decoration: none; }
.footer-credit a:hover { color: var(--green); text-decoration: underline; }

@media (max-width: 1000px) {
    .topbar { grid-template-columns: 1fr auto; }
    .db-state { display: none; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .report-hero { align-items: stretch; flex-direction: column; }
    .period-form { min-width: 0; }
}

@media (max-width: 720px) {
    .topbar { height: auto; padding: 13px 18px; grid-template-columns: 1fr; gap: 11px; }
    .topbar nav { width: 100%; }
    .topbar nav a { flex: 1; text-align: center; }
    .shell { width: min(100% - 24px, 1480px); margin-top: 18px; }
    .hero { padding: 28px 22px; flex-direction: column; align-items: stretch; }
    .hero-metric { min-width: 0; }
    .stat-grid, .upload-grid { grid-template-columns: 1fr; }
    .upload-card { grid-template-columns: 1fr; }
    .upload-card .card-number { grid-row: auto; margin-bottom: 12px; }
    .period-form { grid-template-columns: 1fr; }
    .panel-heading { align-items: flex-start; flex-direction: column; }
}
