/* ==========================================================================
   TimeBridge — bright & colorful app UI
   Signature: the sunset gradient (coral → pink → violet) on hero cards and the
   primary action; every person gets their own pastel colour that follows them
   through chips, the grid and the best-times list.
   ========================================================================== */

:root {
  --bg: #ffffff;
  --bg-2: #f6f4fe;
  --card: #ffffff;
  --ink: #1b1530;
  --ink-2: #5d5775;
  --ink-3: #9893ad;
  --line: #ece9f6;
  --line-2: #dcd7ee;

  --coral: #ff6f5b;
  --pink: #f0458a;
  --violet: #7b5cff;
  --sky: #38b6ff;
  --mint: #19c38c;
  --amber: #ffb21e;
  --red: #ef4467;

  --grad: linear-gradient(135deg, #ff7a59 0%, #f0458a 48%, #7b5cff 100%);
  --grad-soft: linear-gradient(135deg, #fff1ec 0%, #ffe8f2 50%, #efeaff 100%);
  --grad-mint: linear-gradient(160deg, #2ed8a0, #12b27f);

  --yes: #19c38c;
  --yes-soft: #d8f7eb;
  --maybe: #ffb21e;
  --maybe-soft: #fff1cc;
  --no: #ef4467;
  --no-soft: #ffe1e8;
  --accent: #7b5cff;
  --accent-soft: #efeaff;
  --focus: #7b5cff;

  /* person palette (pastel bg / strong ink) */
  --p0: #ffe3d8; --p0i: #d4512f;
  --p1: #e9e2ff; --p1i: #6142e0;
  --p2: #d6f5e8; --p2i: #0d8f63;
  --p3: #dbf0ff; --p3i: #1677b8;
  --p4: #fff1c2; --p4i: #a26c00;
  --p5: #ffdcec; --p5i: #c02a6b;

  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 24px;
  --r-xl: 30px;
  --shadow-1: 0 1px 2px rgba(40, 20, 90, .05), 0 4px 14px rgba(40, 20, 90, .05);
  --shadow-2: 0 10px 30px rgba(90, 40, 180, .12), 0 2px 6px rgba(40, 20, 90, .06);
  --shadow-glow: 0 12px 30px rgba(240, 69, 138, .28);

  --font: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --tabbar-h: 68px;
  --cell-h: 30px;
  --cell-w: 58px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #110d1f; --bg-2: #18132b; --card: #1d1733;
    --ink: #f4f1ff; --ink-2: #bdb6d6; --ink-3: #8a83a6;
    --line: #2a2345; --line-2: #3a3260;
    --yes-soft: #123c2f; --maybe-soft: #43350f; --no-soft: #47162a; --accent-soft: #2a2152;
    --grad-soft: linear-gradient(135deg, #2a1a2a 0%, #2a1638 50%, #1f1a45 100%);
    --p0: #4a2a22; --p0i: #ffb39f; --p1: #2f2659; --p1i: #c8b8ff; --p2: #173d31; --p2i: #7fe6bf;
    --p3: #183650; --p3i: #9fd6ff; --p4: #45370f; --p4i: #ffd979; --p5: #4a1c34; --p5i: #ffa6cc;
    --shadow-1: 0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.25);
    --shadow-2: 0 10px 30px rgba(0,0,0,.45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 var(--font); font-feature-settings: 'tnum' 1;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.15; letter-spacing: -.02em; }
h1 { font-size: clamp(1.7rem, 5.5vw, 2.3rem); font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1.02rem; font-weight: 700; }
p { margin: 0 0 .8rem; }
code { font-size: .88em; background: var(--bg-2); padding: 1px 6px; border-radius: 6px; }
.muted, small { color: var(--ink-2); }
.muted-3 { color: var(--ink-3); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus) 55%, transparent); outline-offset: 2px; border-radius: 8px; }
@media (prefers-reduced-motion: reduce) { *, ::view-transition-group(*) { transition: none !important; animation: none !important; } }
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }

/* ==========================================================================
   App shell
   ========================================================================== */
.app { min-height: 100dvh; }
.main {
  max-width: 1120px; margin: 0 auto;
  padding: 8px 18px calc(var(--tabbar-h) + 34px + env(safe-area-inset-bottom));
}
.main.narrow-main { max-width: 760px; }

.appbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px; min-height: 60px;
  padding: max(8px, env(safe-area-inset-top)) 14px 8px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
}
.appbar .title { font-weight: 700; font-size: 1.08rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar .brandmark { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.15rem; color: var(--ink); flex: 1; }
.appbar .brandmark img { width: 32px; height: 32px; border-radius: 10px; }
.iconbtn {
  width: 42px; height: 42px; border-radius: 14px; display: inline-grid; place-items: center; flex: none;
  border: 0; background: var(--bg-2); color: var(--ink); cursor: pointer; text-decoration: none !important;
}
.iconbtn svg { width: 22px; height: 22px; }
.iconbtn:hover { background: var(--accent-soft); }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: var(--grad); color: #fff; font-weight: 700; text-decoration: none !important;
}

