/* Free Wheelers Scotland - Cloudflare edition. Saltire blue on road-atlas paper. */
:root {
  --paper: #f3efe6;
  --paper-2: #ebe5d8;
  --card: #fbf8f1;
  --ink: #18212d;
  --ink-2: #4a5462;
  --muted: #6b7380;
  --line: #d9d1c1;
  --primary: #1d4f91;
  --primary-ink: #133867;
  --primary-soft: #e2e9f3;
  --night: #121a24;
  --rail: #2f7a4f;
  --rail-soft: #e3efe6;
  --amber: #b4471f;
  --amber-soft: #fbefd9;
  --danger: #a3261b;
  --sign-green: #00703c;
  --sign-yellow: #ffd200;
  --sign-blue: #0b5bab;
  --r: 14px;
  --font: "Archivo", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.6 var(--font); -webkit-font-smoothing: antialiased; min-height: 100dvh; display: flex; flex-direction: column; }
body::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 100; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
main { flex: 1; outline: none; }
img { max-width: 100%; display: block; }
img.img-failed { visibility: hidden; }
a { color: var(--primary); }
h1, h2, h3, h4 { margin: 0; line-height: 1.1; letter-spacing: -.02em; }
p { margin: 0 0 .8em; }
.wrap { width: min(1120px, 100% - 40px); margin-inline: auto; }
.narrow { width: min(760px, 100% - 40px); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.strong { font-weight: 600; }
.grow { flex: 1; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--card); padding: 8px 12px; z-index: 200; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--sign-yellow); outline-offset: 2px; }

