/* Reachline shared stylesheet.
   Look A "Wayfinding": road-sign green plates, signal amber for actions and "your turn",
   Overpass type. Spec: design-system/reachline/MASTER.md. Data colours (viridis) live in
   the pages that draw data, not here. */

:root {
  --bg: #f2f5f1;
  --surface: #ffffff;
  --surface-2: #e9eee9;
  --ink: #17241d;
  --ink2: #4b5a51;
  --line: #d6ded7;
  --line-strong: #b9c6bc;
  --sign: #0d6a4b;
  --sign-ink: #ffffff;
  --sign-text: #0d6a4b;   /* green used as text: 6.6:1 on white */
  --sign-night: #3fb488;  /* green used as text on night grounds: 5.8-7.2:1 */
  --amber: #e3a21a;
  --amber-ink: #2b1d00;
  --link: #0d6a4b;
  --ok-bg: #e3f2e9;  --ok-text: #11613f;
  --warn-bg: #fbf0d9; --warn-text: #7a4c00;
  --err-bg: #fdeaea;  --err-text: #a12626;
  --info-bg: #e8eef2;
  /* map drawing (light ground) */
  --road: #c3cec5;
  --bldg: #e3e9e3;
  --bldg-edge: #cdd7cf;

  --night: #0b1410;
  --night-2: #111d17;
  --night-ink: #e6efe9;
  --night-dim: #93a89b;
  --night-line: #22332a;

  --font: "Overpass", "Segoe UI", system-ui, sans-serif;
  --radius: 9px;
  --radius-lg: 14px;

  /* Older template names, mapped onto the Reachline tokens until each page is rebuilt. */
  --panel: var(--surface);
  --text: var(--ink);
  --muted: var(--ink2);
  --accent: var(--sign);
  --accent-text: var(--sign-ink);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1713; --surface: #16211b; --surface-2: #1c2a22;
    --ink: #e6efe9; --ink2: #a3b3a9; --line: #26352c; --line-strong: #36493d;
    --sign: #14825d; --sign-text: #3fb488; --amber: #f0b43a; --link: #5cc89b;
    --ok-bg: #12301f; --ok-text: #7fd6a8;
    --warn-bg: #33270e; --warn-text: #f0c46a;
    --err-bg: #3a1717; --err-text: #f19a9a;
    --info-bg: #1a2730;
    --road: #33463b; --bldg: #1d2a23; --bldg-edge: #2b3c32;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1713; --surface: #16211b; --surface-2: #1c2a22;
  --ink: #e6efe9; --ink2: #a3b3a9; --line: #26352c; --line-strong: #36493d;
  --sign: #14825d; --sign-text: #3fb488; --amber: #f0b43a; --link: #5cc89b;
  --ok-bg: #12301f; --ok-text: #7fd6a8;
  --warn-bg: #33270e; --warn-text: #f0c46a;
  --err-bg: #3a1717; --err-text: #f19a9a;
  --info-bg: #1a2730;
  --road: #33463b; --bldg: #1d2a23; --bldg-edge: #2b3c32;
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.55; }
h1, h2, h3, h4 { line-height: 1.12; text-wrap: balance; letter-spacing: -.015em; }
h1 { font-size: clamp(28px, 3.4vw, 38px); font-weight: 900; }
h2 { font-size: 22px; font-weight: 800; }
h3 { font-size: 18px; font-weight: 800; }
a { color: var(--link); }
img, svg, canvas { max-width: 100%; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--amber) 45%, transparent); color: var(--ink); }
html { scrollbar-color: var(--line-strong) transparent; }
a { text-underline-offset: 3px; }
table { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.muted { color: var(--ink2); }
.num, td.num, th.num { font-variant-numeric: tabular-nums; }
.wrap { max-width: 1180px; margin: 0 auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 900; font-size: 20px; letter-spacing: -.01em; color: inherit; text-decoration: none; }
.logo-mark { display: block; width: 34px; height: 34px; flex: none; }

/* ---------- app header (signed-in pages) ---------- */
/* The account pages use the same night bar as the public header (home, pricing). */
.site-head { background: var(--night); color: var(--night-ink); border-bottom: 1px solid var(--night-line); }
.site-head .inner { max-width: 1180px; margin: 0 auto; padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-head nav { display: flex; align-items: center; gap: 6px 18px; flex-wrap: wrap; font-size: 15px; font-weight: 600; }
.site-head nav a { color: var(--night-dim); text-decoration: none; }
.site-head nav a.btn { color: var(--amber-ink); }
.site-head nav a:hover { color: var(--night-ink); }
.site-head nav a.btn:hover { color: var(--amber-ink); }
.site-head nav a[aria-current="page"] { opacity: 1; text-decoration: underline; text-underline-offset: 4px; }
.site-head .who { opacity: .78; font-weight: 400; }

main.app { max-width: 1180px; margin: 0 auto; padding: 28px 16px 64px; }

/* ---------- footer ---------- */
.site-foot { border-top: 1px solid var(--line); }
.site-foot .inner { max-width: 1180px; margin: 0 auto; padding: 22px 16px 32px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 20px; font-size: 14px; color: var(--ink2); }
.site-foot nav { display: flex; gap: 18px; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 11px 20px 9px; border: 0; border-radius: var(--radius); font: inherit; font-weight: 800; font-size: 16px; line-height: 1.2; cursor: pointer; text-decoration: none; background: var(--amber); color: var(--amber-ink); }
.btn:hover { filter: brightness(1.04); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; filter: none; }
.btn.secondary { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line-strong); }
.btn.sign { background: #0d6a4b; color: #fff; }
.btn.ghost { background: transparent; color: inherit; box-shadow: inset 0 0 0 2px currentColor; }
.btn.danger { background: var(--err-bg); color: var(--err-text); box-shadow: inset 0 0 0 2px var(--err-text); }
.btn.small { min-height: 36px; padding: 8px 14px 6px; font-size: 14px; }

/* ---------- notes ---------- */
.note { padding: 12px 16px; border-radius: var(--radius); background: var(--info-bg); }
.note.ok { background: var(--ok-bg); color: var(--ok-text); }
.note.warn { background: var(--warn-bg); color: var(--warn-text); }
.note.err { background: var(--err-bg); color: var(--err-text); }

/* ---------- tables ---------- */
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { font-size: 13.5px; font-weight: 700; color: var(--ink2); }
td.num, th.num { text-align: right; }
.table-scroll { overflow-x: auto; }

/* ---------- forms ---------- */
label { font-weight: 600; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 12px 7px; min-height: 44px; max-width: 100%;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--amber); outline-offset: 1px; border-color: transparent; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--sign); width: 18px; height: 18px; }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; }

