/* ════════════════════════════════════════════════════════════════════
   Catbird — Still Habitat PWA app styles.

   Layered ON TOP of the shared design kit (/vendor/catbird-kit/catbird-kit.css,
   loaded BEFORE this file in catbird.html). We do NOT redefine the kit's
   --cb-* tokens; we reference them via var(--cb-…). The :root block below is
   a FALLBACK only — if the kit somehow isn't loaded, these warm-linen /
   sage / clay / forest values keep the app legible. The kit's own :root wins
   on cascade order when present (same specificity, kit loads first… so we
   guard each fallback with the kit value via var(--cb-x, fallback) at use
   sites where it matters, and keep these here as a safety net).

   Fonts: Spectral serif comes from the kit's already-loaded /vendor/fonts.
   This file references NO external/CDN URLs. CDN-free is mandatory.

   Class inventory (everything app.js / map.js / catbird.html emit):
     shell    .cb-status-bar .cb-header .cb-brand .cb-app-name .cb-main
              .cb-pane .cb-nav .nav-btn #toast/.toast .cb-map-container
              .cb-gps-indicator .cb-pending-badge .cb-stale-bar
     content  .cb-card .cb-heading .cb-subheading .cb-body .cb-muted .cb-pad
              .cb-input .cb-btn .cb-btn-primary .cb-spinner .cb-label
              .cb-stat-hero .cb-bucket-list/row/label/count
              .cb-det-row/species/ear/day
              .cb-log-list/row/tier/species/ear/day
     record   .cb-taxon-row/btn .cb-rec-center .cb-mic-btn .cb-rec-timer
              .cb-id-result .cb-canopy-status .cb-id-guess
              .cb-live-toggle #live-panel .cb-spec-canvas
              .cb-live-list/row/dim/species/pct/tag
     fleet    .cb-fleet-summary/row/ear/status/quiet/active/count
     suggest  .cb-suggest-row/title/reason/badge
     guest    .cb-gb-list/row/head/name/day/species/note  body.cb-guest
     onboard  .cb-onboard-gps .cb-onboard-status .cb-checklist
     toast    .toast-info/ok/warn/error
     markers  .cb-map-marker .cb-ear-marker .cb-suggest-marker
   ════════════════════════════════════════════════════════════════════ */

/* ── Fallback tokens (kit's :root wins when loaded) ──────────────────── */
:root {
  --cb-bg:        #F5F2EE;
  --cb-panel:     #EDE8E1;
  --cb-panel-2:   #E2DAD0;
  --cb-fg:        #211E18;
  --cb-muted:     #6B6358;
  --cb-accent:    #3E6B57;
  --cb-accent-2:  #9E5A3E;
  --cb-danger:    #A6463A;
  --cb-warn:      #9E5A3E;
  --cb-border:    rgba(33, 30, 24, 0.14);
  --cb-sage:      #C4BEAF;
  --cb-hover:     rgba(33, 30, 24, 0.05);
  --cb-tier-rare:    #9E5A3E;
  --cb-tier-notable: #6B8E6E;
  --cb-tier-common:  #C4BEAF;
  --cb-status-online:  #3E6B57;
  --cb-status-stale:   #9E5A3E;
  --cb-status-offline: #6B6358;
  --cb-hf:   'Spectral', Georgia, 'Times New Roman', serif;
  --cb-bf:   -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --cb-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  --cb-shadow:      0 1px 1px rgba(33,30,24,0.05), 0 2px 4px rgba(33,30,24,0.07);
  --cb-shadow-card: 0 2px 12px rgba(33,30,24,0.09);
  --cb-radius:    12px;
  --cb-radius-sm: 8px;

  /* App-local layout rhythm (NOT kit tokens — safe to define) */
  --sh-header-h: 52px;
  --sh-status-h: 26px;
  --sh-nav-h:    58px;
  --sh-safe-top:    env(safe-area-inset-top, 0px);
  --sh-safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── Reset / base ────────────────────────────────────────────────────── */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--cb-bg);
  color: var(--cb-fg);
  font-family: var(--cb-bf);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Lock the document; only .cb-main scrolls. Prevents the fixed nav from
     drifting and stops iOS rubber-banding over the chrome. */
  overflow: hidden;
  overscroll-behavior: none;
}

/* THE FOOTGUN (requirement 1): a bare `.cb-pane { display: … }` rule would
   override the [hidden] attribute. We never give .cb-pane a display rule, and
   we add this global belt-and-suspenders guard so ANY [hidden] element (panes,
   nav buttons, badges, timers, previews) is truly removed from layout. */
[hidden] { display: none !important; }

/* ════════════════════════════════════════════════════════════════════
   SHELL — fixed status bar + header on top, fixed nav at bottom,
   scrollable .cb-main between them.
   ════════════════════════════════════════════════════════════════════ */

/* Stale-data banner — thin amber ribbon pinned to the very top, above the
   status bar. Shown via [hidden] toggle from app.js when reading a cache. */
.cb-stale-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  padding: calc(4px + var(--sh-safe-top)) 12px 4px;
  background: var(--cb-accent-2);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
}
/* When a stale-bar is rendered INSIDE a pane (renderPlace/renderLog inline it
   as a non-fixed block), keep it a normal in-flow chip, not a fixed banner. */
.cb-pane .cb-stale-bar {
  position: static;
  padding: 6px 10px;
  margin-bottom: 0.75rem;
  border-radius: var(--cb-radius-sm);
  text-align: left;
}

/* Status bar — GPS indicator + pending badge. Sits under the notch. */
.cb-status-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: calc(var(--sh-status-h) + var(--sh-safe-top));
  padding: var(--sh-safe-top) 14px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--cb-panel);
  border-bottom: 1px solid var(--cb-border);
  font-size: 0.7rem;
}

.cb-gps-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--cb-muted);
  font-family: var(--cb-mono);
  letter-spacing: 0.02em;
}
.cb-gps-indicator::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cb-status-offline);
}
/* A live fix turns the dot forest-green (heuristic: text starts with "GPS"). */
.cb-gps-indicator:not(:empty)::before { background: var(--cb-status-online); }

.cb-pending-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--cb-accent-2);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* App header — brand lockup. Pinned just below the status bar. */
.cb-header {
  position: fixed;
  top: calc(var(--sh-status-h) + var(--sh-safe-top));
  left: 0;
  right: 0;
  z-index: 40;
  height: var(--sh-header-h);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0 16px;
  background: var(--cb-bg);
  border-bottom: 1px solid var(--cb-border);
  /* family signature sage→clay→forest hairline under the header */
  box-shadow: 0 2px 0 -1px transparent;
  /* clip the decorative bird layer to the header bar */
  overflow: hidden;
}

/* Flying-bird silhouettes — drift behind the header text at half opacity.
   Pure CSS; ported from Maggii field.html. Pointer-transparent. */
#bird-layer {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 0;          /* behind .cb-brand / .cb-app-name (raised below) */
  opacity: 0.5;        /* half opacity behind the header text */
  overflow: hidden;
}
#bird-layer .bird {
  position: absolute; opacity: 0;
  animation: bird-fly linear infinite;
}
@keyframes bird-fly {
  0%   { transform: translateX(-40px); opacity: 0; }
  4%   { opacity: 0.55; }
  92%  { opacity: 0.4; }
  100% { transform: translateX(calc(100vw + 40px)); opacity: 0; }
}
/* Honour reduced-motion: hold the birds still and out of sight. */
@media (prefers-reduced-motion: reduce) {
  #bird-layer .bird { animation: none; opacity: 0; }
}
/* Keep the brand lockup above the bird layer. */
.cb-header > .cb-brand,
.cb-header > .cb-app-name { position: relative; z-index: 1; }
.cb-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  pointer-events: none;
  background: linear-gradient(90deg,
    var(--cb-sage), var(--cb-accent-2), var(--cb-accent));
  opacity: 0.55;
}
.cb-brand {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cb-accent);
  font-style: italic;
}
.cb-app-name {
  font-family: var(--cb-hf);
  font-size: 1.32rem;
  font-weight: 700;
  color: var(--cb-fg);
  letter-spacing: 0.01em;
}

