/* =======================================================================
   OneIsland — "Atoll" design system
   -----------------------------------------------------------------------
   Real Pacific coastal palette: deep ocean, reef teal, sun-bleached sand,
   coral/amber storm language. Cards read like reef charts and dock
   signage, not SaaS tiles — hairline strata instead of drop shadows,
   a scalloped tideline instead of a straight card edge, tick-marked
   gauges instead of bordered stat boxes. Mobile-only, portrait.
   ======================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Libre+Caslon+Display&family=Public+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* -- sand surfaces -- */
  --sand: #F6EFDD;
  --sand-deep: #ECE0C4;
  --shell: #FFFFFF;
  --shell-warm: #FCF6E9;
  --hairline: rgba(15, 61, 74, 0.14);
  --hairline-strong: rgba(15, 61, 74, 0.28);

  /* -- ink (deep water, not black) -- */
  --ink: #0E2F38;
  --ink-dim: #4C6D74;
  --ink-faint: #86A0A5;

  /* -- reef teal accent (buttons, active states, instrument lines) —
        pulled toward blue rather than green so it reads as lagoon water,
        not seafoam -- */
  --reef: #146E8C;
  --reef-bright: #1C93B8;
  --reef-dim: #0A4A60;

  /* -- deep ocean (headers, brand, dark passages) -- */
  --ocean: #0B3A4A;
  --ocean-deep: #072531;

  /* -- sunset warning language -- */
  --coral: #D9663D;
  --coral-dim: #F1C6AE;
  --amber: #C98A1E;

  /* -- status language (shared meaning across every screen) -- */
  --critical: #C2452B;
  --critical-dim: #EFBBA9;
  --shortage: #C98A1E;
  --balanced: #178577;
  --surplus: #1C7FA6;

  /* -- ledger (Decision Log / Storm Log stay dark by design, a lit
        wheelhouse panel set into the paper console) -- */
  --terminal-bg: #0B2A34;
  --terminal-text: #BFE3DE;
  --terminal-accent: #4FC3B4;
  --terminal-border: rgba(191, 227, 222, 0.20);

  /* -- desktop backdrop (behind the phone-shaped shell) -- */
  --desktop-backdrop: #00008B;

  --radius: 10px;
  --radius-sm: 5px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  /* -- reusable tideline motif: a slow, hand-drawn-feeling wave, tiled
        as a background strip wherever a hard border would otherwise sit -- */
  --tide-svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='8' viewBox='0 0 40 8'%3E%3Cpath d='M0 4 C 5 0, 15 8, 20 4 C 25 0, 35 8, 40 4' fill='none' stroke='%230F3D4A' stroke-opacity='0.32' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--sand);
  color: var(--ink);
  font-family: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.45;
  text-wrap: pretty;
  overscroll-behavior-y: contain;
}

h1, h2, h3 { margin: 0; font-weight: 700; color: var(--ink); font-family: 'Libre Caslon Display', Georgia, serif; }
button { font-family: inherit; }
.mono { font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace; font-variant-numeric: tabular-nums; }

/* -----------------------------------------------------------------------
   App shell — locked to a phone-shaped column. Backdrop reads as sun on
   still water: a warm glow from the upper right, and faint, widely
   spaced contour bands standing in for reef bathymetry lines instead of
   a generic graph-paper grid.
----------------------------------------------------------------------- */
.app-shell {
  max-width: 460px;
  margin: 0 auto;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  background:
    radial-gradient(ellipse 480px 320px at 88% -6%, rgba(201, 138, 30, 0.13), transparent 60%),
    radial-gradient(ellipse 620px 520px at -16% 4%, rgba(11, 58, 74, 0.28), transparent 64%),
    radial-gradient(ellipse 560px 460px at 6% 96%, rgba(20, 110, 140, 0.16), transparent 68%),
    repeating-radial-gradient(ellipse 700px 700px at 50% 118%, rgba(11,58,74,0.06) 0px, rgba(11,58,74,0.06) 1px, transparent 1px, transparent 26px),
    var(--sand);
  overflow: hidden;
}
@media (min-width: 461px) {
  html, body { height: 100%; }
  body { display: flex; align-items: center; justify-content: center; background: var(--desktop-backdrop); }
  .app-shell {
    width: auto;
    height: min(818px, calc(100dvh - 64px));
    aspect-ratio: 9 / 16;
    max-width: none;
    border-radius: 30px;
    box-shadow: 0 0 0 1px var(--hairline), 0 30px 70px rgba(11, 58, 74, 0.22);
  }
}

