/* ============================================================
   Smarter-HR Pool · style.css
   Unified design system. One shell, one rhythm, one type scale.
   ============================================================ */

:root {
  /* ── Surfaces ───────────────────────────────────── */
  --bg:        #0f1115;
  --bg-elev:   #161a22;
  --bg-card:   #1a1f2a;
  --bg-deep:   #0a0d12;

  /* ── Borders / dividers ─────────────────────────── */
  --border:    #2a3140;
  --border-2:  #3a4456;

  /* ── Text ───────────────────────────────────────── */
  --text-0:    #eef1f7;
  --text-1:    #aab2c2;
  --text-2:    #7a8294;
  --text-3:    #5a6275;

  /* ── Brand / accent ─────────────────────────────── */
  --accent:        #5b9eff;
  --accent-strong: #3f7ce8;
  --accent-glow:   rgba(91, 158, 255, 0.35);
  --accent-2:      #34c38f;
  --accent-2-soft: rgba(52, 195, 143, 0.12);
  --warn:          #f5b13d;
  --danger:        #ef5b6b;

  /* ── Shape ──────────────────────────────────────── */
  --radius:    14px;
  --radius-sm: 10px;
  --radius-lg: 20px;

  /* ── Touch / safe area ──────────────────────────── */
  --tap-min:   44px;
  --safe-top:  env(safe-area-inset-top, 0px);
  --safe-bot:  env(safe-area-inset-bottom, 0px);

  /* ── Type ───────────────────────────────────────── */
  --font:        -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Space Grotesk', var(--font);

  /* ── SHELL SIZES (THE ONLY WIDTHS THAT EXIST) ─────
     Every page-level container picks ONE of these.
     Inline max-width overrides on the markup side are forbidden. */
  --shell:        1120px;   /* THE ONE width for all /pool/ landing cards */
  --shell-wide:   1280px;   /* /pool/session.html workspace ONLY — do not use on landing */

  /* ── Spacing scale (4-px base) ───────────────────── */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;

  /* ── Elevation / shadow ─────────────────────────── */
  --shadow-1: 0 1px 2px rgba(0,0,0,.35);
  --shadow-2: 0 4px 14px rgba(0,0,0,.35);
  --shadow-3: 0 16px 40px rgba(0,0,0,.45);
  --ring-focus: 0 0 0 3px rgba(91,158,255,.35);

  /* ── Gradients ──────────────────────────────────── */
  --grad-hero: radial-gradient(ellipse 90% 60% at 50% 0%,
              rgba(91,158,255,0.15), transparent 60%),
              radial-gradient(ellipse 60% 40% at 80% 25%,
              rgba(52,195,143,0.10), transparent 70%);
  --grad-accent: linear-gradient(135deg, #5b9eff 0%, #34c38f 100%);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  color: var(--text-0);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

#app { position: relative; z-index: 1; }
::selection { background: rgba(79, 140, 247, 0.28); }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: 16px; }
img { display: block; max-width: 100%; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap-min);
  padding: 12px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-size: 15px; font-weight: 600;
  cursor: pointer;
  transition: opacity .15s ease, background-color .15s ease;
  user-select: none;
}
.btn:hover { background: #3f7ce8; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .icon { font-size: 1em; }

.btn--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-0);
}
.btn--ghost:hover { background: var(--bg-elev); }

.btn--sm {
  padding: 9px 14px;
  font-size: 13.5px;
  border-radius: var(--radius-sm);
  min-height: 38px;
}

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  width: 100%;
}
.nav .brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 16px;
  color: var(--text-0);
}
.brand-name { line-height: 1.1; }
.logo-mark {
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text-0);
  font-size: 14px;
}
.nav-right { display: flex; align-items: center; gap: 8px; }

.nav-desktop { display: none; }
.nav-burger {
  width: var(--tap-min); height: var(--tap-min);
  display: grid; place-items: center;
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-0); font-size: 18px;
  cursor: pointer;
}
.nav-burger:active { background: var(--bg-elev); }

/* drawer */
.nav-drawer { position: fixed; inset: 0; z-index: 200; }
.nav-drawer-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.5);
  opacity: 0; transition: opacity .2s ease;
}
.nav-drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(320px, 86%);
  padding: 18px;
  background: var(--bg-elev);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px;
  transform: translateX(100%);
  transition: transform .25s ease;
}
.nav-drawer.open .nav-drawer-overlay { opacity: 1; }
.nav-drawer.open .nav-drawer-panel { transform: none; }
.nav-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.nav-drawer-close {
  width: 38px; height: 38px; display: grid; place-items: center;
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-0); font-size: 16px; cursor: pointer;
}
.nav-drawer-link {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; min-height: var(--tap-min);
  border-radius: var(--radius-sm);
  background: transparent; border: 1px solid transparent;
  color: var(--text-0); font-size: 15px; font-weight: 500;
  cursor: pointer; text-align: left;
  transition: background .15s ease;
}
.nav-drawer-link:hover { background: var(--bg-card); }
.nav-drawer-link i { color: var(--text-1); width: 18px; text-align: center; }
.nav-drawer-install {
  margin-top: 6px;
  border-color: var(--border) !important;
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  padding: clamp(56px, 8vw, 96px) var(--s-5) clamp(40px, 6vw, 64px);
  text-align: center;
  max-width: var(--shell);
  margin: 0 auto;
  background: var(--grad-hero);
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-1);
  font-size: 12px; font-weight: 500;
  letter-spacing: .02em;
}
.eyebrow i { color: var(--accent); }
.hero h1 {
  margin: var(--s-5) auto var(--s-3);
  font-size: clamp(32px, 6vw, 52px);
  line-height: 1.1; letter-spacing: -.03em;
  max-width: 18ch;
  color: var(--text-0);
  font-weight: 700;
  font-family: var(--font-display);
}
.hero h1 .accent-glow {
  background: var(--grad-accent);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.hero .lede {
  margin: 0 auto var(--s-5); max-width: 52ch;
  color: var(--text-1); font-size: clamp(15px, 2vw, 17px); line-height: 1.6;
}
.hero-cta { display: flex; gap: var(--s-3); justify-content: center; flex-wrap: wrap; }
.hero-cta .btn { padding: 14px 28px; font-size: 16px; border-radius: 999px; }
.hero .trust {
  margin-top: var(--s-5); display: flex; gap: var(--s-4); justify-content: center; flex-wrap: wrap;
  color: var(--text-2); font-size: 13px;
}
.hero .trust i { color: var(--accent-2); margin-right: 4px; }

/* ---------- card ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-1);
}
.card--glass {
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-elev) 100%);
  border-color: var(--border-2);
  box-shadow: var(--shadow-2);
}

/* ---------- wizard ---------- */
.ignite-nav { margin-top: var(--s-6); text-align: center; }
.frost-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-1);
  font-size: 12px; font-weight: 500;
  letter-spacing: .02em;
}
.frost-tag i { color: var(--accent); }

