:root {
  --paper: #F2F5F1;
  --shallow: #D3E6EA;
  --deep: #0F3B55;
  --ink: #14242E;
  --muted: #4E6470;
  --rule: #C4D2D3;
  --magenta: #A8246F;
  --magenta-ink: #7D1A52;
  --ok: #2B6E4F;
  --font: "Archivo", system-ui, sans-serif;
  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.75rem;
  --step-3: 2.75rem;
  --radius-control: 3px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.5;
  font-variation-settings: "wdth" 100;
  font-variant-numeric: tabular-nums;
}
[hidden] { display: none !important; }

h1, h2 {
  font-variation-settings: "wdth" 72;
  font-weight: 650;
  letter-spacing: -0.005em;
  line-height: 1.1;
  color: var(--deep);
  margin: 0;
}
h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
.lede { color: var(--muted); max-width: 34rem; margin: 0.75rem 0 2rem; }
.sub { color: var(--muted); margin: 0.25rem 0 0; max-width: 40rem; font-size: var(--step--1); }

.wordmark {
  font-variation-settings: "wdth" 62;
  font-weight: 700;
  font-size: var(--step-1);
  letter-spacing: 0.02em;
  color: var(--deep);
  text-decoration: none;
}

/* Form controls */
label { display: block; font-size: var(--step--1); font-weight: 550; margin: 1rem 0 0.35rem; }
input {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--radius-control);
  padding: 0.7rem 0.8rem;
}
input:hover { border-color: var(--muted); }
:focus-visible { outline: 3px solid var(--magenta); outline-offset: 2px; }
input:focus-visible { outline-offset: 0; border-color: var(--magenta); }

button { font: inherit; cursor: pointer; }
.primary {
  background: var(--magenta);
  color: #fff;
  border: 0;
  border-radius: var(--radius-control);
  padding: 0.7rem 1.2rem;
  font-weight: 600;
}
.primary:hover { background: var(--magenta-ink); }
.primary[disabled] { opacity: 0.6; cursor: progress; }
.secondary {
  background: transparent;
  color: var(--deep);
  border: 1px solid var(--deep);
  border-radius: var(--radius-control);
  padding: 0.5rem 0.9rem;
}
.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--deep);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link:hover { color: var(--magenta); }
.danger { color: var(--magenta-ink); }

.error { color: var(--magenta-ink); font-size: var(--step--1); margin: 0.6rem 0 0; }
.hint { color: var(--muted); font-size: var(--step--1); margin: 0.35rem 0 0; }
.notice {
  margin-top: 1.5rem;
  padding: 0.9rem 1rem;
  background: var(--shallow);
  color: var(--deep);
  border-left: 3px solid var(--deep);
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Sign in: chart + panel */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(22rem, 0.85fr);
}
.chart { margin: 0; position: relative; background: var(--shallow); overflow: hidden; }
.chart svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
@media (max-width: 760px) { .chart-legend { left: 0.75rem; bottom: 0.6rem; font-size: 0.75rem; } }
.chart-legend {
  position: absolute;
  left: 1.5rem;
  bottom: 1.25rem;
  font-size: var(--step--1);
  color: var(--deep);
  background: rgba(242, 245, 241, 0.85);
  padding: 0.3rem 0.6rem;
}
.auth-panel { padding: 3rem clamp(1.5rem, 5vw, 4.5rem); display: flex; flex-direction: column; justify-content: center; max-width: 34rem; }
.auth-panel .wordmark { margin-bottom: 3rem; }
.auth-panel form .primary { margin-top: 1.5rem; width: 100%; }
.switch { margin-top: 1.5rem; color: var(--muted); }
.switch .link { margin-left: 0.35rem; }
.resend { margin-top: 0.75rem; align-self: flex-start; }

