/* Meridian — follows the Motive-Lite / Mirror direction: calm, dark UI in
   IBM Plex. Colour carries meaning only: the MFI-Tools-Design status hues
   (night sheet) for status, working hours and time of day, and sunlight on
   the globe. All colours live in :root below. */

:root {
  --bg: #121212;
  --bg-deep: #0e0e0e;
  --bg2: #1a1a1a;
  --panel: #1c1c1c;
  --input: #161616;
  --line: #3a3a3a;
  --line-soft: #2a2a2a;
  --text: #f6f6f6;
  --muted: #d0d0d0;
  --faint: #9c9c9c;
  --btn: #e8e8e8;
  --btn-hover: #ffffff;
  --btn-ink: #111111;
  /* status hues + washes — MFI-Tools-Design palette, night sheet */
  --good: #2fd19a;
  --good-wash: #14312a;
  --warn: #f0b429;
  --warn-wash: #33291a;
  --bad: #ff6b5c;
  --bad-wash: #35211f;
  --info: #5aa6d9;
  --info-wash: #172836;
  --good-line: color-mix(in oklab, var(--good) 45%, var(--bg2));
  --warn-line: color-mix(in oklab, var(--warn) 45%, var(--bg2));
  --bad-line: color-mix(in oklab, var(--bad) 45%, var(--bg2));
  --info-line: color-mix(in oklab, var(--info) 45%, var(--bg2));
  --live: var(--good);
  --live-line: var(--good-line);
  --live-bg: var(--good-wash);
  --bad-bg: var(--bad-wash);
  --scrim: rgba(0, 0, 0, 0.6);

  /* working-hours ladder: one hue, three steps, always labelled */
  --hours-core: var(--good);
  --hours-edge: color-mix(in oklab, var(--good) 38%, var(--panel));
  --hours-off: #262626;

  /* globe: the one place Meridian uses colour — sunlight */
  --sun: #f5a623;
  --viewport: #0b0b0b;
  --globe-ocean: #070707;
  --globe-outline: #3f3f3f;
  --globe-land-day: #d9d9d9;
  --globe-land-night: #4a4a4a;
  --globe-sea: #2e2e2e;
  /* sunlight ramp across the terminator (see buildSunRamp in globe.js) */
  --twilight-deep: #5e2626;
  --twilight: #d2552b;
  --sunrise: #f0922f;
  --golden-hour: #e9c48c;
  /* city lights on the night side */
  --city-light: #ffc861;
  --city-light-hot: #fff1cf;
  --globe-marker: var(--sun);
  --globe-marker-edge: #0b0b0b;
  --globe-me: #ffffff;

  --font: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --radius: 8px;
  --radius-sm: 6px;
  --topbar-h: 56px;
}