/* Scrollable content region — the only thing that scrolls. */
.cb-main {
  position: fixed;
  left: 0;
  right: 0;
  top: calc(var(--sh-status-h) + var(--sh-safe-top) + var(--sh-header-h));
  bottom: calc(var(--sh-nav-h) + var(--sh-safe-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 14px 14px 20px;
}

/* Field-notebook pattern — a muted forest-green duotone owl, tiled behind the
   whole app as a quiet vintage-endpaper motif. The colour is pre-baked into the
   tile (already a soft sage duotone), so no filter is applied here. Fixed and
   low opacity, sitting behind the solid card backgrounds; it reads through the
   gutters and the empty/loading state. Pure CSS — no render-path code, so it can
   never blank the app. Owl: BHL, Edinburgh Jrnl of Nat. Hist. 1835–40. */
body::before {
  content: "";
  position: fixed;
  left: 0; right: 0;
  top: calc(var(--sh-status-h) + var(--sh-safe-top) + var(--sh-header-h));
  bottom: calc(var(--sh-nav-h) + var(--sh-safe-bottom));
  z-index: 0;
  pointer-events: none;
  background: url(/vendor/plates/owl-motif.jpg) left top / 128px auto repeat;
  opacity: 0.22;
}
/* Keep app content above the pattern. */
.cb-main { z-index: 1; }
@media (prefers-color-scheme: dark) { body::before { opacity: 0.16; } }

/* Panes stack their cards. NOTE: deliberately NO `display` here so [hidden]
   wins (see footgun note above). We only set spacing via children. */
.cb-pane > * + * { margin-top: 14px; }

/* The map pane needs to fill its area, so it gets flow layout when visible. */
.cb-pane[data-pane="map"]:not([hidden]) {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.cb-map-container {
  flex: 1;
  min-height: 60vh;
  width: 100%;
  border-radius: var(--cb-radius);
  overflow: hidden;
  border: 1px solid var(--cb-border);
  box-shadow: var(--cb-shadow);
  background: var(--cb-panel-2);
}

/* ── Bottom navigation ───────────────────────────────────────────────── */
.cb-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  height: calc(var(--sh-nav-h) + var(--sh-safe-bottom));
  padding-bottom: var(--sh-safe-bottom);
  display: flex;
  align-items: stretch;
  background: var(--cb-panel);
  border-top: 1px solid var(--cb-border);
  box-shadow: 0 -2px 12px rgba(33, 30, 24, 0.08);
}

.nav-btn {
  flex: 1 1 0;        /* equal share; hidden ones are removed via [hidden] */
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 2px;
  border: 0;
  background: none;
  color: var(--cb-muted);
  font-family: var(--cb-bf);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.18s ease;
}
.nav-btn svg {
  width: 22px;
  height: 22px;
  opacity: 0.78;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.nav-btn span {
  line-height: 1;
}
.nav-btn:active svg { transform: scale(0.9); }

.nav-btn.active {
  color: var(--cb-accent);
}
.nav-btn.active svg {
  opacity: 1;
  transform: translateY(-1px);
}
/* Active accent tick above the icon. */
.nav-btn.active::before {
  content: "";
  position: absolute;
  top: 0;
  width: 26px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--cb-accent);
}
.nav-btn { position: relative; }

/* Field Sync nav badge — the pending-upload count on the tab itself (the app's #1
   nag: "you still have detections to send"). Fulcrum rule: show the number up to 9,
   then a bare dot for 10+ (.cb-nav-badge-dot), so it stays legible in sun/gloves. */
.cb-nav-badge {
  position: absolute;
  top: 2px;
  left: calc(50% + 8px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--cb-accent-2);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.cb-nav-badge-dot {
  min-width: 9px;
  width: 9px;
  height: 9px;
  padding: 0;
}

/* ════════════════════════════════════════════════════════════════════
   CARDS + TYPOGRAPHY — parchment surface, Spectral letterpress headings.
   ════════════════════════════════════════════════════════════════════ */
.cb-card {
  background: var(--cb-panel);
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-radius);
  padding: 1rem 1.05rem;
  box-shadow: var(--cb-shadow-card);
}

.cb-heading {
  margin: 0 0 0.5rem;
  font-family: var(--cb-hf);
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.12;
  color: var(--cb-fg);
  letter-spacing: 0.005em;
  /* subtle letterpress: a faint light edge above, soft dark below */
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}
.cb-subheading {
  margin: 0 0 0.5rem;
  font-family: var(--cb-hf);
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--cb-fg);
  letter-spacing: 0.01em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}
.cb-body {
  margin: 0 0 0.7rem;
  color: var(--cb-fg);
  font-size: 0.94rem;
  line-height: 1.5;
}
.cb-muted {
  color: var(--cb-muted);
  font-size: 0.88rem;
}
/* Status-line color modifiers (e.g. the field clock-sync result). */
.cb-muted.cb-ok   { color: var(--cb-accent); }
.cb-muted.cb-warn { color: var(--cb-warn); }
.cb-pad { padding: 1rem; }

/* Small "ready/online" dot — leads a status line (account "Signed in as…",
   the Offline-ID "Ready for offline" line). Forest-green, gently glowing. */
.cb-signed-dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.45rem;
  border-radius: 50%;
  background: var(--cb-accent);
  box-shadow: 0 0 6px var(--cb-accent);
  vertical-align: middle;
}

/* Hero stat — big mono number, the "X total" on Place/Now. */
.cb-stat-hero {
  font-family: var(--cb-hf);
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--cb-accent);
  line-height: 1;
  margin: 0.1rem 0 0.8rem;
  letter-spacing: 0.01em;
}

/* ── Forms ───────────────────────────────────────────────────────────── */
.cb-input,
textarea.cb-input {
  display: block;
  width: 100%;
  margin: 0.4rem 0;
  padding: 0.7rem 0.8rem;
  min-height: 44px;                 /* comfortable tap target */
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-radius-sm);
  background: var(--cb-bg);
  color: var(--cb-fg);
  font-family: var(--cb-bf);
  font-size: 1rem;
  line-height: 1.35;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
textarea.cb-input {
  min-height: 72px;
  resize: vertical;
}
.cb-input:focus,
textarea.cb-input:focus {
  outline: none;
  border-color: var(--cb-accent);
  box-shadow: 0 0 0 3px rgba(62, 107, 87, 0.16);
}
.cb-input::placeholder { color: var(--cb-muted); opacity: 0.8; }

.cb-label {
  display: block;
  margin: 0.65rem 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--cb-muted);
}
.cb-label .cb-input { margin-top: 0.3rem; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.cb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  margin: 0.4rem 0;
  padding: 0.7rem 1rem;
  min-height: 44px;
  border: 1px solid var(--cb-accent);
  border-radius: var(--cb-radius-sm);
  background: transparent;
  color: var(--cb-accent);
  font-family: var(--cb-bf);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.16s ease, transform 0.08s ease, box-shadow 0.16s ease;
}
.cb-btn:active { transform: translateY(1px); }
.cb-btn:hover { background: var(--cb-hover); }
.cb-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.cb-btn-primary {
  background: var(--cb-accent);
  border-color: var(--cb-accent);
  color: #fff;
  box-shadow: var(--cb-shadow);
}
.cb-btn-primary:hover { background: #355d4b; }
.cb-btn-primary:disabled { background: var(--cb-accent); }

/* Field-grade primary: taller target for cold/gloved hands in the field (toward
   NN/g ~2cm). WCAG 2.5.8 (AA) floor is 24px and the base .cb-btn already clears
   that at 44px; this pushes the FIELD primaries (Collect / Upload) to ~58px. */
.cb-btn-field {
  min-height: 58px;
  font-size: 1.02rem;
}

/* ── Spinner ─────────────────────────────────────────────────────────── */
.cb-spinner {
  width: 34px;
  height: 34px;
  margin: 2.5rem auto;
  border: 3px solid var(--cb-border);
  border-top-color: var(--cb-accent);
  border-radius: 50%;
  animation: cb-spin 0.85s linear infinite;
}
@keyframes cb-spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════════════════════════════════
   BUCKET LIST (species counts) + DETECTION ROWS (Place/Now)
   ════════════════════════════════════════════════════════════════════ */
.cb-bucket-list { margin: 0.3rem 0 0.2rem; }
.cb-bucket-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--cb-border);
}
.cb-bucket-row:last-child { border-bottom: none; }
.cb-bucket-label {
  flex: 1;
  min-width: 0;
  color: var(--cb-fg);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cb-bucket-count {
  flex: 0 0 auto;
  font-family: var(--cb-mono);
  font-weight: 700;
  color: var(--cb-accent);
  font-variant-numeric: tabular-nums;
}

.cb-det-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--cb-border);
}
.cb-det-row:last-child { border-bottom: none; }
.cb-det-species {
  flex: 1;
  min-width: 0;
  font-family: var(--cb-hf);
  font-size: 1rem;
  font-weight: 600;
  color: var(--cb-fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cb-det-ear {
  flex: 0 0 auto;
  font-size: 0.74rem;
  color: var(--cb-accent);
  font-weight: 600;
}
.cb-det-day {
  flex: 0 0 auto;
  font-family: var(--cb-mono);
  font-size: 0.72rem;
  color: var(--cb-muted);
  white-space: nowrap;
  /* tappable: title shows the absolute local time */
  cursor: help;
  text-decoration: underline dotted var(--cb-border);
  text-underline-offset: 2px;
}

/* ── Log tab rows ────────────────────────────────────────────────────── */
.cb-log-list {
  background: var(--cb-panel);
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-radius);
  overflow: hidden;
  box-shadow: var(--cb-shadow);
}
.cb-log-row {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--cb-border);
}
.cb-log-row:last-child { border-bottom: none; }
/* confidence glyph — ✓ confirmed / ~ likely / ? maybe, mapped to tier hues */
.cb-log-tier {
  flex: 0 0 auto;
  width: 1.3rem;
  text-align: center;
  font-weight: 700;
  color: var(--cb-status-offline);
}
.cb-log-tier[title="confirmed"] { color: var(--cb-status-online); }
.cb-log-tier[title="likely"]    { color: var(--cb-status-stale); }
.cb-log-tier[title="maybe"]     { color: var(--cb-muted); }
.cb-log-species {
  flex: 1;
  min-width: 0;
  font-family: var(--cb-hf);
  font-weight: 600;
  color: var(--cb-fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cb-log-ear {
  flex: 0 0 auto;
  font-size: 0.74rem;
  color: var(--cb-accent);
  font-weight: 600;
}
.cb-log-day {
  flex: 0 0 auto;
  font-family: var(--cb-mono);
  font-size: 0.72rem;
  color: var(--cb-muted);
  white-space: nowrap;
  /* tappable: title shows the absolute local time */
  cursor: help;
  text-decoration: underline dotted var(--cb-border);
  text-underline-offset: 2px;
}

/* ════════════════════════════════════════════════════════════════════
   RECORD TAB — taxon segmented row, big mic button, timer, ID result.
   ════════════════════════════════════════════════════════════════════ */
.cb-taxon-row {
  display: flex;
  gap: 0;
  margin: 0.6rem 0 1rem;
  border: 1px solid var(--cb-border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--cb-bg);
}
.cb-taxon-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 0.55rem 0.4rem;
  border: 0;
  border-right: 1px solid var(--cb-border);
  background: transparent;
  color: var(--cb-muted);
  font-family: var(--cb-bf);
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: capitalize;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.16s ease, color 0.16s ease;
}
.cb-taxon-btn:last-child { border-right: 0; }
.cb-taxon-btn.active {
  background: var(--cb-accent);
  color: #fff;
}

/* Live spectrogram waterfall on the Record tab. The widget paints onto the
   canvas; the dark surface matches the widget's own #131822 background so the
   idle state and live frames read as one panel. */
.cb-rec-canvas-wrap {
  position: relative;
  margin-top: 0.9rem;
  border-radius: var(--cb-radius-sm);
  overflow: hidden;
  background: #131822;
  border: 1px solid var(--cb-border);
  line-height: 0;
}
#rec-canvas {
  display: block;
  width: 100%;
  height: 150px;
}
.cb-rec-canvas-idle {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.38);
  font-size: 0.88rem;
  line-height: 1.2;
  pointer-events: none;
}
.cb-rec-canvas-idle[hidden] { display: none; }

