/* Traverse studio. "Marker orange": white ground, an ink rail, one orange accent.
   Every colour is a token, so the dark theme is the same sheet with other values.
   Text on orange is always ink. Orange is never small text on the ground: use --accent-text.
   One typeface, Archivo: condensed and heavy for headings and figures, regular width for reading. */
@font-face { font-family: "Archivo"; src: url("Archivo-VF.3084864834b6.ttf") format("truetype"); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }

:root {
  --bg: #FFFFFF; --well: #F4F4F1; --well-2: #E8E7E2; --ink: #111418; --muted: #59606A; --line: #DCDAD3; --outline: #8E949D;
  --accent: #E8590C; --on-accent: #111418; --accent-text: #B03F06; --accent-wash: #FDEEE4; --success: #1B7347; --danger: #B3261E; --focus: #1F5EFF;
  --rail: #111418; --rail-ink: #F2F0EC; --rail-muted: #9CA3AD; --rail-line: #2A3038; --rail-active: #1F252D;
  --shadow: 0 1px 2px rgba(17,20,24,.06), 0 12px 32px rgba(17,20,24,.08);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #14181D; --well: #1C2128; --well-2: #272D36; --ink: #F2F0EC; --muted: #A4ABB5; --line: #2F3640; --outline: #6B7380;
  --accent: #FF7A2F; --on-accent: #111418; --accent-text: #FF9A5C; --accent-wash: #2E1F16; --success: #5BD08F; --danger: #FF8A80; --focus: #8AB0FF;
  --rail: #0C0F12; --rail-ink: #F2F0EC; --rail-muted: #8E96A1; --rail-line: #20262D; --rail-active: #1A2027;
  --shadow: 0 1px 2px rgba(0,0,0,.5), 0 12px 32px rgba(0,0,0,.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.5 "Archivo", system-ui, "Segoe UI", sans-serif; }
h1, h2, h3 { font-stretch: 78%; font-weight: 760; line-height: 1.1; margin: 0; }
h1 { font-size: clamp(1.9rem, 1.3rem + 2vw, 2.75rem); letter-spacing: -.01em; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.1rem; }
p { margin: 0; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.label { font-size: .8125rem; font-weight: 600; color: var(--muted); }
.figure { font-stretch: 76%; font-weight: 780; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.measure { max-width: 68ch; }
.stack > * + * { margin-top: var(--gap, 16px); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
[hidden] { display: none !important; }

/* --- Shell: an ink rail beside the sheet ------------------------------------------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.rail { background: var(--rail); color: var(--rail-ink); display: flex; flex-direction: column; padding: 20px 14px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.lockup { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-stretch: 70%; font-weight: 820; letter-spacing: .07em; font-size: 1.25rem; }
.lockup svg { width: 32px; height: 32px; flex: none; }
.rail .lockup { padding: 2px 8px 18px; }
.rail .lockup svg { --bg: var(--rail); }
.rail .place { margin: 0 8px 14px; padding: 12px 0 14px; border-top: 1px solid var(--rail-line); border-bottom: 1px solid var(--rail-line); }
.rail .place strong { display: block; font-stretch: 82%; font-weight: 700; line-height: 1.25; }
.rail .place span { font-size: .8125rem; color: var(--rail-muted); }
.rail select { margin-top: 8px; min-height: 38px; background: var(--rail-active); color: var(--rail-ink); border-color: var(--rail-line); }
.rail nav { display: flex; flex-direction: column; gap: 2px; }
.rail nav a { display: flex; align-items: center; gap: 12px; padding: 10px 10px; border-radius: 6px; text-decoration: none; font-weight: 600; color: var(--rail-muted); }
.rail nav a svg { width: 20px; height: 20px; flex: none; }
.rail nav a:hover { color: var(--rail-ink); background: var(--rail-active); }
.rail nav a[aria-current="page"] { color: var(--rail-ink); background: var(--rail-active); box-shadow: inset 3px 0 0 var(--accent); }
.rail .foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--rail-line); display: flex; flex-direction: column; gap: 8px; }
.rail .who { padding: 0 8px; font-size: .875rem; color: var(--rail-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail .who strong { display: block; color: var(--rail-ink); font-weight: 650; }
.rail .foot .btn { border-color: var(--rail-line); color: var(--rail-ink); justify-content: flex-start; min-height: 40px; padding: 0 10px; font-weight: 600; }
.rail .foot .btn:hover { background: var(--rail-active); }
.sheet { min-width: 0; }
.sheet > .inner { max-width: 1160px; margin: 0 auto; padding: 32px clamp(18px, 3.2vw, 44px) 72px; }
.crumb { font-size: .875rem; color: var(--muted); text-decoration: none; }
.crumb:hover { color: var(--ink); text-decoration: underline; }
.page-head { display: flex; gap: 16px 24px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 12px; }
  .rail .lockup { padding: 0 8px 0 4px; }
  .rail .place { display: none; }
  .rail nav { flex-direction: row; flex: 1 1 100%; order: 3; overflow-x: auto; gap: 2px; padding-bottom: 2px; }
  .rail nav a { white-space: nowrap; padding: 8px 10px; }
  .rail nav a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--accent); }
  .rail .foot { margin: 0 0 0 auto; padding: 0; border: 0; flex-direction: row; align-items: center; }
  .rail .who { display: none; }
  .rail .foot .btn span { display: none; }
  .sheet > .inner { padding-top: 22px; }
}

/* --- Buttons and inputs -------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 6px; border: 1.5px solid var(--ink);
  background: transparent; color: var(--ink); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { background: var(--well); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.07); background: var(--accent); }
.btn.ink { background: var(--ink); color: var(--bg); }
.btn.ink:hover { opacity: .88; background: var(--ink); }
.btn.quiet { border-color: transparent; color: var(--muted); padding: 0 10px; }
.btn.quiet:hover { color: var(--ink); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: .9rem; }
.btn[disabled] { opacity: .5; cursor: default; }
label.field { display: block; }
label.field > span { display: block; font-weight: 650; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 6px; border: 1.5px solid var(--outline); background: var(--bg); color: var(--ink); font: inherit; }
textarea { min-height: 84px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--ink); }

/* --- Surfaces -------------------------------------------------------------------------- */
.card { border: 1.5px solid var(--line); border-radius: 8px; padding: 22px; background: var(--bg); }
.card.flat { background: var(--well); border-color: transparent; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.tiles { display: grid; gap: 0; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); border: 1.5px solid var(--ink); border-radius: 8px; overflow: hidden; }
.tile { padding: 14px 18px 16px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -1px -1px 0; }
.tile .figure { font-size: 2.1rem; display: block; line-height: 1.05; margin-top: 2px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 4px; background: var(--well-2); font-stretch: 80%; font-weight: 700; font-size: .8125rem; }
.chip.accent { background: var(--accent); color: var(--on-accent); }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.notice { border-radius: 8px; padding: 12px 14px; background: var(--well); border-left: 4px solid var(--ink); }
.notice.error { border-left-color: var(--danger); color: var(--danger); }
.notice.good { border-left-color: var(--success); }
.secret { font-weight: 700; word-break: break-all; padding: 10px 12px; border: 1.5px dashed var(--ink); border-radius: 6px; background: var(--bg); user-select: all; }

/* --- The traverse: the workspace's progress, drawn as a survey line ----------------------- */
.traverse { position: relative; border: 1.5px solid var(--ink); border-radius: 8px; padding: 26px 26px 22px; overflow: hidden;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 32px 32px; background-position: -1px -1px; }
.traverse::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 78%, transparent), var(--bg) 82%); pointer-events: none; }
.traverse > * { position: relative; }
.stations { list-style: none; margin: 22px 0 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.station { position: relative; padding: 34px 14px 0 0; }
.station::before { content: ""; position: absolute; left: 0; right: 0; top: 10px; height: 4px; background: var(--well-2); }
.station:last-child::before { right: auto; width: 0; }
.station.done::before { background: var(--ink); }
.station .mark { position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--bg); border: 4px solid var(--well-2); }
.station.done .mark { background: var(--accent); border-color: var(--ink); border-width: 2.5px; }
.station.next .mark { border-color: var(--accent); box-shadow: 0 0 0 5px var(--accent-wash); }
.station .figure { font-size: 2rem; line-height: 1; display: block; }
.station .name { font-weight: 700; display: block; margin-top: 2px; }
.station .note { font-size: .875rem; color: var(--muted); display: block; margin-top: 2px; }
.station.todo .figure, .station.todo .name { color: var(--muted); }
.traverse .next-step { margin-top: 22px; padding-top: 18px; border-top: 1.5px solid var(--line); display: flex; gap: 14px 20px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
@media (max-width: 760px) {
  .stations { grid-template-columns: 1fr; }
  .station { padding: 0 0 22px 40px; min-height: 48px; }
  .station::before { left: 10px; right: auto; top: 0; bottom: 0; width: 4px; height: auto; }
  .station:last-child::before { height: 0; }
}

/* --- Tabs inside a project -------------------------------------------------------------- */
.subnav { display: flex; gap: 2px; border-bottom: 1.5px solid var(--line); overflow-x: auto; }
.subnav a { padding: 10px 14px 9px; text-decoration: none; font-weight: 650; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1.5px; white-space: nowrap; }
.subnav a:hover { color: var(--ink); }
.subnav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

/* --- People ------------------------------------------------------------------------------ */
.person { display: inline-flex; align-items: center; gap: 8px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--well-2); display: inline-grid; place-items: center; font-style: normal; font-weight: 750; font-size: .8125rem; text-transform: uppercase; flex: none; }
.members { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 4px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; max-height: 300px; overflow-y: auto; }
.check { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 6px; cursor: pointer; }
.check:has(input:checked) { border-color: var(--ink); background: var(--well); }
.check input { accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
select.inline { width: auto; min-height: 38px; padding: 6px 10px; }
.feed { list-style: none; margin: 0; padding: 4px 20px; }
.feed li { display: flex; flex-direction: column; gap: 1px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }

/* --- Project rows ---------------------------------------------------------------------- */
.projects { border: 1.5px solid var(--line); border-radius: 8px; overflow: hidden; }
.project-row { display: grid; grid-template-columns: minmax(0, 2.2fr) auto repeat(2, minmax(84px, .6fr)) minmax(0, 1.2fr); gap: 8px 20px; align-items: center; padding: 16px 20px; text-decoration: none; border-bottom: 1px solid var(--line); }
.project-row:last-child { border-bottom: 0; }
.project-row:hover { background: var(--well); }
.project-row h3 { font-size: 1.2rem; }
.project-row .figure { font-size: 1.5rem; display: block; line-height: 1.1; }
.project-row .go { justify-self: end; font-size: .9rem; text-align: right; white-space: nowrap; }
.project-row > div:first-child { min-width: 0; }
@media (max-width: 760px) { .project-row { grid-template-columns: minmax(0, 1fr) auto; } .project-row .go { grid-column: 1 / -1; justify-self: start; text-align: left; } }

/* --- Stage board: two steps, one current -------------------------------------------------- */
.stage-board { display: inline-grid; grid-template-columns: 1fr 1fr; border: 1.5px solid var(--ink); border-radius: 8px; overflow: hidden; }
.stage-board > div { padding: 10px 18px 11px; min-width: 150px; }
.stage-board > div + div { border-left: 1.5px solid var(--ink); }
.stage-board .now { background: var(--ink); color: var(--bg); }
.stage-board strong { display: block; font-stretch: 80%; font-weight: 760; font-size: 1.05rem; }
.stage-board span { font-size: .8125rem; opacity: .8; }

/* --- Tables ------------------------------------------------------------------------------ */
.table-wrap { overflow-x: auto; border: 1.5px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th { text-align: left; font-weight: 650; font-size: .8125rem; color: var(--muted); background: var(--well); white-space: nowrap; }
th, td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--well); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td a { font-weight: 650; }
.one-line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) { .table-wrap table { min-width: 620px; } }
.clip { max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 6px; border: 1.5px solid var(--line); text-decoration: none; font-weight: 650; }
.tabs a:hover { border-color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* --- Progress -------------------------------------------------------------------------------- */
.bar { height: 10px; background: var(--well-2); border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ink); }
.bar.accent > i { background: var(--accent); }
.tally { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; align-items: baseline; padding: 12px 0; border-bottom: 1px solid var(--line); }
.tally:last-child { border-bottom: 0; padding-bottom: 0; }
.tally .figure { font-size: 1.5rem; }
.tally .bar, .tally .small { grid-column: 1 / -1; }
.days { display: grid; grid-template-columns: repeat(14, 1fr); gap: 5px; align-items: end; height: 120px; }
.days > div { background: var(--ink); border-radius: 2px 2px 0 0; min-height: 2px; }
.days > div.zero { background: var(--well-2); }
.days > div.today { background: var(--accent); }

/* --- Dialog ------------------------------------------------------------------------------------ */
dialog { border: 1.5px solid var(--ink); border-radius: 10px; padding: 0; background: var(--bg); color: var(--ink); width: min(620px, calc(100vw - 28px)); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(17, 20, 24, .55); }
dialog form { padding: 26px; }
.choice { display: block; border: 1.5px solid var(--line); border-radius: 8px; padding: 14px 16px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--ink); background: var(--well); }
.choice input { accent-color: var(--accent); margin-right: 8px; }
.choice strong { font-weight: 700; }
.choice span { display: block; color: var(--muted); font-size: .9rem; margin: 4px 0 0 26px; }