/* ---------- route: the stops of a project (MASTER idea 1) ---------- */
.route { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--stops, 5), minmax(0, 1fr)); }
.route li { position: relative; padding: 36px 16px 0 0; }
.route li::before { content: ""; position: absolute; top: 10px; left: 0; right: 0; height: 4px; background: var(--line); }
.route li::after { content: ""; position: absolute; top: 0; left: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 4px solid var(--line); transition: background .5s, border-color .5s; }
.route li .fill { position: absolute; top: 10px; left: 0; height: 4px; width: 0; background: var(--sign); transition: width .9s ease; }
.route li.lit .fill { width: 100%; }
.route li.lit::after { background: var(--sign); border-color: var(--sign); }
.route li.you.lit::after { background: var(--amber); border-color: var(--amber); }
.route .n { font-weight: 900; color: var(--sign-text); font-size: 15px; }
.route h3 { font-size: 20px; margin: 2px 0 6px; }
.route p { margin: 0; font-size: 15.5px; color: var(--ink2); }
@media (max-width: 820px) {
  .route { grid-template-columns: 1fr; gap: 22px; }
  .route li { padding: 0 0 0 44px; }
  .route li::before { top: 0; bottom: -22px; left: 10px; right: auto; width: 4px; height: auto; }
  .route li:last-child::before { display: none; }
  .route li .fill { top: 0; left: 10px; width: 4px; height: 0; transition: height .9s ease; }
  .route li.lit .fill { width: 4px; height: calc(100% + 22px); }
  .route li:last-child .fill { display: none; }
}

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