.wizard {
  max-width: var(--shell);
  margin: var(--s-3) auto 0;
  padding: clamp(24px, 3vw, 36px) clamp(22px, 3vw, 38px) clamp(22px, 3vw, 30px);
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-elev) 100%);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  text-align: left;
}

.wizard-step h2 {
  font-size: 19px;
  letter-spacing: -.01em;
  margin-bottom: 4px;
  color: var(--text-0);
  font-weight: 700;
}
.wizard-step .step-hint {
  color: var(--text-2);
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.5;
}
.wiz-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.wiz-counter { color: var(--text-2); font-size: 12px; }

.wiz-dots {
  display: flex; gap: 6px;
  justify-content: center;
  margin-bottom: 16px;
}
.wdot {
  width: 8px; height: 8px;
  border-radius: 99px;
  background: var(--border);
  transition: background .2s ease, width .25s ease;
}
.wdot.on { background: var(--accent); width: 22px; }

/* ---------- form fields ---------- */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px;
  color: var(--text-1);
  margin-bottom: 6px;
  font-weight: 500;
}

.input, .select {
  width: 100%;
  min-height: var(--tap-min);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-0);
  font-size: 15px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .15s ease;
}
.input::placeholder { color: var(--text-2); }
.input:focus, .select:focus { border-color: var(--accent); }

.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23aab2c2' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.select option { background: var(--bg-elev); color: var(--text-0); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.form-actions .btn { flex: 1; min-width: 0; }

.range-hint { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.range-hint .frost-tag { font-size: 11px; padding: 4px 9px; }

/* ---------- Time-range picker (Step 2 of wizard) ---------- */
.time-range {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: end;
}
.time-range .time-sep {
  align-self: center;
  padding-bottom: 12px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}
.time-presets {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-top: 8px;
}
.time-preset-btn {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text-1);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color .12s, border-color .12s, color .12s;
  touch-action: manipulation;
}
.time-preset-btn:hover { background: #232b3a; border-color: var(--accent); color: #fff; }
.time-preset-btn.is-active {
  background: #1a2742;
  border-color: var(--accent);
  color: #d6e3ff;
}
.dow-picker {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.dow-chip {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text-1);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  min-width: 40px;
  text-align: center;
  transition: background-color .12s, border-color .12s, color .12s;
  touch-action: manipulation;
}
.dow-chip:hover { background: #232b3a; border-color: var(--accent); }
.dow-chip.is-on {
  background: #1a2742;
  border-color: var(--accent);
  color: #fff;
}

.hint { color: var(--text-2); font-size: 12px; margin-top: 6px; }

.gen-result { text-align: center; padding: 6px 0 0; }
.gen-meta {
  display: flex; flex-wrap: wrap; gap: 6px;
  justify-content: center;
  margin: 10px 0 14px;
  font-size: 12px;
  color: var(--text-1);
}
.gen-meta .badge-dim { font-size: 11px; }

.result-link-box {
  display: flex; align-items: center; gap: 8px;
  margin: 12px 0 4px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  border: 1px solid var(--border);
}
.result-link-box .link-val {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text-1);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.result-link-box .btn {
  padding: 7px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  min-height: 32px;
}
.copy-ok { color: var(--accent-2); font-size: 12px; min-height: 16px; margin-top: 4px; }

.qr-details {
  margin: 14px auto 0;
  text-align: left;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.qr-details summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text-0);
  font-size: 13px;
  font-weight: 500;
}
.qr-details summary::-webkit-details-marker { display: none; }
.qr-details summary:hover { background: var(--border); }
.qr-details[open] summary { margin-bottom: 12px; }
.qr-details[open] summary i { color: var(--accent); }

.qr-wrap {
  width: 168px; height: 168px;
  padding: 8px;
  margin: 0 auto;
  background: #fff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.qr-wrap img,
.qr-wrap canvas,
.qr-wrap svg,
.qr-target img,
.qr-target canvas,
.qr-target svg { width: 100%; height: 100%; display: block; }
.qr-target { width: 100%; height: 100%; display: block; }
.qr-target:empty::before {
  content: "Loading…";
  color: #6b7280;
  font-size: 12px;
}

.quick-join {
  max-width: var(--shell);
  margin: var(--s-4) auto 0;
  padding: 18px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  display: flex; align-items: stretch; gap: 8px;
  flex-wrap: wrap;
}
.quick-join .qj-label {
  color: var(--text-1); font-size: 12px; font-weight: 600;
  width: 100%;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.quick-join .input { flex: 1; min-width: 0; }

/* ---------- features ---------- */
.features {
  max-width: var(--shell);
  margin: var(--s-7) auto 0;
  padding: 0 var(--s-5);
  display: grid; grid-template-columns: 1fr;
  gap: 14px;
}
.feat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 22px 20px;
  box-shadow: var(--shadow-1);
  transition: transform .15s ease, border-color .15s ease;
}
.feat:hover {
  transform: translateY(-1px);
  border-color: var(--border-2);
}
.feat:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), var(--shadow-1);
}
.feat .fi {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: grid; place-items: center;
  background: var(--bg-elev);
  border: 1px solid var(--border-2);
  color: var(--accent);
  font-size: 16px;
  margin-bottom: 14px;
}
.feat h3 {
  font-size: 16px;
  margin-bottom: 6px;
  color: var(--text-0);
  font-weight: 600;
}
.feat p { color: var(--text-1); font-size: 14px; line-height: 1.6; }