.cb-rec-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  padding: 1.2rem 0 0.6rem;
}

.cb-mic-btn {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 0;
  background: var(--cb-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 4px 16px rgba(62, 107, 87, 0.35);
  transition: transform 0.12s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.cb-mic-btn:active { transform: scale(0.94); }
.cb-mic-btn svg { width: 38px; height: 38px; }

/* Recording state — clay-red + a sonar pulse ring that breathes outward. */
.cb-mic-btn.recording {
  background: var(--cb-danger);
  box-shadow: 0 4px 18px rgba(166, 70, 58, 0.45);
}
.cb-mic-btn.recording::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid var(--cb-danger);
  animation: cb-mic-pulse 1.5s ease-out infinite;
  pointer-events: none;
}
@keyframes cb-mic-pulse {
  0%   { transform: scale(1);    opacity: 0.7; }
  100% { transform: scale(1.7);  opacity: 0; }
}

.cb-rec-timer {
  font-family: var(--cb-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--cb-danger);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.cb-id-result {
  margin: 0.7rem 0;
  padding: 0.7rem 0.85rem;
  min-height: 1.5rem;
  border-radius: var(--cb-radius-sm);
  background: var(--cb-panel-2);
  border-left: 4px solid var(--cb-accent);
  color: var(--cb-fg);
  font-size: 0.95rem;
}
.cb-id-result:empty {
  display: none;
}
.cb-id-result strong {
  font-family: var(--cb-hf);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--cb-accent);
}

/* On-device ID engine status line. */
.cb-canopy-status {
  margin-top: 0.8rem;
  padding-top: 0.7rem;
  border-top: 1px dashed var(--cb-border);
  font-size: 0.78rem;
  color: var(--cb-muted);
}
.cb-canopy-status #canopy-state {
  font-family: var(--cb-mono);
  color: var(--cb-accent);
  font-weight: 600;
}
/* Phase C debug line (?debug=1): build-time adaptive metadata + live cell. */
.cb-canopy-debug {
  margin-top: 0.4rem;
  font-family: var(--cb-mono);
  font-size: 0.72rem;
  color: var(--cb-muted);
  word-break: break-all;
}

/* ── Phase 2: live "rolling" listen mode ─────────────────────────────────────── */
.cb-live-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0 0.2rem;
  font-size: 0.85rem;
  color: var(--cb-muted);
  cursor: pointer;
}
.cb-live-toggle input { accent-color: var(--cb-accent); }

#live-panel {
  margin: 0.7rem 0;
}
.cb-spec-canvas {
  width: 100%;
  height: 120px;
  display: block;
  border-radius: var(--cb-radius-sm);
  background: #131822;
  border: 1px solid var(--cb-border);
}
.cb-live-list {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.cb-live-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: var(--cb-radius-sm);
  background: var(--cb-panel-2);
  border-left: 4px solid var(--cb-accent);
}
.cb-live-row.cb-live-dim {
  opacity: 0.6;
  border-left-color: var(--cb-muted);
}
.cb-live-species {
  flex: 1;
  font-family: var(--cb-hf);
  font-weight: 600;
  color: var(--cb-fg);
}
.cb-live-pct {
  font-family: var(--cb-mono);
  color: var(--cb-accent);
  font-weight: 600;
}
.cb-live-dim .cb-live-pct { color: var(--cb-muted); }
.cb-live-tag {
  font-size: 0.72rem;
  color: var(--cb-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* recorded-clip preview audio element */
#clip-preview audio {
  width: 100%;
  margin: 0.6rem 0;
}

/* ════════════════════════════════════════════════════════════════════
   FLEET HEALTH — summary line + per-ear rows with a status pill.
   ════════════════════════════════════════════════════════════════════ */
.cb-fleet-summary {
  margin: 0.2rem 0 0.6rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--cb-muted);
  letter-spacing: 0.01em;
}
.cb-fleet-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--cb-border);
}
.cb-fleet-row:last-child { border-bottom: none; }
.cb-fleet-ear {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  color: var(--cb-fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cb-fleet-ear-stack {
  flex: 1 1 11rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}
.cb-fleet-ear-stack .cb-fleet-ear { display: block; }
.cb-fleet-strategy {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  font-size: 0.72rem;
  color: var(--cb-muted);
}
.cb-fleet-strategy > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cb-fleet-strategy-summary {
  margin: -0.2rem 0 0.45rem;
  padding: 0.45rem 0.6rem;
  border-left: 3px solid var(--cb-accent);
  background: var(--cb-panel-2);
  color: var(--cb-text);
  font-size: 0.8rem;
  line-height: 1.35;
}
.cb-strategy-pill {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 1.35rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}
.cb-strategy-static { color: var(--cb-status-online); background: rgba(62, 107, 87, 0.12); }
.cb-strategy-shadow { color: #675a22; background: rgba(194, 158, 45, 0.17); }
.cb-strategy-stale { color: var(--cb-status-stale); background: rgba(158, 90, 62, 0.12); }
.cb-strategy-unknown { color: var(--cb-muted); background: var(--cb-panel-2); }
.cb-fleet-status {
  flex: 0 0 auto;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}
.cb-fleet-active {
  background: rgba(62, 107, 87, 0.14);
  color: var(--cb-status-online);
}
.cb-fleet-quiet {
  background: rgba(158, 90, 62, 0.14);
  color: var(--cb-status-stale);
}
.cb-fleet-count {
  flex: 0 0 auto;
  min-width: 1.8rem;
  text-align: right;
  font-family: var(--cb-mono);
  font-weight: 700;
  color: var(--cb-accent);
  font-variant-numeric: tabular-nums;
}
/* The word "detections" next to the count — turns a bare number into a label. */
.cb-fleet-count-label {
  flex: 0 0 auto;
  font-size: 0.74rem;
  color: var(--cb-muted);
  margin-left: -0.3rem;
}

/* ── Clickable fleet rows + inline ear-detail accordion ─────────────────── */
.cb-fleet-clickable { cursor: pointer; }
.cb-fleet-clickable:hover { background: rgba(33, 30, 24, 0.03); }
.cb-fleet-clickable:focus-visible { outline: 2px solid var(--cb-accent); outline-offset: -2px; }
.cb-fleet-caret {
  flex: 0 0 auto;
  color: var(--cb-muted);
  font-size: 0.8rem;
  transition: transform 0.15s ease;
}
.cb-fleet-row.open .cb-fleet-caret { transform: rotate(90deg); }

.cb-ear-detail {
  padding: 0.4rem 0 0.7rem 1.2rem;
  border-bottom: 1px solid var(--cb-border);
}
.cb-fleet-item:last-child .cb-ear-detail { border-bottom: none; }
.cb-spinner-sm { width: 20px; height: 20px; border-width: 2px; margin: 0.6rem auto; }

.cb-ear-detail-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0.2rem 0 0.5rem;
}
.cb-ear-detail-total { font-weight: 700; color: var(--cb-fg); font-size: 0.9rem; }
.cb-ear-detail-seen { font-size: 0.78rem; color: var(--cb-muted); }
.cb-ear-detail-note { font-size: 0.85rem; margin: 0.4rem 0 0; }

.cb-ear-rename {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}
.cb-ear-rename-input { flex: 1; min-width: 0; }

.cb-ear-taxon { margin-bottom: 0.5rem; }
.cb-ear-taxon-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.15rem;
}
.cb-ear-taxon-name { font-weight: 600; color: var(--cb-fg); font-size: 0.92rem; }
.cb-ear-taxon-counts { font-family: var(--cb-mono); font-size: 0.76rem; color: var(--cb-muted); }
.cb-ear-species-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.2rem 0 0.2rem 0.9rem;
}
.cb-ear-species-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
  color: var(--cb-fg);
}
.cb-ear-species-count {
  flex: 0 0 auto;
  font-family: var(--cb-mono);
  font-weight: 700;
  color: var(--cb-accent);
  font-variant-numeric: tabular-nums;
}