/* -----------------------------------------------------------------------
   App modes — Landing / Auth / Onboarding / Dashboard.
----------------------------------------------------------------------- */
.app-mode {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  opacity: 0; transform: translateY(6px);
  pointer-events: none;
  visibility: hidden;
  overflow-y: auto;
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease), visibility 0s linear 0.22s;
}
.app-mode.active {
  opacity: 1; transform: translateY(0); pointer-events: auto; visibility: visible;
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
}
#mode-dashboard { overflow: hidden; }

/* ---- Landing ---- */
.landing {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 40px 24px 32px;
  position: relative;
}
.landing-title { margin-bottom: 14px; }
.landing-logo { display: block; width: 100%; max-width: 260px; height: auto; margin: 0 auto; }
.landing-tagline { font-family: 'Libre Caslon Display', Georgia, serif; font-size: 1.02rem; font-style: italic; color: var(--reef-dim); line-height: 1.5; margin: 0 0 14px; max-width: 320px; }
.landing-copy { font-size: 0.85rem; color: var(--ink-dim); line-height: 1.55; margin: 0 0 20px; max-width: 340px; }
.landing-badges { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 28px; }
.landing-badge { background: var(--shell); border: 1px solid var(--hairline-strong); color: var(--ink-dim); padding: 5px 10px; border-radius: 999px; }
.landing .btn { max-width: 320px; width: 100%; }

/* ---- Auth ---- */
.auth-screen { flex: 1; padding: 20px 20px 28px; display: flex; flex-direction: column; }
.auth-back { align-self: flex-start; background: none; border: none; color: var(--ink-dim); font-size: 0.8rem; font-weight: 600; padding: 6px 0; margin-bottom: 10px; min-height: 32px; }
.auth-screen h2 { font-size: 1.35rem; margin-bottom: 16px; }
.auth-screen .btn-primary { margin-top: 18px; }

/* ---- Onboarding wizard chrome ---- */
.onb-shell { flex: 1; padding: 20px 20px 24px; display: flex; flex-direction: column; }
.onb-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 22px; flex-shrink: 0; }
.onb-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--hairline-strong); transition: background 0.25s var(--ease), transform 0.25s var(--ease); }
.onb-dot.active { background: var(--reef); transform: scale(1.3); }
.onb-dot.done { background: var(--reef-dim); }
.onb-step-container { flex: 1; }
.onb-nav { display: flex; gap: 10px; margin-top: 18px; flex-shrink: 0; }
.onb-nav .onb-back { flex: 0 0 auto; width: auto; margin-top: 0; }
.onb-nav .btn-primary { flex: 1; margin-top: 0; }

.onb-welcome { text-align: center; padding: 30px 8px; }
.onb-kicker { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--reef); font-weight: 700; margin-bottom: 10px; }
.onb-welcome h2 { font-size: 1.45rem; margin-bottom: 12px; }
.onb-welcome p { font-size: 0.88rem; color: var(--ink-dim); line-height: 1.55; }
.onb-hint { font-size: 0.76rem; color: var(--ink-faint); margin: 2px 0 12px; }

.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.chip-toggle {
  min-height: 40px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--hairline-strong); background: var(--shell); color: var(--ink-dim);
  font-size: 0.82rem; font-weight: 600;
}
.chip-toggle.active { background: var(--reef); border-color: var(--reef); color: var(--shell-warm); }

.yn-toggle { display: flex; gap: 8px; margin-top: 4px; }
.yn-btn { flex: 1; min-height: 44px; border: 1px solid var(--hairline-strong); background: var(--shell); color: var(--ink-dim); border-radius: var(--radius-sm); font-weight: 700; font-size: 0.9rem; }
.yn-btn.active { background: var(--reef); border-color: var(--reef); color: var(--shell-warm); }
.onb-followup { margin-top: 16px; }