/* --- Sign-in: the survey grid and a traverse on one side, the form on the other ------------------ */
.signin { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, 520px); }
.signin .scene { position: relative; background: var(--rail); color: var(--rail-ink); overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; padding: 40px 44px 44px; --line: var(--rail-line); --ink: var(--rail-ink); --surface: var(--rail); --bg: var(--rail); --muted: var(--rail-muted); }
.signin .scene svg.grid-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.signin .scene .words { position: relative; max-width: 32ch; }
.signin .scene > .lockup { position: relative; }
.signin .scene .words h2 { font-size: clamp(1.7rem, 1.2rem + 1.6vw, 2.5rem); }
.signin .scene .words p { font-size: 1.1rem; line-height: 1.4; }
.signin .form { padding: 40px clamp(20px, 5vw, 56px); display: flex; flex-direction: column; justify-content: center; }
@media (max-width: 860px) { .signin { grid-template-columns: 1fr; } .signin .scene { min-height: 230px; padding: 24px; } }
.plain-page { max-width: 560px; margin: 0 auto; padding: 48px 20px; }

/* --- Monitoring map ------------------------------------------------------------------------------- */
.map-shell { position: relative; height: min(70vh, 760px); min-height: 400px; border: 1.5px solid var(--ink); border-radius: 8px; overflow: hidden; background: var(--well); }
.map-shell iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.map-tools { position: absolute; top: 12px; right: 12px; display: flex; gap: 8px; }
.map-tools .btn { background: var(--bg); box-shadow: var(--shadow); }
.map-legend { position: absolute; left: 12px; top: 12px; display: flex; gap: 6px 14px; flex-wrap: wrap; max-width: calc(100% - 320px); background: var(--bg); border: 1.5px solid var(--ink); border-radius: 6px; padding: 7px 12px; font-size: .875rem; font-weight: 600; box-shadow: var(--shadow); }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-card { position: absolute; left: 12px; bottom: 12px; max-width: min(360px, calc(100% - 24px)); background: var(--bg); border: 1.5px solid var(--ink); border-radius: 8px; padding: 14px 16px; box-shadow: var(--shadow); }
.map-wait { position: absolute; inset: 0; display: grid; place-items: center; background: var(--well); }
@media (max-width: 760px) { .map-legend { display: none; } }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.split.thirds { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, .9fr); }
.split.wide { grid-template-columns: minmax(0, 1.9fr) minmax(280px, 1fr); gap: 28px; align-items: start; }
.split.wide > * { min-width: 0; }
@media (max-width: 1000px) { .split, .split.thirds { grid-template-columns: 1fr; } }
@media (max-width: 1240px) { .split.wide { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: no-preference) { .btn, .rail nav a, .project-row { transition: background .12s, color .12s, border-color .12s; } }