/* ---------- account pages (django-allauth) ---------- */
.entrance-main { padding: 48px 16px 72px; display: grid; justify-items: center; }
.entrance-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: calc(100vh - 120px); }
/* Real Reachline output (Sheikh Zayed City, every street by Pull Score) behind a dark fade. */
.entrance-pitch {
  position: relative;
  background:
    linear-gradient(180deg, rgba(11,20,16,.9) 0%, rgba(11,20,16,.55) 38%, rgba(11,20,16,.2) 70%, rgba(11,20,16,.75) 100%),
    image-set(url("backdrops/sheikh-zayed-pull-2400.7e5e166d8335.avif") type("image/avif"), url("backdrops/sheikh-zayed-pull-2400.9bde78fce18d.webp") type("image/webp")) 62% 50% / cover no-repeat,
    var(--night);
  color: var(--night-ink); display: grid; align-items: start; padding: 56px clamp(24px, 5vw, 72px) 64px;
}
.pitch-credit { position: absolute; left: clamp(24px, 5vw, 72px); bottom: 18px; margin: 0; font-size: 13px; color: var(--night-dim); }
.pitch-inner { max-width: 440px; display: grid; gap: 22px; }
.pitch-title { margin: 0; font-size: clamp(34px, 4vw, 52px); font-weight: 900; line-height: 1; letter-spacing: -.035em; }
.pitch-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; font-size: 18px; font-weight: 600; }
.pitch-list li { display: flex; gap: 12px; align-items: center; }
.pitch-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 5px color-mix(in srgb, var(--c) 25%, transparent); }
.pitch-trial { margin: 0; display: inline-block; justify-self: start; background: var(--amber); color: var(--amber-ink); font-weight: 800; padding: 6px 12px 4px; border-radius: 7px; }
.entrance-form { display: grid; place-items: center; padding: 40px 16px 56px; }
.entrance-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 30px 28px 32px; display: grid; gap: 16px; }
.entrance-card h1 { font-size: 32px; margin: 0; }
.entrance-card p { margin: 0; }
.entrance-card .lead { color: var(--ink2); }
.entrance-card .stack { display: grid; gap: 16px; }
.entrance-card .field { display: grid; gap: 6px; }
.entrance-card .field input[type="email"], .entrance-card .field input[type="password"], .entrance-card .field input[type="text"] { width: 100%; }
.entrance-card .field .help { font-size: 13.5px; color: var(--ink2); }
.entrance-card .field-error { font-size: 14px; color: var(--err-text); font-weight: 600; }
.entrance-card .has-error input { border-color: var(--err-text); }
.entrance-card .check { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; }
.entrance-card .row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; flex-wrap: wrap; font-size: 15px; }
.entrance-card .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.entrance-card .switch { color: var(--ink2); font-size: 15px; text-align: center; }
.entrance-card .tips { margin: 0; padding-left: 20px; color: var(--ink2); display: grid; gap: 6px; }
.entrance-card .or { display: flex; align-items: center; gap: 12px; color: var(--ink2); font-size: 14px; }
.entrance-card .or::before, .entrance-card .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.icon-badge { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; background: var(--ok-bg); color: var(--sign); }
.btn.wide { width: 100%; }
/* allauth's own element markup, on pages we haven't rewritten (email management etc.) */
.entrance-card form p { display: grid; gap: 6px; }
.entrance-card button:not(.btn) { font: inherit; font-weight: 800; min-height: 44px; padding: 11px 20px 9px; border: 0; border-radius: var(--radius); background: var(--amber); color: var(--amber-ink); cursor: pointer; justify-self: start; }
.entrance-card ul.errorlist { color: var(--err-text); margin: 0; padding-left: 18px; font-size: 14px; }
@media (max-width: 860px) {
  .entrance-split { grid-template-columns: 1fr; min-height: 0; }
  .entrance-pitch { padding: 28px 16px; order: 2; }
  .pitch-title { font-size: 30px; }
  .pitch-list { font-size: 16px; }
}