.stepper { display: flex; align-items: center; justify-content: center; gap: 24px; padding: 20px 0; }
.stepper-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--hairline-strong); background: var(--shell); color: var(--reef); font-size: 1.3rem; font-weight: 700; line-height: 1; }
.stepper-value { font-family: 'Libre Caslon Display', Georgia, serif; font-size: 2.1rem; font-weight: 700; min-width: 48px; text-align: center; }

.age-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.age-field { display: flex; flex-direction: column; gap: 4px; }
.age-field-label { font-size: 0.66rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.05em; }

/* -----------------------------------------------------------------------
   Top bar — island identity + live storm signal. The wave-line motif
   replaces a flat hairline: a tideline instead of a ruled edge.
----------------------------------------------------------------------- */
.topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 15px;
  background:
    linear-gradient(180deg, rgba(11, 58, 74, 0.22), transparent 75%),
    linear-gradient(180deg, var(--sand-deep), var(--sand) 85%);
  position: relative;
}
.topbar::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px; height: 7px;
  background-image: var(--tide-svg);
  background-repeat: repeat-x;
  background-size: 34px 7px;
  opacity: 0.9;
}

.mark { flex-shrink: 0; width: 36px; height: 36px; }
.mark .atoll-ring:first-child { stroke: var(--ocean); }
.mark .atoll-ring { stroke: var(--reef); }
.mark .atoll-motu { fill: var(--coral); }
.mark .mark-ping { animation: ping 3.2s var(--ease) infinite; }

@keyframes ping {
  0%   { r: 4;  opacity: 0.85; }
  70%  { r: 15; opacity: 0; }
  100% { r: 15; opacity: 0; }
}

.brand-text { flex: 1; min-width: 0; }
.brand-text .name { font-family: 'Libre Caslon Display', Georgia, serif; font-size: 1.12rem; font-weight: 700; letter-spacing: 0.01em; color: var(--ocean); }
.brand-text .place { font-size: 0.68rem; color: var(--ink-dim); text-transform: uppercase; letter-spacing: 0.08em; }

/* Storm signal: 4 bars shaped like tide-gauge marks, not a generic dot */
.signal { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.signal-bars { display: flex; align-items: flex-end; gap: 2px; height: 16px; }
.signal-bars i { display: block; width: 4px; background: var(--hairline-strong); border-radius: 1px 1px 0 0; transition: background 0.3s var(--ease); }
.signal-bars i:nth-child(1) { height: 6px; }
.signal-bars i:nth-child(2) { height: 9px; }
.signal-bars i:nth-child(3) { height: 12px; }
.signal-bars i:nth-child(4) { height: 16px; }
.signal-bars.lit-1 i:nth-child(1) { background: var(--balanced); }
.signal-bars.lit-2 i:nth-child(-n+2) { background: var(--shortage); }
.signal-bars.lit-3 i:nth-child(-n+3) { background: var(--shortage); }
.signal-bars.lit-4 i { background: var(--critical); }
.signal-label { font-size: 0.72rem; font-weight: 600; color: var(--ink); white-space: nowrap; }

/* -----------------------------------------------------------------------
   Screens
----------------------------------------------------------------------- */
.screens { flex: 1; position: relative; overflow: hidden; }

.screen {
  position: absolute; inset: 0;
  overflow-y: auto;
  padding: 18px 16px 24px;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
}
.screen.active { opacity: 1; transform: translateY(0); pointer-events: auto; }

.screen-title { font-family: 'Libre Caslon Display', Georgia, serif; font-size: 1.3rem; font-weight: 700; color: var(--ocean); margin-bottom: 12px; }

section + section, .block + .block { margin-top: 16px; }

/* -----------------------------------------------------------------------
   Console screen
----------------------------------------------------------------------- */
.hero-readout {
  border: 1px solid var(--hairline);
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--shell);
  padding: 18px 18px 26px;
  position: relative;
  overflow: hidden;
  /* a gentle scalloped tideline instead of a flat bottom edge — the one
     place the wave silhouette becomes literal, reserved for the single
     most important reading on the screen */
  clip-path: polygon(
    0 0, 100% 0, 100% 88%,
    92% 100%, 84% 90%, 76% 100%, 68% 90%, 60% 100%,
    52% 90%, 44% 100%, 36% 90%, 28% 100%, 20% 90%,
    12% 100%, 4% 90%, 0 96%
  );
}
.hero-readout::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 100% 0%, rgba(31, 174, 158, 0.10), transparent 60%),
    radial-gradient(circle at 0% 100%, rgba(11, 58, 74, 0.08), transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 140 140'%3E%3Cg fill='none' stroke='%230B3A4A' stroke-opacity='0.05' stroke-width='1.5'%3E%3Ccircle cx='118' cy='22' r='14'/%3E%3Ccircle cx='118' cy='22' r='26'/%3E%3Ccircle cx='118' cy='22' r='38'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: top right;
  pointer-events: none;
}
.hero-severity { font-family: 'Libre Caslon Display', Georgia, serif; font-size: 2.3rem; font-weight: 700; line-height: 1.02; letter-spacing: -0.005em; }
.hero-severity.calm     { color: var(--balanced); }
.hero-severity.watch    { color: var(--shortage); }
.hero-severity.warning  { color: var(--critical); }
.hero-severity.severe   { color: var(--critical); text-shadow: 0 0 18px rgba(194, 69, 43, 0.30); }
.hero-sub { font-size: 0.78rem; color: var(--ink-dim); margin-top: 4px; }
.hero-source { display: inline-flex; align-items: center; gap: 5px; margin-top: 10px; font-size: 0.66rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
.hero-source .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--balanced); }
.hero-source.simulated .dot { background: var(--reef); }