/* ── Owner-only listening strategy ──────────────────────────────────────── */
.cb-listening-card {
  margin: 0.75rem 0 0.9rem;
  padding: 0.8rem;
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-radius-sm);
  background: var(--cb-panel);
  background: color-mix(in srgb, var(--cb-panel) 88%, var(--cb-accent) 12%);
}
.cb-listening-warning { border-color: var(--cb-status-stale); }
.cb-listening-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}
.cb-listening-heading .cb-subheading { margin-bottom: 0.05rem; }
.cb-strategy-kicker { margin: 0; color: var(--cb-muted); font-size: 0.77rem; }
.cb-strategy-stale-note {
  margin-bottom: 0.55rem;
  padding: 0.35rem 0.5rem;
  border-radius: var(--cb-radius-sm);
  background: rgba(158, 90, 62, 0.12);
  color: var(--cb-status-stale);
  font-size: 0.78rem;
  font-weight: 600;
}
.cb-strategy-active,
.cb-strategy-proposal {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.55rem 0;
}
.cb-strategy-active > div,
.cb-strategy-proposal { flex-direction: column; }
.cb-strategy-active strong,
.cb-strategy-proposal strong { color: var(--cb-fg); font-size: 0.9rem; }
.cb-strategy-active span,
.cb-strategy-proposal span { color: var(--cb-muted); font-size: 0.78rem; }
.cb-strategy-dot {
  flex: 0 0 0.65rem;
  width: 0.65rem;
  height: 0.65rem;
  margin-top: 0.25rem;
  border-radius: 50%;
  background: var(--cb-status-online);
  box-shadow: 0 0 0 3px rgba(62, 107, 87, 0.12);
}
.cb-strategy-proposal {
  border-top: 1px dashed var(--cb-border);
  border-bottom: 1px dashed var(--cb-border);
}
.cb-strategy-proposal-empty { opacity: 0.86; }
.cb-strategy-safety,
.cb-strategy-controls-note {
  margin: 0.55rem 0;
  color: var(--cb-muted);
  font-size: 0.76rem;
  line-height: 1.4;
}
.cb-strategy-label {
  margin: 0.8rem 0 0.35rem;
  color: var(--cb-fg);
  font-size: 0.85rem;
  font-weight: 700;
}
.cb-strategy-reasons,
.cb-strategy-history ol,
.cb-strategy-history li ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.cb-strategy-reasons > li,
.cb-strategy-history li ul > li {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  margin: 0.3rem 0;
  color: var(--cb-text);
  font-size: 0.8rem;
  line-height: 1.35;
}
.cb-strategy-reason-tag {
  flex: 0 0 auto;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: var(--cb-panel-2);
  color: var(--cb-muted);
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.cb-strategy-context {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 0.7rem;
}
.cb-strategy-context > div {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.45rem 0.5rem;
  border-radius: var(--cb-radius-sm);
  background: var(--cb-panel-2);
}
.cb-strategy-context span { color: var(--cb-muted); font-size: 0.68rem; }
.cb-strategy-context strong { color: var(--cb-fg); font-size: 0.78rem; }
.cb-strategy-advanced { margin-top: 0.75rem; }
.cb-strategy-advanced summary {
  cursor: pointer;
  color: var(--cb-accent);
  font-size: 0.78rem;
  font-weight: 700;
}
.cb-strategy-advanced summary:focus-visible { outline: 2px solid var(--cb-accent); outline-offset: 3px; }
.cb-strategy-advanced dl { margin: 0.5rem 0 0; }
.cb-strategy-advanced dl > div {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.2rem 0;
  border-bottom: 1px dotted var(--cb-border);
  font-size: 0.76rem;
}
.cb-strategy-advanced dt { color: var(--cb-muted); }
.cb-strategy-advanced dd { margin: 0; color: var(--cb-fg); font-family: var(--cb-mono); }
.cb-strategy-history { margin-top: 0.85rem; padding-top: 0.2rem; border-top: 1px solid var(--cb-border); }
.cb-strategy-history-note { margin: 0 0 0.55rem; font-size: 0.72rem; line-height: 1.35; }
.cb-strategy-history > ol > li { padding: 0.55rem 0; border-bottom: 1px dotted var(--cb-border); }
.cb-strategy-event-head { display: flex; justify-content: space-between; gap: 0.6rem; }
.cb-strategy-event-head strong { color: var(--cb-fg); font-size: 0.8rem; }
.cb-strategy-event-head > span { color: var(--cb-muted); font-family: var(--cb-mono); font-size: 0.68rem; }
.cb-strategy-more { margin-top: 0.6rem; }

@media (max-width: 640px) {
  .cb-fleet-row { flex-wrap: wrap; gap: 0.4rem 0.55rem; }
  .cb-fleet-ear-stack { flex-basis: calc(100% - 1.5rem); }
  .cb-fleet-clickable .cb-fleet-status { margin-left: 1.45rem; }
  .cb-fleet-locate { margin-left: auto; }
  .cb-listening-card { margin-left: -0.55rem; padding: 0.7rem; }
  .cb-listening-heading { align-items: center; }
  .cb-strategy-context { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .cb-fleet-caret { transition: none; }
}

/* ════════════════════════════════════════════════════════════════════
   PLACEMENT SUGGESTIONS — advisory rows with a reason + optional badge.
   ════════════════════════════════════════════════════════════════════ */
.cb-suggest-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.6rem;
  padding: 0.55rem 0;
  border-bottom: 1px dashed var(--cb-border);
}
.cb-suggest-row:last-child { border-bottom: none; }
.cb-suggest-title {
  flex: 1 1 100%;
  font-family: var(--cb-hf);
  font-size: 1rem;
  font-weight: 600;
  color: var(--cb-fg);
}
.cb-suggest-reason {
  flex: 1 1 auto;
  font-size: 0.82rem;
  color: var(--cb-muted);
  line-height: 1.4;
}
.cb-suggest-badge {
  flex: 0 0 auto;
  align-self: center;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--cb-accent-2);
  background: rgba(158, 90, 62, 0.08);
  color: var(--cb-accent-2);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ════════════════════════════════════════════════════════════════════
   GUESTBOOK — entry cards: name/day header, optional species, note body.
   ════════════════════════════════════════════════════════════════════ */
.cb-gb-list > * + * { margin-top: 12px; }
.cb-gb-row {
  background: var(--cb-panel);
  border: 1px solid var(--cb-border);
  border-left: 4px solid var(--cb-sage);
  border-radius: var(--cb-radius-sm);
  padding: 0.75rem 0.9rem;
  box-shadow: var(--cb-shadow);
}
.cb-gb-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}
.cb-gb-name {
  font-family: var(--cb-hf);
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--cb-fg);
}
.cb-gb-day {
  flex: 0 0 auto;
  font-family: var(--cb-mono);
  font-size: 0.72rem;
  color: var(--cb-muted);
}
.cb-gb-species {
  margin-bottom: 0.3rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cb-accent);
  letter-spacing: 0.01em;
}
.cb-gb-note {
  color: var(--cb-fg);
  font-size: 0.92rem;
  line-height: 1.5;
}

/* ════════════════════════════════════════════════════════════════════
   ONBOARDING — add-ear flow: GPS readout, status line, "you're live" list.
   ════════════════════════════════════════════════════════════════════ */
.cb-onboard-gps,
.cb-onboard-status {
  margin: 0.6rem 0;
  padding: 0.6rem 0.8rem;
  border-radius: var(--cb-radius-sm);
  background: var(--cb-panel-2);
  font-family: var(--cb-mono);
  font-size: 0.85rem;
  color: var(--cb-fg);
}
.cb-onboard-status { color: var(--cb-muted); }

.cb-checklist {
  list-style: none;
  margin: 0.4rem 0 0.9rem;
  padding: 0;
}
.cb-checklist li {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--cb-border);
  font-size: 0.92rem;
  color: var(--cb-fg);
}
.cb-checklist li:last-child { border-bottom: none; }
/* A ✓-prefixed line reads as done (forest green); ○ stays muted. */
.cb-checklist li { color: var(--cb-muted); }

/* Empty-fleet two-way CTA: stack the branch buttons with a little breathing room. */
.cb-empty-cta { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.6rem; }
.cb-empty-cta .cb-body { margin: 0 0 0.2rem; }

/* ════════════════════════════════════════════════════════════════════
   TOAST — bottom-center pill, sits above the nav. Color by kind.
   ════════════════════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--sh-nav-h) + var(--sh-safe-bottom) + 14px);
  transform: translateX(-50%);
  z-index: 80;
  max-width: calc(100vw - 28px);
  padding: 0.65rem 1.05rem;
  border-radius: 999px;
  background: var(--cb-fg);
  color: var(--cb-bg);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  box-shadow: 0 4px 20px rgba(33, 30, 24, 0.3);
  animation: cb-toast-in 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes cb-toast-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
.toast-info  { background: var(--cb-fg);     color: var(--cb-bg); }
.toast-ok    { background: var(--cb-accent); color: #fff; }
.toast-warn  { background: var(--cb-warn);   color: #fff; }
.toast-error { background: var(--cb-danger); color: #fff; }

/* ════════════════════════════════════════════════════════════════════
   UPLOAD SUCCESS CARD (Phase F) — persistent confirmation of a field
   round-trip. Top-anchored banner; stays until dismissed.
   ════════════════════════════════════════════════════════════════════ */