/* ---------- study areas list ---------- */
.check.agree, .entrance-card .check.agree { align-items: flex-start; font-weight: 500; line-height: 1.45; }
.check.agree input { margin-top: 3px; flex: none; }
.pay-agree { margin: 4px 0 12px; font-weight: 500; font-size: 14.5px; line-height: 1.45; }
.pay-agree input { margin-top: 3px; flex: none; }
/* Delete my account */
.delete-panel { max-width: 72ch; }
.delete-panel h2 { font-size: 19px; margin: 22px 0 6px; }
.delete-panel h2:first-child { margin-top: 0; }
.delete-panel ul { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 6px; }
.delete-form { display: grid; gap: 14px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.delete-form .actions { display: flex; flex-wrap: wrap; gap: 10px; }
.list-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.list-head h1 { margin: 0 0 4px; }
/* The study areas header as a night banner, with real Reachline output fading in on the right. */
.list-hero { position: relative; overflow: hidden; min-height: 210px; padding: 28px 28px 26px; border-radius: var(--radius-lg);
  color: var(--night-ink); border: 1px solid var(--night-line);
  background:
    linear-gradient(90deg, var(--night) 0%, rgba(11,20,16,.92) 34%, rgba(11,20,16,.35) 62%, rgba(11,20,16,.1) 100%),
    image-set(url("backdrops/sheikh-zayed-clean-2400.165714c82eaf.avif") type("image/avif"), url("backdrops/sheikh-zayed-clean-2400.10d33447fa0e.webp") type("image/webp")) 70% 58% / cover no-repeat,
    var(--night); }
.list-hero h1 { color: #fff; font-size: clamp(30px, 3.4vw, 42px); }
.list-hero .muted, .list-hero p { color: var(--night-dim); }
.list-hero .lede { max-width: 44ch; margin-top: 6px; font-size: 16.5px; }
.list-hero .credit { position: absolute; right: 14px; bottom: 10px; font-size: 12.5px; color: var(--night-dim); background: rgba(11,20,16,.7); padding: 3px 8px 1px; border-radius: 6px; }
@container content (max-width: 600px) { .list-hero { padding: 22px 18px 40px; } .list-hero .credit { left: 18px; right: auto; } }
.list-head p { margin: 0; }
.needs-count { margin-left: 10px; padding: 2px 9px 0; border-radius: 99px; background: var(--amber); color: var(--amber-ink); font-weight: 800; font-size: 13.5px; }

.trial-ready { display: flex; justify-content: space-between; align-items: center; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 22px; padding: 18px 22px; border-radius: var(--radius-lg); background: var(--night); color: var(--night-ink); box-shadow: inset 0 0 0 3px var(--sign), inset 0 0 0 5px rgba(255,255,255,.85); }
.trial-ready h2 { margin: 0 0 4px; font-size: 20px; }
.trial-ready p { margin: 0; color: var(--night-dim); }

.areas { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.area { display: grid; grid-template-columns: 160px minmax(0, 1fr) minmax(170px, auto) auto; gap: 8px 22px; align-items: center; padding: 12px 18px 12px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.area.needs-you { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber); }
.area-thumb { display: block; border-radius: 10px; overflow: hidden; background: var(--bg); line-height: 0; }
.area-main { min-width: 0; display: grid; gap: 6px; }
.area-main h2 { margin: 0; font-size: 19px; overflow-wrap: anywhere; }
.area-main h2 a { color: var(--ink); text-decoration: none; }
.area-main h2 a:hover { text-decoration: underline; }
.area-meta { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; color: var(--ink2); }
.area-status { display: grid; gap: 2px; justify-items: start; }
.status { font-weight: 800; font-size: 15px; }
.status.tone-you { color: var(--warn-text); }
.status.tone-current { color: var(--link); }
.status.tone-done { color: var(--ok-text); }
.status.tone-failed { color: var(--err-text); }
.status-detail { font-size: 13.5px; color: var(--ink2); }
.area-status .price { font-size: 14px; color: var(--ink2); }
.area-action { white-space: nowrap; }
.trial-used { margin-top: 14px; font-size: 14px; }

/* the route, small: one dot per stop */
.mini-route { list-style: none; margin: 2px 0 0; padding: 0; display: grid; grid-template-columns: repeat(var(--stops), 1fr); max-width: 260px; }
.mini-route li { position: relative; height: 14px; }
.mini-route li::before { content: ""; position: absolute; top: 6px; left: 0; right: 0; height: 2px; background: var(--line); }
.mini-route li:first-child::before { left: 5px; }
.mini-route li:last-child::before { right: calc(100% - 5px); }
.mini-route li::after { content: ""; position: absolute; top: 2px; left: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); box-sizing: border-box; }
.mini-route li.done::before { background: var(--sign); }
.mini-route li.done::after { background: var(--sign); border-color: var(--sign); }
.mini-route li.current::after { border-color: var(--sign); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sign) 25%, transparent); }
.mini-route li.you::after { background: var(--amber); border-color: var(--amber); box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 30%, transparent); }
.mini-route li.failed::after { background: var(--err-text); border-color: var(--err-text); }

/* map thumbnails */
svg.thumb { display: block; width: 100%; height: auto; }
.thumb-area { fill: color-mix(in srgb, var(--sign) 7%, transparent); }
.thumb-edge { fill: none; stroke: var(--sign); stroke-width: 1.6; stroke-linejoin: round; }
.thumb-edge.dashed { stroke-dasharray: 4 3; }

.empty-areas { display: grid; justify-items: center; text-align: center; gap: 12px; padding: 48px 20px; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); }
.empty-areas svg { width: 160px; }
.empty-areas h2 { margin: 0; font-size: 24px; }
.empty-areas p { margin: 0; color: var(--ink2); max-width: 46ch; }

@media (max-width: 900px) {
  .area { grid-template-columns: 120px minmax(0, 1fr); }
  .area-status { grid-column: 2; }
  .area-action { grid-column: 1 / -1; justify-self: stretch; }
}
@media (max-width: 480px) {
  .area { grid-template-columns: 88px minmax(0, 1fr); padding: 10px; }
}

@media (max-width: 600px) {
  .site-head .who { display: none; }
}

