/* CrashWatch Liberia */
:root {
  --primary: #0b3d91;
  --primary-dark: #082c69;
  --accent: #f2a900;
  --bad: #c62828;
  --ok: #2e7d32;
  --warn: #b26a00;
  --bg: #f4f6fa;
  --panel: #ffffff;
  --fg: #172033;
  --muted: #5b6475;
  --line: #e3e7ef;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--fg);
  background: var(--bg);
}
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4rem; }
h1 { font-size: 1.75rem; font-weight: 600; }
h2 { font-size: 1.05rem; font-weight: 600; }
code { background: #eef1f7; padding: .1rem .35rem; border-radius: 4px; font-size: .9em; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 760px; }
main.wrap { padding-top: 24px; padding-bottom: 40px; display: flex; flex-direction: column; gap: 18px; }

/* Top bar */
.topbar { background: var(--primary); color: #fff; border-bottom: 4px solid var(--accent); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand strong { display: block; font-size: 1.05rem; font-weight: 600; }
.brand small { display: block; font-size: .75rem; opacity: .85; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; background: var(--accent); position: relative; flex: none; }
.brand-mark::after { content: ""; position: absolute; left: 15px; top: 6px; width: 4px; height: 22px; background: repeating-linear-gradient(var(--primary) 0 5px, transparent 5px 9px); }
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; }
.topbar nav a { color: #fff; text-decoration: none; padding: 6px 12px; border-radius: 8px; font-size: .9rem; font-weight: 500; opacity: .9; }
.topbar nav a:hover, .topbar nav a.active { background: rgba(255, 255, 255, .15); opacity: 1; }

/* Hero and filters */
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.lead { margin: 0; color: var(--muted); font-size: 1rem; max-width: 60ch; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; }
.filters label, label.inline { display: flex; flex-direction: column; font-size: .78rem; color: var(--muted); font-weight: 500; gap: 4px; }
select, input, textarea {
  font: inherit; font-size: .92rem; color: var(--fg); background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 40px; width: 100%;
}
.filters select { min-width: 160px; }
select:focus, input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

/* Cards and grids */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.card-head input { max-width: 320px; }
.note { margin: 0 0 12px; color: var(--muted); font-size: .82rem; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 14px; }
.kpi span { display: block; font-size: .8rem; color: var(--muted); font-weight: 500; }
.kpi strong { display: block; font-size: 2rem; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; color: var(--primary); }
.kpi-bad strong { color: var(--bad); }
.kpi .kpi-date { font-size: 1.25rem; padding-top: .45rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 18px; }
.chart { position: relative; height: 280px; }
.section-title { font-size: 1.25rem; margin-top: 10px; }
.coverage { font-size: 1.6rem; margin: 10px 0; }
.coverage strong { color: var(--primary); font-weight: 600; }
.updated { font-size: .78rem; text-align: right; margin: 0; }

/* Tables */
.table-box { overflow: auto; max-height: 560px; }
.table-box.tall { max-height: none; padding: 0; }
.table { width: 100%; border-collapse: collapse; font-size: .86rem; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; padding: 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 1; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:hover td { background: #f8f9fc; }
.table .num { text-align: right; }
.table .summary { max-width: 360px; color: var(--muted); }
.table.compact td, .table.compact th { padding: 7px 8px; }
.table tr.total td { font-weight: 600; }
.nowrap { white-space: nowrap; }
.tag { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: #fff4d6; color: #7a5200; font-size: .72rem; font-weight: 500; white-space: nowrap; }
.bad { color: var(--bad); }

/* Forms and buttons */
.form { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: .86rem; font-weight: 500; }
.row-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 14px; }
.row-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 14px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px 14px; margin: 0; }
legend { font-size: .82rem; color: var(--muted); padding: 0 6px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 500; font-size: .9rem; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--primary); background: var(--primary); color: #fff; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-ghost:hover { background: #eef2fb; }
.btn-danger { background: var(--bad); border-color: var(--bad); }
.btn-sm { padding: 5px 10px; font-size: .8rem; }
.form .btn { align-self: flex-start; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form { display: inline; margin: 0; }
.alert { padding: 10px 14px; border-radius: 8px; font-size: .9rem; margin: 0; }
.alert ul { margin: 0; padding-left: 18px; }
.alert-ok { background: #e8f5e9; color: var(--ok); }
.alert-warn { background: #fff6e0; color: #6b4500; }
.alert-bad { background: #fdecea; color: var(--bad); }
.found { background: #f6f8fc; border: 1px dashed var(--line); border-radius: 10px; padding: 12px 14px; margin: 12px 0; }
.found p { margin: 0 0 6px; }
.plain { padding-left: 18px; }

/* Admin */
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 500; font-size: .9rem; border: 1px solid transparent; }
.tabs a.active { background: var(--panel); border-color: var(--line); color: var(--fg); box-shadow: var(--shadow); }
.count { display: inline-block; min-width: 22px; padding: 0 6px; border-radius: 999px; background: #e9edf5; font-size: .75rem; text-align: center; }

/* Footer */
.footer { background: #0e1a33; color: #cfd6e4; padding: 24px 0; font-size: .84rem; }
.footer p { margin: 0 0 6px; }
.footer a { color: #fff; }
.footer .muted { color: #9aa6bd; }

@media (max-width: 900px) { .hide-md { display: none; } }
@media (max-width: 600px) {
  .hide-sm { display: none; }
  h1 { font-size: 1.4rem; }
  .kpi strong { font-size: 1.6rem; }
  .card { padding: 16px; }
  .filters { width: 100%; }
  .filters label { flex: 1; }
  .filters select { min-width: 0; }
  .card-head input { max-width: none; }
}