.weather-fallback {
  margin-top: 8px; font-size: 0.72rem; font-weight: 600; color: var(--shortage);
  background: rgba(201,138,30,0.10); border: 1px solid rgba(201,138,30,0.30);
  border-radius: var(--radius-sm); padding: 6px 9px; text-transform: none; letter-spacing: normal;
}

.console-summary { font-size: 0.78rem; color: var(--ink-dim); padding: 10px 2px 4px; }
.summary-error { color: var(--critical); }
.link-btn {
  background: none; border: none; padding: 0; margin-left: 4px;
  font: inherit; font-weight: 700; color: inherit; text-decoration: underline;
  cursor: pointer;
}

/* Inline loading state (data still in flight) and a small spinner used
   wherever we replace a blank section with "Loading…" rather than nothing. */
.loading-inline { display: inline-flex; align-items: center; gap: 7px; }
.spinner {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid var(--hairline-strong); border-top-color: var(--reef);
  animation: spin 0.7s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.photo-status { font-size: 0.72rem; color: var(--ink-faint); margin-top: 6px; }
.photo-status.photo-status-error { color: var(--critical); }

.recs-list { display: flex; flex-direction: column; gap: 14px; }

.activity-row {
  display: flex; flex-direction: column; gap: 3px;
  padding: 10px 12px; border: 1px solid var(--hairline);
  border-left: 2px solid var(--hairline-strong);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--shell);
}
.activity-row + .activity-row { margin-top: 6px; }
.activity-flow { font-size: 0.82rem; }
.activity-meta { font-size: 0.7rem; color: var(--ink-faint); }

.outlook-peak { font-size: 0.8rem; color: var(--ink-dim); margin-bottom: 8px; }

.rec-card {
  border: 1px solid var(--reef-dim);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(22, 126, 119, 0.07), transparent 40%), var(--shell);
  padding: 16px 16px 14px;
}
.rec-card .rec-question { font-size: 0.94rem; margin-top: 8px; line-height: 1.4; }
.rec-card .rec-question strong { font-weight: 700; }
.rec-contact {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(22, 126, 119, 0.08);
  border: 1px solid var(--hairline);
}
.rec-contact-label { font-size: 0.72rem; font-weight: 700; color: var(--reef-dim); margin-bottom: 4px; }
.rec-contact-phone {
  display: block; font-family: 'JetBrains Mono', monospace; font-size: 0.95rem; font-weight: 700;
  color: var(--reef); text-decoration: none;
}
.rec-contact-phone::before { content: "\260E  "; }
.rec-contact-address { font-size: 0.76rem; color: var(--ink-dim); margin-top: 2px; }
.rec-contact-missing { font-size: 0.76rem; color: var(--ink-faint); font-style: italic; }