/* ---------- drawing page ---------- */
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 380px; height: 100dvh; }
.map-pane { position: relative; min-height: 0; }
.map-pane #map { position: absolute; inset: 0; }
#map.drawing, #map.drawing .maplibregl-canvas { cursor: crosshair; }
.map-tip { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 2; background: var(--night); color: var(--night-ink); padding: 8px 14px 6px; border-radius: 8px; font-weight: 700; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: calc(100% - 32px); text-align: center; }
.draw-panel { background: var(--surface); border-left: 1px solid var(--line); overflow-y: auto; padding: 20px 20px 32px; display: grid; gap: 4px; align-content: start; }
.draw-panel h1 { font-size: 26px; margin: 0 0 6px; }
.draw-step { padding: 16px 0; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.draw-step h2 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 10px; }
.step-n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--sign); color: var(--sign-ink); font-size: 13px; font-weight: 900; padding-top: 2px; }
.draw-panel .hint { margin: 0; font-size: 14px; color: var(--ink2); }
.draw-panel .sub { margin: 6px 0 0; font-weight: 800; font-size: 14px; }
.draw-panel .row { display: flex; gap: 8px; flex-wrap: wrap; }
.draw-panel label[for="name"] { font-size: 14px; }
.draw-panel #name { width: 100%; }

.seg { display: grid; grid-template-columns: 1fr 1fr; border: 2px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.seg label { text-align: center; padding: 10px 8px 8px; cursor: pointer; font-weight: 800; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.seg label:has(input:checked) { background: var(--sign); color: var(--sign-ink); }
.seg label:has(input:focus-visible) { outline: 3px solid var(--amber); outline-offset: -5px; }
.seg label:has(input:disabled) { opacity: .45; cursor: not-allowed; }

.option { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; font-weight: 400; }
.option:has(input:checked) { border-color: var(--sign); background: color-mix(in srgb, var(--sign) 7%, transparent); }
.option input { margin-top: 3px; flex: none; }
.option strong { display: block; }
.option small { display: block; color: var(--ink2); font-size: 13.5px; }

.edge-note { font-size: 14px; background: var(--warn-bg); color: var(--warn-text); border-radius: var(--radius); padding: 8px 12px; }
.edge-note summary { font-weight: 800; cursor: pointer; }
.edge-note p { margin: 6px 0 2px; }

.q-area { display: grid; gap: 2px; }
.q-big { font-size: 30px; font-weight: 900; letter-spacing: -.02em; line-height: 1.1; }
.ruler { position: relative; padding-top: 30px; margin: 4px 0; }
.ruler-track { display: flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.ruler-seg { display: grid; padding: 6px 6px 5px; border-left: 1px solid var(--line); min-width: 0; }
.ruler-seg:first-child { border-left: 0; }
.ruler-seg b { font-size: 13.5px; white-space: nowrap; }
.ruler-seg small { font-size: 13px; color: var(--ink2); white-space: nowrap; }
.ruler-seg.on { background: color-mix(in srgb, var(--sign) 16%, transparent); }
.ruler-seg.on b { color: var(--sign-text); }
.ruler-marker { position: absolute; top: 0; bottom: 0; border-left: 2px solid var(--ink); z-index: 1; }
.ruler-marker span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; background: var(--ink); color: var(--surface); font-weight: 800; font-size: 13px; padding: 3px 7px 1px; border-radius: 5px; }
.q-lines td { padding: 6px 0; font-size: 14.5px; }
.q-lines td.num { text-align: right; }
.q-total { display: flex; justify-content: space-between; align-items: baseline; font-weight: 900; font-size: 20px; padding-top: 4px; }
.q-total small { font-size: 13px; color: var(--ink2); font-weight: 700; }
.q-next { margin: 0; font-size: 14px; padding: 8px 12px; border-radius: var(--radius); background: var(--info-bg); }
.cap { display: grid; gap: 4px; }
.cap-bar { height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.cap-bar span { display: block; height: 100%; background: var(--sign); border-radius: 5px; }
.cap-bar span.over { background: var(--err-text); }
.cap-text { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink2); }
#quote { display: grid; gap: 10px; }

@media (max-width: 860px) {
  .workspace { grid-template-columns: 1fr; grid-template-rows: 58vh auto; height: auto; }
  .draw-panel { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
}

/* ---------- project page ---------- */
.crumb { margin: 0 0 6px; font-size: 15px; }
.project-head h1 { margin: 0 0 6px; overflow-wrap: anywhere; }
.project-head .area-meta { margin-bottom: 18px; }
.project-route { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px 20px 16px; margin-bottom: 18px; }
.project-route .route h3 { font-size: 15.5px; }
.project-route .route p { font-size: 13.5px; }
.route li.current::after { border-color: var(--sign); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--sign) 22%, transparent); }
.route li.current .fill { width: 0; }
.route li.you .fill, .route li.failed .fill { width: 0; }
.route li.you p { color: var(--warn-text); font-weight: 700; }
.route li.failed::after { background: var(--err-text); border-color: var(--err-text); }
.route li.failed p { color: var(--err-text); font-weight: 700; }
.route li.todo h3 { color: var(--ink2); font-weight: 600; }

.project-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(300px, 2fr); gap: 18px; align-items: start; }
.map-card #map { height: 460px; border-radius: var(--radius-lg); border: 1px solid var(--line); overflow: hidden; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13.5px; margin: 8px 0 0; color: var(--ink2); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; background: var(--c); vertical-align: -1px; }
.action-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; display: grid; gap: 12px; }
.action-card > p { margin: 0; }
.action-card .hint { margin: 0; font-size: 14px; color: var(--ink2); }
.action-card .sub { margin: 4px 0 0; font-weight: 800; font-size: 14px; }
.status-lg { font-size: 21px; margin: 0; }
.files { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.files a { display: flex; justify-content: space-between; gap: 10px; padding: 8px 12px 6px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--ink); font-size: 14.5px; overflow-wrap: anywhere; }
.files a:hover { border-color: var(--sign); }
.files .dl { color: var(--link); font-weight: 700; flex: none; }
.quote-box { display: grid; gap: 8px; padding: 12px 14px; border-radius: var(--radius); background: var(--bg); }
.refund { display: grid; gap: 8px; padding-top: 6px; border-top: 1px solid var(--line); }
.refund h3 { margin: 0; font-size: 17px; }
.refund form { display: grid; gap: 8px; }
.refund label { font-size: 14px; }
.refund textarea { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); }
.check { display: inline-flex; gap: 8px; align-items: flex-start; font-weight: 600; }