/* ==========================================================================
   Base
   ========================================================================== */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html {
  color-scheme: dark;
  min-height: 100%;
  background-color: var(--bg-deep);
  background-image: linear-gradient(180deg, #161616 0%, var(--bg) 40%, var(--bg-deep) 100%);
  background-attachment: fixed;
}
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
h1, h2, h3, p, ul { margin: 0; }
h1 { font-size: 2.25rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
h2 { font-size: 1.15rem; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 1rem; font-weight: 600; }
a { color: var(--text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }
::placeholder { color: var(--faint); opacity: 1; }
.mono { font-family: var(--mono); }
.sub { color: var(--muted); font-size: 0.92rem; }
.kicker { color: var(--muted); font-size: 0.9rem; }

/* ==========================================================================
   Controls
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 2.4rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--btn);
  border-radius: var(--radius-sm);
  background: var(--btn);
  color: var(--btn-ink);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover:not(:disabled) { background: var(--btn-hover); border-color: var(--btn-hover); text-decoration: none; }
.btn.secondary { background: transparent; color: var(--text); border-color: var(--line); }
.btn.secondary:hover:not(:disabled) { background: var(--bg2); border-color: #777; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { background: var(--bg2); border-color: transparent; color: var(--text); }
.btn.danger { background: transparent; border-color: var(--bad-line); color: var(--bad); }
.btn.danger:hover:not(:disabled) { background: var(--bad-wash); border-color: var(--bad); }
.btn.on { background: var(--btn); border-color: var(--btn); color: var(--btn-ink); }
.btn.small { min-height: 2rem; padding: 0.25rem 0.65rem; font-size: 0.85rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }

.segmented {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--input);
  flex-shrink: 0;
}
.segmented button {
  min-height: 1.8rem;
  padding: 0.15rem 0.7rem;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}
.segmented button:hover { color: var(--text); background: var(--bg2); }
.segmented button[aria-pressed="true"] { background: var(--btn); color: var(--btn-ink); font-weight: 600; }

.field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.field-label { font-size: 0.85rem; font-weight: 500; color: var(--muted); }
.field-label .opt { color: var(--faint); font-weight: 400; margin-left: 0.25rem; }
input, select {
  width: 100%;
  min-width: 0;
  min-height: 2.4rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--input);
  color: var(--text);
}
input:hover, select:hover { border-color: #555; }
input:focus, select:focus { outline: none; border-color: var(--info-line); box-shadow: 0 0 0 3px color-mix(in oklab, var(--info) 18%, transparent); }
input.small { min-height: 2rem; padding: 0.25rem 0.5rem; font-size: 0.85rem; }
input.invalid { border-color: var(--bad-line); }
input[type="datetime-local"] { font-family: var(--mono); font-size: 0.85rem; }

/* Badges + status (mono, uppercase, small — Motive-Lite) */
.badge, .status-word {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--bg2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge.live { color: var(--live); border-color: var(--live-line); background: var(--live-bg); font-weight: 600; }
.badge.strong { color: var(--btn-ink); background: var(--btn); border-color: var(--btn); font-weight: 600; }
.badge.good { color: var(--good); border-color: var(--good-line); background: var(--good-wash); }
.badge.info { color: var(--info); border-color: var(--info-line); background: var(--info-wash); }
.badge.warn { color: var(--warn); border-color: var(--warn-line); background: var(--warn-wash); }
.badge-row { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.led { width: 6px; height: 6px; border-radius: 50%; background: var(--live); flex-shrink: 0; }
.led.off { background: #6a6a6a; }
.led.warn { background: var(--warn); }
.led.bad { background: var(--bad); }
.led.signal { background: var(--sun); }
.led.neutral { display: none; }
.status-word:has(.led:not(.off):not(.warn):not(.bad):not(.signal):not(.neutral)) {
  color: var(--live); border-color: var(--live-line); background: var(--live-bg);
}

.sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }
.sw-day { background: var(--globe-land-day); }
.sw-twilight { background: linear-gradient(90deg, var(--twilight), var(--golden-hour)); }
.sw-lights { background: var(--city-light); box-shadow: 0 0 4px var(--city-light); }
.sw-member { background: var(--globe-marker); }
.sw-me { background: var(--globe-me); box-shadow: inset 0 0 0 2px var(--globe-marker); }
.sw-core { background: var(--hours-core); }
.sw-edge { background: var(--hours-edge); }
.sw-off { background: var(--hours-off); box-shadow: inset 0 0 0 1px var(--line); }

/* ==========================================================================
   Shell
   ========================================================================== */
.app-shell { min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 1.25rem;
  height: var(--topbar-h);
  padding: 0 max(1.25rem, env(safe-area-inset-right)) 0 max(1.25rem, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: rgba(18, 18, 18, 0.92);
  backdrop-filter: blur(8px);
}
.topbar-brand { display: flex; align-items: center; gap: 0.6rem; color: inherit; min-width: 0; }
.topbar-brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; flex-shrink: 0; }
.brand { font-weight: 700; letter-spacing: -0.03em; font-size: 1.15rem; white-space: nowrap; }
.brand span { color: var(--muted); font-weight: 500; letter-spacing: 0; font-size: 0.9rem; margin-left: 0.2rem; }
.topnav { display: flex; gap: 0.15rem; padding-left: 1rem; border-left: 1px solid var(--line); }
.topnav a {
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 500;
}
.topnav a:hover { color: var(--text); background: var(--bg2); text-decoration: none; }
.topnav a.active { color: var(--text); background: var(--bg2); box-shadow: inset 0 0 0 1px var(--line); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 0.6rem; }
.utc { color: var(--muted); font-size: 0.85rem; }
.utc span { color: var(--text); }
@media (max-width: 860px) { .brand span, .utc { display: none; } }
@media (max-width: 560px) {
  .topbar { gap: 0.75rem; padding: 0 0.9rem; }
  .topnav { padding-left: 0.6rem; }
  .topnav a { padding: 0.3rem 0.5rem; }
  #conn-status { display: none; }
}

.notice {
  display: none;
  align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
  margin: 1rem 1.25rem 0;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--info-line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--info-wash) 0%, var(--panel) 100%);
  color: var(--muted);
}
.notice.visible { display: flex; }
.notice strong { color: var(--text); font-weight: 600; }

/* ==========================================================================
   Panels
   ========================================================================== */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem; margin-bottom: 0.85rem; }
.count { color: var(--muted); font-size: 0.85rem; }
.count.full { color: var(--warn); }
.note { margin-top: 0.85rem; }
.note strong { color: var(--text); font-weight: 600; }
.empty {
  padding: 1rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-align: center;
  font-size: 0.92rem;
}

/* ==========================================================================
   Bridge
   ========================================================================== */
.view { display: none; }
.view.active { display: block; }
.view.bridge.active { display: grid; }

.bridge {
  grid-template-columns: minmax(0, 1fr) clamp(380px, 32vw, 500px);
  grid-template-rows: minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem 1.25rem 1.25rem;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  height: calc(100dvh - var(--topbar-h) - var(--banner-h, 0px));
  min-height: 560px;
}
@media (max-width: 1000px) {
  .bridge { grid-template-columns: 1fr; grid-template-rows: auto; height: auto; }
}
@media (max-width: 560px) { .bridge { padding: 0.75rem; gap: 0.75rem; } .notice { margin: 0.75rem 0.75rem 0; } }

.stage { display: flex; flex-direction: column; gap: 1rem; min-width: 0; min-height: 0; }
.side { display: flex; flex-direction: column; gap: 1rem; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #444 transparent; }
@media (max-width: 1000px) { .side { overflow: visible; } }

.viewport-panel { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; }
.viewport-head { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.85rem 1rem; border-bottom: 1px solid var(--line); }
.viewport-head .sub { font-size: 0.8rem; margin-top: 0.1rem; }
.viewport-tools { display: flex; align-items: center; gap: 0.5rem; }
.icon-btn { width: 2.1rem; padding: 0; }
.settings-wrap { position: relative; }
.settings-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50;
  width: 16rem;
  display: flex; flex-direction: column; gap: 0.75rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
.settings-pop .btn { align-self: flex-start; }
input[type="range"] {
  min-height: 0; padding: 0; border: 0; background: none; box-shadow: none;
  accent-color: var(--btn);
  height: 1.25rem;
}
.viewport { position: relative; flex: 1 1 auto; min-height: 260px; background: var(--viewport); }
.globe-frame { position: absolute; inset: 0; }
#globe-svg { width: 100%; height: 100%; display: block; cursor: grab; user-select: none; touch-action: none; }
#globe-svg.dragging { cursor: grabbing; }
#globe-svg:focus-visible { outline: 2px solid var(--muted); outline-offset: -4px; }
@media (max-width: 1000px) {
  .viewport { flex: none; height: min(80vw, 520px); min-height: 300px; }
  #globe-svg { touch-action: pan-y; }
}

.float {
  position: absolute; z-index: 10;
  background: rgba(28, 28, 28, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(6px);
}
.zoom-controls { right: 0.75rem; bottom: 0.75rem; display: flex; flex-direction: column; overflow: hidden; }
.zoom-controls button {
  width: 34px; height: 32px;
  border: 0; background: transparent; color: var(--text);
  font-size: 1rem; cursor: pointer;
}
.zoom-controls button + button { border-top: 1px solid var(--line); }
.zoom-controls button:hover:not(:disabled) { background: var(--bg2); }
.zoom-controls button:disabled { color: #555; cursor: default; }
.legend { left: 0.75rem; bottom: 0.75rem; display: flex; gap: 0.9rem; padding: 0.35rem 0.65rem; font-size: 0.78rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
@media (max-width: 560px) { .legend { display: none; } }

.globe-tip { pointer-events: none; padding: 0.55rem 0.7rem; font-size: 0.82rem; white-space: nowrap; opacity: 0; transition: opacity 0.12s; max-width: calc(100% - 16px); }
.globe-tip.visible { opacity: 1; }
.globe-tip .name { font-weight: 600; color: var(--text); margin-bottom: 0.15rem; }
.globe-tip .co { color: var(--faint); font-size: 0.75rem; }
.globe-tip .row { display: flex; justify-content: space-between; gap: 0.9rem; align-items: baseline; }
.globe-tip .row .co { margin-right: 0.35rem; }
.globe-tip .dim { color: var(--muted); font-family: var(--mono); }
.globe-tip .faint { color: var(--faint); }

/* globe drawing */
.g-ocean { fill: var(--globe-ocean); }
.g-outline { fill: none; stroke: var(--globe-outline); stroke-width: 1; vector-effect: non-scaling-stroke; }
.dither { stroke: none; pointer-events: none; }
.lights { animation: twinkle 3600ms ease-in-out infinite; }
@keyframes twinkle {
  0%, 100% { opacity: 1; }
  45% { opacity: 0.62; }
  60% { opacity: 0.9; }
}
@media (prefers-reduced-motion: reduce) { .lights { animation: none; } }
.sun-marker { fill: var(--sun); stroke: var(--viewport); stroke-width: 2; pointer-events: none; }
.member-marker { fill: var(--globe-marker); stroke: var(--globe-marker-edge); stroke-width: 1.5; pointer-events: none; }
.member-marker.me { fill: var(--globe-me); stroke: var(--globe-marker); stroke-width: 2; }
.cluster-count { fill: var(--btn-ink); font-family: var(--font); font-weight: 700; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.cluster-hit { fill: transparent; cursor: pointer; }

/* scrubber */
.scrubber { flex-shrink: 0; }
.scrub-readout { display: flex; justify-content: space-between; align-items: flex-end; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.85rem; }
.scrub-time { display: flex; flex-direction: column; align-items: flex-start; gap: 0.4rem; min-width: 0; }
.scrub-value { font-size: 1.2rem; font-weight: 600; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scrub-actions button { font-family: var(--mono); font-size: 0.8rem; }
.scrub-track-wrap { position: relative; }
.scrub-track {
  position: relative; height: 8px;
  border-radius: 999px;
  background: var(--input);
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: pointer; user-select: none; touch-action: none;
}
.scrub-fill { position: absolute; top: 0; bottom: 0; left: 50%; width: 0; border-radius: 999px; background: #5a5a5a; pointer-events: none; }
.scrub-now-marker { position: absolute; top: -5px; bottom: -5px; left: 50%; width: 1px; background: var(--muted); pointer-events: none; }
.scrub-thumb {
  position: absolute; top: 50%; left: 50%;
  width: 16px; height: 16px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--btn);
  box-shadow: 0 0 0 3px var(--panel), 0 1px 4px rgba(0, 0, 0, 0.6);
  cursor: grab;
}
.scrub-thumb.live { background: var(--live); }
.scrub-thumb.dragging { cursor: grabbing; }
.scrub-thumb.pegged { background: var(--sun); }
.scrub-thumb:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.scrub-ticks { display: flex; justify-content: space-between; margin-top: 0.5rem; font-size: 0.72rem; color: var(--faint); }
.scrub-jumps { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.85rem; align-items: center; }
.scrub-datepick { display: flex; gap: 0.4rem; margin-left: auto; }
.scrub-datepick input { width: auto; }
@media (max-width: 720px) {
  .scrub-datepick { margin-left: 0; width: 100%; }
  .scrub-datepick input { flex: 1; }
  .scrub-actions { width: 100%; }
  .scrub-actions button { flex: 1; }
}

/* members */
.members-list { display: flex; flex-direction: column; }
.member {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.25rem;
  border-bottom: 1px solid var(--line-soft);
}
.member:first-child { border-top: 1px solid var(--line-soft); }
.member.me { background: linear-gradient(90deg, var(--info-wash), transparent 70%); box-shadow: inset 2px 0 0 var(--info); }
.member-info { display: flex; flex-direction: column; min-width: 0; }
.member-company { font-size: 0.75rem; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-you { margin-left: 0.4rem; vertical-align: 1px; }
.member-loc { font-size: 0.82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-when { display: flex; flex-direction: column; align-items: flex-end; gap: 0.2rem; }
.member-time { font-family: var(--mono); font-size: 1.05rem; font-weight: 500; }
.member-day { color: var(--faint); font-size: 0.78rem; margin-right: 0.35rem; }
.tod.tod-day { color: var(--info); border-color: var(--info-line); background: var(--info-wash); }
.tod.tod-twi { color: var(--warn); border-color: var(--warn-line); background: var(--warn-wash); }
.tod.tod-night { color: var(--faint); }
.tod .led { display: none; }
.member-remove {
  width: 30px; height: 30px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--faint);
  cursor: pointer;
}
.member-remove:hover { color: var(--text); border-color: var(--line); background: var(--bg2); }
.member-remove.confirm { width: auto; padding: 0 0.55rem; border-color: var(--bad-line); background: var(--bad-wash); color: var(--bad); font-size: 0.8rem; }

.add-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; margin-top: 1rem; }
.add-form .field-wide { grid-column: 1 / -1; }
.add-form .tz-combo { position: relative; }
.add-form.disabled { opacity: 0.5; pointer-events: none; }
@media (max-width: 480px) { .add-form { grid-template-columns: 1fr; } }

.tz-dropdown {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px);
  z-index: 30;
  display: none;
  max-height: 280px; overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
.tz-dropdown.open { display: block; }
.tz-option { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: 0.5rem 0.7rem; cursor: pointer; }
.tz-option:hover, .tz-option.active { background: var(--bg2); }
.tz-city { font-weight: 500; }
.tz-match { color: var(--faint); font-size: 0.8rem; margin-left: 0.35rem; }
.tz-zone { font-family: var(--mono); font-size: 0.75rem; color: var(--faint); white-space: nowrap; }
.tz-empty { padding: 0.75rem; color: var(--muted); font-size: 0.9rem; }

/* overlap */
.hours-key { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; margin-bottom: 0.75rem; font-size: 0.8rem; color: var(--muted); }
.hours-key span { display: inline-flex; align-items: center; gap: 0.35rem; }
.timebar-row, .timebar-labels { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 0.6rem; align-items: center; }
.timebar-row { margin-bottom: 3px; }
.timebar-labels { margin-bottom: 0.35rem; }
.timebar-axis { font-size: 0.72rem; color: var(--faint); }
.timebar-hours { display: grid; grid-template-columns: repeat(24, 1fr); font-size: 0.66rem; color: var(--faint); }
.timebar-hours span { text-align: center; }
.timebar-hours span:nth-child(even) { visibility: hidden; }
.timebar-name { font-size: 0.85rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timebar-cells { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; height: 18px; }
.cell { background: var(--hours-off); border-radius: 2px; cursor: pointer; position: relative; }
.cell.meh { background: var(--hours-edge); }
.cell.work { background: var(--hours-core); }
.cell.now { box-shadow: 0 0 0 1.5px var(--sun); z-index: 2; }
.cell:hover { box-shadow: 0 0 0 1.5px var(--text); z-index: 3; }
.cell.picked { box-shadow: 0 0 0 2px var(--info); z-index: 4; }
@media (max-width: 480px) { .timebar-row, .timebar-labels { grid-template-columns: 56px minmax(0, 1fr); gap: 0.4rem; } }

.overlap-chart-wrap { margin-top: 0.85rem; padding: 0.75rem 0.75rem 0.5rem; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--input); }
#overlap-chart { width: 100%; height: 110px; display: block; overflow: visible; }
.overlap-chart-labels { display: flex; justify-content: space-between; margin-top: 0.4rem; font-size: 0.72rem; color: var(--faint); }
.bar { fill: #333; cursor: pointer; }
.bar.meh { fill: var(--hours-edge); }
.bar.work { fill: var(--good); }
.bar.peak { fill: #ffffff; }
.bar:hover { fill: var(--sun); }
.bar.picked { fill: var(--info); }
.bell-line { fill: none; stroke: var(--muted); stroke-opacity: 0.6; stroke-width: 1.25; pointer-events: none; }
.axis-line { stroke: var(--line-soft); stroke-width: 1; }
.now-marker { stroke: var(--sun); stroke-width: 1.5; pointer-events: none; }
.now-label { fill: var(--sun); font-family: var(--mono); font-size: 10px; pointer-events: none; }
.peak-dot { fill: #ffffff; stroke: var(--input); stroke-width: 2; pointer-events: none; }

/* hour picked in the overlap panel, awaiting confirmation */
.propose-preview {
  display: flex; flex-direction: column; gap: 0.55rem;
  margin-top: 0.85rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--info-line);
  border-radius: var(--radius-sm);
  background: var(--info-wash);
}
.pick-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.pick-title { font-weight: 600; }
.pick-title .sub { font-weight: 400; font-size: 0.8rem; margin-left: 0.25rem; }
.propose-preview .proposal-locals { display: flex; flex-wrap: wrap; gap: 0.1rem 0.9rem; }

/* proposals */
.voter-picker { margin-bottom: 0.85rem; }
.proposal {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.4rem 0.9rem;
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg2);
}
.proposal.leading { border-color: var(--good-line); box-shadow: inset 2px 0 0 var(--good); }
.proposal.past { opacity: 0.55; }
.proposal-time { font-weight: 600; display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.proposal-utc { font-family: var(--mono); font-size: 0.75rem; color: var(--faint); margin-top: 0.1rem; }
.proposal-count { font-family: var(--mono); font-size: 1.6rem; font-weight: 500; line-height: 1; text-align: right; }
.proposal-locals { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0.1rem 0.9rem; font-family: var(--mono); font-size: 0.75rem; color: var(--muted); }
.proposal-locals .odd { color: var(--bad); }
.proposal-voters { grid-column: 1 / -1; font-size: 0.82rem; color: var(--muted); }
.proposal-actions { grid-column: 1 / -1; display: flex; gap: 0.4rem; margin-top: 0.15rem; }
.vote-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.6rem; align-items: end; margin-top: 0.85rem; }

/* session */
.session-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; margin: 0; }
.session-facts div { padding: 0.55rem 0.7rem; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--input); min-width: 0; }
.session-facts dt { font-size: 0.75rem; color: var(--faint); }
.session-facts dd { margin: 0.1rem 0 0; font-family: var(--mono); font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-copy { margin: 0.85rem 0; color: var(--muted); font-size: 0.92rem; }
.session-note { margin-top: 0.85rem; font-size: 0.8rem; color: var(--faint); }

/* ==========================================================================
   About
   ========================================================================== */
.about.active {
  display: flex; flex-direction: column; gap: 2.5rem;
  width: 100%; max-width: 56rem;
  margin: 0 auto;
  padding: 3rem 1.5rem 3rem;
}
.about section > h2 { margin-bottom: 0.85rem; }
.hero { display: flex; flex-direction: column; gap: 1rem; }
.lede { color: var(--muted); font-size: 1.05rem; max-width: 40rem; }
.clock-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.6rem; }
@media (max-width: 900px) { .clock-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 420px) { .clock-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.clock { padding: 0.75rem 0.85rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.clock-city { font-size: 0.8rem; color: var(--muted); }
.clock-time { font-family: var(--mono); font-size: 1.35rem; font-weight: 500; margin-top: 0.1rem; }
.clock-meta { font-size: 0.75rem; color: var(--faint); }
.feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.feature-grid .panel h3 { margin-bottom: 0.35rem; }
.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; }
.plan { display: flex; flex-direction: column; gap: 0.6rem; }
.plan.current { border-color: var(--good-line); }
.plan-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.plan-price { color: var(--muted); }
.plan-price .mono { font-size: 1.6rem; color: var(--text); font-weight: 500; margin-right: 0.25rem; }
.plan ul { padding-left: 1.1rem; color: var(--muted); font-size: 0.9rem; display: flex; flex-direction: column; gap: 0.2rem; }
@media (max-width: 760px) {
  .feature-grid, .plan-grid { grid-template-columns: 1fr; }
  h1 { font-size: 1.8rem; }
  .about.active { padding: 2rem 1rem; }
}
.site-foot { color: var(--faint); font-size: 0.85rem; text-align: center; padding-top: 1rem; border-top: 1px solid var(--line-soft); }
.site-foot a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }

/* ==========================================================================
   Overlay, toasts
   ========================================================================== */
.overlay { position: fixed; inset: 0; z-index: 950; display: none; align-items: center; justify-content: center; padding: 1.5rem; background: var(--scrim); }
.overlay.visible { display: flex; }
.dialog { width: 100%; max-width: 26rem; display: flex; flex-direction: column; gap: 0.75rem; padding: 1.5rem; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
.dialog .btn-row { margin-top: 0.4rem; }

.toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 960; display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; pointer-events: none; max-width: calc(100vw - 2rem); }
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  font-size: 0.92rem;
}
.toast.good { border-color: var(--live-line); }
.toast.error { border-color: var(--bad-line); background: var(--bad-wash); }
.toast .toast-action {
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}
.toast .toast-action:hover { background: var(--bg2); }
@media (max-width: 560px) { .toasts { left: 0.75rem; right: 0.75rem; align-items: stretch; } }

.noscript { position: fixed; left: 0; right: 0; bottom: 3rem; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