.rec-confirm-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 0.82rem;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--hairline-strong);
}
.rec-confirm-row:first-of-type { border-top: none; margin-top: 12px; padding-top: 0; }
.rec-confirm-name { font-weight: 600; }
.rec-confirm-change { font-variant-numeric: tabular-nums; font-weight: 600; }
.rec-confirm-change.loss { color: var(--shortage); }
.rec-confirm-change.gain { color: var(--balanced); }

.rec-actions { display: flex; gap: 8px; margin-top: 14px; }
.rec-btn {
  flex: 1;
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--hairline);
  background: var(--shell);
}
.rec-btn-accept { background: var(--reef); color: #fff; border-color: var(--reef); }
.rec-btn-dismiss { color: var(--ink-dim); }

.feature-ticket {
  border: 1px solid var(--reef-dim);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(22, 126, 119, 0.07), transparent 40%), var(--shell);
  padding: 12px 14px;
}
.feature-ticket .ft-kicker { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--reef); font-weight: 700; }
.feature-ticket .ft-flow { display: flex; align-items: center; gap: 6px; font-weight: 600; margin-top: 6px; flex-wrap: wrap; font-size: 0.9rem; }
.feature-ticket .ft-arrow { color: var(--reef); }
.feature-ticket .ft-reason { font-size: 0.78rem; color: var(--ink-dim); margin-top: 6px; }
.feature-ticket .ft-empty { font-size: 0.82rem; color: var(--ink-dim); }

/* -----------------------------------------------------------------------
   Zones screen
----------------------------------------------------------------------- */
.network-frame {
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: radial-gradient(circle at 50% 42%, rgba(28, 127, 166, 0.09), transparent 65%), var(--shell);
  padding: 6px;
}
.network-frame svg { width: 100%; height: auto; display: block; }
.zone-node { cursor: pointer; }
.zone-node text { font-family: 'Public Sans', sans-serif; fill: var(--ink); pointer-events: none; }
.zone-node .node-count { font-family: 'JetBrains Mono', monospace; font-weight: 600; }
.zone-node .node-bg {
  transition: transform 0.15s var(--ease), stroke-width 0.15s var(--ease); transform-origin: center; transform-box: fill-box;
  /* An empty zone's circle has fill="none", so by default only its stroke
     line is clickable, not the middle — this makes the whole circle area
     hit-testable regardless of fill, for both node variants. */
  pointer-events: all;
}
.zone-node:hover .node-bg, .zone-node:focus-visible .node-bg { transform: scale(1.06); }
.zone-node.selected .node-bg { stroke-width: 3.5; transform: scale(1.1); }
.zone-node:focus-visible { outline: none; }
.zone-node:focus-visible .node-bg { stroke: var(--reef); stroke-width: 3; }
.net-link { stroke: var(--hairline-strong); stroke-width: 1.5; fill: none; stroke-dasharray: 1 5; stroke-linecap: round; }
.net-ring { stroke: rgba(15, 61, 74, 0.09); fill: none; }

.legend-strip { display: flex; gap: 12px; flex-wrap: wrap; padding: 10px 4px 2px; font-size: 0.68rem; color: var(--ink-dim); }
.legend-strip .lg-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 4px; vertical-align: middle; }
.legend-strip .lg-dot-empty { background: transparent; border: 1.5px dashed var(--ink-faint); }
.legend-strip .lg-dot-critical { background: var(--critical); }
.legend-strip .lg-dot-shortage { background: var(--shortage); }
.legend-strip .lg-dot-balanced { background: var(--balanced); }
.legend-strip .lg-dot-surplus { background: var(--surplus); }

.zone-detail { margin-top: 14px; }
.zone-detail-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.zone-detail-head h3 { font-size: 1rem; font-weight: 600; font-family: 'Public Sans', sans-serif; }
.zd-coastal {
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--surplus); background: rgba(28, 127, 166, 0.12);
  padding: 2px 7px; border-radius: 999px;
}
.zone-detail-body { display: flex; flex-direction: column; gap: 8px; }

.goto-storm {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; border: 1px solid var(--reef-dim); border-radius: 999px;
  background: transparent; color: var(--reef-dim); color: var(--reef); padding: 12px 16px;
  font-size: 0.85rem; font-weight: 600; min-height: 44px; margin-top: 4px;
}
.goto-storm:active { background: rgba(22, 126, 119, 0.10); }