.panel h2 { margin: 0 0 8px; }
.review { margin-top: 18px; display: grid; gap: 10px; }
.review > p { margin: 0; }
.review-tips { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.review-more { font-size: 14.5px; color: var(--ink2); }
.review-more summary { cursor: pointer; font-weight: 700; color: var(--ink); }
.review-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 6px; }
.review-tools input[type="search"] { min-width: 220px; flex: 0 1 280px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; font-size: 14px; font-weight: 700; padding: 6px 12px 4px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink2); cursor: pointer; text-transform: capitalize; min-height: 34px; }
.chip.on { background: var(--sign); border-color: var(--sign); color: var(--sign-ink); }
.bulk-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; padding: 8px 12px; border-radius: var(--radius); background: var(--surface-2); font-size: 14.5px; margin: 8px 0; position: sticky; top: 0; z-index: 2; }
.bulk-bar.active { background: var(--night); color: var(--night-ink); }
.bulk-bar.active .btn.secondary { background: transparent; color: var(--night-ink); box-shadow: inset 0 0 0 2px rgba(255,255,255,.4); }
.bulk-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.bulk-actions select { min-height: 36px; padding: 5px 8px 3px; }
.poi-table { font-size: 14.5px; }
.poi-table td, .poi-table th { padding: 8px 10px; }
.poi-table .pick-col { width: 36px; }
.poi-table select { min-height: 36px; padding: 4px 8px 2px; }
.poi-table tr.excluded td:not(.pick-col):not(:last-child) { color: var(--ink2); text-decoration: line-through; }
.poi-table tr.excluded select { text-decoration: none; }
.poi-table tr.hl { background: var(--warn-bg); }
.poi-table .changed { font-size: 12px; color: var(--warn-text); font-weight: 700; margin-left: 4px; }
.keep { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.review-submit { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 0 0; border-top: 1px solid var(--line); margin-top: 8px; position: sticky; bottom: 0; background: var(--surface); padding-bottom: 12px; }
#kept-count { font-weight: 700; color: var(--ink2); }

.tracker { margin-top: 18px; }
.tracker-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.tracker h2 { margin: 0; font-size: 19px; }
.tracker-pct { font-variant-numeric: tabular-nums; color: var(--ink2); }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 10px 0; }
.bar span { display: block; height: 100%; width: 0; background: var(--sign); border-radius: inherit; transition: width .6s ease; }
.bar.failed span { background: var(--err-text); }
.bar.done span { background: var(--ok-text); }
.tracker-now { margin: 0 0 8px; font-size: 14.5px; color: var(--ink2); }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: grid; grid-template-columns: 26px 1fr auto; gap: 2px 8px; padding: 9px 0; border-top: 1px solid var(--line); align-items: start; }
.steps .icon { font-weight: 800; text-align: center; }
.steps .label { font-weight: 600; }
.steps .detail { grid-column: 2 / 4; font-size: 14px; color: var(--ink2); }
.steps .time { font-size: 13.5px; color: var(--ink2); font-variant-numeric: tabular-nums; }
.steps li.pending .label { color: var(--ink2); font-weight: 400; }
.steps li.done .icon, .steps li.skipped .icon { color: var(--ok-text); }
.steps li.running .icon { color: var(--sign); animation: pulse 1.2s ease-in-out infinite; }
.steps li.waiting .icon, .steps li.waiting .detail { color: var(--warn-text); }
.steps li.failed .icon, .steps li.failed .detail { color: var(--err-text); }
@keyframes pulse { 50% { opacity: .3; } }

