:root {
  --bg: #0f0a18;
  --bg-2: #150e22;
  --surface: #1b1329;
  --surface-2: #241a37;
  --surface-3: #2e2245;
  --border: #3a2b57;
  --border-soft: #2b2042;
  --text: #f4eeff;
  --muted: #a898c6;
  --faint: #6f6190;
  --gold: #e3bb5c;
  --gold-2: #f7dc92;
  --gold-ink: #1a1026;
  --violet: #8b5cf6;
  --violet-2: #a78bfa;
  --green: #22c55e;
  --green-bg: #0f5132;
  --green-bg-2: #13693f;
  --green-ink: #d9ffe8;
  --amber: #f5a524;
  --red: #f25f5c;
  --red-bg: #3b1422;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .7);
  --font-display: 'Cinzel', Georgia, serif;
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
.sky {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(139, 92, 246, .22), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(227, 187, 92, .10), transparent 60%),
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,.5), transparent 50%),
    radial-gradient(1px 1px at 70% 20%, rgba(255,255,255,.35), transparent 50%),
    radial-gradient(1px 1px at 40% 80%, rgba(255,255,255,.3), transparent 50%),
    radial-gradient(1.5px 1.5px at 85% 65%, rgba(255,255,255,.4), transparent 50%),
    radial-gradient(1px 1px at 10% 60%, rgba(255,255,255,.3), transparent 50%),
    linear-gradient(180deg, #120b1e, var(--bg));
}