.zone-hint { font-size: 0.76rem; color: var(--ink-faint); text-align: center; padding: 10px 8px; }

/* -----------------------------------------------------------------------
   Storm Mode screen
----------------------------------------------------------------------- */
.severity-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.severity-chip {
  min-height: 44px;
  border: 1px solid var(--hairline-strong);
  background: var(--shell);
  color: var(--ink-dim);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 2px;
}
.severity-chip.active { background: var(--coral); border-color: var(--coral); color: #fff; }

.btn { border: none; border-radius: 999px; font-weight: 700; cursor: pointer; min-height: 48px; transition: transform 0.08s ease, opacity 0.15s ease; }
.btn:active { transform: scale(0.98); }
.btn-primary {
  width: 100%; color: #fff8f2; font-size: 0.95rem; letter-spacing: 0.02em; margin-top: 10px;
  background: linear-gradient(180deg, #E17A4C, var(--coral));
  box-shadow: 0 6px 20px rgba(217, 102, 61, 0.30);
}
.btn-primary:disabled { opacity: 0.55; }
.btn-text { width: 100%; background: transparent; color: var(--ink-dim); font-size: 0.78rem; font-weight: 600; margin-top: 8px; text-decoration: underline; text-underline-offset: 3px; }

.pipeline-v { list-style: none; margin: 0; padding: 0; }
.pipeline-v .pv-step { display: flex; gap: 12px; padding-bottom: 14px; position: relative; }
.pipeline-v .pv-step:last-child { padding-bottom: 0; }
.pipeline-v .pv-rail { position: relative; width: 20px; flex-shrink: 0; display: flex; justify-content: center; }
.pipeline-v .pv-rail::before {
  content: ""; position: absolute; top: 20px; bottom: -14px; width: 0;
  border-left: 2px dashed var(--hairline-strong);
}
.pipeline-v .pv-step:last-child .pv-rail::before { display: none; }
.pv-dot {
  width: 18px; height: 18px; border-radius: 50%; background: var(--shell);
  border: 2px solid var(--hairline-strong); flex-shrink: 0; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s var(--ease);
}
.pv-step.done .pv-dot { background: var(--reef); border-color: var(--reef); }
.pv-step.active .pv-dot { border-color: var(--reef-bright); box-shadow: 0 0 0 4px rgba(22, 126, 119, 0.16); }
.pv-body { padding-top: 1px; }
.pv-label { font-size: 0.85rem; font-weight: 600; color: var(--ink-faint); transition: color 0.3s var(--ease); }
.pv-step.active .pv-label, .pv-step.done .pv-label { color: var(--ink); }
.pv-desc { font-size: 0.7rem; color: var(--ink-faint); margin-top: 1px; }

/* Tide gauge: one continuous instrument strip with tick dividers,
   instead of three separate bordered stat tiles */
.outcome-strip {
  display: grid; grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--hairline); border-radius: var(--radius);
  background: linear-gradient(180deg, var(--shell-warm), var(--shell));
  overflow: hidden;
}
.outcome-strip .o-tile { padding: 10px 6px; text-align: center; position: relative; }
.outcome-strip .o-tile + .o-tile::before {
  content: ""; position: absolute; left: 0; top: 14%; bottom: 14%; width: 0;
  border-left: 1px dashed var(--hairline-strong);
}
.outcome-strip .o-value { font-family: 'JetBrains Mono', monospace; font-size: 1.2rem; font-weight: 700; color: var(--ocean); }
.outcome-strip .o-label { font-size: 0.6rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }

.section-label {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-dim); margin: 18px 0 8px; display: flex; align-items: center; gap: 7px;
}
.section-label::before {
  content: ""; width: 14px; height: 6px; flex-shrink: 0;
  background-image: var(--tide-svg); background-repeat: no-repeat; background-size: 20px 6px;
}

/* Manifest-ticket match cards: a tear-stub layout instead of a rounded
   card with a colored left border. */