.cb-upload-card {
  position: fixed;
  left: 50%;
  top: calc(var(--sh-safe-top, 0px) + 12px);
  transform: translateX(-50%);
  z-index: 90;
  width: min(calc(100vw - 24px), 440px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.7rem 0.85rem;
  border-radius: 14px;
  background: var(--cb-accent);
  color: #fff;
  box-shadow: 0 6px 26px rgba(33, 30, 24, 0.32);
  animation: cb-upload-in 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes cb-upload-in {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
.cb-upload-card-body { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.cb-upload-card-check {
  flex: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.22);
  font-weight: 800; font-size: 1rem;
}
.cb-upload-card-title { font-weight: 700; font-size: 0.95rem; line-height: 1.25; }
.cb-upload-card-sub   { font-size: 0.8rem; opacity: 0.92; line-height: 1.3; }
.cb-upload-card-x {
  flex: none;
  appearance: none; border: none; background: none; color: #fff;
  font-size: 1.5rem; line-height: 1; cursor: pointer;
  padding: 0.1rem 0.3rem; opacity: 0.85;
}
.cb-upload-card-x:active { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .cb-upload-card { animation: none; } }

/* ════════════════════════════════════════════════════════════════════
   MAP MARKERS — L.divIcon HTML, styled globally (must be top-level, not
   scoped to a pane, since Leaflet appends them to the map overlay panes).
   ════════════════════════════════════════════════════════════════════ */

/* Bio-bucket detection dot — a tier-ringed parchment disc with an ink
   silhouette inside (naturalist field-guide treatment). The ring color is
   set inline by map.js per confidence tier. */
.cb-map-marker {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 242, 238, 0.92);  /* warm-linen fill, map peeks through */
  border: 2.5px solid var(--cb-accent);   /* overridden inline per tier */
  box-shadow: 0 1px 3px rgba(30, 20, 10, 0.28);
}
.cb-map-marker svg { width: 20px; height: 20px; display: block; }

/* Ear pin — a QUIET reference marker (2-letter ear initials). Detections are
   the focus of this map, so ears are deliberately small, muted, and low-
   contrast: a slate chip that recedes behind the colored detection clusters.
   Hover lifts it slightly so it's still discoverable/tappable to move it. */
.cb-ear-marker {
  width: 20px;
  height: 20px;
  border-radius: 50% 50% 50% 2px;   /* teardrop nod — this is a placed thing */
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(96, 110, 116, 0.82);  /* cool slate, semi-transparent */
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  color: #fff;
  font-family: var(--cb-bf);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 3px rgba(30, 20, 10, 0.25);
  opacity: 0.78;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.cb-ear-marker-wrap:hover .cb-ear-marker {
  opacity: 1;
  transform: scale(1.15);
}
/* "location not set" hint in a detection popup + Fleet Health row. */
.cb-map-noloc { color: var(--cb-accent-2); font-size: 0.82em; }
.cb-fleet-noloc { font-size: 0.8em; opacity: 0.7; cursor: help; }
.cb-fleet-locate { white-space: nowrap; }

/* Suggestion marker — DELIBERATELY ghostly: dashed clay ring, hollow fill,
   a "+" glyph. Must read as advisory, NOT as a real ear (requirement 7). */
.cb-suggest-marker {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 242, 238, 0.55);
  border: 2px dashed var(--cb-accent-2);
  color: var(--cb-accent-2);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: none;
  opacity: 0.92;
}

/* Leaflet popup — align to the kit so it isn't default-blue Leaflet chrome. */
.leaflet-popup-content {
  font-family: var(--cb-bf);
  color: var(--cb-fg);
  font-size: 0.85rem;
}
.leaflet-popup-content strong {
  font-family: var(--cb-hf);
  color: var(--cb-accent);
}

/* ════════════════════════════════════════════════════════════════════
   GUEST MODE — body.cb-guest. The nav buttons are hidden in JS via the
   [hidden] attribute (handled by the global guard); this is just for any
   guest-only tonal shift. Kept light: a faint clay top-rule on the header
   so a guest can tell at a glance they're in the visitor view.
   ════════════════════════════════════════════════════════════════════ */
body.cb-guest .cb-header::after {
  opacity: 0.75;
}
body.cb-guest .cb-brand::after {
  content: " · visitor";
  color: var(--cb-muted);
  font-weight: 600;
  font-style: normal;
  letter-spacing: 0.04em;
}

/* ── Reduced-motion: respect the OS setting ──────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .cb-spinner,
  .cb-mic-btn.recording::after,
  .toast { animation: none; }
  .nav-btn svg, .cb-btn, .cb-mic-btn { transition: none; }
}

/* ── Move-confirm modal ─────────────────────────────────────────────────────
   Confirmation before stamping an ear's location. Shows the ear name, a mini
   map with the OLD and PROPOSED pins, and the coords/accuracy being saved. */
.cb-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;                 /* above the nav (40) and status bar (50) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(33, 30, 24, 0.5);
}
.cb-modal {
  width: 100%;
  max-width: 380px;
  background: var(--cb-panel);
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-radius);
  box-shadow: var(--cb-shadow-card);
  padding: 1rem 1.05rem calc(1rem + var(--sh-safe-bottom));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}
.cb-modal-title {
  margin: 0 0 0.6rem;
  font-size: 1.05rem;
  color: var(--cb-text, #211E18);
}
.cb-modal-map {
  width: 100%;
  height: 200px;
  border-radius: var(--cb-radius-sm);
  border: 1px solid var(--cb-border);
  overflow: hidden;
  background: var(--cb-sage);
}
.cb-modal-detail {
  margin: 0.6rem 0 0;
  font-size: 0.82rem;
  color: var(--cb-muted);
  line-height: 1.4;
}
.cb-modal-detail .cb-modal-warn { color: var(--cb-accent-2); font-weight: 600; }
.cb-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 0.9rem;
}
/* Legend dots reused inline in the detail line. */
.cb-modal-dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 3px;
}
.cb-modal-dot-old { background: #9aa0a6; }
.cb-modal-dot-new { background: #1565c0; }
/* Preview map pins (old vs proposed). */
.cb-preview-pin {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.cb-preview-pin-old { opacity: 0.85; }

/* ── Insights tab (Increment 1) ──────────────────────────────────────────── */
.cb-cooc-note {
  margin: 0 0 0.6rem;
  font-size: 0.82rem;
}
.cb-cooc-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.cb-cooc-grid {
  display: grid;
  gap: 2px;
  min-width: max-content;
}
.cb-cooc-cell {
  min-width: 26px;
  height: 26px;
  border-radius: 3px;
  font-size: 0.66rem;
  line-height: 1;
}
.cb-cooc-corner { background: transparent; }
.cb-cooc-col-label {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 56px;
  color: var(--cb-muted);
  overflow: hidden;
}
/* Column labels read bottom-to-top so the matrix stays narrow. */
.cb-cooc-col-label span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  max-height: 54px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cb-cooc-row-label {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 0.4rem;
  color: var(--cb-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cb-cooc-data { border: 1px solid rgba(33, 30, 24, 0.05); }
.cb-cooc-diag {
  background: repeating-linear-gradient(
    45deg, var(--cb-panel-2), var(--cb-panel-2) 3px, transparent 3px, transparent 6px);
}
.cb-cooc-toptitle {
  margin: 0.9rem 0 0.4rem;
  font-family: var(--cb-hf);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--cb-fg);
}
.cb-cooc-toplist { display: flex; flex-direction: column; gap: 0.25rem; }
.cb-cooc-toprow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.3rem 0.1rem;
  border-bottom: 1px solid var(--cb-border);
}
.cb-cooc-toprow:last-child { border-bottom: none; }
.cb-cooc-toppair { font-size: 0.92rem; color: var(--cb-fg); }
.cb-cooc-topn { font-weight: 700; color: var(--cb-accent); }

/* Morning chorus — per-day 24-bar profile, dawn hour highlighted. */
.cb-chorus-day { margin-top: 0.85rem; }
.cb-chorus-day:first-of-type { margin-top: 0.4rem; }
.cb-chorus-dayhead {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}
.cb-chorus-date { font-weight: 600; color: var(--cb-fg); font-size: 0.9rem; }
.cb-chorus-total { font-size: 0.78rem; color: var(--cb-muted); }
.cb-chorus-dawnlabel { font-size: 0.72rem; color: var(--cb-accent); margin-left: auto; }
.cb-chorus-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 64px;
  padding: 2px 0;
  background: linear-gradient(to top, var(--cb-panel-2) 0%, transparent 60%);
  border-radius: var(--cb-radius-sm);
}
.cb-chorus-bar {
  flex: 1 1 0;
  min-height: 1px;
  /* now a stacked container: species segments fill bottom-up */
  display: flex;
  flex-direction: column-reverse;
  background: var(--cb-muted);
  border-radius: 1px 1px 0 0;
  overflow: hidden;
}
/* A bar with no species segments (flat fallback) still reads as activity. */
.cb-chorus-bar:empty { opacity: 0.45; }
.cb-chorus-seg { display: block; width: 100%; min-height: 1px; }
/* Civil-dawn hour: outline the whole bar instead of recoloring it (segments keep
   their species colors). */
.cb-chorus-dawn {
  outline: 2px solid var(--cb-accent);
  outline-offset: -1px;
  border-radius: 2px 2px 0 0;
}

/* Dawn-window species ranking (who's singing at dawn) */
.cb-chorus-ranking { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.cb-chorus-sprow { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; }
.cb-chorus-spdot { flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; }
.cb-chorus-spname {
  flex: 0 0 92px; color: var(--cb-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cb-chorus-spbar {
  flex: 1 1 auto; height: 8px; background: var(--cb-panel-2);
  border-radius: var(--cb-radius-sm); overflow: hidden;
}
.cb-chorus-spbar > span { display: block; height: 100%; border-radius: var(--cb-radius-sm); min-width: 2px; }
.cb-chorus-spshare { flex: 0 0 auto; color: var(--cb-muted); min-width: 30px; text-align: right; }
.cb-chorus-spmore { font-size: 0.72rem; margin-top: 2px; }

/* Chorus stats line: start–end / peak / strength-vs-baseline */
.cb-chorus-stats {
  display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline;
  margin: 2px 0 6px; font-size: 0.78rem; color: var(--cb-muted);
}
.cb-chorus-strength { font-weight: 600; }
.cb-chorus-up   { color: #3e8e5e; }
.cb-chorus-down { color: #c06a4a; }

/* Dawn-by-weather per-condition species split */
.cb-dbw-species {
  display: flex; flex-wrap: wrap; gap: 4px 8px;
  margin: -2px 0 6px 78px;  /* align under the bar track, not the label */
}
.cb-dbw-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.72rem; color: var(--cb-text);
}
.cb-dbw-chipdot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; }

/* Soundscape "current hour" column marker */
.cb-ss-now { outline: 1px solid var(--cb-accent); outline-offset: -1px; }
.cb-ss-hour.cb-ss-now { color: var(--cb-accent); font-weight: 600; }

/* Patterns section header inside Place */
.cb-patterns-head { margin-top: 6px; }

/* ── Dawn chorus by weather (Increment 2) ─────────────────────────────────── */
.cb-dbw-group { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.cb-dbw-row { display: flex; align-items: center; gap: 8px; }
.cb-dbw-label {
  flex: 0 0 76px; font-size: 0.82rem; color: var(--cb-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cb-dbw-track {
  flex: 1 1 auto; height: 14px; background: var(--cb-panel-2);
  border-radius: var(--cb-radius-sm); overflow: hidden;
}
.cb-dbw-fill { display: block; height: 100%; border-radius: var(--cb-radius-sm); min-width: 2px; }
.cb-dbw-wx { background: var(--cb-accent); }
.cb-dbw-season { background: var(--cb-muted); opacity: 0.75; }
.cb-dbw-val { flex: 0 0 auto; font-size: 0.82rem; color: var(--cb-text); min-width: 30px; text-align: right; }
.cb-dbw-days { font-size: 0.72rem; }

/* ── Soundscape band heat strip (Increment 2) ─────────────────────────────── */
.cb-ss-scroll { overflow-x: auto; margin-top: 6px; -webkit-overflow-scrolling: touch; }
.cb-ss-grid { display: grid; gap: 1px; min-width: 460px; }
.cb-ss-cell { min-height: 16px; font-size: 0.62rem; line-height: 16px; }
.cb-ss-corner { background: transparent; }
.cb-ss-hour { color: var(--cb-muted); text-align: center; }
.cb-ss-bandlabel {
  color: var(--cb-text); font-size: 0.68rem; padding-right: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right;
}
.cb-ss-data { border-radius: 1px; }
.cb-ss-empty { background: var(--cb-panel-2); opacity: 0.4; border-radius: 1px; }
.cb-ss-coverage { margin-top: 6px; font-size: 0.72rem; }

/* ── Reviewed account-v2 shell ───────────────────────────────────────────── */
.cb-account-control {
  position: relative;
  z-index: 2;
  margin-left: auto;
  max-width: min(52vw, 280px);
  padding: 7px 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  border: 1px solid var(--cb-border);
  border-radius: 999px;
  background: var(--cb-panel);
  color: var(--cb-fg);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}
.cb-account-control > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cb-account-control > .cb-muted { flex: 0 0 auto; font-size: 0.7rem; }
.cb-account-control:focus-visible,
.cb-account-dialog button:focus-visible,
.cb-account-dialog input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--cb-accent) 48%, transparent);
  outline-offset: 2px;
}
.cb-account-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  padding: max(16px, var(--sh-safe-top)) 12px max(16px, var(--sh-safe-bottom));
  display: grid;
  place-items: center;
  background: rgba(20, 18, 14, 0.56);
}
.cb-account-dialog {
  position: relative;
  width: min(100%, 560px);
  max-height: min(88vh, 780px);
  overflow-y: auto;
  padding: 28px 20px 22px;
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-radius);
  background: var(--cb-bg);
  box-shadow: 0 20px 70px rgba(20, 18, 14, 0.28);
}
.cb-account-close {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 7px 9px;
  border: 0;
  background: transparent;
  color: var(--cb-muted);
  font: inherit;
  cursor: pointer;
}
.cb-account-body { display: grid; gap: 12px; }
.cb-account-body > .cb-heading { padding-right: 64px; margin-bottom: 0; }
.cb-account-body > .cb-btn,
.cb-account-form > .cb-btn { width: 100%; }
.cb-account-form { display: grid; gap: 12px; }
.cb-turnstile {
  min-height: 65px;
  display: grid;
  align-items: center;
  justify-content: start;
  overflow: hidden;
}
.cb-account-error {
  margin: 0;
  padding: 10px 12px;
  border-left: 4px solid var(--cb-danger);
  border-radius: var(--cb-radius-sm);
  background: color-mix(in srgb, var(--cb-danger) 9%, var(--cb-panel));
  color: var(--cb-fg);
}
.cb-account-current {
  display: grid;
  gap: 2px;
  padding: 12px;
  border-radius: var(--cb-radius-sm);
  background: var(--cb-panel);
}
.cb-account-switcher { display: grid; gap: 10px; }
.cb-account-organization {
  display: grid;
  gap: 5px;
  padding: 8px;
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-radius-sm);
}
.cb-account-choice,
.cb-account-property {
  width: 100%;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--cb-fg);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.cb-account-choice:hover,
.cb-account-property:hover { background: var(--cb-hover); }
.cb-account-property { padding-left: 24px; color: var(--cb-muted); }
.cb-account-property[aria-current="true"] {
  background: color-mix(in srgb, var(--cb-accent) 12%, var(--cb-panel));
  color: var(--cb-accent);
  font-weight: 650;
}
.cb-account-session,
.cb-account-member,
.cb-account-notice,
.cb-account-intent {
  padding: 12px;
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-radius-sm);
  background: var(--cb-panel);
}
.cb-account-session > *,
.cb-account-member > *,
.cb-account-notice > *,
.cb-account-intent > * { margin-top: 5px; margin-bottom: 5px; }
.cb-account-member { display: grid; gap: 8px; }
.cb-account-status { min-height: 1px; }
.cb-ear-claim-overlay { z-index: 980; }
.cb-ear-claim-dialog { position: relative; max-width: 560px; }
.cb-ear-claim-body { display: grid; gap: 12px; }
.cb-ear-claim-body > .cb-heading { padding-right: 64px; margin-bottom: 0; }
.cb-ear-claim-body > .cb-btn { width: 100%; }
.cb-ear-claim-dialog button:focus-visible,
.cb-ear-claim-dialog input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--cb-accent) 48%, transparent);
  outline-offset: 2px;
}