/* bottom tab bar (phones / tablets) */
.tabbar {
  position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 50;
  height: var(--tabbar-h); border-radius: 24px;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 10px 40px rgba(60, 30, 140, .16), 0 0 0 1px var(--line);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none !important;
  color: var(--ink-3); font-size: .72rem; font-weight: 600; padding: 6px 0;
}
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a[aria-current=page] { color: var(--ink); }
.tabbar a[aria-current=page] svg { color: var(--pink); }
.tabbar .fab {
  justify-self: center; width: 58px; height: 58px; border-radius: 20px; margin-top: -26px;
  background: var(--grad); color: #fff; display: grid; place-items: center; box-shadow: var(--shadow-glow);
}
.tabbar .fab svg { width: 28px; height: 28px; color: #fff !important; }

/* sidebar (desktop) */
.sidebar { display: none; }
@media (min-width: 1024px) {
  .tabbar { display: none; }
  .app.has-nav { display: grid; grid-template-columns: 260px 1fr; }
  .sidebar {
    display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100dvh;
    padding: 22px 16px; border-right: 1px solid var(--line); background: var(--bg-2);
  }
  .sidebar .brandmark { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.25rem; color: var(--ink); padding: 6px 10px 22px; text-decoration: none; }
  .sidebar .brandmark img { width: 36px; height: 36px; border-radius: 11px; }
  .sidebar nav a {
    display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 14px;
    color: var(--ink-2); font-weight: 600; text-decoration: none;
  }
  .sidebar nav a svg { width: 22px; height: 22px; }
  .sidebar nav a:hover { background: var(--card); color: var(--ink); }
  .sidebar nav a[aria-current=page] { background: var(--card); color: var(--ink); box-shadow: var(--shadow-1); }
  .sidebar nav a[aria-current=page] svg { color: var(--pink); }
  .sidebar .newbtn { margin: 4px 0 18px; }
  .sidebar .me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow-1); }
  .sidebar .me .who { min-width: 0; }
  .sidebar .me .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sidebar .me .who span { font-size: .8rem; color: var(--ink-3); }
  .main { padding: 8px 36px 60px; }
  .appbar { padding-left: 36px; padding-right: 36px; }
  .appbar .hide-desk { display: none; }
}
@media (max-width: 1023px) { .only-desk { display: none !important; } }
@media (min-width: 1024px) { .only-mob { display: none !important; } }

/* guest pages (no nav) */
.app.guest .main { padding-bottom: 40px; }

/* ==========================================================================
   Surfaces
   ========================================================================== */
.card, .panel {
  background: var(--card); border-radius: var(--r-lg); padding: 20px;
  box-shadow: var(--shadow-1); border: 1px solid var(--line); margin-bottom: 16px;
}
.card.flat { box-shadow: none; }
.card.tint { background: var(--bg-2); border-color: transparent; box-shadow: none; }
.panel-flush { padding: 0; overflow: hidden; }
.card h2, .panel h2 { margin-bottom: .75rem; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 26px 0 12px; }
.section-title h2 { margin: 0; font-size: 1.25rem; }
.section-title a { font-weight: 600; font-size: .92rem; }

