:root {
  --bg: #f6f7f9; --card: #ffffff; --ink: #1d2430; --muted: #5f6b7a; --line: #e2e6eb;
  --accent: #0b3d91; --accent-ink: #ffffff; --accent-soft: #e8eefb; --warn: #fff7e6; --warn-line: #f2c46d;
  --ok: #1f7a4d; --err: #b42318; --pilot: #6d28d9;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11151b; --card: #1a2029; --ink: #e6e9ee; --muted: #9aa5b3; --line: #2b3440;
    --accent: #7aa7ff; --accent-ink: #0d1420; --accent-soft: #1d2a40; --warn: #2a2414; --warn-line: #8a6a22;
    --ok: #4cc38a; --err: #ff6b5e; --pilot: #b794f6; }
  .leaflet-tile { filter: brightness(.8) contrast(1.1); }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: .2rem 0 .4rem; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .err { color: var(--err); }

.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.2rem; padding: .6rem 1rem;
  background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1000; }
.brand { font-weight: 700; text-decoration: none; color: var(--ink); }
.topbar nav { display: flex; flex-wrap: wrap; gap: .2rem .9rem; align-items: center; }
.topbar nav a { text-decoration: none; color: var(--muted); padding: .2rem 0; }
.topbar nav a.on { color: var(--ink); font-weight: 600; border-bottom: 2px solid var(--accent); }
.badge { background: var(--accent); color: var(--accent-ink); border-radius: 9px; padding: 0 .4rem; font-size: .75rem; }
.inline { display: inline; }
.linkish { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font: inherit; }

html, body { overflow-x: hidden; }
.page { max-width: 1080px; margin: 0 auto; padding: 1rem 16px 5rem; }
.page.wide { max-width: 1500px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.1rem; margin: 0 0 1rem; }
.card.warn { background: var(--warn); border-color: var(--warn-line); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .8rem; margin: 1rem 0; }
.tile { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: .8rem 1rem; text-decoration: none; color: var(--muted); }
.tile .big { font-size: 1.8rem; font-weight: 700; color: var(--ink); }
.steps li { margin-bottom: .4rem; }

.btn { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 7px; padding: .5rem .9rem;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn.small { padding: .25rem .6rem; font-size: .85rem; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .6; cursor: wait; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 7px; padding: .4rem .55rem; width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; }
label { display: block; margin: .3rem 0; }
.stack > * { margin-bottom: .5rem; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .6rem; align-items: end; }

.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font-size: .8rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.missing { color: var(--muted); }
.tbl tr.prov td { opacity: .78; }
.tbl tr.unverified td:nth-child(2) { opacity: .65; font-style: italic; }
.tbl tr.grouphead td { background: var(--accent-soft); font-weight: 600; font-size: .85rem; }
.sortable th[data-k] { cursor: pointer; }
.sortable th[data-k]:hover { color: var(--accent); }
.tablewrap { overflow-x: auto; padding: .4rem; }

.pill { display: inline-block; font-size: .72rem; padding: 0 .45rem; border-radius: 9px; border: 1px solid var(--line); color: var(--muted); }
.pill.pilot { border-color: var(--pilot); color: var(--pilot); }
.pill.applying, .pill.done { border-color: var(--ok); color: var(--ok); }
.pill.long_list, .pill.in_progress { border-color: var(--accent); color: var(--accent); }
.pill.dropped { text-decoration: line-through; }

.flash { padding: .6rem .9rem; border-radius: 8px; margin-bottom: .8rem; background: var(--accent-soft); }
.flash.error { background: #fde8e6; color: #7a1a12; }
.flash.success { background: #e5f5ec; color: #14532d; }
@media (prefers-color-scheme: dark) { .flash.error { background: #3b1714; color: #ffb4ab; } .flash.success { background: #12301f; color: #a7f3c5; } }

.explore { display: grid; grid-template-columns: 290px 1fr; gap: 1rem; align-items: start; }
.explore > * { min-width: 0; }
@media (max-width: 900px) { .explore { grid-template-columns: 1fr; } .explore .results { order: -1; } }
.controls { position: sticky; top: 4rem; }
@media (max-width: 900px) { .controls { position: static; } }
.slider label { display: flex; justify-content: space-between; font-size: .88rem; margin-bottom: 0; }
.slider input { padding: 0; }
.savebox { margin: .6rem 0 1rem; } .savebox > * { margin-top: .4rem; }
.map { height: 420px; border-radius: 10px; border: 1px solid var(--line); margin-bottom: 1rem; }
@media (max-width: 600px) { .map { height: 300px; } }

.dossier-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.scorebox { text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .6rem 1.2rem; }
.scorebox .big { font-size: 2.2rem; font-weight: 700; line-height: 1.1; }

.review-item { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.review-item:last-child { border-bottom: 0; }
.compare { display: flex; gap: 1.2rem; flex-wrap: wrap; margin: .2rem 0; }
.conflict { color: var(--err); font-weight: 600; }
.ri-actions { display: flex; flex-direction: column; gap: .3rem; align-items: flex-end; }
blockquote { margin: .3rem 0; padding-left: .7rem; border-left: 3px solid var(--line); color: var(--muted); }

.prose { line-height: 1.6; } .prose table { border-collapse: collapse; } .prose td, .prose th { border: 1px solid var(--line); padding: .3rem .5rem; }

.login { max-width: 380px; margin: 4rem auto; }
.fab { position: fixed; right: 16px; bottom: 16px; z-index: 1100; background: var(--pilot); color: #fff; border: 0;
  border-radius: 22px; padding: .6rem 1rem; font: inherit; font-weight: 600; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.dlg { border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); width: min(520px, 92vw); }
.dlg::backdrop { background: rgba(0,0,0,.35); }
.kinds { display: flex; gap: 1rem; flex-wrap: wrap; margin: .4rem 0; }
.kinds label { display: inline-flex; gap: .3rem; align-items: center; margin: 0; }
.row-end { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .6rem; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 1rem 0 4rem; }