.eyebrow { font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--primary); margin: 0 0 .5em; }
.kicker { display: inline-block; font-size: .72rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; padding: 6px 12px; border-radius: 99px; background: rgba(255,255,255,.12); color: #d6e2f3; margin-bottom: 22px; }
.h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 900; margin-bottom: .35em; }
.h1 em, .h3 em, .hero-title em { font-style: normal; color: var(--primary); }
.h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 900; margin-bottom: .5em; }
.h3 { font-size: 1.35rem; font-weight: 800; margin-bottom: .3em; }
.lede { font-size: 1.08rem; color: var(--ink-2); max-width: 62ch; }
.lede.dim { opacity: .7; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; font: 700 .92rem var(--font); padding: 11px 20px; border-radius: 10px; border: 1.5px solid transparent; cursor: pointer; text-decoration: none; transition: transform .15s, background-color .15s, opacity .15s; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-primary { background: var(--primary); color: #f6f8fb; }
.btn-primary:hover { background: var(--primary-ink); }
.btn-line { border-color: rgba(255,255,255,.4); color: #eef2f7; }
.btn-line:hover { background: rgba(255,255,255,.1); }
.btn-line-dark { border-color: rgba(243,239,230,.35); color: var(--paper); background: transparent; }
.btn-ghost { background: var(--card); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--primary); }
.btn-danger { background: transparent; border-color: #e3b8b2; color: var(--danger); }
.btn-danger:hover { background: #f7e3df; }
.btn-sm { padding: 7px 12px; font-size: .82rem; }
.btn-lg { padding: 15px 28px; font-size: 1rem; }
.link-strong { font-weight: 800; text-decoration: none; }
.back { display: inline-block; font-weight: 700; text-decoration: none; margin: 8px 0 22px; }
.back::before { content: "\2190  "; }

/* Header */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1000; }
.header-row { display: flex; align-items: center; gap: 16px; padding: 10px 0; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand-logo { width: 44px; height: 44px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 1.2rem; font-weight: 900; letter-spacing: -.02em; }
.brand-text small { font-size: .66rem; color: var(--muted); margin-top: 3px; }
.nav-count { margin-left: auto; font-size: .76rem; color: var(--muted); }
.admin-link { font-size: .8rem; color: var(--muted); text-decoration: none; font-weight: 600; }
.admin-link.active, .admin-link:hover { color: var(--primary); }
.main-nav { display: flex; }
.nav-links { display: flex; gap: 4px; }
.nav-link { padding: 10px 14px; font-weight: 700; font-size: .9rem; color: var(--ink-2); text-decoration: none; border-bottom: 3px solid transparent; }
.nav-link:hover { color: var(--ink); }
.nav-link.active { color: var(--primary); border-bottom-color: var(--primary); }
.mobile-nav { display: none; }
@media (max-width: 767px) {
  .nav-count { display: none; }
  .admin-link { margin-left: auto; }
  .nav-links { display: none; }
  .mobile-nav { display: block; width: 100%; padding-bottom: 8px; }
  .mobile-nav summary { cursor: pointer; font-weight: 800; padding: 8px 0; list-style: none; }
  .mobile-nav summary::after { content: " +"; color: var(--primary); }
  .mobile-links { display: grid; }
  .mobile-links .nav-link { border-bottom: 1px solid var(--line); border-left: 3px solid transparent; }
  .mobile-links .nav-link.active { border-left-color: var(--primary); }
}

/* Footer */
.site-footer { background: var(--night); color: #c9cfd8; margin-top: 64px; padding: 36px 0; }
.site-footer strong { color: var(--paper); }
.footer-row { display: flex; gap: 32px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.footer-row p { max-width: 60ch; font-size: .88rem; margin-top: 6px; }
.footer-actions { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }

/* Page scaffolding */
.page { padding-block: 32px 24px; animation: rise .45s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.page-head { margin-bottom: 26px; }
.page-home, [data-testid="page-roads"], [data-testid="page-rail"] { padding-top: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; margin-top: 22px; }

/* States */
.skeleton-block { display: grid; gap: 14px; padding: 28px 0; }
.sk { height: 18px; border-radius: 6px; background: linear-gradient(90deg, var(--paper-2), var(--card), var(--paper-2)); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.sk:first-child { height: 42px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.error-box { border: 1.5px solid #e3b8b2; background: #fbf1ee; border-radius: var(--r); padding: 22px; }
.error-box strong { display: block; color: var(--danger); margin-bottom: 4px; }
.empty-box { border: 1.5px dashed var(--line); border-radius: var(--r); padding: 28px; text-align: center; color: var(--ink-2); background: var(--card); margin-top: 22px; }
.empty-box strong { display: block; color: var(--ink); font-size: 1.05rem; margin-bottom: 4px; }

/* Hero */
.hero { position: relative; overflow: hidden; background: var(--night); color: #f1f3f6; min-height: 520px; display: flex; align-items: center; }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: drift 24s ease-in-out infinite alternate; }
@keyframes drift { to { transform: scale(1.06) translateX(-1%); } }
.hero-shade { position: absolute; inset: 0; background: linear-gradient(95deg, rgba(14,20,29,.95) 0%, rgba(14,20,29,.78) 50%, rgba(14,20,29,.35) 100%); }
.hero-inner { position: relative; padding: 72px 0; }
.hero-title { font-size: clamp(2.6rem, 7vw, 5rem); font-weight: 900; line-height: .98; letter-spacing: -.035em; max-width: 14ch; margin-bottom: 22px; }
.hero-title em { color: #7fb0ec; }
.hero-lede { max-width: 54ch; color: rgba(241,243,246,.72); font-size: 1.08rem; margin-bottom: 30px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .kicker, .hero-title, .hero-lede, .hero-actions { animation: rise .7s ease both; }
.hero-title { animation-delay: .08s; } .hero-lede { animation-delay: .16s; } .hero-actions { animation-delay: .24s; }

.statbar { background: var(--primary); color: #eef3fa; }
.statbar-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.stat { padding: 20px 16px; text-align: center; border-left: 1px solid rgba(255,255,255,.18); display: flex; flex-direction: column; }
.stat:first-child { border-left: 0; }
.stat-n { font-size: 1.6rem; font-weight: 600; }
.stat-l { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; opacity: .75; }
@media (max-width: 640px) { .statbar-grid { grid-template-columns: 1fr; } .stat { border-left: 0; border-top: 1px solid rgba(255,255,255,.18); } }

.home-body { padding-top: 52px; }
.block { margin-bottom: 44px; }
.people { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.person { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; padding-bottom: 14px; }
.person:nth-child(even) { transform: translateY(18px); }
.person-img { height: 140px; background: var(--paper-2); overflow: hidden; }
.person-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.person:hover .person-img img { transform: scale(1.05); }
.person h3 { font-size: 1rem; padding: 12px 14px 4px; }
.person p { font-size: .84rem; color: var(--ink-2); padding: 0 14px; margin: 0; }
@media (max-width: 860px) { .people { grid-template-columns: repeat(2, 1fr); } .person:nth-child(even) { transform: none; } }

.petition { display: flex; gap: 24px; align-items: center; justify-content: space-between; flex-wrap: wrap; border: 2px solid var(--primary); background: var(--primary-soft); border-radius: 18px; padding: 30px; margin: 30px 0 40px; }
.petition > div { max-width: 60ch; }

.folds { display: grid; gap: 10px; margin-bottom: 48px; }
.fold { border: 1px solid var(--line); border-radius: var(--r); background: var(--card); overflow: hidden; }
.fold summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; padding: 18px 22px; font-weight: 800; }
.fold summary::-webkit-details-marker { display: none; }
.chev { color: var(--primary); font-weight: 900; transition: transform .2s; }
.fold[open] .chev { transform: rotate(45deg); }
.fold-body { border-top: 1px solid var(--line); }
.say-mean { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 20px; }
.say, .mean { border-radius: 12px; padding: 20px; }
.say { border: 1.5px dashed var(--line); color: var(--muted); }
.mean { background: var(--primary-soft); }
.say ul, .mean ul { margin: 0; padding-left: 1.1em; display: grid; gap: 8px; }
.dark-panel { background: var(--night); color: rgba(241,243,246,.75); padding: 28px; }
.dark-panel .h3 { color: #f1f3f6; }
.dark-panel .h3 em { color: #7fb0ec; }
.dark-panel .eyebrow { color: #7fb0ec; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
.heritage { margin: 0; border-radius: 12px; overflow: hidden; height: 220px; background: #1f2a38; }
.heritage img { width: 100%; height: 100%; object-fit: cover; }
.eras { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 24px; }
.era { border: 1px solid rgba(255,255,255,.1); border-radius: 12px; padding: 18px; background: rgba(255,255,255,.04); }
.era-year { font-family: var(--mono); color: #7fb0ec; font-size: .8rem; }
.era h4 { color: #f1f3f6; margin: 6px 0; }
.era p { font-size: .85rem; margin: 0; }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.timeline li { display: flex; gap: 14px; }
.tl-year { font-family: var(--mono); color: #7fb0ec; width: 86px; flex-shrink: 0; font-size: .8rem; padding-top: 2px; }
.timeline strong { color: #f1f3f6; }
.timeline p { font-size: .85rem; margin: 2px 0 0; }
.deployed { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 20px; }
.deployed figure { position: relative; margin: 0; height: 190px; border-radius: 12px; overflow: hidden; background: var(--paper-2); }
.deployed img { width: 100%; height: 100%; object-fit: cover; }
.deployed span { position: absolute; left: 0; right: 0; bottom: 0; padding: 24px 14px 12px; background: linear-gradient(transparent, rgba(14,20,29,.8)); color: #f1f3f6; font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
@media (max-width: 767px) { .say-mean, .split, .eras, .deployed { grid-template-columns: 1fr; } }
.row-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }

/* News */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.filters input, .filters select { width: 100%; }
.fld-inline.grow { flex: 2 1 260px; }
.fld-inline { flex: 1 1 160px; }
input, select, textarea { font: inherit; font-size: .95rem; color: var(--ink); background: var(--card); border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); }
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.news-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; transition: transform .2s, opacity .2s; }
.news-card:hover { transform: translateY(-3px); }
.news-card-link { display: flex; flex-direction: column; height: 100%; color: inherit; text-decoration: none; }
.news-thumb { height: 170px; background: var(--paper-2); overflow: hidden; }
.news-thumb img { width: 100%; height: 100%; object-fit: cover; }
.no-photo { display: grid; place-items: center; background: repeating-linear-gradient(135deg, var(--paper-2) 0 14px, var(--paper) 14px 28px); }
.thumb-mark { font-size: 3rem; font-weight: 900; color: var(--line); }
.news-body { padding: 16px; display: flex; flex-direction: column; flex: 1; }
.news-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .74rem; color: var(--muted); margin-bottom: 8px; }
.news-meta .eyebrow { margin: 0; }
.news-body h3 { font-size: 1.05rem; margin-bottom: 6px; }
.news-card:hover h3 { color: var(--primary); }
.clamp { font-size: .86rem; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.news-foot { margin-top: auto; display: flex; justify-content: space-between; gap: 8px; font-size: .82rem; }
.money { font-family: var(--mono); font-weight: 600; color: var(--primary); }
.money.big { font-size: 1.8rem; }
.flag { font-size: .66rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; background: var(--primary-soft); color: var(--primary-ink); padding: 3px 8px; border-radius: 99px; }
.flag-amber { background: var(--amber-soft); color: var(--amber); }
.flag-draft { background: var(--paper-2); color: var(--ink-2); }
.chip { background: var(--primary); color: #eef3fa; font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; padding: 5px 10px; border-radius: 6px; }
.article .h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); margin-top: 12px; }
.article-img { width: 100%; max-height: 420px; object-fit: cover; border-radius: var(--r); margin: 18px 0; }
.cost-panel { display: flex; flex-wrap: wrap; gap: 0; margin: 20px 0 28px; border: 1px solid #c4d3e8; background: var(--primary-soft); border-radius: var(--r); }
.cost-panel > div { padding: 16px 22px; border-left: 1px solid #c4d3e8; }
.cost-panel > div:first-child { border-left: 0; }
.cost-panel dt { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.cost-panel dd { margin: 2px 0 0; font-weight: 700; }
.prose { font-size: 1.08rem; line-height: 1.75; white-space: pre-line; }
.footnote { margin-top: 32px; padding-top: 18px; border-top: 1px solid var(--line); font-size: .85rem; font-style: italic; color: var(--muted); }

/* Bands for roads/rail */
.band { padding: 60px 0 44px; margin-bottom: 32px; border-bottom: 1px solid var(--line); }
.band-road { background: var(--primary-soft); }
.band-road .kicker { background: var(--card); color: var(--primary); border: 1px solid #c4d3e8; }
.band-rail { background: #10211a; color: #e5eee8; }
.band-rail .kicker { background: rgba(127,201,154,.15); color: #a9dcbb; }
.band-rail .h1 em { color: #7fc99a; }
.band-rail .lede { color: rgba(229,238,232,.72); }
.badge-key { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-size: .8rem; color: var(--ink-2); margin-top: 18px; }

/* Road number badges */
.road-badge { display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: .85rem; padding: 4px 9px; border-radius: 5px; border: 2px solid; min-width: 40px; letter-spacing: 0; white-space: nowrap; }
.badge-motorway { background: var(--sign-blue); color: #fff; border-color: #fff; box-shadow: 0 0 0 1.5px var(--sign-blue); }
.badge-primary { background: var(--sign-green); color: var(--sign-yellow); border-color: #fff; box-shadow: 0 0 0 1.5px var(--sign-green); }
.badge-nonprimary { background: #fff; color: #111; border-color: #111; }
.badge-lg { font-size: 1.35rem; min-width: 64px; height: 54px; padding: 0 12px; }

/* Project cards */
.projects { display: grid; gap: 26px; }
.project { background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; scroll-margin-top: 140px; }
.project-photo-wrap { height: 260px; background: var(--paper-2); }
.project-photo { width: 100%; height: 100%; object-fit: cover; }
.project-head { display: flex; gap: 16px; align-items: flex-start; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.project-head .h3 { font-size: 1.55rem; }
.rail-label { font-family: var(--mono); background: var(--rail); color: #eef6f1; padding: 6px 10px; border-radius: 6px; font-weight: 600; }
.project-rail .eyebrow { color: var(--rail); }
.phase { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.phase span { font-size: .7rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; padding: 4px 10px; border-radius: 99px; }
.phase-open { background: var(--rail); color: #eef6f1; }
.phase-proposed { border: 1.5px dashed var(--amber); color: var(--amber); }
.phase-note { margin: 0; padding: 12px 24px; background: var(--rail-soft); font-size: .88rem; border-bottom: 1px solid var(--line); }
.project-cols { display: grid; grid-template-columns: 1fr 1fr; }
.project-cols > section { padding: 22px 24px; }
.col-official { background: var(--paper); border-left: 1px solid var(--line); }
.col-label { font-size: .7rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--primary); }
.project-rail .col-label:not(.muted) { color: var(--rail); }
.col-label.muted { color: var(--muted); }
.ticks { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.ticks li { position: relative; padding-left: 24px; font-size: .94rem; }
.ticks li::before { content: ""; position: absolute; left: 2px; top: .45em; width: 11px; height: 6px; border-left: 2.5px solid var(--primary); border-bottom: 2.5px solid var(--primary); transform: rotate(-45deg); }
.project-rail .ticks li::before { border-color: var(--rail); }
.status-pill { display: inline-block; border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 4px 12px; font-size: .8rem; font-weight: 700; }
.note { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 10px 12px; font-size: .84rem; color: var(--ink-2); border-left: 3px solid var(--primary); }
.ext { font-weight: 700; text-decoration: none; display: inline-flex; gap: 4px; align-items: baseline; }
.ext:hover { text-decoration: underline; }
.ext-arrow { font-size: .8em; }
.reviewed { margin: 0; padding: 10px 24px; border-top: 1px solid var(--line); font-size: .78rem; color: var(--muted); }
.emergency { background: var(--amber-soft); border-top: 1px solid #ecd3a8; padding: 22px 24px; }
.em-tag { font-size: .7rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--amber); }
.emergency h3 { font-size: 1.2rem; margin-bottom: 10px; }
.em-sources { padding-left: 1.1em; font-size: .85rem; display: grid; gap: 4px; margin: 10px 0 0; }
@media (max-width: 767px) { .project-cols { grid-template-columns: 1fr; } .col-official { border-left: 0; border-top: 1px solid var(--line); } .project-photo-wrap { height: 190px; } }
.source-list { margin-top: 28px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; }
.source-list ul { margin: 0; padding-left: 1.1em; display: grid; gap: 6px; }
.view-panel { background: #10211a; color: rgba(229,238,232,.75); border-radius: 18px; padding: 30px; margin-top: 36px; }
.view-panel .h2 { color: #f1f5f2; }
.view-panel .split > div { border-radius: 12px; padding: 18px; }
.vp-road { background: rgba(29,79,145,.25); } .vp-road .eyebrow { color: #9cc0ee; }
.vp-rail { background: rgba(47,122,79,.25); } .vp-rail .eyebrow { color: #7fc99a; }
.view-panel ul { margin: 0; padding-left: 1.1em; display: grid; gap: 6px; font-size: .9rem; }

/* Fuel */
.pie-wrap { max-width: 340px; margin: 10px auto; }
.pie { width: 100%; height: auto; }
.pie-label { font: 700 11px var(--font); fill: #14202b; }
.legend { margin: 16px 0 0; padding-top: 16px; border-top: 1px solid var(--line); display: grid; gap: 12px; }
.legend-row { display: flex; gap: 12px; align-items: flex-start; }
.swatch { width: 14px; height: 14px; border-radius: 3px; margin-top: 5px; flex-shrink: 0; }
.legend dt { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; font-weight: 700; font-size: .92rem; }
.legend dd { margin: 0; font-size: .82rem; color: var(--muted); }
.total { background: var(--primary-soft); border-radius: 10px; padding: 12px 16px; margin: 16px 0 0; }
.sources { margin-top: 20px; color: var(--muted); }

/* Map */
.map-shell { display: grid; grid-template-columns: 240px 1fr; gap: 16px; }
.map-controls { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.map-canvas { height: min(70dvh, 640px); min-height: 380px; border-radius: var(--r); border: 1px solid var(--line); overflow: hidden; z-index: 0; }
.layer-toggle { display: flex; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-weight: 600; font-size: .88rem; cursor: pointer; }
.layer-toggle .dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); flex-shrink: 0; }
.layer-toggle .count { margin-left: auto; font-family: var(--mono); font-size: .78rem; color: var(--muted); }
@media (max-width: 767px) { .map-shell { grid-template-columns: 1fr; } .map-canvas { height: 60dvh; } }
.popup { display: grid; gap: 3px; font-family: var(--font); min-width: 190px; }
.popup .eyebrow { margin: 0; }
.popup a { font-weight: 700; margin-top: 4px; }

/* Dialog */
.dialog { border: 1px solid var(--line); border-radius: 18px; background: var(--card); color: var(--ink); padding: 26px; width: min(560px, 100% - 32px); max-height: 85dvh; }
.dialog::backdrop { background: rgba(18,26,36,.55); }
.credits { list-style: none; padding: 0; margin: 14px 0 20px; display: grid; gap: 14px; }
.credits li { display: grid; gap: 2px; padding-bottom: 12px; border-bottom: 1px solid var(--line); font-size: .9rem; }
.credit-links { display: flex; gap: 14px; flex-wrap: wrap; font-size: .84rem; }

/* Admin */
.login-card { max-width: 420px; margin: 40px auto; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 32px; }
.login-logo { width: 56px; height: 56px; object-fit: contain; margin-bottom: 14px; }
.login-form { display: grid; gap: 14px; margin-top: 10px; }
.notice { background: var(--primary-soft); padding: 10px 14px; border-radius: 10px; font-size: .9rem; }
.form-error { color: var(--danger); font-weight: 600; font-size: .9rem; }
.form-error ul { margin: 8px 0; padding-left: 1.2em; }
.admin-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; }
.admin-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.admin-tab { font: 700 .9rem var(--font); background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.admin-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.flash { background: var(--rail-soft); color: #1d5236; border-radius: 10px; padding: 10px 14px; font-weight: 600; font-size: .9rem; }
.admin-bar { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; }
.admin-bar input { max-width: 340px; }
.admin-bar p { margin: 0; }
.admin-list { display: grid; gap: 8px; }
.admin-row { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.admin-row .grow { display: flex; flex-direction: column; gap: 2px; }
.flags { display: flex; gap: 6px; margin-top: 4px; }
.editor { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 24px; display: grid; gap: 18px; }
.editor-head, .editor-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.editor-foot { justify-content: flex-end; position: sticky; bottom: 0; background: var(--card); padding-top: 12px; border-top: 1px solid var(--line); }
.group { border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin: 0 0 14px; display: grid; gap: 12px; }
.group legend, .group > summary { font-weight: 800; font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--primary); padding: 0 6px; }
.group > summary { cursor: pointer; padding: 0; }
details.group:not([open]) { gap: 0; }
.fld { display: grid; gap: 5px; font-size: .85rem; font-weight: 700; }
.hint { font-weight: 400; color: var(--muted); font-size: .78rem; margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 767px) { .grid2, .grid3 { grid-template-columns: 1fr; } .admin-row { flex-wrap: wrap; } }
.checks { display: flex; gap: 20px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; cursor: pointer; }
.img-preview { width: 120px; height: 76px; border-radius: 8px; overflow: hidden; background: var(--paper-2); display: grid; place-items: center; flex-shrink: 0; border: 1px solid var(--line); }
.img-preview img { width: 100%; height: 100%; object-fit: cover; }
.picker-canvas { height: 320px; border-radius: 12px; border: 1px solid var(--line); z-index: 0; }
.picker .hint { margin-top: 6px; }
.settings { display: grid; gap: 10px; }
.rail-feature-image { width: 100%; max-height: 340px; object-fit: cover; border-radius: 16px; margin-top: 24px; }
.setting-row { display: flex; gap: 14px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
@media (max-width: 640px) { .setting-row { flex-wrap: wrap; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