/* Contour styling (drawn by app.js) */
.contour { fill: none; stroke: var(--deep); stroke-width: 0.6; opacity: 0.85; }
.contour.major { stroke-width: 1.6; }
.depth-fill { stroke: none; }
.sounding { font-family: var(--font); fill: var(--deep); font-style: italic; font-variation-settings: "wdth" 80; }
.buoy { fill: var(--magenta); }

@media (prefers-reduced-motion: no-preference) {
  .contour { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: survey 2.4s ease-out forwards; }
  @keyframes survey { to { stroke-dashoffset: 0; } }
}

/* Signed in */
.topbar {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  padding: 1rem clamp(1.25rem, 4vw, 3rem);
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.topbar .org { font-weight: 600; color: var(--deep); }
.topbar .who { margin-left: auto; color: var(--muted); font-size: var(--step--1); }
.narrow { max-width: 34rem; padding: 4rem clamp(1.25rem, 4vw, 3rem); }
.narrow form .primary { margin-top: 1.5rem; }

.console-body { max-width: 62rem; padding: 2.5rem clamp(1.25rem, 4vw, 3rem) 5rem; }
.block { padding: 1.5rem 0 2.5rem; }
.block:first-child { padding-top: 0.5rem; }
.block-head { margin-bottom: 1.25rem; }

.gauge { margin-top: 1rem; }
.gauge-figures { display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; }
.spent { font-size: var(--step-3); font-variation-settings: "wdth" 72; font-weight: 600; color: var(--deep); line-height: 1; }
.of { color: var(--muted); }
.gauge-track { margin: 1rem 0 1.5rem; height: 10px; background: var(--shallow); }
.gauge-fill { height: 100%; width: 0; background: var(--deep); transition: width 0.6s ease; }
.gauge-fill.high { background: var(--magenta); }
.limits { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem 2rem; margin: 0; }
.limits dt { color: var(--muted); font-size: var(--step--1); }
.limits dd { margin: 0.15rem 0 0; font-weight: 600; }

.inline-form { display: flex; gap: 0.75rem; max-width: 40rem; }
.inline-form input { flex: 1; }
.inline-form .primary { white-space: nowrap; }

.reveal { margin-top: 1rem; padding: 1rem; background: #fff; border: 1px solid var(--magenta); max-width: 40rem; }
.reveal p { margin: 0 0 0.75rem; }
.reveal-row { display: flex; gap: 0.75rem; align-items: center; }
.reveal code { flex: 1; overflow-wrap: anywhere; font-size: var(--step--1); background: var(--paper); padding: 0.5rem; }

.rows { list-style: none; padding: 0; margin: 1.25rem 0 0; max-width: 52rem; }
.rows li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.25rem 1.5rem;
  align-items: baseline;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--rule);
}
.rows li:first-child { border-top: 1px solid var(--rule); }
.rows .name { font-weight: 600; overflow-wrap: anywhere; }
.rows .meta { color: var(--muted); font-size: var(--step--1); grid-column: 1; }
.rows .side { grid-row: 1 / span 2; grid-column: 2; text-align: right; }
.rows .empty { display: block; color: var(--muted); border: 0; padding: 0.5rem 0; }
.revoked .name { color: var(--muted); text-decoration: line-through; }

.status { font-size: var(--step--1); font-weight: 600; }
.status.completed { color: var(--ok); }
.status.failed, .status.cancelled { color: var(--magenta-ink); }
.status.running, .status.queued { color: var(--deep); }

.boot { position: fixed; inset: 0; display: grid; place-items: center; color: var(--muted); background: var(--paper); }

@media (max-width: 760px) {
  .auth { grid-template-columns: 1fr; grid-template-rows: 34vh auto; }
  .auth-panel { padding-top: 2rem; }
  .auth-panel .wordmark { margin-bottom: 1.5rem; }
  h1 { font-size: var(--step-2); }
  .inline-form { flex-direction: column; }
  .topbar { flex-wrap: wrap; gap: 0.5rem 1rem; }
  .topbar .who { margin-left: 0; width: 100%; order: 3; }
}