@media (max-width: 900px) {
  .project-grid { grid-template-columns: 1fr; }
  .map-card #map { height: 340px; }
}

/* ---------- contact us ---------- */
.contact-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.contact-form { display: grid; gap: 10px; }
.contact-form input[type="text"], .contact-form select, .contact-form textarea, .reply-form textarea, .draw-panel textarea { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 12px 7px; }
.contact-form label, .reply-form label { font-size: 14.5px; }
.contact-form .btn { justify-self: start; }
.kind-pick { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.kind-pick legend { font-weight: 700; font-size: 14.5px; margin-bottom: 8px; }
.case-list { list-style: none; margin: 0; padding: 0; display: grid; }
.case-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.case-list li:first-child { border-top: 0; }
.case-list a { color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.case-list a:hover { text-decoration: underline; }
.case-meta { grid-column: 1; font-size: 13.5px; color: var(--ink2); }
.case-state { font-size: 13px; font-weight: 800; padding: 2px 9px 0; border-radius: 99px; align-self: start; grid-column: 2; grid-row: 1; white-space: nowrap; background: var(--surface-2); color: var(--ink2); }
.case-state.state-open { background: var(--info-bg); color: var(--link); }
.case-state.state-answered { background: var(--warn-bg); color: var(--warn-text); }
.special-box { margin-bottom: 14px; display: grid; gap: 10px; justify-items: start; }
.special-box p { margin: 0; }
.thread { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 12px; }
.thread li { padding: 12px 16px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface); max-width: 760px; }
.thread li.staff { border-color: color-mix(in srgb, var(--sign) 35%, var(--line)); background: color-mix(in srgb, var(--sign) 6%, var(--surface)); margin-left: clamp(0px, 6vw, 60px); }
.thread .who { margin: 0 0 6px; font-weight: 800; font-size: 14.5px; }
.thread .who span { font-weight: 400; color: var(--ink2); font-size: 13px; margin-left: 8px; }
.thread .body { overflow-wrap: anywhere; }
.reply-form { display: grid; gap: 10px; max-width: 760px; }
.reply-form .btn { justify-self: start; }
@media (max-width: 860px) {
  .contact-grid { grid-template-columns: 1fr; }
  .kind-pick { grid-template-columns: 1fr; }
}

/* project page map: extracted road network key */
.map-frame { position: relative; }
.map-key-net { position: absolute; right: 10px; top: 10px; z-index: 2; padding: 10px 12px; border-radius: 10px; font-size: 12.5px;
  background: color-mix(in srgb, var(--night) 88%, transparent); color: var(--night-ink); border: 1px solid var(--night-line); }
.map-key-net h3 { margin: 0 0 6px; font-size: 12.5px; font-weight: 800; }
.map-key-net ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.map-key-net li { display: flex; align-items: center; gap: 8px; }
.map-key-net .sw { width: 18px; height: 4px; border-radius: 2px; }


/* ---------- signed-in app shell: night sidebar ---------- */
.app-shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100dvh; }
.side { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 22px; padding: 18px 14px;
  background: var(--night); color: var(--night-ink); border-right: 1px solid var(--night-line); }
.side .logo { color: var(--night-ink); padding: 2px 6px; }
.side-nav { display: grid; gap: 4px; }
.side-nav a, .side-foot a { display: flex; align-items: center; gap: 12px; padding: 10px 12px 8px; border-radius: 10px;
  color: var(--night-dim); text-decoration: none; font-weight: 600; font-size: 15px; min-height: 44px; }