/* ---------- bands ---------- */
.band {
  max-width: var(--shell);
  margin: var(--s-7) auto 0;
  padding: 0 var(--s-5);
}
.band .card { padding: 36px clamp(20px, 3vw, 32px); }
.band h2 {
  font-size: clamp(22px, 3.4vw, 32px);
  letter-spacing: -.02em;
  margin-bottom: 10px;
  color: var(--text-0);
  font-weight: 700;
  font-family: var(--font-display);
  line-height: 1.2;
}
.band h2 .accent-glow {
  background: var(--grad-accent);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.band p { color: var(--text-1); margin-bottom: 20px; line-height: 1.6; }
.lede { font-size: clamp(15px, 2vw, 17px); line-height: 1.6; }
.band .card--center { text-align: center; }
.band .card--center .lede { margin-inline: auto; max-width: 60ch; }

/* ---------- How it works card ---------- */
.howit-card {
  padding: clamp(26px, 3.6vw, 38px) clamp(20px, 3vw, 32px);
  max-width: var(--shell);
  margin-inline: auto;
}
.howit-head {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
}
.howit-title {
  font-size: clamp(22px, 3.4vw, 30px);
  letter-spacing: -.02em;
  font-weight: 700;
  color: var(--text-0);
  font-family: var(--font-display);
  line-height: 1.2;
  margin: 0;
}
.howit-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
  counter-reset: howit;
}
.howit-step {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px clamp(14px, 2vw, 18px);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.howit-step:hover {
  background: var(--bg-card);
  border-color: var(--border-2);
  transform: translateY(-1px);
}
.howit-step .num {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
  background: var(--bg-deep);
  color: var(--text-1);
  border: 1px solid var(--border-2);
  font-family: var(--font-display);
}
.howit-step .lbl {
  font-size: 14.5px;
  color: var(--text-0);
  font-weight: 500;
}
.howit-step .lbl strong { color: var(--accent); font-weight: 600; }
.howit-step.done {
  background: linear-gradient(135deg,
    rgba(91, 158, 255, 0.10),
    rgba(52, 195, 143, 0.10) 100%);
  border-color: var(--accent-2);
}
.howit-step.done .num {
  background: var(--accent-2);
  color: #0a0d12;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(52, 195, 143, .25);
}
.howit-step.done .lbl strong {
  background: var(--grad-accent);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ---------- small utility classes (replaces inline style="") ---------- */
.brand-name--strong { font-weight: 700; }
.label-ico { margin-right: 5px; color: var(--accent); }
.hint--inline { display: inline; margin: 0; font-size: 11px; }
.hint--bare { margin-top: 0; margin-bottom: 8px; }
.footer-brand-name { font-weight: 700; color: var(--text-0); }
.footer-link--spaced { margin-left: 14px; }
.cal-title {
  font-size: clamp(22px, 4vw, 36px);
  letter-spacing: -.02em;
  font-weight: 700;
  color: var(--text-0);
  font-family: var(--font-display);
  line-height: 1.2;
  margin: 0 0 14px;
}
.cal-lede { color: var(--text-1); margin: 0 auto 26px; max-width: 52ch; }
.cal-badges { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.time-presets--top { margin-top: 6px; }
.gen-result .wiz-head h2 { text-align: left; }

/* ---------- mobile table-cell labels: keep accessibility but hide visually ---------- */

footer {
  margin-top: 48px;
  padding: 24px 20px calc(32px + var(--safe-bot));
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-2);
  font-size: 12.5px;
}
footer .footer-brand {
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}
footer .brand-sub { font-size: 11px; color: var(--text-2); }
footer .f-line {
  display: flex; gap: 14px; justify-content: center;
  flex-wrap: wrap;
  margin-top: 6px;
  color: var(--text-1);
}
footer .footer-meta {
  display: flex; flex-wrap: wrap; gap: 8px;
  align-items: center; justify-content: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
}
footer .footer-link {
  background: transparent; border: none;
  color: var(--accent); cursor: pointer;
  font-size: 12px;
  display: inline-flex; align-items: center; gap: 6px;
}
footer .footer-link:hover { text-decoration: underline; }

.steps {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 12px 16px;
  font-size: 12.5px;
  color: var(--text-1);
  justify-content: center;
}
.step {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--bg-elev);
  border-radius: 99px;
  border: 1px solid var(--border);
}
.step .num {
  width: 18px; height: 18px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  background: var(--bg-card);
  color: var(--text-1);
}
.step.on .num { background: var(--accent); color: #fff; }
.step.on { color: var(--text-0); }

/* ---------- preview band ---------- */
.preview-card { padding: 28px clamp(20px, 3vw, 32px); }
.preview-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.preview-title {
  font-size: clamp(18px, 3vw, 22px);
  letter-spacing: -.01em;
  color: var(--text-0);
  font-weight: 600;
  display: flex; align-items: center; gap: 10px;
}
.preview-title i { color: var(--accent-2); }
.preview-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  max-width: 420px;
  margin-bottom: 16px;
}
.pg-cell {
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  position: relative;
}
.pg-cell::after {
  content: ""; position: absolute; inset: auto 2px 2px auto;
  width: 4px; height: 4px; border-radius: 50%;
  background: transparent;
}
.pgh-1 { background: #243047; border-color: #33445f; }
.pgh-2 { background: #2f4a6e; border-color: #405f8c; }
.pgh-3 { background: #2f6a8a; border-color: #3f84a8; color: #eaf4ff; }
.pgh-4 { background: #5e8e3a; border-color: #7aaa52; color: #f4ffe8; }
.pg-cell.apex {
  background: var(--accent-2);
  border-color: #5be8b6;
  box-shadow: inset 0 0 0 1px rgba(7, 18, 13, 0.18), 0 0 12px rgba(52, 195, 143, 0.45);
}
.pg-cell.apex::after { background: #07120d; }

.preview-meta { color: var(--text-1); font-size: 13.5px; }
.preview-meta strong { color: var(--text-0); font-weight: 600; }

/* ---------- presence strip (real people, light up) ---------- */
.presence-card {
  padding: 22px clamp(20px, 3vw, 28px);
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: center;
}
@media (min-width: 720px) {
  .presence-card { grid-template-columns: 1.4fr 1fr; gap: 28px; }
}
.presence-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 6px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.presence-head .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 0 var(--accent-2);
  animation: presence-pulse 1.6s ease-out infinite;
}
@keyframes presence-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(52, 195, 143, .55); }
  70%  { box-shadow: 0 0 0 8px rgba(52, 195, 143, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 195, 143, 0); }
}
.presence-title {
  font-size: clamp(18px, 3vw, 22px);
  letter-spacing: -.01em;
  color: var(--text-0);
  font-weight: 600;
  margin-bottom: 10px;
}
.presence-desc { color: var(--text-1); font-size: 14px; line-height: 1.55; }
.presence-stack {
  display: flex; align-items: center; gap: 0;
  flex-wrap: nowrap;
  overflow: hidden;
}
.avatar {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  font-size: 13px; font-weight: 700;
  color: #fff;
  border: 2px solid var(--bg-card);
  margin-inline-start: -10px;
  position: relative;
  flex: 0 0 auto;
  transition: transform .25s ease;
}
.avatar:first-child { margin-inline-start: 0; }
.avatar.lit { z-index: 2; transform: translateY(-2px) scale(1.06); }
.avatar.a0 { background: linear-gradient(135deg, #5b9eff, #34c38f); }
.avatar.a1 { background: linear-gradient(135deg, #c58cff, #5b9eff); }
.avatar.a2 { background: linear-gradient(135deg, #ff8a65, #f5b13d); }
.avatar.a3 { background: linear-gradient(135deg, #34c38f, #5be8b6); }
.avatar.a4 { background: linear-gradient(135deg, #ff5cae, #c58cff); }
.avatar.a5 { background: linear-gradient(135deg, #f5b13d, #ef5b6b); }
.avatar.more {
  background: var(--bg-elev);
  color: var(--text-1);
  font-weight: 600;
  font-size: 11.5px;
  border-color: var(--border-2);
  margin-inline-start: -10px;
}
.avatar.lit { box-shadow: 0 0 0 2px var(--accent-2), 0 4px 14px rgba(52, 195, 143, .35); }

/* ---------- stats band ---------- */
.stats-band { margin-top: var(--s-6); }
.stat-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px;
  box-shadow: var(--shadow-1);
}
.stat-num {
  font-size: clamp(26px, 5vw, 36px);
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text-0);
  line-height: 1;
  font-family: var(--font-display);
}
.stat-num-suffix {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}
.stat-label {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--text-2);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* ============================================================
   SESSION WORKSPACE
   ============================================================ */
.sesh-wrap {
  max-width: var(--shell-wide);
  margin: 0 auto;
  padding: 0 16px calc(96px + var(--safe-bot));
}

.sesh-head {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.sesh-title h1 {
  font-size: clamp(17px, 4.5vw, 22px);
  letter-spacing: -.01em;
  line-height: 1.2;
  color: var(--text-0);
  font-weight: 700;
}
.sesh-title .slugline {
  color: var(--text-2);
  font-size: 12px;
  margin-top: 4px;
  line-height: 1.5;
  word-break: break-all;
}
.sesh-title .slugline code {
  color: var(--text-1);
  font-size: 11.5px;
  background: var(--bg-elev);
  padding: 1px 6px;
  border-radius: 4px;
}
.sesh-head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sesh-head-desktop { display: none; }

.live-pulse {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border-radius: 99px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text-1);
  font-size: 12px;
  opacity: 0;
  transition: opacity .3s ease;
}
.live-pulse.is-visible { opacity: 1; }
.live-pulse i { color: var(--accent-2); font-size: 8px; }

/* bottom action bar (mobile) */
.bottom-bar {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(12px + var(--safe-bot));
  z-index: 60;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.bottom-bar[hidden] { display: none; }
.bottom-bar-info { min-width: 0; flex: 1; }
.bb-title { font-size: 13px; font-weight: 600; color: var(--text-0); }
.bb-sub { font-size: 11.5px; color: var(--text-1); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bb-cta { flex: 0 0 auto; }

/* session body */
.sesh-body { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 14px; }
.col-left, .col-right { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* identity card */
.ident {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 20px;
}
.ident h2 { font-size: 16px; margin-bottom: 12px; color: var(--text-0); font-weight: 700; }
.ident-hint { color: var(--text-2); font-size: 12px; margin-top: 10px; }

/* matrix card */
.matrix-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  /* IMPORTANT: do NOT use `overflow: hidden` here. It kills horizontal
     scrolling of the inner .matrix-scroll because it creates an extra
     scroll container ancestor that captures pan gestures. Use isolation
     to create a stacking context for the rounded corners instead. */
  isolation: isolate;
}
.mtx-toolbar { padding: 14px 16px 0; }
.mtx-controls {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.mtx-controls .field { margin-bottom: 0; min-width: 130px; flex: 0 1 auto; }
.mtx-legend {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--text-2);
}
.legend-scale { display: flex; align-items: center; gap: 3px; }
.legend-scale i {
  width: 14px; height: 9px;
  border-radius: 2px;
  display: block;
  border: 1px solid var(--border);
}
.legend-scale .lg-0 { background: var(--bg-elev); }
.legend-scale .lg-1 { background: #243047; border-color: #33445f; }
.legend-scale .lg-2 { background: #2f4a6e; border-color: #405f8c; }
.legend-scale .lg-3 { background: #2f6a8a; border-color: #3f84a8; }
.legend-scale .lg-4 { background: var(--accent-2); border-color: #4fe0ab; }

/* Save indicator (debounced commit feedback) */
.save-indicator {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .2px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-2);
  transition: opacity .15s ease, color .15s ease, border-color .15s ease;
}
.save-indicator i { font-size: 11px; }
.save-indicator.is-pending { color: var(--text-1); border-color: var(--border-2); }
.save-indicator.is-saving {
  color: #d6e3ff;
  border-color: #3b5d97;
  background: #1a2742;
}
.save-indicator.is-saving i { animation: save-spin 1s linear infinite; display: inline-block; }
.save-indicator.is-saved {
  color: var(--accent-2);
  border-color: var(--accent-2);
  background: rgba(52, 195, 143, .08);
}
.save-indicator.is-error {
  color: var(--danger);
  border-color: var(--danger);
  background: rgba(239, 91, 107, .08);
}
@keyframes save-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Unsaved-changes badge (explicit submit flow) */
.dirty-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .2px;
  border: 1px solid var(--accent);
  background: rgba(79, 140, 247, .10);
  color: #d6e3ff;
  transition: opacity .15s ease, color .15s ease, border-color .15s ease;
}
.dirty-badge i { font-size: 11px; }
.dirty-badge.is-on i { animation: dirty-pulse 1.6s ease-in-out infinite; }
@keyframes dirty-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .35; }
}

.matrix-scroll-wrap {
  position: relative;
  margin: 0 12px 14px;
}
.matrix-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 10px 4px 14px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  position: relative;
  /* touch-action: pan-y → the browser handles VERTICAL panning natively, but
     NOT horizontal. Horizontal scrolling is driven manually in JS (session.js
     touchmove sets scrollLeft on horizontal-dominant drags). This is the
     reliable fix for the persistent mobile bug where horizontal swipe from
     inside a cell never scrolled: interactive .mtx-slot elements block native
     horizontal pan initiation on some mobile browsers, so we take horizontal
     into our own hands while keeping vertical native and smooth. */
  touch-action: pan-y;
  -ms-touch-action: pan-y;
}
/* Edge fades — absolutely positioned siblings, pointer-events:none so they don't block taps */
.matrix-scroll-wrap .edge-fade {
  position: absolute;
  top: 0; bottom: 0;
  width: 22px;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  transition: opacity .2s ease;
}
.matrix-scroll-wrap .edge-fade.left  { left: 0;  background: linear-gradient(to right, var(--bg-card), transparent); }
.matrix-scroll-wrap .edge-fade.right { right: 0; background: linear-gradient(to left,  var(--bg-card), transparent); }
.matrix-scroll-wrap.can-scroll-left  .edge-fade.left  { opacity: 1; }
.matrix-scroll-wrap.can-scroll-right .edge-fade.right { opacity: 1; }
.matrix-scroll-wrap .edge-fade i {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--text-2);
  background: var(--bg-elev);
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
}
.matrix-scroll-wrap .edge-fade.left  i { right: 3px; }
.matrix-scroll-wrap .edge-fade.right i { left: 3px; }

/* Quick-select toolbar above the matrix */
.quick-pick {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
  padding: 0 16px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--text-2);
}
.quick-pick-label {
  font-weight: 600;
  color: var(--text-1);
  margin-right: 4px;
}
.quick-pick-btn {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text-1);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color .12s, border-color .12s, color .12s;
  white-space: nowrap;
  touch-action: manipulation;
}
.quick-pick-btn:hover { background: #232b3a; border-color: var(--accent); color: #fff; }
.quick-pick-btn:active { transform: scale(0.97); }
.quick-pick-btn.is-active {
  background: #1a2742;
  border-color: var(--accent);
  color: #d6e3ff;
}
.quick-pick-spacer { flex: 1; }
.quick-pick-count {
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  font-size: 11.5px;
}

/* Explicit Submit button (replaces auto-save) */
.submit-btn {
  min-height: 34px;
  padding: 7px 14px;
  font-size: 13px;
  border-radius: 999px;
  gap: 7px;
  margin-left: 2px;
  transition: opacity .15s ease, background-color .15s ease,
              transform .12s ease, box-shadow .15s ease;
}
.submit-btn.is-ready {
  box-shadow: 0 0 0 1px rgba(79, 140, 247, .45), 0 4px 14px rgba(79, 140, 247, .28);
  animation: submit-glow 2s ease-in-out infinite;
}
@keyframes submit-glow {
  0%, 100% { box-shadow: 0 0 0 1px rgba(79, 140, 247, .45), 0 4px 14px rgba(79, 140, 247, .28); }
  50%      { box-shadow: 0 0 0 1px rgba(79, 140, 247, .65), 0 4px 20px rgba(79, 140, 247, .42); }
}
.submit-btn.is-busy { opacity: .7; cursor: progress; }
.submit-btn-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  font-size: 11px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.submit-btn:disabled .submit-btn-count { background: rgba(255, 255, 255, .10); }

.mtx {
  min-width: 560px;
  /* No `user-select: none` here by default — that interferes with iOS scroll
     initiation. The .paint-active class on the .mtx element will lock down
     user-select only while a paint drag is in progress (see rule above). */
  touch-action: pan-y;
  -ms-touch-action: pan-y;
}
.mtx-row {
  display: flex;
  align-items: stretch;
  gap: 2px;
  margin-bottom: 2px;
  position: relative;
}

.mtx-slot {
  flex: 1;
  min-width: 44px;
  height: 36px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
  /* touch-action: pan-y → vertical pan is native; horizontal pan is handled
     manually in JS (see .matrix-scroll). Setting pan-y here (rather than
     pan-x pan-y) guarantees the browser does NOT try to do horizontal pan
     itself, so our manual scrollLeft in touchmove is the sole horizontal
     driver — no double-scroll conflict, and it works even when the finger
     starts inside a cell. */
  touch-action: pan-y;
  -ms-touch-action: pan-y;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.mtx-slot:hover:not(.mtx-blank) { border-color: var(--accent); background: #1f2632; }
/* Intentionally NO :active transform or background on slots. On real touch devices,
   :active fires the moment the finger lands on the cell and persists until release,
   which makes every touch look like a selection and prevents native horizontal/vertical
   scrolling from initiating. Painting is handled exclusively in JS via the .mine class. */
.mtx-blank { cursor: default; background: transparent !important; border-color: transparent !important; }

/* Slot size: mobile gets larger cells for fat-finger comfort */
@media (max-width: 640px) {
  .mtx-slot { min-width: 52px; height: 40px; }
  .mtx-labels .day-label { font-size: 11px; padding: 4px 4px; }
  .quick-pick-btn { padding: 7px 12px; font-size: 13px; }
}

/* Range-select mode: tap first slot to anchor, tap second to fill the range */
.mtx.range-mode .mtx-slot:not(.mtx-blank) {
  cursor: cell;
}
.mtx .range-anchor {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
.mtx .range-preview {
  background: rgba(79, 140, 247, 0.18) !important;
  border-color: var(--accent) !important;
}

/* ── Slot selection feedback (the simple way) ─────────────────────
   Tap → instant toggle. No press-hold highlight, no paint mode on touch.
   The .mine border + .slot-ripple animation are the visible confirmation.
   Drag-paint is opt-in for desktop mouse users only (.mtx.painting). */
.mtx-slot.mine {
  box-shadow: inset 0 0 0 2px var(--accent);
  border-color: var(--accent);
  background: rgba(79, 140, 247, 0.16);
  transition: background-color .12s ease, box-shadow .12s ease, border-color .12s ease;
}

/* Snappy tap ripple — anchored to the actual finger / cursor position.
   420ms total: a quick fade-in then a slightly longer fade-out so the
   eye registers the click even on fast taps. */
.mtx-slot .slot-ripple {
  position: absolute;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  margin-top:  -4px;
  border-radius: 50%;
  background: var(--accent);
  pointer-events: none;
  opacity: .65;
  animation: slot-ripple .42s ease-out forwards;
  z-index: 1;
}
@keyframes slot-ripple {
  0%   { transform: scale(1);   opacity: .65; }
  60%  { transform: scale(11);  opacity: .18; }
  100% { transform: scale(14);  opacity: 0;   }
}

/* Desktop drag-paint (mouse only) — power-user affordance. Touch never
   enters this state. A subtle cursor change + user-select lock during
   the drag is all we need; no flashing, no per-cell animation. */
.mtx.painting,
.mtx.painting * {
  cursor: grabbing !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

/* ── Floating scroll joystick ─────────────────────────────────────
   A compact, always-available control for scrolling the matrix in any
   direction. Press & hold an arrow to scroll left/right (days) or
   up/down (rows). Reliable on every device — no reliance on touch-swipe. */
.float-joy {
  position: fixed;
  right: 14px;
  bottom: 18px;
  z-index: 40;
  display: grid;
  grid-template-columns: 40px 40px 40px;
  grid-template-rows: 40px 40px 40px;
  gap: 2px;
  place-items: center;
  background: rgba(16, 22, 34, 0.86);
  border: 1px solid var(--border-2);
  border-radius: 18px;
  padding: 6px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.float-joy[hidden] { display: none; }
.joy-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text-1);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color .1s ease, color .1s ease, transform .08s ease;
  touch-action: none;
}
.joy-btn:hover { background: #232b3a; color: #fff; }
.joy-btn:active { background: var(--accent); color: #0a1014; transform: scale(0.92); }
.joy-btn.is-active { background: var(--accent); color: #0a1014; }
.joy-up    { grid-column: 2; grid-row: 1; }
.joy-left  { grid-column: 1; grid-row: 2; }
.joy-right { grid-column: 3; grid-row: 2; }
.joy-down  { grid-column: 2; grid-row: 3; }
.joy-center {
  grid-column: 2; grid-row: 2;
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  font-size: 13px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  pointer-events: none;
}

/* Heatmap — sequential availability ramp (dark theme): empty cells stay
   nearly invisible, low-availability cells lift gently off the background,
   and the top tier pops with a bright fill + soft glow. */
.heat-0 { background-color: var(--bg-elev); border-color: var(--border); }
.heat-1 { background-color: #243047; border-color: #33445f; }
.heat-2 { background-color: #2f4a6e; border-color: #405f8c; }
.heat-3 { background-color: #2f6a8a; border-color: #3f84a8; color: #eaf4ff; }
.heat-4 {
  background-color: var(--accent-2);
  border-color: #4fe0ab;
  color: #07120d;
  box-shadow: inset 0 0 0 1px rgba(7, 18, 13, 0.18), 0 0 8px rgba(52, 195, 143, 0.45);
}

.mtx-slot.mine { box-shadow: inset 0 0 0 2px var(--accent); border-color: var(--accent); }

/* Count badge inside availability cells — dark pill with bright text so
   it stays readable on every heat level, pinned top-right so it never
   overlaps the drag/paint target area in the middle of the cell. */
.mtx-slot .amt {
  position: absolute;
  top: 2px;
  right: 3px;
  z-index: 2;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.03em;
  background: rgba(8, 12, 18, 0.85);
  color: #eaf2ff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  user-select: none;
}
@media (max-width: 640px) {
  .mtx-slot .amt { min-width: 16px; height: 16px; font-size: 10.5px; top: 2px; right: 3px; }
}

.mtx-slot.apex-slot { border: 2px solid var(--accent-2); }

.mtx.locked .mtx-slot:not(.mtx-blank) { cursor: not-allowed; opacity: .55; }

.mtx-labels {
  display: flex; align-items: center; gap: 4px;
  margin-bottom: 4px;
  position: sticky; top: 0; z-index: 2;
  background: var(--bg-card);
  padding: 4px 0;
}
.mtx-labels .day-label {
  flex: 1; min-width: 44px;
  text-align: center;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-2);
}
.mtx-col-time {
  width: 64px; flex: 0 0 64px;
  display: flex; align-items: center;
  font-size: 10.5px; color: var(--text-2);
  padding-right: 6px;
  justify-content: flex-end;
  white-space: nowrap;
}

/* apex banner */
.apex-banner {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  margin: 0 14px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--accent-2);
  border-radius: var(--radius-sm);
  transition: opacity .3s ease, transform .3s ease;
}
.apex-banner.hidden { opacity: 0; transform: translateY(-6px); pointer-events: none; position: absolute; }
.apex-ico {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  flex: 0 0 auto;
  display: grid; place-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--accent-2);
  font-size: 14px;
}
.apex-txt { flex: 1; min-width: 160px; }
.apex-txt .apex-when { font-weight: 700; font-size: 14px; color: var(--text-0); }
.apex-txt .apex-meta { font-size: 12px; color: var(--text-1); margin-top: 2px; }

.apex-avatar-stack { display: flex; align-items: center; margin-right: 4px; }
.apex-avatar-stack .avatar {
  width: 26px; height: 26px;
  font-size: 10px;
}

.apex-bar-track {
  flex-basis: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 6px;
}
.apex-bar-fill {
  height: 100%;
  background: var(--accent-2);
  border-radius: 99px;
  transition: width .4s ease;
}

.apex-copy-btn {
  flex: 0 0 auto;
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-1);
  display: grid; place-items: center;
  cursor: pointer;
  transition: background .15s ease;
}
.apex-copy-btn:hover { background: var(--bg-card); color: var(--text-0); }
.apex-copy-btn.copied { color: var(--accent-2); border-color: var(--accent-2); }

/* QR card (session page) */
.qr-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.qr-card h3 { color: var(--text-0); }
.qr-card h3 i { color: var(--accent); margin-right: 6px; }
.qr-close {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  cursor: pointer;
}
.qr-close:hover { background: var(--bg-elev); color: var(--text-0); }
.qr-card .qr-wrap { width: 180px; height: 180px; }
.qr-card .hint { text-align: center; margin-top: 8px; }

/* finalized card */
.finalized-card {
  background: var(--bg-card);
  border: 1px solid var(--accent-2);
  border-radius: var(--radius);
  padding: 22px 18px;
  text-align: center;
}
.finalized-ico {
  width: 48px; height: 48px;
  margin: 0 auto 10px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bg-elev);
  border: 1px solid var(--accent-2);
  color: var(--accent-2);
  font-size: 20px;
}
.finalized-card h2 { font-size: 18px; margin-bottom: 4px; color: var(--text-0); font-weight: 700; }
.finalized-when { color: var(--accent-2); font-size: 15px; font-weight: 600; margin: 6px 0 4px; }
.finalized-sub { color: var(--text-1); font-size: 12.5px; margin-bottom: 4px; }
.export-grid {
  display: grid; grid-template-columns: 1fr; gap: 8px;
  margin-top: 16px;
  max-width: 380px;
  margin-left: auto; margin-right: auto;
}
.export-row { display: flex; flex-direction: column; gap: 8px; }
.export-row .btn { flex: 1; }
.export-hint { color: var(--text-2); font-size: 12px; margin-top: 10px; }

/* consensus activity */
.pulse-list {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.pulse-list h2 { color: var(--text-0); font-weight: 700; }

.consensus-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.consensus-item:last-child { border-bottom: none; }

.avatars { display: flex; }
.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  color: #fff;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  margin-left: -6px;
  flex: 0 0 auto;
}
.avatar:first-child { margin-left: 0; }

.c-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.c-name { font-weight: 500; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-meta { font-size: 11.5px; color: var(--text-2); }
.c-pct { font-size: 11.5px; color: var(--accent-2); font-weight: 600; white-space: nowrap; }

.consensus-spark {
  flex: 0 0 56px;
  height: 26px;
  display: flex; align-items: flex-end; gap: 1px;
}
.consensus-spark .bar {
  flex: 1; min-width: 2px;
  background: var(--accent);
  border-radius: 2px;
}

/* roster */
.roster-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.roster-item:last-child { border-bottom: none; }
.roster-item .you {
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 700;
}

/* tips */
.tip-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.tip-card h4 { font-size: 12px; color: var(--text-1); margin-bottom: 8px; font-weight: 600; }
.tip-card ul { list-style: none; }
.tip-card li {
  font-size: 13px;
  color: var(--text-1);
  padding: 4px 0;
  display: flex; gap: 8px;
}
.tip-card li i { color: var(--text-2); }

/* loaders */
.sesh-loader, .sesh-missing {
  max-width: 480px; margin: 60px auto;
  padding: 28px 22px;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.spinner {
  width: 28px; height: 28px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.sesh-missing h2 { margin-bottom: 8px; }

/* ---------- modal ---------- */
.modal-wrap {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
}
.modal-wrap.open { opacity: 1; pointer-events: auto; }
.modal-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.55);
}
.modal-box {
  position: relative; z-index: 1;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 22px 18px calc(18px + var(--safe-bot));
  max-width: 520px; width: 100%;
  transform: translateY(100%);
  transition: transform .25s ease;
}
.modal-wrap.open .modal-box { transform: none; }
.modal-box h3 {
  font-size: 17px;
  margin: 4px 0 10px;
  color: var(--text-0);
  font-weight: 700;
}
.modal-box h3 i { color: var(--accent-2); margin-right: 6px; }
.modal-box p { color: var(--text-1); font-size: 13.5px; margin-bottom: 12px; line-height: 1.5; }

.modal-event-preview {
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 13px;
}
.modal-event-preview .evt-title {
  font-weight: 600; color: var(--text-0); margin-bottom: 4px;
  display: flex; align-items: center; gap: 6px;
}
.modal-event-preview .evt-title i { color: var(--accent-2); }
.modal-event-preview .evt-when { color: var(--accent-2); font-size: 14px; font-weight: 600; }
.modal-event-preview .evt-meta { color: var(--text-2); font-size: 11.5px; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 8px; }

.modal-apex-info {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  margin-bottom: 14px;
}
.modal-apex-time { font-size: 14px; font-weight: 600; color: var(--text-0); }
.modal-apex-sub { font-size: 12px; color: var(--text-1); margin-top: 3px; }

.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }

.modal-topic-edit {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text-0);
  font-size: 14px; font-weight: 600;
  padding: 4px 0; margin-bottom: 6px;
  outline: none;
}
.modal-topic-edit:focus { border-bottom-color: var(--accent); }

/* ---------- interactive states ----------
   IMPORTANT: Do NOT apply `user-select: none` to the entire body when grabbing.
   Doing so disables iOS native momentum scrolling for the matrix-scroll container,
   because Safari ties selection-initiation to scroll-initiation. Only apply the
   grabbing cursor + user-select lock to the matrix grid itself while paint mode is
   active, so the rest of the page (and the matrix before paint is engaged) scrolls
   freely. */
body.grabbing { cursor: grabbing !important; }
body.busy .btn { pointer-events: none; }
/* (legacy .paint-active rule removed — superseded by .mtx.painting above) */

/* ---------- toasts ---------- */
#as-toast-layer {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(16px + var(--safe-bot));
  z-index: 999;
  display: flex; flex-direction: column; gap: 8px;
  align-items: stretch;
  pointer-events: none;
  max-width: 480px;
  margin: 0 auto;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-0);
  opacity: 0; transform: translateY(12px);
  transition: opacity .25s ease, transform .25s ease;
  pointer-events: auto;
}
.toast--in  { opacity: 1; transform: none; }
.toast--out { opacity: 0; transform: translateY(6px); }
.toast--ok  { border-color: var(--accent-2); }
.toast--err { border-color: var(--danger); }
.toast-msg { position: relative; }

/* ============================================================
   TABLET ≥ 720px
   ============================================================ */
@media (min-width: 720px) {
  body { font-size: 15px; }
  .nav { padding: 10px 22px; }
  .nav-desktop { display: inline-flex; }
  .nav-burger { display: none; }
  .hero { padding: 72px 24px 40px; }
  .features { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .wizard { padding: 28px 26px 22px; max-width: 580px; }
  .wizard-step h2 { font-size: 21px; }
  .card { padding: 24px; }
  .sesh-head { padding: 16px 22px; }
  .sesh-head-desktop { display: inline-flex; }
  .nav-burger { display: none; }
  .sesh-title h1 { font-size: clamp(18px, 2.5vw, 22px); }
  .modal-wrap { align-items: center; padding: 20px; }
  .modal-box {
    padding: 28px;
    border-radius: var(--radius);
    transform: scale(0.96) translateY(8px);
  }
  .modal-wrap.open .modal-box { transform: none; }
  .bottom-bar { display: none !important; }
  .export-row { flex-direction: row; }
  .band .card { padding: 40px 28px; }
  .quick-join { flex-wrap: nowrap; }
  .quick-join .qj-label { width: auto; }
}

/* ============================================================
   DESKTOP ≥ 1080px
   ============================================================ */
@media (min-width: 1080px) {
  .sesh-body { grid-template-columns: 1fr 340px; gap: 16px; margin-top: 16px; }
  .features { grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 60px; }
  .feat { padding: 20px; }
  .feat .fi { width: 38px; height: 38px; }
  .sesh-wrap { padding: 0 18px 80px; }
  .sesh-head { padding: 18px 22px; flex-wrap: nowrap; }
  .live-pulse { margin-top: 0; }
  .export-row { flex-direction: row; }
  .band { margin-top: 56px; }
  footer { margin-top: 64px; padding-bottom: 36px; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}

/* ============================================================
   WIZARD STAGE TRANSITIONS
   ============================================================ */
.wiz-stage {
  position: relative;
  overflow: hidden;
  min-height: 340px;
}
.wizard-step {
  transition: opacity .3s ease, transform .3s ease;
}
.wizard-step[hidden] { display: none !important; }
.wizard-step.wiz-slide-out {
  display: block !important;
  opacity: 0;
  transform: translateX(-20px);
  pointer-events: none;
  position: absolute; inset: 0;
}
.wizard-step.wiz-slide-in {
  display: block !important;
  opacity: 0;
  transform: translateX(20px);
  animation: wizSlideIn .35s ease forwards;
}
.wizard-step.wiz-slide-back {
  display: block !important;
  opacity: 0;
  transform: translateX(-20px);
  animation: wizSlideBack .35s ease forwards;
}
@keyframes wizSlideIn  { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes wizSlideBack { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: none; } }

/* ============================================================
   IDENTITY ENTRY AVATAR PREVIEW
   ============================================================ */
.id-preview-row {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.id-preview-avatar {
  width: 50px; height: 50px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 20px; font-weight: 700;
  color: #fff;
  background: var(--bg-card);
  border: 1px solid var(--border);
  flex: 0 0 auto;
}
.id-preview-info { flex: 1; min-width: 0; }
.id-preview-label { font-size: 11px; color: var(--text-2); font-weight: 500; }
.id-preview-name {
  font-size: 14px; font-weight: 600; color: var(--text-0);
  margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.id-preview-hint { font-size: 11.5px; color: var(--text-2); margin-top: 2px; }

/* ============================================================
   KEYBOARD SHORTCUTS MODAL
   ============================================================ */
.shortcut-grid {
  display: grid; grid-template-columns: 1fr;
  gap: 6px; margin-top: 12px;
}
.shortcut-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.shortcut-row .kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-1);
}

/* ============================================================
   INSTALL-APP SHEET (mobile PWA)
   ============================================================ */
.install-sheet {
  position: fixed; inset: 0;
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s ease;
}
@media (min-width: 720px) {
  .install-sheet { align-items: center; }
}
.install-sheet.open { opacity: 1; pointer-events: auto; }

.install-sheet--scrim {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.55);
}

.install-sheet--card {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 0 12px calc(12px + var(--safe-bot, 0px)) 12px;
  padding: 20px 20px 18px;
  border-radius: var(--radius);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  transform: translateY(20px);
  transition: transform .25s ease;
  text-align: center;
}
.install-sheet.open .install-sheet--card { transform: none; }

.install-sheet--close {
  position: absolute; top: 10px; right: 10px;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-2);
  cursor: pointer;
}
.install-sheet--close:hover { background: var(--bg-card); color: var(--text-0); }

.install-sheet--icon {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 72px; height: 72px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  margin-bottom: 12px;
}

.install-sheet--title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-0);
}
.install-sheet--body {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-2);
  margin-bottom: 16px;
}
.install-sheet--step {
  display: flex; align-items: center; gap: 10px;
  margin: 6px 0;
  padding: 8px 11px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: left;
}
.install-sheet--step .step-ico {
  flex: 0 0 24px;
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px;
  background: var(--bg-elev);
  color: var(--text-1);
  font-size: 12px;
  border: 1px solid var(--border);
}
.install-sheet--step strong { color: var(--text-0); font-weight: 600; }

.install-sheet--actions {
  display: flex; justify-content: center;
}
.install-sheet--actions .btn { min-width: 120px; }

@media (prefers-reduced-motion: reduce) {
  .install-sheet, .install-sheet--card { transition: none; }
}

/* ============================================================
   TABLET/DESKTOP ENHANCEMENTS
   ============================================================ */
@media (min-width: 720px) {
  .stat-row { grid-template-columns: repeat(4, 1fr); }
  .preview-grid { max-width: 380px; }
  .preview-card { padding: 32px 32px 24px; }
  .hero .trust { font-size: 13px; }
  .id-preview-avatar { width: 56px; height: 56px; font-size: 22px; }
  .wiz-stage { min-height: 360px; }
  .modal-box { max-width: 480px; }
}