/* TripAgenda — the Now Bar + Active HUD (IA_v1 §4a, Stage C Task 9).
   Docs: IA_v1.md, BRAND_v1.md
   The app's signature interaction: a context-aware bottom bar that reflects
   the current itinerary moment (computed, offline-safe), morphs as the day
   advances, and swipes up into a full-screen thumb-tile HUD. SOS lives ONLY
   in that HUD. Token-driven; documented exempts only:
     • accent ring rgba(245,135,10,.18) — the established pulse-dot ring
     • iOS system red #FF3B30 — the SOS tile (system-canonical danger colour)
     • soft shadows (non-semantic depth) */

/* ===== THE NOW BAR ===== */
#nowBar.nowbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 1200;
  background: var(--bar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--sep);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, .06);
  padding-bottom: env(safe-area-inset-bottom, 0);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.nowbar .nb-grab {
  width: 36px; height: 5px; border-radius: 3px;
  background: var(--ink3);
  margin: 7px auto 0;
  cursor: grab;
}

.nowbar .nb-chiprow {
  display: flex; align-items: center;
  padding: 8px 16px 5px;
  gap: 8px;
}
.nowbar .nb-chip {
  display: flex; align-items: center; gap: 8px;
  background: none; border: 0; padding: 0; margin: 0;
  font: inherit; cursor: pointer; text-align: left;
  flex: 1; min-width: 0;
}
.nowbar .nb-pdot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--tint); flex: none;
  box-shadow: 0 0 0 4px rgba(245, 135, 10, .18);
}
.nowbar .nb-lbl {
  font-size: 13px; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nowbar .nb-lbl .mut { color: var(--ink2); font-weight: 500; }
.nowbar .nb-chev { color: var(--ink2); font-size: 12px; font-weight: 700; flex: none; }
.nowbar .nb-hint {
  margin-left: auto; flex: none;
  font-size: 10.5px; color: var(--ink3);
  display: flex; align-items: center; gap: 4px;
  background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit;
}
.nowbar .nb-hint svg { width: 12px; height: 12px; }

.nowbar .nb-btnrow {
  display: flex; justify-content: space-around;
  padding: 3px 6px 11px;
}
.nowbar .nb-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--ink); font-size: 10.5px; font-weight: 500; flex: 1;
  background: none; border: 0; padding: 4px 2px; cursor: pointer;
  font-family: inherit;
}
.nowbar .nb-btn:active { opacity: .55; }
.nowbar .nb-btn svg { width: 26px; height: 26px; }

/* shared inline-SVG convention (matches the app's .ico) */
.nowbar .ico, .nowhud .ico {
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}

/* rest state — post-trip: one quiet line, no buttons, reduced height */
.nowbar.is-rest .nb-btnrow,
.nowbar.is-rest .nb-grab,
.nowbar.is-rest .nb-hint { display: none; }
.nowbar .nb-rest {
  padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
  font-size: 12.5px; font-weight: 500; color: var(--ink2);
}
.nowbar .nb-rest .nb-rest-msg { flex: 1; }
/* deliberate reliability deviation (flagged): a quiet SOS text-link remains
   reachable the day after the trip — travellers may still need it. */
.nowbar .nb-rest-sos {
  background: none; border: 0; font-family: inherit; cursor: pointer;
  font-size: 12px; font-weight: 600; color: #FF3B30; padding: 4px 2px;
}

/* ===== THE ACTIVE HUD (swipe-up) ===== */
#nowHud.nowhud {
  position: fixed; inset: 0; z-index: 1300;
  background: var(--ground);
  display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
#nowHud[hidden] { display: none; }

.nowhud .hud-grab {
  width: 40px; height: 5px; border-radius: 3px;
  background: var(--ink3);
  margin: 9px auto 0;
}
.nowhud .hud-head {
  display: flex; align-items: baseline;
  padding: 12px 20px 4px; gap: 12px;
}
.nowhud .hud-title {
  font-size: 22px; font-weight: 700; color: var(--ink);
  flex: 1; letter-spacing: -.4px; min-width: 0;
}
.nowhud .hud-done {
  background: none; border: 0; font-family: inherit; cursor: pointer;
  color: var(--tint); font-size: 16px; font-weight: 600; flex: none;
}
.nowhud .hud-sub {
  font-size: 13px; color: var(--ink2);
  padding: 0 20px 14px;
}
.nowhud .hud-grid {
  flex: 1;
  display: grid; grid-template-columns: 1fr 1fr; gap: 13px;
  padding: 0 16px; align-content: start;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.nowhud .hud-tile {
  background: var(--card); border: 0; border-radius: 12px;
  padding: 18px 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
  min-height: 84px; cursor: pointer;
  font-family: inherit;
}
.nowhud .hud-tile:active { opacity: .7; }
.nowhud .hud-tile svg { width: 28px; height: 28px; color: var(--tint); }
.nowhud .hud-tile .tl { font-size: 15px; font-weight: 600; color: var(--ink); text-align: center; }
/* SOS tile — iOS system red (exempt) */
.nowhud .hud-tile.sos { background: #FF3B30; box-shadow: 0 4px 14px rgba(255, 59, 48, .32); }
.nowhud .hud-tile.sos svg { color: #fff; }
.nowhud .hud-tile.sos .tl { color: #fff; }

.nowhud .hud-next {
  margin: 12px 16px 16px;
  background: rgba(118, 118, 128, .1);
  border-radius: 13px; padding: 11px 15px;
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; color: var(--ink2);
}
.nowhud .hud-next svg { width: 16px; height: 16px; color: var(--ink2); flex: none; }
.nowhud .hud-next b { color: var(--ink); font-weight: 600; }

/* ===== THE ▾ MOMENT SWITCHER + EMERGENCY SHEET (shared sheet chrome) ===== */
.tg-sheet-scrim {
  position: fixed; inset: 0; z-index: 1400;
  background: rgba(0, 0, 0, .4);
  display: flex; align-items: flex-end; justify-content: center;
}
.tg-sheet-scrim[hidden] { display: none; }
.tg-sheet {
  background: var(--ground);
  width: 100%; max-width: 600px;
  border-radius: 18px 18px 0 0;
  max-height: 85vh; overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: env(safe-area-inset-bottom, 0);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.tg-sheet .sheet-grab {
  width: 40px; height: 5px; border-radius: 3px;
  background: var(--ink3); margin: 9px auto 4px;
}
.tg-sheet .sheet-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 8px 18px 10px; gap: 12px;
}
.tg-sheet .sheet-title { font-size: 18px; font-weight: 700; color: var(--ink); }
.tg-sheet .sheet-done {
  background: none; border: 0; font-family: inherit; cursor: pointer;
  color: var(--tint); font-size: 16px; font-weight: 600;
}

/* moment switcher rows */
.tg-switch-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%; background: none; border: 0; cursor: pointer;
  font-family: inherit; text-align: left;
  padding: 13px 18px; color: var(--ink);
  border-top: .5px solid var(--sep);
}
.tg-switch-row:first-of-type { border-top: 0; }
.tg-switch-row .sw-time {
  font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--tint); width: 52px; flex: none;
}
.tg-switch-row .sw-name { font-size: 15px; flex: 1; }
.tg-switch-row.is-active { background: rgba(245, 135, 10, .08); }
.tg-switch-row.is-auto .sw-name { color: var(--ink2); font-weight: 600; }

/* the emergency content lives inside .tg-sheet — its own component CSS in
   index.html still styles the inner blocks; we only host it in the sheet. */
.tg-sheet .emergency-sheet-body { padding: 0 16px 20px; }