/* Runtime-unwired Organization Admin Ear ownership panel. The panel uses the
   same mobile-safe modal geometry as the account shell, but keeps its action
   namespace separate from the legacy map-pin "Move" control. */
.cb-ear-transition-overlay {
  position: fixed;
  inset: 0;
  z-index: 1001;
  padding: max(16px, var(--sh-safe-top)) 12px max(16px, var(--sh-safe-bottom));
  display: grid;
  place-items: center;
  background: rgba(20, 18, 14, 0.56);
}
.cb-ear-transition-dialog {
  position: relative;
  width: min(100%, 560px);
  max-height: min(88vh, 780px);
  overflow-y: auto;
  padding: 28px 20px 22px;
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-radius);
  background: var(--cb-bg);
  box-shadow: 0 20px 70px rgba(20, 18, 14, 0.28);
}
.cb-ear-transition-close {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 44px;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--cb-muted);
  font: inherit;
  cursor: pointer;
}
.cb-ear-transition-body { display: grid; gap: 12px; }
.cb-ear-transition-body > .cb-heading { padding-right: 64px; margin-bottom: 0; }
.cb-ear-transition-body > .cb-btn,
.cb-ear-transition-card > .cb-btn { width: 100%; min-height: 44px; }
.cb-ear-transition-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-radius-sm);
  background: var(--cb-panel);
}
.cb-ear-transition-card > * { margin-top: 0; margin-bottom: 0; }
.cb-ear-transition-warning {
  margin: 0;
  padding: 10px 12px;
  border-left: 4px solid var(--cb-warning, #9a681b);
  border-radius: var(--cb-radius-sm);
  background: color-mix(in srgb, var(--cb-warning, #9a681b) 9%, var(--cb-panel));
  color: var(--cb-fg);
}
.cb-ear-transition-live { min-height: 1px; }
.cb-ear-transition-dialog button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--cb-accent) 48%, transparent);
  outline-offset: 2px;
}