.ticket { border: 1px solid var(--hairline-strong); border-radius: var(--radius-sm); background: var(--shell); overflow: hidden; }
.ticket + .ticket { margin-top: 8px; }
.ticket-top { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; gap: 8px; }
.ticket-flow { font-size: 0.85rem; font-weight: 600; display: flex; align-items: center; gap: 6px; min-width: 0; }
.ticket-flow .tf-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-flow .tf-arrow { color: var(--reef); flex-shrink: 0; }
.stamp {
  flex-shrink: 0; font-family: 'JetBrains Mono', monospace; font-size: 0.62rem; font-weight: 600;
  border: 1px solid var(--reef-dim); color: var(--reef); border-radius: var(--radius-sm);
  padding: 2px 6px; letter-spacing: 0.04em; text-transform: uppercase;
}
.ticket-perf {
  border-top: 1px dashed var(--hairline-strong);
  position: relative;
}
.ticket-meta { padding: 7px 12px 0; font-size: 0.68rem; color: var(--ink-faint); display: flex; justify-content: space-between; gap: 8px; }
.priority-tag { font-family: 'JetBrains Mono', monospace; }
.ticket-reason { padding: 6px 12px 10px; font-size: 0.76rem; color: var(--ink-dim); }
.ticket-contact {
  padding: 6px 12px 10px; font-size: 0.78rem;
  display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
}
.ticket-contact-label { color: var(--ink-faint); font-size: 0.7rem; }
.ticket-contact-phone { font-family: 'JetBrains Mono', monospace; font-weight: 700; color: var(--reef); text-decoration: none; }
.ticket.receiver-CRITICAL .stamp { border-color: var(--critical); color: var(--critical); }
.ticket.receiver-SHORTAGE .stamp { border-color: var(--shortage); color: var(--shortage); }

.unresolved-ticket {
  border: 1px dashed var(--ink-faint); border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 0.76rem; color: var(--ink-dim); background: rgba(194, 69, 43, 0.06);
}
.unresolved-ticket + .unresolved-ticket { margin-top: 8px; }
.unresolved-ticket strong { color: var(--ink); }

/* -----------------------------------------------------------------------
   Resident cards (used inside the Zone Network detail panel)
----------------------------------------------------------------------- */
.resident-card { border: 1px solid var(--hairline); border-radius: var(--radius-sm); background: var(--shell-warm); padding: 10px 12px; }
.resident-card + .resident-card { margin-top: 8px; }
.resident-card-head { display: flex; align-items: center; gap: 9px; }
.resident-photo { width: 38px; height: 38px; border-radius: var(--radius-sm); object-fit: cover; border: 1px solid var(--hairline-strong); flex-shrink: 0; }
.resident-name { font-weight: 700; font-size: 0.88rem; }
.resident-meta { font-size: 0.68rem; color: var(--ink-faint); margin-top: 2px; }

