@font-face {
  font-family: 'Geist';
  src: url('./fonts/Geist-Variable.ttf') format('truetype-variations');
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('./fonts/GeistMono-Variable.ttf') format('truetype-variations');
  font-weight: 100 900; font-style: normal; font-display: swap;
}

:root {
  /* Blue theme (matches admin / bookmark-manager / redirector /
     video-downloader / amethyst): cool blue-tinted glass surfaces and
     translucent hairline borders, so nothing reads as a warm box on the blue
     gradient. The gold accent stays — it's timezones' identity and pairs well
     with deep navy. */
  --bg: #0B0B0A;                     /* kept: dark text on the gold HOME badge */
  --ink: #EEF2FA;                    /* cool near-white */
  --muted: #93A0C0;                  /* cool blue-gray */
  --rule: rgba(150, 178, 235, 0.14); /* translucent blue hairline (was solid warm) */
  --hi: #E4B05A;                     /* gold accent — identity, kept */

  --panel: rgba(10, 17, 40, 0.55);   /* deep-blue glass panel (zone meta) */
  --panel-solid: #0b1430;            /* opaque deep blue (search dropdown) */
  --glass: rgba(86, 116, 190, 0.07); /* faint blue fill for chips/inputs */
  --glass-hi: rgba(110, 142, 215, 0.14);

  --night: rgba(70, 98, 165, 0.05);  /* off-hours: barely-there blue */
  --day: rgba(86, 116, 190, 0.12);   /* daytime: light blue glass */
  --work: rgba(110, 142, 215, 0.20); /* working hours: brighter blue */
  --overlap: rgba(228, 176, 90, 0.20); /* everyone available: gold */
  --cell-w: 38px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html, body {
  /* Platform blue "floating" background: a full-bleed FIXED gradient (not the
     old flat warm-black) so iOS status-bar and home-indicator safe areas show
     the gradient instead of black bars. Matches admin / bookmark-manager /
     redirector / video-downloader / amethyst. */
  min-height: 100dvh;
  background: linear-gradient(178deg, #0d1a44 0%, #081026 44%, #060b18 100%);
  background-attachment: fixed;
}
body {
  font-family: 'Geist', system-ui, sans-serif;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Auth gate: the planner stays hidden until /api/v1/me confirms access, so an
   anonymous visitor never sees the shell flash before the SSO bounce. */
.page { display: none; }
body.authed .page { display: block; }
.auth-gate {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 24px; text-align: center; line-height: 1.6;
  font-family: 'Geist Mono', monospace; font-size: 13px; color: var(--muted);
}
body.authed .auth-gate { display: none; }

.page {
  max-width: 1080px; margin: 0 auto;
  /* keep the original 28 / 28 / 80 spacing, but grow into the iOS safe areas so
     the header clears the notch and the footer clears the home indicator */
  padding:
    max(28px, env(safe-area-inset-top))
    max(28px, env(safe-area-inset-right))
    max(80px, env(safe-area-inset-bottom))
    max(28px, env(safe-area-inset-left));
}

header.top {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 48px;
}
.mark, nav a {
  font-family: 'Geist Mono', monospace; font-size: 12px;
  color: var(--muted); text-decoration: none; letter-spacing: 0.02em;
}
.mark { color: var(--muted); }
nav a { margin-left: 20px; }
nav a:hover, .mark:hover { color: var(--ink); }

.head { margin-bottom: 36px; }
h1 {
  font-family: 'Geist Mono', monospace; font-size: 13px; font-weight: 400;
  text-transform: uppercase; letter-spacing: 0.18em; color: var(--hi);
  margin: 0 0 14px;
}
.lede {
  font-size: 17px; font-weight: 300; color: var(--ink);
  max-width: 56ch; margin: 0; letter-spacing: -0.005em;
}

/* ── toolbar ───────────────────────────────────────────── */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start;
  justify-content: space-between; margin-bottom: 28px;
}
.add { position: relative; flex: 1 1 280px; min-width: 220px; }
#search {
  width: 100%; background: var(--glass); color: var(--ink);
  border: 1px solid var(--rule); border-radius: 6px;
  padding: 10px 12px; font: inherit; font-size: 14px; outline: none;
}
#search:focus { border-color: var(--muted); }
#search::placeholder { color: var(--muted); }

.results {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--panel-solid); border: 1px solid var(--rule); border-radius: 6px;
  max-height: 320px; overflow-y: auto;
  box-shadow: 0 16px 40px rgba(0,0,0,0.55);
}
.results .row {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--rule);
}
.results .row:last-child { border-bottom: none; }
.results .row:hover, .results .row.active { background: var(--glass-hi); }
.results .name { font-size: 14px; }
.results .zone {
  font-family: 'Geist Mono', monospace; font-size: 11px; color: var(--muted);
}
.results .none { padding: 12px; color: var(--muted); font-size: 13px; }

.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; }
.ctl {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--rule); border-radius: 6px; padding: 7px 11px;
  background: var(--glass);
  font-family: 'Geist Mono', monospace; font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.ctl span { white-space: nowrap; }