@media (max-width: 520px) {
  .cb-account-control > .cb-muted { display: none; }
  .cb-account-dialog,
  .cb-ear-transition-dialog { padding: 26px 16px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .cb-account-overlay,
  .cb-account-dialog,
  .cb-ear-transition-overlay,
  .cb-ear-transition-dialog { scroll-behavior: auto; }
}

/* ════════════════════════════════════════════════════════════════════
   CATBIRD 2.0 FIELD NOTEBOOK
   The original linen/sage/clay language remains; hierarchy, navigation, and
   scientific context are made more explicit. These selectors are additive so
   focused legacy flows retain their reviewed behavior.
   ════════════════════════════════════════════════════════════════════ */
.cb-page-intro {
  position: relative;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 22px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--cb-accent) 26%, var(--cb-border));
  border-radius: 18px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--cb-panel) 92%, #fff), color-mix(in srgb, var(--cb-sage) 35%, var(--cb-panel)));
  box-shadow: var(--cb-shadow-card);
}
.cb-page-intro::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -70px;
  bottom: -110px;
  border: 1px solid color-mix(in srgb, var(--cb-accent) 30%, transparent);
  border-radius: 50%;
  box-shadow: 0 0 0 22px color-mix(in srgb, var(--cb-accent) 5%, transparent), 0 0 0 46px color-mix(in srgb, var(--cb-accent-2) 5%, transparent);
  pointer-events: none;
}
.cb-page-intro > * { position: relative; z-index: 1; }
.cb-page-intro h1 {
  max-width: 680px;
  margin: 2px 0 8px;
  font: 650 clamp(1.85rem, 4vw, 3.15rem)/1.02 var(--cb-hf);
  letter-spacing: -.025em;
}
.cb-page-intro p:not(.cb-kicker) { max-width: 720px; margin: 0; color: var(--cb-muted); }
.cb-page-intro-welcome { min-height: 310px; align-items: center; }
.cb-kicker {
  margin: 0 0 5px;
  color: var(--cb-accent);
  font: 800 .7rem/1.2 var(--cb-bf);
  letter-spacing: .13em;
}
.cb-context-button {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 260px;
  padding: 10px 13px;
  border: 1px solid var(--cb-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--cb-bg) 78%, transparent);
  color: var(--cb-fg);
  font: 650 .82rem var(--cb-bf);
  cursor: pointer;
}
.cb-glance-grid, .cb-action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.cb-glance-card {
  display: grid;
  gap: 3px;
  min-height: 126px;
  padding: 16px;
  border: 1px solid var(--cb-border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--cb-panel) 95%, #fff);
  box-shadow: var(--cb-shadow);
}
.cb-glance-card span, .cb-glance-card small { color: var(--cb-muted); }
.cb-glance-card strong { margin-top: auto; color: var(--cb-accent); font: 700 2rem/1 var(--cb-hf); }
.cb-glance-card small { font-size: .72rem; }
.cb-section-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.cb-section-head .cb-heading { margin-bottom: 0; }
.cb-text-action {
  border: 0;
  padding: 6px 0;
  background: transparent;
  color: var(--cb-accent);
  font: 700 .8rem var(--cb-bf);
  cursor: pointer;
}
.cb-field-note {
  width: 100%;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid var(--cb-border);
  background: transparent;
  color: var(--cb-fg);
  text-align: left;
  cursor: pointer;
}
.cb-field-note:last-of-type { border-bottom: 0; }
.cb-field-note-mark { width: 7px; height: 7px; border-radius: 50%; background: var(--cb-accent-2); }
.cb-field-note-main { display: grid; min-width: 0; }
.cb-field-note-main strong { font-family: var(--cb-hf); }
.cb-field-note-main span { color: var(--cb-muted); font-size: .76rem; }
.cb-evidence-chip, .cb-effort-pill, .cb-status-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 5px 8px;
  border: 1px solid var(--cb-border);
  border-radius: 999px;
  color: var(--cb-muted);
  background: var(--cb-bg);
  font-size: .66rem;
  font-weight: 750;
  white-space: nowrap;
}
.cb-evidence-confirmed { color: var(--cb-accent); border-color: color-mix(in srgb, var(--cb-accent) 40%, var(--cb-border)); }
.cb-evidence-likely { color: #6f7650; }
.cb-method-note {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--cb-border);
  color: var(--cb-muted);
  font-size: .74rem;
}
.cb-quiet-card { border-left: 4px solid var(--cb-accent-2); }
.cb-inline-btn { width: auto; min-width: 132px; }
.cb-evidence-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 10px 4px; color: var(--cb-muted); font-size: .74rem; }
.cb-evidence-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.cb-evidence-legend .cb-effort-pill { margin-left: auto; }
.cb-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cb-accent-2); }
.cb-dot-likely { background: #8d9664; }
.cb-dot-reviewed { background: var(--cb-accent); }
.cb-analytics-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.cb-analytics-grid > * { margin-top: 0 !important; }
.cb-cooc-toppair { display: grid; }
.cb-cooc-toppair small { margin-top: 2px; color: var(--cb-muted); font-size: .68rem; font-weight: 400; }
.cb-timeline-card { margin-bottom: 14px; overflow: hidden; }
.cb-timeline-heading { align-items: start; }
.cb-timeline-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 16px 0;
  border-top: 1px solid var(--cb-border);
  border-left: 1px solid var(--cb-border);
}
.cb-timeline-kpis article { min-width: 0; padding: 13px; border-right: 1px solid var(--cb-border); border-bottom: 1px solid var(--cb-border); background: color-mix(in srgb, var(--cb-bg) 55%, transparent); }
.cb-timeline-kpis span, .cb-timeline-kpis small { display: block; color: var(--cb-muted); font-size: .65rem; text-transform: uppercase; letter-spacing: .04em; }
.cb-timeline-kpis strong { display: block; margin: 8px 0 5px; color: var(--cb-accent); font: 700 1.55rem/1 var(--cb-hf); }
.cb-timeline-controls { display: grid; grid-template-columns: auto minmax(220px, 1fr); gap: 14px; align-items: end; margin: 18px 0; }
.cb-timeline-controls > div, .cb-timeline-controls label { display: grid; gap: 7px; }
.cb-timeline-controls > div > span, .cb-timeline-controls label > span { color: var(--cb-muted); font-size: .67rem; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.cb-timeline-controls select { width: 100%; min-height: 38px; padding: 0 10px; border: 1px solid var(--cb-border); border-radius: 8px; color: var(--cb-fg); background: var(--cb-bg); }
.cb-segmented { display: flex; padding: 3px; border: 1px solid var(--cb-border); border-radius: 9px; background: var(--cb-bg); }
.cb-segmented button { min-height: 31px; padding: 0 10px; border: 0; border-radius: 6px; color: var(--cb-muted); background: transparent; cursor: pointer; font-size: .72rem; font-weight: 700; }
.cb-segmented button[aria-pressed="true"] { color: white; background: var(--cb-accent); }
.cb-selected-hour { display: grid; grid-template-columns: minmax(180px, .7fr) minmax(280px, 1.1fr) minmax(240px, 1fr); margin-bottom: 14px; overflow: hidden; border: 1px solid var(--cb-border); border-radius: 11px; background: color-mix(in srgb, var(--cb-bg) 72%, transparent); }
.cb-selected-hour > * { min-width: 0; padding: 16px; border-right: 1px solid var(--cb-border); }
.cb-selected-hour > *:last-child { border-right: 0; }
.cb-selected-hour h3 { margin: 3px 0 8px; font: 680 1.3rem/1.12 var(--cb-hf); }
.cb-selected-hour > div:first-child > span, .cb-selected-events > span { color: var(--cb-accent-2); font-size: .69rem; font-weight: 750; text-transform: uppercase; }
.cb-selected-hour dl { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0; }
.cb-selected-hour dt { color: var(--cb-muted); font-size: .65rem; text-transform: uppercase; }
.cb-selected-hour dd { margin: 3px 0 0; font-size: .8rem; line-height: 1.3; }
.cb-selected-events ul { display: grid; max-height: 130px; gap: 6px; margin: 9px 0 0; padding: 0; overflow-y: auto; list-style: none; }
.cb-selected-events li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 8px; align-items: baseline; }
.cb-selected-events button { min-width: 0; padding: 0; overflow: hidden; border: 0; color: var(--cb-accent); background: transparent; text-align: left; text-decoration: underline; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.cb-selected-events b { font: 750 .72rem var(--cb-mono); }
.cb-selected-events small { grid-column: 1 / -1; color: var(--cb-muted); font-size: .62rem; }
.cb-selected-events p { color: var(--cb-muted); font-size: .78rem; }
.cb-timeline-instruction { display: flex; gap: 7px; align-items: center; margin-bottom: 8px; color: var(--cb-muted); font-size: .69rem; }
.cb-timeline-instruction strong { color: var(--cb-accent); }
.cb-timeline-instruction > span { display: grid; width: 20px; height: 20px; place-items: center; border: 1px solid var(--cb-border); border-radius: 50%; }
.cb-timeline-instruction small { margin-left: auto; font-size: .64rem; }
.cb-timeline-scroll { width: 100%; overflow-x: auto; border: 1px solid var(--cb-border); border-radius: 9px; background: var(--cb-bg); overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.cb-timeline-grid { width: calc(150px + var(--cb-timeline-width)); }
.cb-timeline-row { display: grid; grid-template-columns: 150px var(--cb-timeline-width); min-height: 29px; }
.cb-timeline-row + .cb-timeline-row { border-top: 1px solid color-mix(in srgb, var(--cb-border) 55%, transparent); }
.cb-timeline-label { position: sticky; z-index: 4; left: 0; display: grid; align-content: center; padding: 5px 9px; border-right: 1px solid var(--cb-border); background: var(--cb-bg); }
.cb-timeline-label strong { overflow: hidden; font: 650 .76rem var(--cb-hf); text-overflow: ellipsis; white-space: nowrap; }
.cb-timeline-label small { overflow: hidden; color: var(--cb-muted); font-size: .59rem; text-overflow: ellipsis; white-space: nowrap; }
.cb-timeline-cells { display: grid; grid-template-columns: repeat(var(--cb-timeline-columns), minmax(0, 1fr)); width: var(--cb-timeline-width); }
.cb-timeline-cell, .cb-timeline-tick { min-width: 0; padding: 0; border: 0; border-right: 1px solid rgba(33,30,24,.055); cursor: pointer; }
.cb-timeline-cell { min-height: 29px; }
.cb-timeline-tick { min-height: 35px; overflow: visible; color: var(--cb-muted); background: color-mix(in srgb, var(--cb-panel) 74%, transparent); font: 650 .55rem/1 var(--cb-mono); white-space: nowrap; }
.cb-timeline-cell:hover, .cb-timeline-cell:focus-visible, .cb-timeline-tick:hover, .cb-timeline-tick:focus-visible { outline: 2px solid var(--cb-accent); outline-offset: -2px; }
.cb-timeline-cell.is-selected, .cb-timeline-tick.is-selected { box-shadow: inset 2px 0 var(--cb-accent-2), inset -2px 0 var(--cb-accent-2); }
.cb-timeline-analysis-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.cb-timeline-analysis { padding: 16px; border: 1px solid var(--cb-border); border-radius: 10px; background: color-mix(in srgb, var(--cb-bg) 55%, transparent); }
.cb-timeline-analysis h3 { margin: 4px 0 7px; font: 650 1.08rem var(--cb-hf); }
.cb-timeline-analysis p:not(.cb-kicker) { margin: 0 0 12px; color: var(--cb-muted); font-size: .78rem; }
.cb-light-stack { display: flex; height: 12px; overflow: hidden; border-radius: 999px; background: var(--cb-panel-2); }
.cb-light-stack i { display: block; min-width: 1px; }
.cb-light-stack .is-night { background: #4e5f74; }.cb-light-stack .is-edge { background: var(--cb-accent-2); }.cb-light-stack .is-day { background: #c8ad65; }
.cb-light-key { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 7px; color: var(--cb-muted); font-size: .64rem; }
.cb-weather-compare { display: grid; gap: 7px; }
.cb-weather-compare > div { display: grid; grid-template-columns: 64px 1fr 34px; gap: 7px; align-items: center; font-size: .7rem; }
.cb-weather-compare b { height: 7px; overflow: hidden; border-radius: 999px; background: var(--cb-panel-2); }
.cb-weather-compare i { display: block; height: 100%; border-radius: inherit; background: var(--cb-accent); }
.cb-weather-compare em { color: var(--cb-muted); font-style: normal; text-align: right; }
.cb-timeline-points { margin-top: 18px; padding-top: 17px; border-top: 1px solid var(--cb-border); }
.cb-point-compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 9px; }
.cb-point-compare article { display: grid; gap: 5px; padding: 13px; border: 1px solid var(--cb-border); border-radius: 9px; background: color-mix(in srgb, var(--cb-bg) 55%, transparent); }
.cb-point-compare span { color: var(--cb-muted); font-size: .67rem; font-weight: 750; text-transform: uppercase; }
.cb-point-compare strong { color: var(--cb-accent); font: 700 1.6rem/1 var(--cb-hf); }
.cb-point-compare small { min-height: 31px; color: var(--cb-muted); font-size: .67rem; line-height: 1.35; }
.cb-point-compare b { height: 6px; overflow: hidden; border-radius: 999px; background: var(--cb-panel-2); }
.cb-point-compare i { display: block; height: 100%; border-radius: inherit; background: var(--cb-accent-2); }

/* Catbird 1.0 detection log, retained inside the richer Explore workspace. */
.cb-detection-history { margin-top: 18px; }
.cb-detection-master-detail { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .85fr); gap: 18px; align-items: start; margin-top: 18px; }
.cb-history-columns { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(90px, .75fr) minmax(74px, .62fr) auto; gap: 10px; padding: 0 12px 7px; color: var(--cb-muted); font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.cb-history-list { max-height: 620px; overflow: auto; border: 1px solid var(--cb-border); border-radius: 10px; background: var(--cb-bg); overscroll-behavior: contain; }
.cb-history-row { width: 100%; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(90px, .75fr) minmax(74px, .62fr) auto; gap: 10px; align-items: center; padding: 11px 12px; border: 0; border-bottom: 1px solid var(--cb-border); background: transparent; color: var(--cb-fg); font: inherit; text-align: left; cursor: pointer; transition: background .15s ease, box-shadow .15s ease; }
.cb-history-row:last-child { border-bottom: 0; }
.cb-history-row:hover { background: color-mix(in srgb, var(--cb-accent) 7%, transparent); }
.cb-history-row:focus-visible { outline: 2px solid var(--cb-accent); outline-offset: -2px; }
.cb-history-row.is-selected { background: color-mix(in srgb, var(--cb-accent) 11%, var(--cb-panel)); box-shadow: inset 3px 0 0 var(--cb-accent); }
.cb-history-onset { min-width: 0; display: grid; grid-template-columns: 8px minmax(0, 1fr); column-gap: 9px; align-items: center; }
.cb-history-onset i { grid-row: 1 / 3; width: 7px; height: 7px; border-radius: 50%; background: var(--cb-accent-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cb-accent-2) 16%, transparent); }
.cb-history-onset strong, .cb-history-onset small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-history-onset strong { font-family: var(--cb-hf); font-size: .9rem; }
.cb-history-onset small { color: var(--cb-muted); font-family: var(--cb-mono); font-size: .65rem; }
.cb-history-ear { color: var(--cb-accent); font-size: .75rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-history-row time { color: var(--cb-muted); font-family: var(--cb-mono); font-size: .69rem; white-space: nowrap; }
.cb-history-tier { display: inline-flex; justify-content: center; width: max-content; padding: 4px 7px; border: 1px solid var(--cb-border); border-radius: 99px; font-size: .64rem; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; white-space: nowrap; }
.cb-history-tier-confirmed { color: var(--cb-status-online); background: color-mix(in srgb, var(--cb-status-online) 8%, var(--cb-panel)); }
.cb-history-tier-likely { color: var(--cb-accent-2); background: color-mix(in srgb, var(--cb-accent-2) 8%, var(--cb-panel)); }
.cb-history-tier-maybe { color: var(--cb-muted); background: var(--cb-panel); }
.cb-detection-detail { position: sticky; top: 16px; min-height: 290px; border: 1px solid var(--cb-border); border-radius: 12px; background: color-mix(in srgb, var(--cb-panel) 92%, var(--cb-accent) 8%); overflow: hidden; }
.cb-detection-detail-empty { display: grid; place-items: center; align-content: center; min-height: 290px; padding: 32px; color: var(--cb-muted); text-align: center; }
.cb-detection-detail-empty span { font-size: 1.7rem; color: var(--cb-accent); }
.cb-detection-detail-empty h3 { margin: 7px 0 3px; color: var(--cb-fg); font-family: var(--cb-hf); }
.cb-detection-detail-empty p { margin: 0; max-width: 28ch; font-size: .82rem; line-height: 1.5; }
.cb-detection-detail-card { padding: 20px; }
.cb-detection-detail-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.cb-detection-detail-head h3 { margin: 2px 0 0; font: 700 1.45rem/1.05 var(--cb-hf); }
.cb-detection-detail-summary { margin: 12px 0 16px; color: var(--cb-muted); font-size: .84rem; line-height: 1.5; }
.cb-detection-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin: 0; }
.cb-detection-facts div { min-width: 0; padding-top: 9px; border-top: 1px solid var(--cb-border); }
.cb-detection-facts dt { color: var(--cb-muted); font-size: .63rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.cb-detection-facts dd { margin: 4px 0 0; overflow-wrap: anywhere; font-size: .8rem; font-weight: 650; }
.cb-detection-facts dd small { display: block; margin-top: 2px; color: var(--cb-muted); font: 400 .66rem/1.35 var(--cb-mono); }
.cb-detection-facts code { font-size: .68rem; }
.cb-detection-close { margin-top: 12px; }
.cb-history-more { width: 100%; margin-top: 10px; }
.cb-history-end { margin: 10px 0 0; color: var(--cb-muted); font-size: .72rem; text-align: center; }
.cb-history-empty { padding: 30px; color: var(--cb-muted); text-align: center; }
.cb-history-empty h3 { margin: 0 0 4px; color: var(--cb-fg); font-family: var(--cb-hf); }
.cb-action-card {
  min-height: 145px;
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 16px;
  border: 1px solid var(--cb-border);
  border-radius: 14px;
  background: var(--cb-panel);
  color: var(--cb-fg);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--cb-shadow);
}
.cb-action-card:hover { border-color: color-mix(in srgb, var(--cb-accent) 55%, var(--cb-border)); transform: translateY(-1px); }
.cb-action-card strong { font: 650 1.08rem var(--cb-hf); }
.cb-action-card small { color: var(--cb-muted); }
.cb-action-icon { color: var(--cb-accent); font: 700 1.5rem var(--cb-hf); }
.cb-status-chip.is-good { color: var(--cb-accent); }
.cb-status-chip.is-watch { color: var(--cb-accent-2); }
.cb-mesh-path { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 9px; margin: 18px 0; }
.cb-mesh-path span { padding: 10px; border: 1px solid var(--cb-border); border-radius: 9px; background: var(--cb-bg); text-align: center; font-size: .78rem; font-weight: 700; }
.cb-mesh-path b { color: var(--cb-accent); font-size: .7rem; font-weight: 800; letter-spacing: .04em; }
.cb-mesh-path b::before, .cb-mesh-path b::after { content: " ·· "; color: var(--cb-accent-2); }
.cb-journey { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 0; list-style: none; counter-reset: journey; }
.cb-journey li { counter-increment: journey; display: grid; gap: 4px; padding: 12px; border-top: 2px solid var(--cb-accent); background: color-mix(in srgb, var(--cb-bg) 64%, transparent); }
.cb-journey li::before { content: "0" counter(journey); color: var(--cb-accent-2); font: 800 .67rem var(--cb-mono); }
.cb-journey span { color: var(--cb-muted); font-size: .72rem; }
.cb-record-fab {
  position: fixed;
  right: 18px;
  bottom: calc(var(--sh-nav-h) + var(--sh-safe-bottom) + 16px);
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid color-mix(in srgb, var(--cb-accent-2) 80%, #000);
  border-radius: 999px;
  background: var(--cb-accent-2);
  color: #fff;
  font: 750 .82rem var(--cb-bf);
  box-shadow: 0 8px 24px rgba(33, 30, 24, .22);
  cursor: pointer;
}

@media (min-width: 900px) {
  :root { --sh-rail-w: 180px; }
  .cb-header { left: var(--sh-rail-w); padding-left: 28px; }
  .cb-main { left: var(--sh-rail-w); bottom: 0; padding: 26px clamp(24px, 5vw, 70px) 48px; }
  .cb-main > .cb-pane { width: min(1120px, 100%); margin: 0 auto; }
  body::before { left: var(--sh-rail-w); bottom: 0; }
  .cb-nav {
    top: calc(var(--sh-status-h) + var(--sh-safe-top));
    right: auto;
    width: var(--sh-rail-w);
    height: auto;
    padding: 72px 12px 20px;
    flex-direction: column;
    align-items: stretch;
    justify-content: start;
    gap: 6px;
    border-top: 0;
    border-right: 1px solid var(--cb-border);
    box-shadow: 2px 0 14px rgba(33,30,24,.06);
  }
  .nav-btn { flex: 0 0 52px; min-height: 52px; flex-direction: row; justify-content: start; gap: 12px; padding: 0 14px; border-radius: 10px; font-size: .8rem; }
  .nav-btn.active { background: color-mix(in srgb, var(--cb-accent) 10%, transparent); }
  .nav-btn.active::before { top: 12px; left: 0; width: 3px; height: 28px; border-radius: 0 3px 3px 0; }
  .cb-record-fab { bottom: 22px; right: 28px; }
}

@media (max-width: 720px) {
  .cb-page-intro { display: grid; padding: 19px 17px; }
  .cb-context-button { max-width: 100%; }
  .cb-glance-grid { grid-template-columns: 1fr 1fr; }
  .cb-glance-card:first-child { grid-column: 1 / -1; }
  .cb-analytics-grid, .cb-action-grid { grid-template-columns: 1fr; }
  .cb-timeline-kpis { grid-template-columns: 1fr 1fr; }
  .cb-timeline-controls, .cb-selected-hour, .cb-timeline-analysis-grid { grid-template-columns: 1fr; }
  .cb-selected-hour > * { border-right: 0; border-bottom: 1px solid var(--cb-border); }
  .cb-selected-hour > *:last-child { border-bottom: 0; }
  .cb-timeline-instruction { flex-wrap: wrap; }
  .cb-timeline-instruction small { width: 100%; margin-left: 0; }
  .cb-detection-master-detail { grid-template-columns: 1fr; }
  .cb-detection-detail { position: static; }
  .cb-history-columns { display: none; }
  .cb-history-row { grid-template-columns: minmax(0, 1fr) auto; gap: 5px 10px; }
  .cb-history-onset { grid-row: 1 / 3; }
  .cb-history-ear { grid-column: 2; grid-row: 1; text-align: right; }
  .cb-history-row time { grid-column: 2; grid-row: 2; text-align: right; }
  .cb-history-tier { grid-column: 1; margin-left: 17px; }
  .cb-detection-facts { grid-template-columns: 1fr; }
  .cb-action-card { min-height: 106px; }
  .cb-field-note { grid-template-columns: 7px minmax(0, 1fr); }
  .cb-field-note .cb-evidence-chip { grid-column: 2; }
  .cb-evidence-legend .cb-effort-pill { margin-left: 0; width: 100%; }
  .cb-journey { grid-template-columns: 1fr 1fr; }
  .cb-record-fab span { display: none; }
  .cb-record-fab { width: 50px; justify-content: center; padding: 0; }
}
