:root {
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #eb6834;      /* ember orange — brand only, never a data series */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
}

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */
.site-header {
  background: #241a14;
  color: #fff;
  border-bottom: 4px solid var(--accent);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px; padding-top: 12px; padding-bottom: 12px;
}
.brand { color: #fff; font-weight: 700; font-size: 1.25rem; text-decoration: none; }
.site-header nav { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.site-header nav a {
  color: #e8ded6; text-decoration: none; padding: 6px 10px; border-radius: 6px;
  font-size: 0.95rem;
}
.site-header nav a:hover { background: rgba(255, 255, 255, 0.12); }
.site-header nav a.active { background: var(--accent); color: #fff; font-weight: 600; }
.site-header nav a.user { color: #fff; font-weight: 600; }

main.wrap { padding-top: 24px; padding-bottom: 48px; }

h1 { font-size: 1.6rem; margin: 0 0 4px; }
h2 { font-size: 1.15rem; margin: 28px 0 10px; }
.sub { color: var(--ink-2); margin: 0 0 20px; }

/* ---------- stat tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 20px 0; }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px;
}
.tile .value { font-size: 1.7rem; font-weight: 700; }
.tile .label { color: var(--ink-2); font-size: 0.85rem; }
.tile .chip { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }

/* ---------- tables ---------- */
.table-scroll { overflow-x: auto; }
table.data {
  width: 100%; border-collapse: collapse; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
}
table.data th {
  text-align: left; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--grid);
}
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--grid); vertical-align: top; }
table.data tr:last-child td { border-bottom: none; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tfoot td { font-weight: 700; background: var(--page); }
.stars { color: var(--accent); letter-spacing: 2px; }

/* ---------- category tabs ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0; }
.tabs a {
  text-decoration: none; color: var(--ink-2); background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; font-size: 0.9rem;
}
.tabs a.active { color: #fff; border-color: transparent; font-weight: 600; }

/* ---------- bar chart (single series) ---------- */
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; border-bottom: 2px solid #c3c2b7; }
.bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 20px; position: relative; }
.bar-col .bar { width: 100%; max-width: 34px; background: #2a78d6; border-radius: 4px 4px 0 0; }
.bar-col .val {
  position: absolute; top: -22px; font-size: 0.75rem; color: var(--ink-2);
  visibility: hidden; font-variant-numeric: tabular-nums;
}
.bar-col:hover .val, .bar-col.peak .val { visibility: visible; }
.bar-col:hover .bar { background: #1c5cab; }
.bar-labels { display: flex; gap: 6px; margin-top: 6px; }
.bar-labels span { flex: 1; text-align: center; font-size: 0.72rem; color: var(--muted); min-width: 20px; }

/* ---------- forms ---------- */
form.card, .card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 20px; max-width: 640px;
}
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 4px; }
.field .hint { font-size: 0.8rem; color: var(--muted); font-weight: 400; }
input[type=text], input[type=password], input[type=date], input[type=number],
input[type=url], input[type=email], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--grid); border-radius: 8px;
  font: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 80px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; }
.radio-row label { font-weight: 400; display: flex; align-items: center; gap: 6px; }

button, .btn {
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 9px 18px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { filter: brightness(0.92); }
button.secondary, .btn.secondary {
  background: var(--surface); color: var(--ink); border: 1px solid var(--grid);
}
button.danger { background: #d03b3b; }

.flash { border-radius: 8px; padding: 10px 14px; margin: 0 0 16px; font-size: 0.95rem; }
.flash.ok { background: #e7f5e7; color: #006300; border: 1px solid #b7e0b7; }
.flash.err { background: #fdeaea; color: #a12020; border: 1px solid #f0bcbc; }

/* ---------- map ---------- */
.map-layout { display: flex; gap: 16px; align-items: stretch; }
#map { flex: 1; min-height: 560px; border-radius: 10px; border: 1px solid var(--border); }
.map-side {
  width: 230px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px; font-size: 0.92rem;
}
.map-side h3 { margin: 0 0 8px; font-size: 0.85rem; text-transform: uppercase; color: var(--muted); }
.map-side label.cat { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; }
.map-side .swatch { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border); }
.map-side .count { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.map-side select { margin-top: 4px; }

.site-footer { border-top: 1px solid var(--grid); color: var(--muted); font-size: 0.85rem; padding: 16px 0; }

.actions { white-space: nowrap; }
.actions a { color: var(--ink-2); font-size: 0.85rem; }

@media (max-width: 760px) {
  .map-layout { flex-direction: column; }
  .map-side { width: auto; }
  .field-row { flex-direction: column; gap: 0; }
}