a { color: var(--gold-2); }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: .02em; margin: 0; font-weight: 700; }
h1 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .85rem; }
.tiny { font-size: .75rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: .9rem; }
.grow { flex: 1; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- boot ---------- */
.boot { min-height: 100vh; display: grid; place-content: center; text-align: center; color: var(--muted); gap: 1rem; }
.boot-die { width: 72px; height: 72px; margin: 0 auto; animation: spin 1.6s cubic-bezier(.6,.1,.3,1) infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- buttons & inputs ---------- */
.btn {
  appearance: none; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font: 600 .9rem/1 var(--font-ui); padding: .7rem 1rem; border-radius: var(--radius-sm); cursor: pointer;
  display: inline-flex; align-items: center; gap: .45rem; transition: transform .08s, background .15s, border-color .15s, box-shadow .15s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: #4b3a6e; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: var(--gold-ink); border-color: #c79a3a; box-shadow: 0 6px 20px -8px rgba(227, 187, 92, .55); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--red-bg); border-color: #6b2336; color: #ffc9cf; }
.btn.danger:hover { background: #4c1a2b; }
.btn.sm { padding: .45rem .7rem; font-size: .8rem; }
.btn.block { width: 100%; justify-content: center; }
.icon-btn {
  appearance: none; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
  width: 34px; height: 34px; border-radius: 9px; display: inline-grid; place-items: center; font-size: 1rem;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); border-color: var(--border); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

label.field { display: grid; gap: .35rem; font-size: .85rem; color: var(--muted); font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: .7rem .8rem; font: 500 .95rem var(--font-ui);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(227, 187, 92, .18); }
textarea { resize: vertical; min-height: 84px; }
input[type=date]::-webkit-calendar-picker-indicator { filter: invert(.8); }
.check { display: flex; gap: .55rem; align-items: center; color: var(--text); font-size: .9rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--gold); }
.form-error { color: #ffb4b4; background: var(--red-bg); border: 1px solid #6b2336; padding: .6rem .8rem; border-radius: var(--radius-sm); font-size: .88rem; }

/* ---------- cards & chips ---------- */
.card {
  background: linear-gradient(180deg, rgba(36, 26, 55, .85), rgba(27, 19, 41, .85));
  border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow); backdrop-filter: blur(6px);
}
.card-title { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .8rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: .22rem .5rem; border-radius: 999px; background: var(--surface-3); color: var(--muted); border: 1px solid var(--border); }
.chip.gold { background: rgba(227, 187, 92, .12); color: var(--gold-2); border-color: rgba(227, 187, 92, .4); }
.chip.green { background: rgba(34, 197, 94, .14); color: #86efac; border-color: rgba(34, 197, 94, .45); }
.chip.red { background: rgba(242, 95, 92, .12); color: #ffb4b4; border-color: rgba(242, 95, 92, .4); }
.chip.violet { background: rgba(139, 92, 246, .15); color: #cdb9ff; border-color: rgba(139, 92, 246, .45); }

.avatar {
  --c: var(--violet);
  display: inline-grid; place-items: center; border-radius: 50%; font-weight: 700; color: #120b1e; flex: none;
  background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--c) 60%, white), var(--c));
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px color-mix(in srgb, var(--c) 60%, transparent);
}
.avatar-sm { width: 22px; height: 22px; font-size: .6rem; }
.avatar-md { width: 32px; height: 32px; font-size: .75rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1rem; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar + .avatar { margin-left: -6px; }
.avatar.dim { filter: grayscale(1) brightness(.6); }

/* ---------- app shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem;
  padding: .7rem clamp(1rem, 3vw, 2rem); background: rgba(15, 10, 24, .78); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); min-width: 0; }
.brand img { width: 34px; height: 34px; filter: drop-shadow(0 0 10px rgba(227, 187, 92, .35)); transition: transform .6s; }
.brand:hover img { transform: rotate(72deg); }
.brand-name { font-family: var(--font-display); font-weight: 900; font-size: 1.05rem; letter-spacing: .06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { display: block; font: 600 .65rem var(--font-ui); letter-spacing: .22em; text-transform: uppercase; color: var(--gold); }
.nav { display: flex; gap: .2rem; margin-left: auto; }
.nav a {
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: .88rem; padding: .5rem .8rem; border-radius: 9px;
  display: inline-flex; align-items: center; gap: .4rem;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.active { color: var(--gold-2); background: rgba(227, 187, 92, .1); }
.nav .nav-icon { font-size: 1rem; }
.me-btn { display: flex; align-items: center; gap: .5rem; background: none; border: 1px solid transparent; border-radius: 999px; padding: .2rem .5rem .2rem .2rem; color: var(--text); cursor: pointer; font: 600 .85rem var(--font-ui); }
.me-btn:hover { background: var(--surface-2); border-color: var(--border); }
.menu { position: absolute; right: clamp(1rem, 3vw, 2rem); top: 58px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .35rem; min-width: 190px; box-shadow: var(--shadow); z-index: 30; }
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: .6rem; padding: .6rem .7rem; border-radius: 8px; color: var(--text); text-decoration: none; background: none; border: 0; font: 500 .9rem var(--font-ui); cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--surface-3); }

main.page { padding: clamp(1rem, 3vw, 2rem); max-width: 1320px; margin: 0 auto; padding-bottom: 6rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.page-head p { margin: .3rem 0 0; }
.eyebrow { font: 700 .7rem var(--font-ui); letter-spacing: .24em; text-transform: uppercase; color: var(--gold); margin-bottom: .3rem; }

.banner { display: flex; gap: .8rem; align-items: center; padding: .8rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid rgba(227, 187, 92, .35); background: linear-gradient(90deg, rgba(227, 187, 92, .12), rgba(139, 92, 246, .08)); }
.banner .banner-icon { font-size: 1.4rem; }
.banner p { margin: 0; }

.bottom-nav { display: none; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; }
.auth-card { width: min(420px, 100%); padding: 2rem 1.8rem; text-align: left; }
.auth-logo { display: grid; justify-items: center; gap: .5rem; margin-bottom: 1.4rem; text-align: center; }
.auth-logo img { width: 76px; height: 76px; filter: drop-shadow(0 0 18px rgba(227, 187, 92, .4)); animation: float 5s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px) rotate(8deg); } }
.auth-logo h1 { font-size: 1.7rem; }
.link-btn { background: none; border: 0; color: var(--gold-2); cursor: pointer; font: 500 .85rem var(--font-ui); padding: 0; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- calendar ---------- */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.2rem; align-items: start; }
.cal-toolbar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .9rem; }
.cal-toolbar h1 { min-width: 11ch; }
.cal-nav { display: flex; gap: .3rem; }
.legend { display: flex; flex-wrap: wrap; gap: .9rem; font-size: .78rem; color: var(--muted); margin: 0 0 .8rem; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; border: 1px solid var(--border); }
.swatch.all { background: var(--green-bg-2); border-color: var(--green); }
.swatch.quorum { background: rgba(227, 187, 92, .18); border-color: var(--gold); }
.swatch.maybe { background: rgba(139, 92, 246, .18); border: 1px dashed var(--violet-2); }
.swatch.out { background: repeating-linear-gradient(135deg, rgba(242,95,92,.45) 0 3px, transparent 3px 7px); border-color: var(--red); }
.hint { font-size: .8rem; color: var(--faint); margin: -.3rem 0 .8rem; }
.hint-touch { display: none; }
@media (hover: none), (max-width: 760px) {
  .hint-desktop { display: none; }
  .hint-touch { display: block; }
}

.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.dow { font: 700 .7rem var(--font-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--faint); text-align: center; padding: .2rem 0 .4rem; }
.dow .dow-short { display: none; }
.day {
  position: relative; min-height: 132px; padding: .45rem .45rem .5rem; border-radius: 11px; cursor: pointer;
  background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--border-soft);
  display: flex; flex-direction: column; gap: 4px; transition: border-color .15s, transform .12s, box-shadow .15s; user-select: none;
  -webkit-user-select: none; -webkit-touch-callout: none;
}
.day:hover { border-color: #57457e; transform: translateY(-1px); box-shadow: 0 8px 20px -12px rgba(0,0,0,.8); }
.day.other-month { opacity: .45; }
.day.past { opacity: .38; cursor: default; }
.day.past:hover { transform: none; border-color: var(--border-soft); box-shadow: none; }
.day.today { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 0 22px -6px rgba(227, 187, 92, .6); }
.day-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-height: 22px; }
.day-num { font: 700 .95rem var(--font-display); color: var(--text); }
.day.today .day-num { color: var(--gold-2); }
.day-info { width: 24px; height: 24px; border-radius: 7px; font-size: .75rem; opacity: 0; transition: opacity .15s; }
.day:hover .day-info, .day:focus-within .day-info { opacity: 1; }
.day.out::after {
  content: ''; position: absolute; inset: 0; border-radius: 11px; pointer-events: none;
  background: repeating-linear-gradient(135deg, rgba(242, 95, 92, .16) 0 6px, transparent 6px 13px);
  border: 1px solid rgba(242, 95, 92, .5);
}
.out-tag { font: 800 .6rem var(--font-ui); letter-spacing: .12em; color: #ffb4b4; background: var(--red-bg); border: 1px solid #7a2a3d; padding: .12rem .35rem; border-radius: 5px; }
.session-pill {
  display: flex; align-items: center; gap: .3rem; font-size: .68rem; font-weight: 700; color: var(--gold-ink);
  background: linear-gradient(90deg, var(--gold-2), var(--gold)); border-radius: 6px; padding: .12rem .35rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.session-pill.cancelled { background: var(--surface-3); color: var(--faint); text-decoration: line-through; }
.slots { display: grid; gap: 3px; margin-top: auto; }
.slot {
  position: relative; display: grid; grid-template-columns: 2.4em 1fr auto; align-items: center; gap: 4px;
  font-size: .7rem; font-weight: 600; color: var(--muted); padding: 2px 5px; border-radius: 6px; overflow: hidden;
  background: rgba(255, 255, 255, .025); border: 1px solid transparent;
}
.slot-label { color: var(--faint); font-weight: 700; letter-spacing: .03em; }
.slot-letter { display: none; color: var(--faint); font-weight: 800; }
.slot.all .slot-letter { color: var(--green-ink); }
.slot.quorum .slot-letter { color: var(--gold-2); }
.slot-bar { height: 5px; border-radius: 99px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.slot-bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--violet), var(--violet-2)); }
.slot-count { font-variant-numeric: tabular-nums; color: var(--text); }
.slot.maybe-ok { border-color: rgba(167, 139, 250, .45); border-style: dashed; }
.slot.quorum { background: rgba(227, 187, 92, .13); border-color: rgba(227, 187, 92, .55); }
.slot.quorum .slot-bar > i { background: linear-gradient(90deg, var(--gold), var(--gold-2)); }
.slot.quorum .slot-label { color: var(--gold-2); }
.slot.all { background: linear-gradient(90deg, var(--green-bg), var(--green-bg-2)); border-color: var(--green); color: var(--green-ink); box-shadow: 0 0 12px -3px rgba(34, 197, 94, .6); }
.slot.all .slot-label, .slot.all .slot-count { color: var(--green-ink); }
.slot.all .slot-bar { background: rgba(0, 0, 0, .25); }
.slot.all .slot-bar > i { background: #86efac; }
.slot.booked::before { content: '⚔'; position: absolute; right: 2.3em; font-size: .65rem; color: var(--gold-2); }
.slot.me-busy .slot-label { text-decoration: line-through; text-decoration-color: rgba(242, 95, 92, .7); }

.aside { display: grid; gap: 1rem; position: sticky; top: 78px; }
.best-list { display: grid; gap: .45rem; }
.best-item {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .7rem; padding: .6rem .7rem; border-radius: 10px;
  background: var(--bg-2); border: 1px solid var(--border-soft); cursor: pointer; text-align: left; color: var(--text); font: inherit; width: 100%;
}
.best-item:hover { border-color: #57457e; }
.best-item.all { border-color: rgba(34, 197, 94, .55); background: linear-gradient(90deg, rgba(15, 81, 50, .6), var(--bg-2)); }
.best-item.quorum { border-color: rgba(227, 187, 92, .45); }
.best-date { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; background: var(--surface-3); line-height: 1.05; }
.best-date b { font: 700 1.05rem var(--font-display); }
.best-date small { font-size: .6rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.best-main { min-width: 0; }
.best-main strong { display: block; font-size: .88rem; }
.best-main span { font-size: .75rem; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.best-count { font: 700 1rem var(--font-display); font-variant-numeric: tabular-nums; }
.best-item.all .best-count { color: #86efac; }
.best-item.quorum .best-count { color: var(--gold-2); }
.empty { color: var(--faint); font-size: .88rem; text-align: center; padding: 1rem .5rem; }

/* ---------- drawer (day detail) & modal ---------- */
.backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(8, 4, 14, .62); backdrop-filter: blur(3px); animation: fade .18s ease; display: flex; }
.backdrop.leaving { animation: fade .18s ease reverse forwards; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: relative; margin-left: auto; width: min(480px, 100%); height: 100%; overflow-y: auto; background: var(--surface);
  border-left: 1px solid var(--border); padding: 1.4rem 1.3rem 3rem; animation: slide .22s cubic-bezier(.2,.8,.2,1);
}
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.modal {
  position: relative; margin: auto; width: min(520px, calc(100% - 2rem)); max-height: calc(100% - 2rem); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 1.5rem; box-shadow: var(--shadow);
  animation: pop .2s cubic-bezier(.2,.8,.2,1);
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.close-btn { position: absolute; top: .8rem; right: .8rem; }
.confirm p { font-size: 1rem; margin: .4rem 2rem 1.2rem 0; }

.day-detail h2 { margin-right: 2.5rem; }
.me-out {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .8rem 1rem; border-radius: 12px;
  background: var(--bg-2); border: 1px solid var(--border-soft); margin: 1rem 0;
}
.me-out.on { border-color: rgba(242, 95, 92, .55); background: linear-gradient(90deg, var(--red-bg), var(--bg-2)); }
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--border); transition: background .15s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: transform .18s, background .15s; }
.switch input:checked + span { background: #7a2a3d; border-color: var(--red); }
.switch input:checked + span::after { transform: translateX(20px); background: #ffd1d6; }
.switch input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }

.slot-card { border: 1px solid var(--border-soft); border-radius: 12px; padding: .8rem .9rem; margin-bottom: .7rem; background: var(--bg-2); }
.slot-card.all { border-color: var(--green); background: linear-gradient(180deg, rgba(15, 81, 50, .55), var(--bg-2)); }
.slot-card.quorum { border-color: rgba(227, 187, 92, .55); }
.slot-card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .55rem; }
.slot-card-head h3 { display: flex; align-items: center; gap: .45rem; font-size: .98rem; }
.who { display: grid; gap: .35rem; margin: .4rem 0 .6rem; }
.who-row { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; font-size: .8rem; }
.who-row > b { width: 5.2em; color: var(--faint); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; }
.person { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .45rem .12rem .15rem; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border-soft); font-size: .78rem; }
.person.note-person { cursor: help; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 2px; }
.seg button { appearance: none; border: 0; background: none; color: var(--muted); font: 600 .75rem var(--font-ui); padding: .38rem .6rem; border-radius: 7px; cursor: pointer; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.seg button.on.s2 { background: var(--green-bg); color: var(--green-ink); box-shadow: inset 0 0 0 1px var(--green); }
.seg button.on.s1 { background: rgba(139, 92, 246, .22); color: #e2d6ff; box-shadow: inset 0 0 0 1px var(--violet); }
.seg button.on.s0 { background: var(--red-bg); color: #ffc9cf; box-shadow: inset 0 0 0 1px #7a2a3d; }
.my-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; padding-top: .55rem; border-top: 1px dashed var(--border-soft); }
.my-row .small { color: var(--faint); }

/* ---------- weekly availability ---------- */
.week-wrap { overflow-x: auto; }
.week-grid { display: grid; grid-template-columns: 150px repeat(7, minmax(78px, 1fr)); gap: 6px; min-width: 720px; }
.week-grid .wh { font: 700 .72rem var(--font-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); text-align: center; padding: .5rem 0; background: none; border: 0; cursor: pointer; border-radius: 8px; }
.week-grid .wh:hover { color: var(--gold-2); background: var(--surface-2); }
.week-grid .wh.static { cursor: default; }
.week-grid .wh.static:hover { background: none; color: var(--muted); }
.week-grid .wrow { text-align: left; padding: .5rem .7rem; display: grid; align-content: center; }
.week-grid .wrow strong { font-family: var(--font-display); font-size: .95rem; letter-spacing: .02em; text-transform: none; color: var(--text); }
.week-grid .wrow small { font-size: .7rem; letter-spacing: 0; text-transform: none; color: var(--faint); font-weight: 500; }
.wcell {
  min-height: 66px; border-radius: 10px; border: 1px solid var(--border-soft); background: var(--surface); cursor: pointer;
  display: grid; place-items: center; font: 700 .75rem var(--font-ui); color: var(--faint); letter-spacing: .06em; text-transform: uppercase;
  transition: background .12s, border-color .12s, transform .08s; user-select: none; touch-action: none;
}
.wcell:hover { border-color: #57457e; }
.wcell.s2 { background: linear-gradient(180deg, var(--green-bg-2), var(--green-bg)); border-color: var(--green); color: var(--green-ink); }
.wcell.s1 { background: repeating-linear-gradient(135deg, rgba(139, 92, 246, .28) 0 8px, rgba(139, 92, 246, .16) 8px 16px); border-color: var(--violet); color: #e2d6ff; }
.wcell.s0 { color: var(--faint); }
.brushes { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.brush { display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .8rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: 600 .85rem var(--font-ui); cursor: pointer; }
.brush.on { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(227, 187, 92, .25); }
.brush i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; border: 1px solid var(--border); }
.brush i.s2 { background: var(--green-bg-2); border-color: var(--green); }
.brush i.s1 { background: rgba(139, 92, 246, .35); border-color: var(--violet); }
.brush i.s0 { background: var(--surface); }
.save-bar {
  position: sticky; bottom: 1rem; z-index: 10; margin-top: 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem .8rem .7rem 1.1rem; border-radius: 14px; background: rgba(36, 26, 55, .95); border: 1px solid var(--gold); box-shadow: var(--shadow);
  animation: pop .2s ease;
}

.heat { display: grid; grid-template-columns: 110px repeat(7, minmax(40px, 1fr)); gap: 4px; min-width: 460px; }
.heat .hh { font: 700 .66rem var(--font-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); text-align: center; padding: .2rem 0; }
.heat .hr { font-size: .78rem; color: var(--muted); display: flex; align-items: center; }
.heat .hc {
  --p: 0; min-height: 34px; border-radius: 7px; display: grid; place-items: center; font: 700 .78rem var(--font-ui); font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--violet) calc(var(--p) * 60%), var(--surface)); border: 1px solid var(--border-soft); color: var(--text);
}
.heat .hc.all { background: linear-gradient(180deg, var(--green-bg-2), var(--green-bg)); border-color: var(--green); color: var(--green-ink); }
.heat .hc.quorum { border-color: var(--gold); }
.heat.mini { grid-template-columns: repeat(7, 1fr); min-width: 0; gap: 2px; }
.heat.mini .hc { min-height: 12px; border-radius: 3px; font-size: 0; }
.heat.mini .hc.s2 { background: var(--green); border-color: transparent; }
.heat.mini .hc.s1 { background: var(--violet); border-color: transparent; opacity: .7; }
.heat.mini .hc.s0 { background: var(--surface-3); }

/* ---------- sessions ---------- */
.sessions-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.session-card { position: relative; overflow: hidden; }
.session-card::before { content: ''; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--gold), var(--violet)); }
.session-card.cancelled { opacity: .6; }
.session-card.cancelled::before { background: var(--faint); }
.session-when { display: flex; gap: .9rem; align-items: center; margin-bottom: .7rem; }
.cal-leaf { width: 58px; flex: none; border-radius: 12px; overflow: hidden; text-align: center; border: 1px solid var(--border); background: var(--bg-2); }
.cal-leaf small { display: block; background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: var(--gold-ink); font: 800 .62rem var(--font-ui); letter-spacing: .14em; padding: .18rem 0; text-transform: uppercase; }
.cal-leaf b { display: block; font: 700 1.5rem/1.3 var(--font-display); }
.session-card h3 { font-size: 1.12rem; }
.session-meta { font-size: .82rem; color: var(--muted); }
.session-notes { white-space: pre-wrap; font-size: .88rem; color: #d8cdee; background: var(--bg-2); border-radius: 10px; padding: .6rem .75rem; margin: .5rem 0; border: 1px solid var(--border-soft); }
.rsvp { display: flex; gap: .35rem; margin: .8rem 0 .6rem; flex-wrap: wrap; }
.rsvp button { flex: 1; min-width: 80px; }
.rsvp button.on.yes { background: var(--green-bg); border-color: var(--green); color: var(--green-ink); }
.rsvp button.on.maybe { background: rgba(139, 92, 246, .22); border-color: var(--violet); color: #e2d6ff; }
.rsvp button.on.no { background: var(--red-bg); border-color: #7a2a3d; color: #ffc9cf; }
.rsvp-list { display: grid; gap: .3rem; font-size: .8rem; }
.card-actions { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .8rem; padding-top: .7rem; border-top: 1px solid var(--border-soft); }

/* ---------- party ---------- */
.party-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.member-card { display: grid; gap: .8rem; }
.member-head { display: flex; gap: .8rem; align-items: center; }
.member-head h3 { font-size: 1.05rem; }
.member-head .sub { font-size: .8rem; color: var(--muted); font-style: italic; }

/* ---------- manage ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th { text-align: left; font: 700 .68rem var(--font-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); padding: .5rem .6rem; border-bottom: 1px solid var(--border); }
.table td { padding: .65rem .6rem; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table select { padding: .35rem .5rem; font-size: .82rem; width: auto; }
.table-wrap { overflow-x: auto; }
.manage-grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; }
.color-pick { display: flex; gap: .5rem; flex-wrap: wrap; }
.color-pick button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; background: var(--c); box-shadow: 0 0 0 2px var(--surface); }
.color-pick button.on { border-color: #fff; box-shadow: 0 0 0 2px var(--surface), 0 0 14px var(--c); }
.settings-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: 1.4rem; transform: translateX(-50%); z-index: 80; display: grid; gap: .5rem; width: min(440px, calc(100% - 2rem)); }
.toast {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .75rem .9rem .75rem 1rem; border-radius: 12px;
  background: #2a1f40; border: 1px solid var(--border); box-shadow: var(--shadow); font-size: .9rem; animation: pop .2s ease;
}
.toast.leaving { opacity: 0; transform: translateY(6px); transition: .25s; }
.toast-success { border-color: rgba(34, 197, 94, .6); }
.toast-error { border-color: rgba(242, 95, 92, .7); background: #34162a; }
.toast-action { background: none; border: 0; color: var(--gold-2); font: 700 .85rem var(--font-ui); cursor: pointer; padding: .2rem .4rem; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .cal-layout { grid-template-columns: 1fr; }
  .aside { position: static; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
  .manage-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  body { font-size: 14px; }
  .nav { display: none; }
  .me-btn .me-name { display: none; }
  .topbar { gap: .6rem; }
  .me-btn { margin-left: auto; }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; justify-content: space-around;
    background: rgba(15, 10, 24, .94); backdrop-filter: blur(12px); border-top: 1px solid var(--border-soft);
    padding: .35rem .3rem calc(.35rem + env(safe-area-inset-bottom));
  }
  .bottom-nav a { flex: 1; display: grid; justify-items: center; gap: 2px; color: var(--faint); text-decoration: none; font: 600 .66rem var(--font-ui); padding: .3rem 0; border-radius: 8px; }
  .bottom-nav a span:first-child { font-size: 1.15rem; }
  .bottom-nav a.active { color: var(--gold-2); }
  .cal-grid { gap: 3px; }
  .dow .dow-long { display: none; }
  .dow .dow-short { display: inline; }
  .day { min-height: 92px; padding: .3rem .25rem; border-radius: 8px; gap: 3px; }
  .day.out::after { border-radius: 8px; }
  .day-num { font-size: .8rem; }
  .day-info { display: none; }
  .out-tag { font-size: .5rem; padding: .05rem .2rem; }
  .session-pill { font-size: 0; padding: 0; width: 8px; height: 8px; border-radius: 50%; }
  .slot { grid-template-columns: auto 1fr; padding: 1px 3px; font-size: .62rem; text-align: right; gap: 2px; }
  .slot-label, .slot-bar { display: none; }
  .slot-letter { display: inline; font-size: .55rem; text-align: left; }
  .slot.booked::before { display: none; }
  .save-bar { bottom: 4.6rem; }
  .toasts { bottom: 5rem; }
  .sessions-grid, .party-grid { grid-template-columns: 1fr; }
}
.person.dim { opacity: .55; }