.ctl input[type="date"],
.ctl input[type="number"] {
  background: transparent; border: none; color: var(--ink);
  font: inherit; font-family: 'Geist Mono', monospace; font-size: 12px;
  outline: none; text-transform: none; letter-spacing: 0;
}
.ctl input[type="date"] { color-scheme: dark; }
.ctl input[type="number"] { width: 34px; text-align: center; }
.range { display: inline-flex; align-items: center; gap: 4px; }
.range i { color: var(--muted); font-style: normal; }

button.btn {
  background: var(--glass); cursor: pointer; color: var(--ink);
  text-transform: uppercase;
}
button.btn:hover { border-color: var(--muted); color: var(--ink); }
button.btn[aria-pressed="true"] { border-color: var(--hi); color: var(--hi); }
button.btn:disabled { opacity: 0.4; cursor: default; }
button.btn:disabled:hover { border-color: var(--rule); color: var(--ink); }

/* preset dropdown — same glass chip as the other controls */
.ctl.preset { text-transform: none; }
.ctl select {
  background: transparent; border: none; color: var(--ink);
  font: inherit; font-family: 'Geist Mono', monospace; font-size: 12px;
  outline: none; text-transform: none; letter-spacing: 0;
  max-width: 150px; cursor: pointer;
}
.ctl select option { background: var(--panel-solid); color: var(--ink); }

/* ── board ─────────────────────────────────────────────── */
.board { overflow-x: auto; padding-bottom: 8px; }
.grid { border-collapse: collapse; min-width: max-content; }

.zonecard {
  display: grid;
  grid-template-columns: 200px 1fr;
  align-items: stretch;
  border: 1px solid var(--rule);
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
}
.zonecard.home { border-color: rgba(228,176,90,0.35); }

.zonemeta {
  padding: 12px 14px; border-right: 1px solid var(--rule);
  display: flex; flex-direction: column; gap: 2px; justify-content: center;
  min-width: 0; background: var(--panel);
}
.zonemeta .city { font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 7px; }
.zonemeta .tag {
  font-family: 'Geist Mono', monospace; font-size: 9px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--bg); background: var(--hi);
  padding: 1px 5px; border-radius: 3px;
}
.zonemeta .sub {
  font-family: 'Geist Mono', monospace; font-size: 11px; color: var(--muted);
  display: flex; gap: 8px; align-items: baseline;
}
.zonemeta .bigtime { font-size: 17px; color: var(--ink); letter-spacing: 0.01em; }
.zonemeta .off { color: var(--muted); }
.zonemeta .home-relative { color: var(--hi); }
.zonemeta .rm {
  margin-left: auto; background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 16px; line-height: 1; padding: 0 0 0 8px;
}
.zonemeta .rm:hover { color: var(--ink); }

.track { position: relative; display: flex; }
.cell {
  width: var(--cell-w); flex: 0 0 var(--cell-w);
  border-left: 1px solid var(--rule);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Geist Mono', monospace; font-size: 11px;
  color: var(--muted); padding: 14px 0; background: var(--night);
  position: relative;
}
.cell:first-child { border-left: none; }
.cell.day { background: var(--day); color: #AAB4CC; }
.cell.work { background: var(--work); color: var(--ink); }
.cell.daystart { font-weight: 600; color: var(--hi); }
.cell.overlap::after {
  content: ''; position: absolute; inset: 0; background: var(--overlap);
  pointer-events: none;
}

/* hour ruler (home zone) on top */
.ruler { display: grid; grid-template-columns: 200px 1fr; margin-bottom: 6px; }
.ruler .spacer {
  font-family: 'Geist Mono', monospace; font-size: 10px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.1em;
  display: flex; align-items: flex-end; padding: 0 14px 6px;
}
.ruler .rtrack { display: flex; }
.ruler .rcell {
  width: var(--cell-w); flex: 0 0 var(--cell-w); text-align: center;
  font-family: 'Geist Mono', monospace; font-size: 10px; color: var(--muted);
  padding-bottom: 6px;
}
.ruler .rcell.overlap { color: var(--hi); }

/* now marker */
.nowline {
  position: absolute; top: 0; bottom: 0; width: 1px; background: var(--hi);
  z-index: 5; pointer-events: none;
}
.nowline::before {
  content: ''; position: absolute; top: -3px; left: -2px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--hi);
}

.empty { color: var(--muted); font-size: 14px; padding: 24px 0; }

.legend {
  display: flex; flex-wrap: wrap; gap: 18px; margin-top: 24px;
  font-family: 'Geist Mono', monospace; font-size: 11px; color: var(--muted);
}
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend .sw { width: 14px; height: 14px; border-radius: 3px; display: inline-block; border: 1px solid var(--rule); }
.legend .sw.night { background: var(--night); }
.legend .sw.day { background: var(--day); }
.legend .sw.work { background: var(--work); }
.legend .sw.overlap { background: var(--hi); opacity: 0.5; }

footer {
  margin-top: 72px; padding-top: 14px; border-top: 1px solid var(--rule);
  font-family: 'Geist Mono', monospace; font-size: 11px; color: var(--muted);
  display: flex; justify-content: space-between;
}

@media (max-width: 640px) {
  .page { padding: 20px 16px 64px; }
  .zonecard, .ruler { grid-template-columns: 132px 1fr; }
  .ruler .spacer { padding: 0 10px 6px; }
  .zonemeta { padding: 10px; }
  :root { --cell-w: 34px; }
}