.hero {
  position: relative; overflow: hidden; color: #fff; border-radius: var(--r-xl); padding: 22px;
  background: var(--grad); box-shadow: var(--shadow-glow); margin-bottom: 18px;
}
.hero::after {
  content: ''; position: absolute; width: 260px; height: 260px; right: -80px; top: -110px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.35), rgba(255,255,255,0) 70%); pointer-events: none;
}
.hero .kicker { font-weight: 600; opacity: .9; font-size: .9rem; }
.hero .big { font-size: clamp(1.7rem, 7vw, 2.4rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.05; margin: 6px 0 4px; }
.hero .sub { opacity: .92; }
.hero .btn { background: #fff; color: var(--ink); border-color: #fff; }
.hero .btn.ghost { background: rgba(255,255,255,.18); color: #fff; border-color: rgba(255,255,255,.35); }
.hero a:not(.btn) { color: #fff; text-decoration: underline; }
.hero .chips .chip { background: rgba(255,255,255,.2); color: #fff; }
.hero .chips .chip b { color: #fff; }
.hero.soft { background: var(--grad-soft); color: var(--ink); box-shadow: none; border: 1px solid var(--line); }
.hero.soft::after { display: none; }
.hero.soft .btn { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.hero.muted-hero { background: var(--bg-2); color: var(--ink); box-shadow: none; }

.grid-2 { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 1024px) { .grid-2 { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; } }
.grid-cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 8px; }
.stat { border-radius: var(--r-md); padding: 14px; background: var(--bg-2); }
.stat b { display: block; font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.stat span { font-size: .82rem; color: var(--ink-2); font-weight: 500; }
.stat.s1 { background: var(--p0); } .stat.s1 b { color: var(--p0i); }
.stat.s2 { background: var(--p1); } .stat.s2 b { color: var(--p1i); }
.stat.s3 { background: var(--p2); } .stat.s3 b { color: var(--p2i); }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row-between { display: flex; gap: 10px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 10px; }
.hide { display: none !important; }

/* ==========================================================================
   Meeting cards
   ========================================================================== */
.mcard {
  display: block; position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px 16px 14px; box-shadow: var(--shadow-1); color: var(--ink); text-decoration: none !important;
  transition: transform .15s ease, box-shadow .15s ease;
}
.mcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.mcard .mt { font-weight: 700; font-size: 1.05rem; margin: 8px 0 2px; }
.mcard .md { color: var(--ink-2); font-size: .9rem; }
.mcard .bar { height: 8px; border-radius: 99px; background: var(--bg-2); overflow: hidden; margin-top: 12px; }
.mcard .bar i { display: block; height: 100%; background: var(--grad); border-radius: 99px; }
.mcard .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.faces { display: flex; }
.face {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: .72rem; font-weight: 700;
  border: 2px solid var(--card); margin-left: -8px; background: var(--p1); color: var(--p1i);
}
.faces .face:first-child { margin-left: 0; }
.date-tile {
  position: absolute; right: 16px; top: 16px; width: 52px; text-align: center; border-radius: 14px; overflow: hidden;
  background: var(--bg-2); line-height: 1.1;
}
.date-tile span { display: block; background: var(--grad); color: #fff; font-size: .66rem; font-weight: 700; padding: 3px 0; text-transform: uppercase; letter-spacing: .04em; }
.date-tile b { display: block; font-size: 1.25rem; padding: 4px 0 6px; }

/* person colour helpers */
.c0 { --pc: var(--p0); --pci: var(--p0i); } .c1 { --pc: var(--p1); --pci: var(--p1i); } .c2 { --pc: var(--p2); --pci: var(--p2i); }
.c3 { --pc: var(--p3); --pci: var(--p3i); } .c4 { --pc: var(--p4); --pci: var(--p4i); } .c5 { --pc: var(--p5); --pci: var(--p5i); }
.face[class*=" c"], .chip[class*=" c"] { background: var(--pc); color: var(--pci); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 99px;
  background: var(--bg-2); color: var(--ink-2); font-size: .85rem; font-weight: 600; white-space: nowrap;
}
.chip b { color: inherit; font-weight: 800; }
.chip.lg { padding: 10px 14px; border-radius: 16px; flex-direction: column; align-items: flex-start; gap: 0; white-space: normal; }
.chip.lg small { color: inherit; opacity: .8; font-weight: 600; font-size: .72rem; }
.chip.lg b { font-size: 1.05rem; }

/* ==========================================================================
   Forms & buttons
   ========================================================================== */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.hint { font-weight: 400; color: var(--ink-3); font-size: .84rem; margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=time], input[type=url], input[type=number], select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--bg-2);
  border: 2px solid transparent; border-radius: 14px; padding: 12px 14px; min-height: 50px;
  transition: border-color .15s, background .15s;
}
select { appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%239893ad' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--violet); background-color: var(--card); }
input[disabled] { opacity: .6; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; margin: 8px 0; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--violet); flex: none; }
.cols-2 { display: grid; gap: 0 12px; grid-template-columns: 1fr 1fr; }
@media (max-width: 520px) { .cols-2 { grid-template-columns: 1fr; } }

/* toggle switch for checkboxes with .switch */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; cursor: pointer; font-weight: 500; margin: 0; }
.switch + .switch { border-top: 1px solid var(--line); }
.switch .lbl small { display: block; color: var(--ink-3); font-weight: 400; font-size: .84rem; }
.switch input { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 99px; background: var(--line-2); position: relative; flex: none; cursor: pointer; transition: background .2s; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked { background: var(--grad); }
.switch input:checked::after { transform: translateX(20px); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; font-size: .98rem; min-height: 48px; padding: 0 20px; border-radius: 16px;
  border: 2px solid var(--line-2); background: var(--card); color: var(--ink); cursor: pointer; white-space: nowrap;
  text-decoration: none !important; transition: transform .1s ease, filter .15s, background .15s;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 20px; height: 20px; }
.btn:hover { border-color: var(--ink-3); }
.btn-primary { background: var(--grad); color: #fff; border: 0; box-shadow: var(--shadow-glow); }
.btn-primary:hover { filter: brightness(1.06) saturate(1.1); }
.btn-dark { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-yes { background: var(--grad-mint); color: #fff; border: 0; }
.btn-soft { background: var(--accent-soft); color: var(--violet); border-color: transparent; }
.btn-danger { color: var(--red); }
.btn-danger.solid { background: var(--red); color: #fff; border-color: var(--red); }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: .88rem; border-radius: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.linkbtn { background: none; border: 0; color: var(--violet); font: inherit; font-weight: 700; cursor: pointer; padding: 6px; }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: .76rem; font-weight: 700; padding: 4px 10px; border-radius: 99px; background: var(--bg-2); color: var(--ink-2); white-space: nowrap; }
.pill-yes { background: var(--yes-soft); color: #0b7a55; }
.pill-maybe { background: var(--maybe-soft); color: #8a5a00; }
.pill-no { background: var(--no-soft); color: #b3163c; }
.pill-live { background: var(--grad); color: #fff; }
.pill-violet { background: var(--accent-soft); color: var(--violet); }
@media (prefers-color-scheme: dark) { .pill-yes { color: #7fe6bf; } .pill-maybe { color: #ffd979; } .pill-no { color: #ff9db3; } }

.flash { padding: 13px 16px; border-radius: 16px; margin-bottom: 16px; font-weight: 600; }
.flash-ok { background: var(--yes-soft); color: #0b6b4b; }
.flash-err { background: var(--no-soft); color: #a3123a; }
@media (prefers-color-scheme: dark) { .flash-ok { color: #9ff0cf; } .flash-err { color: #ffb3c4; } }

/* segmented tabs */
.tabs { display: inline-flex; gap: 4px; background: var(--bg-2); padding: 4px; border-radius: 16px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button, .tabs a {
  font: inherit; font-weight: 700; font-size: .92rem; border: 0; background: none; padding: 9px 16px; border-radius: 12px;
  color: var(--ink-2); cursor: pointer; white-space: nowrap; text-decoration: none !important;
}
.tabs button[aria-selected=true], .tabs a[aria-current=page] { background: var(--card); color: var(--ink); box-shadow: var(--shadow-1); }
.tabs.full { display: flex; width: 100%; }
.tabs.full > * { flex: 1; text-align: center; }
.stickytabs { position: sticky; top: 60px; z-index: 30; padding: 6px 0 10px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }

/* mobile section tabs: only the active section shows below 1024px */
@media (max-width: 1023px) { [data-section]:not(.on) { display: none !important; } }
@media (min-width: 1024px) { .section-tabs { display: none !important; } }

/* ==========================================================================
   Lists
   ========================================================================== */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.list > li:first-child { border-top: 0; }
.list .title { font-weight: 700; color: var(--ink); }
.list .sub { color: var(--ink-2); font-size: .88rem; }
.empty { text-align: center; padding: 34px 18px; color: var(--ink-2); }
.empty .art { width: 120px; height: 120px; margin: 0 auto 12px; display: block; }
.empty h2 { color: var(--ink); }

/* ==========================================================================
   People strip
   ========================================================================== */
.people { display: grid; gap: 10px; }
.person {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 2px 12px;
  padding: 12px 14px; border-radius: 20px; background: var(--pc, var(--bg-2)); position: relative; cursor: pointer;
  transition: transform .12s;
}
.person:active { transform: scale(.98); }
.person .face { width: 42px; height: 42px; font-size: .9rem; margin: 0; grid-row: span 2; background: var(--card); color: var(--pci, var(--ink)); border: 0; }
.person .nm { font-weight: 700; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; color: var(--ink); }
.person .tz { color: var(--pci, var(--ink-2)); font-size: .84rem; font-weight: 600; grid-column: 2; }
.person .nowbox { grid-row: 1 / span 2; grid-column: 3; text-align: right; }
.person .now { font-weight: 800; font-size: 1.2rem; letter-spacing: -.02em; color: var(--pci, var(--ink)); }
.person .nowd { color: var(--ink-2); font-size: .76rem; font-weight: 600; }
.person.off { opacity: .4; }
.person .pill { background: var(--card); }
.sky { grid-column: 1 / -1; height: 8px; border-radius: 99px; margin-top: 10px; position: relative; opacity: .9; }
.sky .mark { position: absolute; top: -4px; width: 4px; height: 16px; background: var(--ink); border-radius: 3px; box-shadow: 0 0 0 2px var(--card); }

/* ==========================================================================
   Availability grid
   ========================================================================== */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 12px 0; }
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--bg-2); }
.seg button { font: inherit; font-weight: 700; font-size: .86rem; border: 0; background: none; padding: 7px 12px; cursor: pointer; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; min-height: 36px; border-radius: 10px; }
.seg button[aria-pressed=true] { background: var(--card); color: var(--ink); box-shadow: var(--shadow-1); }
.sw { width: 14px; height: 14px; border-radius: 5px; display: inline-block; }
.sw-yes { background: var(--grad-mint); } .sw-maybe { background: var(--maybe); } .sw-no { background: var(--line-2); }
.savestate { font-size: .85rem; color: var(--ink-3); margin-left: auto; font-weight: 600; }

.gridwrap {
  position: relative; overflow: auto; max-height: min(64vh, 680px); border-radius: var(--r-md);
  background: var(--card); border: 1px solid var(--line); overscroll-behavior: contain; padding: 0 6px 6px 0;
}
.tgrid { border-collapse: separate; border-spacing: 3px; user-select: none; -webkit-user-select: none; touch-action: pan-x pan-y; }
.tgrid.painting { touch-action: none; }
.tgrid th, .tgrid td { padding: 0; }
.tgrid thead th {
  position: sticky; top: 0; z-index: 3; background: var(--card); min-width: var(--cell-w);
  padding: 8px 2px 6px; font-size: .74rem; font-weight: 700; color: var(--ink-3); text-align: center; line-height: 1.1; cursor: pointer;
}
.tgrid thead th .dd { display: block; font-size: 1.2rem; font-weight: 800; color: var(--ink); margin: 2px 0; }
.tgrid thead th.wkend .dd { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tgrid thead th.corner { left: 0; z-index: 4; cursor: default; min-width: 56px; font-weight: 600; }
.tgrid tbody th {
  position: sticky; left: 0; z-index: 2; background: var(--card); font-size: .72rem; font-weight: 700; color: var(--ink-3);
  text-align: right; padding: 0 6px 0 2px; white-space: nowrap; vertical-align: top; line-height: 1; cursor: pointer;
}
.tgrid tbody th span { position: relative; top: -6px; }
.tgrid td {
  height: var(--cell-h); min-width: var(--cell-w); border-radius: 8px; background: var(--bg-2);
  position: relative; cursor: pointer; transition: background .08s;
}
.tgrid tr.hour td { box-shadow: inset 0 2px 0 var(--line-2); }
.tgrid td.out { background: transparent; box-shadow: none !important; cursor: not-allowed; }
.tgrid td.past { opacity: .35; }
.tgrid td.night:not(.v1):not(.v2):not(.out) { background: color-mix(in srgb, var(--bg-2) 70%, var(--line-2)); }
.tgrid td.v2 { background: var(--grad-mint); box-shadow: none; }
.tgrid td.v1 { background: var(--maybe); box-shadow: none; }
.tgrid td.sel { outline: 3px solid var(--ink); outline-offset: -3px; z-index: 1; }
.tgrid td.allin::after { content: ''; position: absolute; inset: -2px; border: 2.5px solid var(--pink); border-radius: 10px; pointer-events: none; }
.tgrid td.sched { outline: 3px solid var(--violet); outline-offset: -3px; }
.tgrid td .n { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: .74rem; font-weight: 800; color: var(--ink); pointer-events: none; }
.tgrid td.hot .n { color: #fff; }
@media (max-width: 600px) { :root { --cell-w: 50px; --cell-h: 32px; } }
@media (hover: hover) { .tgrid td:not(.out):hover { filter: brightness(.95); } }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--ink-2); margin-top: 10px; align-items: center; font-weight: 500; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.heat-scale { display: inline-flex; height: 10px; width: 80px; border-radius: 99px; overflow: hidden; }

/* quick fill */
details.pattern { background: var(--grad-soft); border-radius: var(--r-md); padding: 0 16px; margin: 12px 0; border: 1px solid var(--line); }
details.pattern summary { cursor: pointer; font-weight: 700; padding: 14px 0; list-style: none; display: flex; align-items: center; gap: 10px; }
details.pattern summary::-webkit-details-marker { display: none; }
details.pattern summary::before { content: '✨'; }
details.pattern summary::after { content: '⌄'; margin-left: auto; font-size: 1.2rem; transition: transform .2s; }
details.pattern[open] summary::after { transform: rotate(180deg); }
details.pattern[open] { padding-bottom: 16px; }
details.pattern input, details.pattern select { background-color: var(--card); }
.daychips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.daychips button { font: inherit; font-weight: 700; width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--card); color: var(--ink-2); cursor: pointer; box-shadow: var(--shadow-1); }
.daychips button[aria-pressed=true] { background: var(--grad); color: #fff; }

/* ==========================================================================
   Best times
   ========================================================================== */
.best { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.best li { border-radius: 20px; padding: 14px; background: var(--bg-2); }
.best li:first-child { background: var(--grad-soft); border: 1px solid var(--line); }
.best .when { font-weight: 800; font-size: 1.05rem; letter-spacing: -.01em; }
.best .score { margin-top: 4px; }
.zones { display: grid; gap: 6px; margin: 10px 0 0; font-size: .88rem; }
.zones > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 12px; background: var(--card); }
.zones .lt { font-weight: 700; white-space: nowrap; }
.zones .who { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; }
.zones .who i { width: 10px; height: 10px; border-radius: 50%; background: var(--pci, var(--ink-3)); flex: none; }
.zones .ok::after { content: ' ✓'; color: var(--yes); font-weight: 800; }
.zones .meh::after { content: ' ~'; color: var(--maybe); font-weight: 800; }
.zones .bad { color: var(--ink-3); text-decoration: line-through; }
.zones .odd::after { content: ' 🌙'; }

/* ==========================================================================
   Sheets, dialogs, toast
   ========================================================================== */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; background: var(--card);
  border-radius: 28px 28px 0 0; box-shadow: 0 -12px 50px rgba(40, 20, 90, .25);
  padding: 12px 20px calc(22px + env(safe-area-inset-bottom)); max-height: 78vh; overflow: auto;
  transform: translateY(105%); visibility: hidden; transition: transform .26s cubic-bezier(.2,.8,.2,1), visibility 0s .26s;
}
.sheet.open { transform: none; visibility: visible; transition: transform .26s cubic-bezier(.2,.8,.2,1); }
.sheet .grab, dialog .grab { width: 44px; height: 5px; background: var(--line-2); border-radius: 99px; margin: 0 auto 14px; }
@media (min-width: 1024px) { .sheet { left: auto; right: 24px; bottom: 24px; width: 400px; border-radius: 24px; } }

dialog {
  border: 0; padding: 0; color: var(--ink); background: var(--card);
  width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 28px 28px 0 0; max-height: 92dvh;
  box-shadow: 0 -12px 50px rgba(40, 20, 90, .25);
}
dialog[open] { animation: sheetUp .26s cubic-bezier(.2,.8,.2,1); }
@keyframes sheetUp { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
dialog::backdrop { background: rgba(20, 10, 45, .45); backdrop-filter: blur(3px); }
dialog .dlg-body { padding: 14px 22px 8px; max-height: calc(92dvh - 90px); overflow: auto; }
dialog .dlg-foot { display: flex; gap: 10px; padding: 12px 22px calc(16px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
dialog .dlg-foot .btn { flex: 1; }
dialog h2 { font-size: 1.35rem; }
@media (min-width: 700px) {
  dialog { width: min(560px, calc(100vw - 32px)); margin: auto; border-radius: 28px; }
  dialog .dlg-foot { justify-content: flex-end; }
  dialog .dlg-foot .btn { flex: 0 0 auto; }
}

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 30px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 99px; font-weight: 700; z-index: 99;
  box-shadow: var(--shadow-2); animation: toastIn .25s ease; max-width: calc(100vw - 32px); text-align: center;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } }
@media (min-width: 1024px) { .toast { bottom: 28px; } }

/* booked hero (participant + organizer) */
.booked .zones > div { background: rgba(255,255,255,.18); color: #fff; }
.booked .zones .who i { background: #fff; }
.booked .zones .lt.odd::after { content: ' 🌙'; }
.copyrow { display: flex; gap: 6px; }
.copyrow input { font-size: .84rem; min-height: 42px; padding: 8px 12px; }

.activity { font-size: .9rem; list-style: none; padding: 0; margin: 0; }
.activity li { padding: 10px 0; border-top: 1px solid var(--line); color: var(--ink-2); }
.activity li:first-child { border-top: 0; }
.activity b { color: var(--ink); font-weight: 700; }

/* install banner */
.install {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 20px; margin-bottom: 16px;
  background: var(--ink); color: var(--bg);
}
.install img { width: 44px; height: 44px; border-radius: 12px; flex: none; }
.install .t { flex: 1; min-width: 0; font-size: .9rem; }
.install .t b { display: block; font-size: 1rem; }
.install .btn { min-height: 40px; background: var(--grad); color: #fff; border: 0; }
.install .x { background: none; border: 0; color: inherit; opacity: .6; font-size: 1.3rem; cursor: pointer; padding: 4px 6px; }

/* auth screens */
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1fr; }
.auth .art {
  background: var(--grad); color: #fff; padding: max(28px, env(safe-area-inset-top)) 26px 70px; position: relative; overflow: hidden;
}
.auth .art .brandmark { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2rem; color: #fff; }
.auth .art .brandmark img { width: 36px; height: 36px; border-radius: 11px; background: #fff; }
.auth .art h1 { font-size: clamp(2rem, 8vw, 3.4rem); line-height: 1.02; margin: 26px 0 10px; letter-spacing: -.035em; max-width: 12ch; }
.auth .art p { opacity: .92; max-width: 34ch; }
.auth .clocks { display: flex; gap: 8px; margin-top: 22px; flex-wrap: wrap; }
.auth .clocks .chip { background: rgba(255,255,255,.2); color: #fff; }
.auth .form { padding: 0 20px 40px; margin-top: -40px; position: relative; }
.auth .form .card { max-width: 440px; margin: 0 auto; padding: 26px 22px; box-shadow: var(--shadow-2); }
.auth .form h2 { font-size: 1.5rem; }
@media (min-width: 900px) {
  .auth { grid-template-columns: 1.1fr 1fr; }
  .auth .art { padding: 48px; display: flex; flex-direction: column; justify-content: center; }
  .auth .form { margin: 0; display: grid; place-items: center; padding: 40px; }
  .auth .form .card { width: 100%; box-shadow: none; border: 0; background: transparent; }
}
.blob { position: absolute; border-radius: 50%; filter: blur(2px); pointer-events: none; }

/* misc */
pre.code { white-space: pre-wrap; font-size: .82rem; background: var(--bg-2); padding: 12px; border-radius: 12px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.kv:first-child { border-top: 0; }
.progress-ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(#fff calc(var(--p) * 1%), rgba(255,255,255,.25) 0); }
.progress-ring b { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; background: var(--pink); color: #fff; font-size: .9rem; }
.hero.soft .progress-ring { background: conic-gradient(var(--violet) calc(var(--p) * 1%), var(--line-2) 0); }
.hero.soft .progress-ring b { background: var(--card); color: var(--ink); }

/* choice chips (radio / checkbox) */
.choices { display: flex; gap: 8px; flex-wrap: wrap; }
.choice { position: relative; margin: 0; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span, .choice-btn {
  display: inline-flex; align-items: center; min-height: 42px; padding: 0 16px; border-radius: 99px;
  background: var(--bg-2); color: var(--ink-2); font-weight: 700; font-size: .92rem; border: 2px solid transparent;
  font-family: inherit; cursor: pointer; transition: background .15s, color .15s;
}
.choice input:checked + span, .choice-btn.on { background: var(--accent-soft); color: var(--violet); border-color: var(--violet); }
.choice input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--focus) 55%, transparent); }
.submitbar { position: sticky; bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom)); z-index: 20; padding: 8px 0; }
@media (min-width: 1024px) { .submitbar { bottom: 16px; } .submitbar .btn { width: auto; min-width: 240px; } }
.content { min-width: 0; }

/* personal link rows (organizer) */
.linkrow { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.linkrow .face { width: 40px; height: 40px; margin: 0; border: 0; background: var(--pc); color: var(--pci); flex: none; }
.linkrow .who { flex: 1; min-width: 0; }
.linkrow .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.linkrow .who span { display: block; font-size: .8rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.linkrow .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.linkrow .iconbtn { width: 38px; height: 38px; border-radius: 12px; }
.linkrow .iconbtn svg { width: 19px; height: 19px; }
@media (max-width: 480px) { .linkrow { flex-wrap: wrap; } .linkrow .acts { width: 100%; justify-content: flex-start; padding-left: 52px; } }

/* controls inside the gradient hero */
.hero .seg { background: rgba(255,255,255,.2); }
.hero .seg button { color: #fff; }
.hero .seg button[aria-pressed=true] { background: #fff; color: var(--ink); }
.hero input[type=text] { background: rgba(255,255,255,.18); color: #fff; border-color: transparent; }
.hero input[type=text]::placeholder { color: rgba(255,255,255,.8); }
.hero input[type=text]:focus { background: rgba(255,255,255,.28); border-color: #fff; }

/* --- polish pass --- */
:root { --night: #3d3270; --dawn: #ffb27a; --day: #a9defd; }
@media (prefers-color-scheme: dark) { :root { --night: #0b0818; --dawn: #c9744a; --day: #3c79a8; } }
.tabs.full > * { padding: 9px 6px; font-size: .88rem; }
.tgrid td.allin { background: var(--grad) !important; }
.tgrid td.allin .n { color: #fff; }
.tgrid td.allin::after { display: none; }
.filterchips { display: flex; gap: 6px; flex-wrap: wrap; }
.filterchips .choice-btn { min-height: 34px; padding: 0 12px; font-size: .84rem; }
.filterchips .choice-btn:not(.on) { opacity: .55; text-decoration: line-through; }
.kv { align-items: center; }
.kv .btn { flex: none; }
.radio-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; background: var(--bg-2); margin: 0 0 8px; cursor: pointer; font-weight: 500; }
.radio-row input { width: 20px; height: 20px; accent-color: var(--violet); margin: 2px 0 0; flex: none; }
.radio-row small { display: block; color: var(--ink-3); font-weight: 400; }
.radio-row:has(input:checked) { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--violet); }
.radio-row:has(input:disabled) { opacity: .6; cursor: not-allowed; }
dialog .zones > div { background: var(--bg-2); }
@media (min-width: 1024px) {
  :root { --cell-w: 76px; --cell-h: 30px; }
  body:has(h1.only-desk) .appbar .title { visibility: hidden; }
}