.side-nav a:hover, .side-foot a:hover { color: var(--night-ink); background: var(--night-2); }
/* The current section is a road-sign plate: sign green with a white inset rule (MASTER). */
.side-nav a[aria-current="page"] { color: #fff; background: #0d6a4b; box-shadow: inset 0 0 0 2px #0d6a4b, inset 0 0 0 3.5px rgba(255,255,255,.85); }
.side-nav svg, .side-foot svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-foot { margin-top: auto; display: grid; gap: 4px; border-top: 1px solid var(--night-line); padding-top: 12px; }
.side-foot .who { font-size: 13px; color: var(--night-dim); padding: 0 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot a.side-quiet { font-size: 13.5px; font-weight: 500; min-height: 36px; padding-block: 6px 4px; }
.app-main { min-width: 0; display: flex; flex-direction: column; }
.app-main > main { flex: 1 0 auto; width: 100%; }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  /* phones and tablets: logo and sign out on one line, the sections in one sideways row below */
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 8px 12px 6px; }
  .side-nav { order: 3; flex: 1 0 100%; display: flex; flex-wrap: nowrap; gap: 2px; overflow-x: auto; scrollbar-width: none; margin-inline: -4px; }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-nav a, .side-foot a { padding: 8px 10px 6px; min-height: 44px; white-space: nowrap; flex: none; }
  .side-foot { margin-top: 0; margin-left: auto; border-top: 0; padding-top: 0; display: flex; }
  .side-foot .who, .side-foot a.side-quiet { display: none; }   /* the footer carries it on phones */
  .workspace { height: auto; }
}

/* Layouts inside the shell respond to the content column, not the window (the sidebar takes 236 px). */
.app-main { container-type: inline-size; container-name: content; }
@container content (max-width: 860px) {
  .area { grid-template-columns: 120px minmax(0, 1fr); }
  .area-status { grid-column: 2; }
  .area-action { grid-column: 1 / -1; justify-self: stretch; }
  .project-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .route { grid-template-columns: 1fr; gap: 22px; }
  .route li { padding: 0 0 0 44px; }
  .route li::before { top: 0; bottom: -22px; left: 10px; right: auto; width: 4px; height: auto; }
  .route li:last-child::before { display: none; }
  .route li .fill { top: 0; left: 10px; width: 4px; height: 0; }
  .route li.lit .fill { width: 4px; height: calc(100% + 22px); }
}
@container content (max-width: 600px) {
  /* project page on a phone: the route stays, but only the stop that matters now is spelled out */
  .project-route { padding: 14px 14px 12px; }
  .project-route .route { gap: 8px; }
  .project-route .route li { padding-left: 36px; min-height: 24px; }
  .project-route .route li::before { bottom: -8px; }
  .project-route .route li.lit .fill { height: calc(100% + 8px); }
  .project-route .route h3 { font-size: 15px; margin: 2px 0 0; }
  .project-route .route .n { display: none; }
  .project-route .route li:not(.you):not(.current):not(.failed) p { display: none; }
}
@container content (max-width: 480px) {
  .area { grid-template-columns: 88px minmax(0, 1fr); padding: 10px; }
}
.upload-soon { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; margin-top: 4px; }
.upload-soon .hint { flex: 1 1 200px; margin: 0; }
/* drawing page: place search over the map, and the quote pinned to the bottom of the panel */
.place-search { position: absolute; top: 12px; right: 12px; z-index: 3; width: min(360px, calc(100% - 70px));
  display: grid; grid-template-columns: 1fr auto; gap: 6px; padding: 8px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line-strong); box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.place-search input { margin: 0; min-width: 0; }
.place-results { grid-column: 1 / -1; list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 240px; overflow: auto; }
.place-results button { all: unset; display: block; width: 100%; box-sizing: border-box; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; line-height: 1.35; }
.place-results button:hover, .place-results button:focus-visible { background: var(--surface-2); outline: 2px solid var(--amber); outline-offset: -2px; }
.place-results .hint { padding: 6px 10px; }
.place-credit { grid-column: 1 / -1; margin: 0; font-size: 12.5px; color: var(--ink2); }
.quote-pin { position: sticky; bottom: 0; z-index: 2; display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 4px 12px;
  margin: 8px -20px -32px; padding: 12px 20px; background: var(--surface); border-top: 2px solid var(--sign);
  color: var(--ink); text-decoration: none; font-size: 15px; }
.quote-pin strong { font-size: 19px; font-weight: 900; }
.quote-pin .go { color: var(--link); font-weight: 700; font-size: 14px; }
.soon-badge { font-size: 12.5px; font-weight: 800; padding: 2px 9px 0; border-radius: 99px; background: var(--info-bg); color: var(--link); }
.pay-sum { margin: 4px 0 10px; font-size: 16px; }
.pay-sum strong { font-weight: 900; }