.badge-row { display: flex; gap: 5px; flex-wrap: wrap; margin: 6px 0; }
.badge { font-size: 0.6rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.02em; }
.badge-critical-need { background: rgba(194, 69, 43, 0.12); color: #9E3A24; }
.badge-vulnerable { background: rgba(201, 138, 30, 0.16); color: #8A5A0C; }
.badge-shelter-weak { background: rgba(14, 47, 56, 0.08); color: var(--ink-dim); }

.resource-rows { display: flex; flex-direction: column; gap: 5px; margin-top: 7px; }
.resource-row { display: grid; grid-template-columns: 44px 1fr 52px; align-items: center; gap: 7px; }
.resource-label { font-size: 0.64rem; font-weight: 700; color: var(--ink-faint); text-transform: uppercase; }
.resource-track { background: rgba(14, 47, 56, 0.08); border-radius: 999px; height: 6px; overflow: hidden; }
.resource-fill { height: 100%; border-radius: 999px; transition: width 0.4s var(--ease); }
.resource-fill.CRITICAL { background: var(--critical); }
.resource-fill.SHORTAGE { background: var(--shortage); }
.resource-fill.BALANCED { background: var(--balanced); }
.resource-fill.SURPLUS  { background: var(--surplus); }
.resource-value { font-family: 'JetBrains Mono', monospace; font-size: 0.68rem; text-align: right; color: var(--ink-dim); }
.resource-value.CRITICAL { color: var(--critical); font-weight: 600; }
.resource-value.SHORTAGE { color: var(--shortage); font-weight: 600; }

/* -----------------------------------------------------------------------
   Auth strip (below the top bar, above the screens)
----------------------------------------------------------------------- */
.auth-strip {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 16px;
  background: linear-gradient(180deg, rgba(11, 58, 74, 0.05), var(--shell) 120%);
  border-bottom: 1px solid var(--hairline);
  font-size: 0.72rem;
}
.auth-strip .as-email { color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-strip .as-logout, .auth-strip .as-signin {
  background: transparent; border: none; color: var(--reef);
  font-size: 0.72rem; font-weight: 600; padding: 4px 2px; min-height: 28px;
  text-decoration: underline; text-underline-offset: 2px; flex-shrink: 0;
}
.auth-strip .as-signin { width: 100%; text-align: left; text-decoration: none; }

/* -----------------------------------------------------------------------
   Profile screen — auth forms + "my listing" form
----------------------------------------------------------------------- */
.auth-note { font-size: 0.78rem; color: var(--ink-dim); margin-bottom: 12px; }

.field-label { display: block; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-faint); margin: 12px 0 5px; }
.field-label:first-child { margin-top: 0; }
.field-input {
  width: 100%; min-height: 44px; border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-sm); background: var(--shell); color: var(--ink);
  font-family: inherit; font-size: 0.9rem; padding: 8px 10px;
}
.field-input:focus { outline: none; border-color: var(--reef); box-shadow: 0 0 0 3px rgba(31, 174, 158, 0.22); }
input.field-input[type="file"] { padding: 9px 8px; font-size: 0.76rem; color: var(--ink-dim); }
select.field-input { appearance: none; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row .field-label { margin-top: 12px; }

.field-check {
  display: flex; align-items: center; gap: 8px; margin-top: 14px;
  font-size: 0.82rem; color: var(--ink);
}
.field-check input { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--reef); }

.auth-error {
  margin-top: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  background: rgba(194, 69, 43, 0.10); border: 1px solid var(--critical-dim);
  color: var(--critical); font-size: 0.76rem;
}

.photo-preview { margin-top: 8px; }
.photo-preview img { width: 100%; max-height: 160px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--hairline-strong); }

.profile-photo { width: 64px; height: 64px; border-radius: var(--radius); margin-bottom: 12px; }
.review-list { border: 1px solid var(--hairline); border-radius: var(--radius-sm); background: var(--shell); overflow: hidden; margin: 4px 0 16px; }
.review-row { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; font-size: 0.82rem; }
.review-row + .review-row { border-top: 1px solid var(--hairline); }
.review-row span { color: var(--ink-faint); flex-shrink: 0; }
.review-row strong { color: var(--ink); text-align: right; font-weight: 600; }

/* One card per property — used on both the onboarding review step and
   the Profile tab summary, since a household can now have several. */
.property-card { border: 1px solid var(--hairline); border-radius: var(--radius); padding: 12px; margin-top: 14px; background: var(--shell-warm); }
.property-card-head { font-weight: 700; font-size: 0.9rem; margin-bottom: 8px; color: var(--reef-dim); }
.property-card .review-list { margin-bottom: 12px; }
.property-card .field-input, .property-card .photo-preview { margin-bottom: 0; }

/* -----------------------------------------------------------------------
   Bottom tab bar
----------------------------------------------------------------------- */
.tabbar {
  flex-shrink: 0;
  display: flex;
  background: var(--sand-deep);
  padding-bottom: env(safe-area-inset-bottom, 0);
  position: relative;
}
.tabbar::before {
  content: "";
  position: absolute; left: 0; right: 0; top: -1px; height: 7px;
  background-image: var(--tide-svg);
  background-repeat: repeat-x;
  background-size: 34px 7px;
  transform: scaleY(-1);
  opacity: 0.9;
}
.tab-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 11px 4px 8px; min-height: 52px; border: none; background: transparent;
  color: var(--ink-faint); font-size: 0.64rem; font-weight: 600; letter-spacing: 0.02em;
}
.tab-btn svg { width: 21px; height: 21px; }
.tab-btn svg * { stroke: currentColor; }
.tab-btn.active { color: var(--reef); }
.tab-btn:active { opacity: 0.7; }

/* Utility */
.hidden { display: none !important; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: var(--hairline-strong); border-radius: 2px; }
