/* =============================================================================
   Family Dashboard — Design System
   -----------------------------------------------------------------------------
   A studio-grade, GPU-light design system for a TV-first family dashboard.
   - Theme axis:  [data-theme="aurora"]   (palette family — extensible)
   - Mode  axis:  [data-mode="night"|"day"]  (dark / light surfaces)
   - Device axis: body.tv | body.tablet | body.phone  (set by app.js)
   - Night-dim:   body.dimmed  (after night_start: clock + tomorrow preview)
   All motion uses transform/opacity only so it stays smooth on a cheap Google TV.
   ============================================================================ */

/* ── Tokens: motion, type, space, radius ──────────────────────────────────── */
:root {
  /* Motion */
  --ease-spring: cubic-bezier(.22, 1.2, .36, 1);
  --ease-out:    cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --dur-fast: 140ms;
  --dur:      260ms;
  --dur-slow: 520ms;

  /* Type families */
  --font-display: 'Outfit', system-ui, -apple-system, sans-serif;
  --font-text:    'Inter', system-ui, -apple-system, sans-serif;

  /* Modular type scale (1.25 minor-third), TV-tuned base 18px */
  --fs-2xs: .72rem;
  --fs-xs:  .8rem;
  --fs-sm:  .9rem;
  --fs-md:  1rem;
  --fs-lg:  1.25rem;
  --fs-xl:  1.6rem;
  --fs-2xl: 2.1rem;
  --fs-3xl: 2.9rem;
  --fs-4xl: 4rem;
  --fs-clock: 5.5rem;

  /* Spacing (4px base) */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px;
  --s12: 48px; --s16: 64px; --s20: 80px;

  /* Radii */
  --r-sm: 10px; --r-md: 16px; --r-lg: 22px; --r-xl: 30px; --r-pill: 999px;

  /* Z-layers */
  --z-bg: 0; --z-content: 1; --z-chrome: 40; --z-fx: 60; --z-toast: 80; --z-modal: 100;
}

/* ── Theme: aurora · NIGHT (default) ──────────────────────────────────────── */
[data-theme="aurora"][data-mode="night"] {
  --bg-0:   #07060f;          /* page base */
  --bg-1:   #0b0a1a;          /* behind cards */
  --ink:    #f3f1ff;          /* primary text */
  --ink-2:  #c6c3e6;          /* secondary text */
  --ink-3:  #8c89b8;          /* muted text */
  --ink-on-accent: #0a0918;

  /* Glass surfaces */
  --glass:        rgba(28, 26, 56, .55);
  --glass-2:      rgba(36, 33, 68, .66);
  --glass-hi:     rgba(54, 50, 96, .72);
  --stroke:       rgba(150, 140, 230, .16);
  --stroke-hi:    rgba(170, 160, 255, .34);
  --modal-bg:     #11151c;    /* SOLID — wallpaper must not bleed (shop-modal lesson) */

  /* Brand accent ramp (indigo→violet) */
  --accent:    #7c8cff;
  --accent-2:  #9a7cff;
  --accent-3:  #f06cd0;
  --accent-soft: rgba(124, 140, 255, .18);
  --accent-glow: rgba(124, 140, 255, .55);

  /* Semantic */
  --good: #54e3a8;
  --warn: #ffd166;
  --bad:  #ff6b8b;
  --info: #62d2ff;

  /* Aurora blobs */
  --aur-1: #4b3bd6;
  --aur-2: #b14bd6;
  --aur-3: #2e6fff;
  --aur-4: #1b1450;

  /* Shadows / depth */
  --sh-1: 0 1px 2px rgba(0,0,0,.4);
  --sh-2: 0 8px 30px rgba(0,0,0,.45);
  --sh-3: 0 20px 60px rgba(0,0,0,.55);
  --sh-glow: 0 0 0 1px var(--stroke), 0 18px 50px rgba(10,6,40,.6);
  --tv-vignette: radial-gradient(120% 90% at 50% -10%, transparent 40%, rgba(0,0,0,.35) 100%);
}

/* ── Theme: aurora · DAY (light) ──────────────────────────────────────────── */
[data-theme="aurora"][data-mode="day"] {
  --bg-0:   #eef0ff;
  --bg-1:   #e6e8fb;
  --ink:    #1c1840;
  --ink-2:  #4a4675;
  --ink-3:  #7d79a6;
  --ink-on-accent: #ffffff;

  --glass:        rgba(255, 255, 255, .62);
  --glass-2:      rgba(255, 255, 255, .76);
  --glass-hi:     rgba(255, 255, 255, .9);
  --stroke:       rgba(80, 70, 170, .14);
  --stroke-hi:    rgba(90, 80, 200, .28);
  --modal-bg:     #ffffff;

  --accent:    #5b6cff;
  --accent-2:  #8a5cff;
  --accent-3:  #e052b8;
  --accent-soft: rgba(91, 108, 255, .14);
  --accent-glow: rgba(91, 108, 255, .4);

  --good: #16b377;
  --warn: #d99411;
  --bad:  #e23b63;
  --info: #1796d6;

  --aur-1: #9aa6ff;
  --aur-2: #e0a6ff;
  --aur-3: #a6d0ff;
  --aur-4: #d6dcff;

  --sh-1: 0 1px 2px rgba(40,30,120,.08);
  --sh-2: 0 10px 30px rgba(60,50,140,.12);
  --sh-3: 0 24px 60px rgba(60,50,140,.18);
  --sh-glow: 0 0 0 1px var(--stroke), 0 18px 50px rgba(90,80,200,.18);
  --tv-vignette: radial-gradient(120% 90% at 50% -10%, transparent 55%, rgba(120,110,200,.12) 100%);
}

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
/* Root text follows the --ink ramp so nothing inherits the boot splash's
   hardcoded near-white (#eef) once app.css loads — keeps day mode dark. */
html { color: var(--ink); }
body {
  margin: 0;
  background: var(--bg-0);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 18px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;                 /* TV: no scroll chrome; views scroll internally */
  overscroll-behavior: none;
  transition: background var(--dur-slow) var(--ease-out), color var(--dur) var(--ease-out);
}
h1,h2,h3,h4 { font-family: var(--font-display); font-weight: 700; margin: 0; letter-spacing: -.01em; color: var(--ink); }
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
::selection { background: var(--accent-soft); }

/* Scrollbars (subtle, in-view scrollers) */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--stroke-hi); border-radius: 999px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ── Animated aurora background ───────────────────────────────────────────── */
.aurora-bg {
  position: fixed; inset: 0; z-index: var(--z-bg);
  overflow: hidden; pointer-events: none;
  background:
    radial-gradient(140% 120% at 80% -20%, color-mix(in oklab, var(--aur-2) 30%, transparent), transparent 60%),
    radial-gradient(120% 120% at 10% 110%, color-mix(in oklab, var(--aur-3) 28%, transparent), transparent 55%),
    var(--bg-0);
}
.aurora-blob {
  position: absolute; border-radius: 50%;
  filter: blur(70px); opacity: .55; mix-blend-mode: screen;
  will-change: transform;
}
[data-mode="day"] .aurora-blob { mix-blend-mode: multiply; opacity: .45; filter: blur(80px); }
.aurora-blob.b1 { width: 52vw; height: 52vw; left: -10vw; top: -14vw;
  background: radial-gradient(circle, var(--aur-1), transparent 70%); animation: drift1 26s var(--ease-in-out) infinite; }
.aurora-blob.b2 { width: 46vw; height: 46vw; right: -8vw; top: 12vh;
  background: radial-gradient(circle, var(--aur-2), transparent 70%); animation: drift2 32s var(--ease-in-out) infinite; }
.aurora-blob.b3 { width: 60vw; height: 60vw; left: 22vw; bottom: -26vw;
  background: radial-gradient(circle, var(--aur-3), transparent 70%); animation: drift3 38s var(--ease-in-out) infinite; }
.aurora-grain {
  position: absolute; inset: -200%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
  opacity: .03; mix-blend-mode: overlay;
}
.tv-vignette::after { content:''; position: fixed; inset: 0; z-index: var(--z-bg); pointer-events: none; background: var(--tv-vignette); }

@keyframes drift1 { 0%,100%{transform:translate3d(0,0,0) scale(1)} 50%{transform:translate3d(6vw,4vh,0) scale(1.12)} }
@keyframes drift2 { 0%,100%{transform:translate3d(0,0,0) scale(1.05)} 50%{transform:translate3d(-5vw,6vh,0) scale(.92)} }
@keyframes drift3 { 0%,100%{transform:translate3d(0,0,0) scale(1)} 50%{transform:translate3d(4vw,-5vh,0) scale(1.1)} }

/* ── App shell layout ─────────────────────────────────────────────────────── */
#app {
  position: relative; z-index: var(--z-content);
  height: 100vh; height: 100dvh;
  display: grid; grid-template-rows: auto 1fr;
  padding: clamp(12px, 1.6vw, 28px);
  gap: clamp(12px, 1.4vw, 22px);
}
.view-scroll { overflow: auto; min-height: 0; width: 100%; min-width: 0; padding-right: 4px; }
.view-scroll::-webkit-scrollbar { width: 8px; }
/* the view host slot is a 1-col stretch grid; make the column definite so
   fr-based grids inside a view (e.g. the calendar's 7 columns) fill the width */
#view-slot { grid-template-columns: minmax(0, 1fr); }

/* Boot splash handled inline in index.html; this hides it when app ready */
#boot.gone { opacity: 0; pointer-events: none; }

/* ── Top chrome: clock / family / weather / nav ───────────────────────────── */
.chrome {
  display: flex; align-items: center; gap: var(--s5);
  padding: var(--s2) var(--s2);
}
.chrome .brand { display: flex; align-items: center; gap: var(--s4); min-width: 0; }
.chrome .brand-glyph {
  width: 46px; height: 46px; border-radius: 14px; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--accent), var(--accent-2) 55%, var(--accent-3));
  box-shadow: 0 8px 24px var(--accent-glow); display: grid; place-items: center;
  color: #fff; animation: float 6s var(--ease-in-out) infinite;
}
.chrome .brand-name { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-lg);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chrome .brand-date { color: var(--ink-3); font-size: var(--fs-sm); font-weight: 500; }

.chrome .spacer { flex: 1 1 auto; }

/* Live clock */
.clock { display: flex; align-items: baseline; gap: var(--s2); font-family: var(--font-display);
  font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.clock .hm { font-size: var(--fs-2xl); font-weight: 700; line-height: 1; }
.clock .sec { font-size: var(--fs-lg); font-weight: 500; color: var(--ink-3);
  font-variant-numeric: tabular-nums; min-width: 2.2ch; }
.clock .ampm { font-size: var(--fs-md); font-weight: 600; color: var(--ink-2); }
.clock .tick { animation: pulse-soft 1s var(--ease-out); }

/* Weather pill */
.wx-pill {
  display: inline-flex; align-items: center; gap: var(--s3);
  padding: var(--s2) var(--s4); border-radius: var(--r-pill);
  background: var(--glass); border: 1px solid var(--stroke);
  backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: var(--sh-1); white-space: nowrap;
}
.wx-pill .wx-temp { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-lg); font-variant-numeric: tabular-nums; color: var(--ink); }
.wx-pill .wx-glyph { width: 30px; height: 30px; flex: 0 0 auto; color: var(--accent-2); }
.wx-pill .wx-label { color: var(--ink-2); font-size: var(--fs-sm); }

/* View switcher / nav */
.nav { display: flex; gap: var(--s1); padding: var(--s1);
  background: var(--glass); border: 1px solid var(--stroke); border-radius: var(--r-pill);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.nav button {
  border: 0; background: transparent; color: var(--ink-2);
  padding: var(--s2) var(--s4); border-radius: var(--r-pill); cursor: pointer;
  display: inline-flex; align-items: center; gap: var(--s2); font-weight: 600; font-size: var(--fs-sm);
  transition: color var(--dur-fast), background var(--dur-fast);
}
.nav button svg { width: 20px; height: 20px; }
.nav button:hover { color: var(--ink); }
.nav button.active { color: var(--ink-on-accent);
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 6px 18px var(--accent-glow); }

/* TV mode hides the nav (it's glanceable, not navigated); shows on phones/tablets */
body.tv .nav { display: none; }
body.tv .chrome .brand-glyph { width: 56px; height: 56px; border-radius: 18px; }
body.tv .clock .hm { font-size: var(--fs-3xl); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  --bg: var(--glass-2);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  padding: var(--s3) var(--s5); border-radius: var(--r-pill);
  border: 1px solid var(--stroke); background: var(--bg); color: var(--ink);
  font-weight: 600; font-size: var(--fs-sm); cursor: pointer; user-select: none;
  transition: transform var(--dur-fast) var(--ease-spring), background var(--dur-fast), box-shadow var(--dur-fast), border-color var(--dur-fast);
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { transform: translateY(-1px); border-color: var(--stroke-hi); }
.btn:active { transform: translateY(0) scale(.97); }
.btn.primary { border: 0; color: var(--ink-on-accent);
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 8px 22px var(--accent-glow); }
.btn.primary:hover { box-shadow: 0 12px 30px var(--accent-glow); }
.btn.ghost { background: transparent; }
.btn.danger { color: #fff; background: linear-gradient(135deg, var(--bad), #ff4d7e); border: 0; }
.btn.icon { padding: var(--s3); width: 44px; height: 44px; border-radius: 50%; }
.btn.sm { padding: var(--s2) var(--s4); font-size: var(--fs-xs); }
.btn:disabled { opacity: .5; pointer-events: none; }

/* ── Cards / surfaces ─────────────────────────────────────────────────────── */
.card {
  background: var(--glass); border: 1px solid var(--stroke); border-radius: var(--r-lg);
  backdrop-filter: blur(20px) saturate(1.15); -webkit-backdrop-filter: blur(20px) saturate(1.15);
  box-shadow: var(--sh-2);
}
.card-pad { padding: var(--s5); }
.card-title { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-md);
  display: flex; align-items: center; gap: var(--s2); color: var(--ink); margin-bottom: var(--s3); }
.card-title .hint { margin-left: auto; color: var(--ink-3); font-size: var(--fs-xs); font-weight: 500; }

/* ── The board: 7 day columns Mon..Sun ────────────────────────────────────── */
.board { display: grid; grid-template-columns: 1fr; gap: var(--s5); min-height: 0; }
.board-week {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: clamp(8px, .8vw, 16px); min-height: 0;
}
.day-col {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--glass); border: 1px solid var(--stroke); border-radius: var(--r-md);
  overflow: hidden; transition: transform var(--dur) var(--ease-spring), box-shadow var(--dur), border-color var(--dur);
  animation: slide-in var(--dur-slow) var(--ease-out) backwards;
}
.day-col:nth-child(1){animation-delay:.02s}.day-col:nth-child(2){animation-delay:.06s}
.day-col:nth-child(3){animation-delay:.1s}.day-col:nth-child(4){animation-delay:.14s}
.day-col:nth-child(5){animation-delay:.18s}.day-col:nth-child(6){animation-delay:.22s}
.day-col:nth-child(7){animation-delay:.26s}
.day-col.today {
  border-color: var(--stroke-hi);
  box-shadow: 0 0 0 1px var(--accent-soft), 0 18px 44px rgba(10,6,40,.5), inset 0 0 60px var(--accent-soft);
}
.day-head { padding: var(--s3) var(--s4); display: flex; align-items: baseline; justify-content: space-between;
  border-bottom: 1px solid var(--stroke); }
.day-head .dow { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-sm); letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); }
.day-col.today .day-head .dow { color: var(--accent-2); }
.day-head .dnum { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }
.day-head .today-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2);
  box-shadow: 0 0 12px var(--accent-glow); animation: pulse-soft 2.4s var(--ease-in-out) infinite; }
.day-wx { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s4);
  color: var(--ink-3); font-size: var(--fs-xs); border-bottom: 1px solid var(--stroke); }
.day-wx svg { width: 22px; height: 22px; color: var(--accent-2); }
.day-wx .hi { color: var(--ink); font-weight: 600; }
.day-body { padding: var(--s3); display: flex; flex-direction: column; gap: var(--s2); overflow: auto; min-height: 0; }
.day-body::-webkit-scrollbar { width: 6px; }

/* meal / event chips inside a day */
.day-meal { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-xs); color: var(--ink-2);
  padding: var(--s2) var(--s3); border-radius: var(--r-sm); background: var(--accent-soft); }
.day-event { display: flex; gap: var(--s2); font-size: var(--fs-xs); padding: var(--s1) var(--s2);
  border-left: 3px solid var(--accent); border-radius: 6px; background: var(--glass-2); }
.day-event .et { color: var(--ink); font-weight: 600; }
.day-event .ex { color: var(--ink-3); }

/* ── Chore cards ──────────────────────────────────────────────────────────── */
.chore {
  position: relative; display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3); border-radius: var(--r-sm);
  background: var(--glass-2); border: 1px solid var(--stroke);
  cursor: pointer; user-select: none;
  transition: transform var(--dur-fast) var(--ease-spring), background var(--dur-fast), border-color var(--dur-fast), opacity var(--dur);
}
.chore:hover { transform: translateY(-2px); border-color: var(--stroke-hi); }
.chore:active { transform: scale(.98); }
.chore .ic { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-2); }
.chore .ic svg { width: 20px; height: 20px; }
.chore .meta { min-width: 0; flex: 1 1 auto; }
.chore .t { font-weight: 600; font-size: var(--fs-sm); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chore .sub { font-size: var(--fs-2xs); color: var(--ink-3); display: flex; gap: var(--s2); align-items: center; }
.chore .pts { font-size: var(--fs-2xs); font-weight: 700; color: var(--warn); font-variant-numeric: tabular-nums; }
.chore .check {
  width: 26px; height: 26px; flex: 0 0 auto; border-radius: 50%;
  border: 2px solid var(--stroke-hi); display: grid; place-items: center; color: transparent;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.chore .check svg { width: 16px; height: 16px; }
.chore.done { opacity: .62; }
.chore.done .t { text-decoration: line-through; text-decoration-color: var(--ink-3); }
.chore.done .check { background: var(--good); border-color: var(--good); color: #08130d; }
.chore.just-done .check { animation: check-pop var(--dur-slow) var(--ease-spring); }
/* tiny accent stripe keyed to assignee color via inline --mc */
.chore[style*="--mc"] .ic { background: color-mix(in oklab, var(--mc, var(--accent)) 22%, transparent); color: var(--mc, var(--accent-2)); }

/* ── Member avatars ───────────────────────────────────────────────────────── */
.avatar {
  --mc: var(--accent);
  position: relative; flex: 0 0 auto; border-radius: 50%;
  width: var(--av, 48px); height: var(--av, 48px);
  display: grid; place-items: center; font-family: var(--font-display); font-weight: 700;
  background: color-mix(in oklab, var(--mc) 26%, var(--bg-1));
  color: #fff; font-size: calc(var(--av, 48px) * .42); overflow: hidden;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--mc) 70%, transparent), 0 0 0 6px var(--bg-1), 0 6px 18px rgba(0,0,0,.35);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { --av: 84px; }
.avatar.sm { --av: 34px; }
.avatar .emoji { font-size: calc(var(--av, 48px) * .5); }

/* roster strip on the board */
.roster { display: flex; gap: var(--s5); flex-wrap: wrap; align-items: stretch; }
.roster .person { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4);
  border-radius: var(--r-md); background: var(--glass); border: 1px solid var(--stroke); min-width: 0; }
.roster .person .name { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-md); }
.roster .person .stat { font-size: var(--fs-xs); color: var(--ink-3); display: flex; gap: var(--s3); }
.roster .person .stat b { color: var(--ink); font-variant-numeric: tabular-nums; }
.roster .person .streak { color: var(--warn); }
.roster .person .pts-num { font-variant-numeric: tabular-nums; }

/* ── Announcements / banner ───────────────────────────────────────────────── */
.ann-strip { display: flex; gap: var(--s4); flex-wrap: wrap; }
.ann {
  display: inline-flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s5);
  border-radius: var(--r-pill); font-weight: 600; font-size: var(--fs-sm);
  background: var(--accent-soft); border: 1px solid var(--stroke-hi); color: var(--ink);
  animation: slide-in var(--dur-slow) var(--ease-out) backwards;
}
.ann .emoji { font-size: 1.3em; }

/* ── Mini calendar ────────────────────────────────────────────────────────── */
.mini-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--s1); }
.mini-cal .dow-h { text-align: center; font-size: var(--fs-2xs); color: var(--ink-3); font-weight: 700; padding-bottom: var(--s1); }
.mini-cal .cell { aspect-ratio: 1; display: grid; place-items: center; border-radius: var(--r-sm);
  font-size: var(--fs-sm); color: var(--ink-2); font-variant-numeric: tabular-nums; position: relative;
  transition: background var(--dur-fast), color var(--dur-fast); cursor: pointer; }
.mini-cal .cell:hover { background: var(--glass-2); color: var(--ink); }
.mini-cal .cell.muted { color: var(--ink-3); opacity: .45; }
.mini-cal .cell.today { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--ink-on-accent); font-weight: 700; box-shadow: 0 6px 16px var(--accent-glow); }
.mini-cal .cell.has-events::after { content:''; position: absolute; bottom: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent-3); }
.mini-cal .cell.today.has-events::after { background: #fff; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: var(--s2); }
.field > label { font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); }
.input, select.input, textarea.input {
  width: 100%; padding: var(--s3) var(--s4); border-radius: var(--r-sm);
  background: var(--glass-2); border: 1px solid var(--stroke); color: var(--ink);
  font: inherit; font-size: var(--fs-sm); outline: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.input:focus, select.input:focus, textarea.input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder { color: var(--ink-3); }
textarea.input { resize: vertical; min-height: 80px; }
.row { display: flex; gap: var(--s3); flex-wrap: wrap; }
.row > .field { flex: 1 1 140px; }

/* color swatch picker */
.swatches { display: flex; gap: var(--s2); flex-wrap: wrap; }
.swatch { width: 32px; height: 32px; border-radius: 50%; cursor: pointer; border: 2px solid transparent;
  transition: transform var(--dur-fast) var(--ease-spring); }
.swatch:hover { transform: scale(1.12); }
.swatch.sel { border-color: var(--ink); transform: scale(1.1); box-shadow: 0 0 0 2px var(--bg-1), 0 0 14px currentColor; }

/* ── Modals (SOLID bg so wallpaper never bleeds — shop-modal lesson) ───────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: var(--z-modal);
  display: grid; place-items: center; padding: var(--s5);
  background: rgba(4, 3, 14, .72);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: fade-in var(--dur) var(--ease-out);
}
.modal {
  width: min(560px, 100%); max-height: 88vh; overflow: auto;
  background: var(--modal-bg);                 /* SOLID #11151c in night */
  border: 1px solid var(--stroke-hi); border-radius: var(--r-xl);
  box-shadow: var(--sh-3); padding: var(--s8);
  animation: modal-in var(--dur-slow) var(--ease-spring);
}
[data-mode="day"] .modal { box-shadow: var(--sh-3); border-color: var(--stroke); }
.modal-head { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s5); }
.modal-head h2 { font-size: var(--fs-xl); flex: 1 1 auto; }
.modal-head .close { margin-left: auto; }
.modal-body { display: flex; flex-direction: column; gap: var(--s4); }
.modal-foot { display: flex; gap: var(--s3); justify-content: flex-end; margin-top: var(--s6); }

/* ── Toasts ───────────────────────────────────────────────────────────────── */
.toast-stack { position: fixed; bottom: var(--s6); left: 50%; transform: translateX(-50%);
  z-index: var(--z-toast); display: flex; flex-direction: column; gap: var(--s3); align-items: center; pointer-events: none; }
.toast {
  pointer-events: auto; display: inline-flex; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s5); border-radius: var(--r-pill);
  background: var(--modal-bg); border: 1px solid var(--stroke-hi); color: var(--ink);
  box-shadow: var(--sh-3); font-weight: 600; font-size: var(--fs-sm); max-width: 90vw;
  animation: toast-in var(--dur-slow) var(--ease-spring);
}
.toast.out { animation: toast-out var(--dur) var(--ease-in-out) forwards; }
.toast .dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.toast.good .dot { background: var(--good); box-shadow: 0 0 12px var(--good); }
.toast.warn .dot { background: var(--warn); box-shadow: 0 0 12px var(--warn); }
.toast.bad  .dot { background: var(--bad);  box-shadow: 0 0 12px var(--bad); }
.toast.info .dot { background: var(--info); box-shadow: 0 0 12px var(--info); }

/* ── FX canvas (confetti) ─────────────────────────────────────────────────── */
.fx-canvas { position: fixed; inset: 0; z-index: var(--z-fx); pointer-events: none; }

/* ── Empty / loading states ───────────────────────────────────────────────── */
.empty { display: grid; place-items: center; gap: var(--s3); padding: var(--s10); color: var(--ink-3); text-align: center; }
.empty .big { font-size: var(--fs-xl); font-family: var(--font-display); color: var(--ink-2); }
.skeleton { background: linear-gradient(100deg, var(--glass-2) 30%, var(--glass-hi) 50%, var(--glass-2) 70%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: var(--r-sm); }

/* ── Login / setup centered card ──────────────────────────────────────────── */
.gate { display: grid; place-items: center; height: 100%; padding: var(--s6); }
.gate .gate-card { width: min(440px, 100%); }
.gate .gate-logo { width: 72px; height: 72px; border-radius: 22px; margin: 0 auto var(--s5);
  background: linear-gradient(135deg, var(--accent), var(--accent-2) 55%, var(--accent-3));
  box-shadow: 0 16px 44px var(--accent-glow); display: grid; place-items: center; color: #fff;
  animation: float 6s var(--ease-in-out) infinite; }
.gate h1 { text-align: center; font-size: var(--fs-2xl); margin-bottom: var(--s2); }
.gate .sub { text-align: center; color: var(--ink-3); margin-bottom: var(--s6); }

/* ── Night-dim mode: just a giant clock + tomorrow preview ─────────────────── */
body.dimmed .aurora-blob { opacity: .22; }
body.dimmed #app > *:not(.night-screen) { display: none; }
.night-screen {
  position: fixed; inset: 0; z-index: var(--z-chrome);
  display: grid; place-content: center; justify-items: center; gap: var(--s6);
  background: radial-gradient(80% 80% at 50% 40%, color-mix(in oklab, var(--aur-4) 40%, var(--bg-0)), var(--bg-0));
  animation: fade-in var(--dur-slow) var(--ease-out);
}
.night-screen .nc-clock { font-family: var(--font-display); font-weight: 800; font-size: clamp(4rem, 16vw, 13rem);
  letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: .9;
  background: linear-gradient(180deg, var(--ink), var(--ink-3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.night-screen .nc-date { font-size: var(--fs-2xl); color: var(--ink-2); font-family: var(--font-display); font-weight: 600; }
.night-screen .nc-tom { display: flex; gap: var(--s5); align-items: center; color: var(--ink-3); font-size: var(--fs-lg); }
.night-screen .nc-tom svg { width: 40px; height: 40px; color: var(--accent-2); }
.night-screen .nc-wake { color: var(--ink-3); font-size: var(--fs-sm); }

/* ── Responsive: device modes ─────────────────────────────────────────────── */

/* TV / big-screen (>=1280px): glanceable, generous */
@media (min-width: 1280px) {
  body { font-size: 19px; }
  .board-week { gap: clamp(10px, .9vw, 18px); }
}
@media (min-width: 1800px) {
  body { font-size: 21px; }
}

/* Tablet (768–1279): board wraps to fewer columns, nav visible */
@media (max-width: 1279px) {
  body.tv .nav { display: flex; }            /* allow nav on smaller "tv" too */
}
@media (max-width: 1024px) {
  .board-week { grid-template-columns: repeat(4, 1fr); }
  .day-col:nth-child(n+5){ /* keep flowing */ }
  .roster { gap: var(--s3); }
}
@media (max-width: 820px) {
  .board-week { grid-template-columns: repeat(2, 1fr); }
}

/* Phone (remote): single column, big touch targets, sticky bottom nav */
@media (max-width: 600px) {
  body { font-size: 16px; }
  #app { padding: 10px 10px calc(72px + env(safe-area-inset-bottom, 0px)); grid-template-rows: auto 1fr; }
  .chrome { flex-wrap: wrap; gap: var(--s3); }
  .chrome .clock .hm { font-size: var(--fs-xl); }
  .wx-pill .wx-label { display: none; }
  .board-week { grid-template-columns: 1fr; }
  .day-col { animation: none; }
  .nav {
    position: fixed; left: 50%; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
    z-index: var(--z-chrome); box-shadow: var(--sh-3); max-width: calc(100vw - 20px); overflow-x: auto;
  }
  .nav button span { display: none; }       /* icon-only nav on phone */
  .nav button { padding: var(--s3); }
  .modal { padding: var(--s5); border-radius: var(--r-lg); }
  .roster .person .stat { font-size: var(--fs-2xs); }
}

/* ── Utilities ────────────────────────────────────────────────────────────── */
.stack { display: flex; flex-direction: column; gap: var(--s4); }
.flex { display: flex; align-items: center; gap: var(--s3); }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.grow { flex: 1 1 auto; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--ink-3); }
.dim { color: var(--ink-2); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.count-up { animation: count-up var(--dur-slow) var(--ease-spring); }
.pill { display: inline-flex; align-items: center; gap: var(--s1); padding: 2px var(--s3); border-radius: var(--r-pill);
  background: var(--glass-2); border: 1px solid var(--stroke); font-size: var(--fs-2xs); font-weight: 600; color: var(--ink-2); }
.view-enter { animation: view-in var(--dur-slow) var(--ease-out); }
.section-grid { display: grid; gap: var(--s5); grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* ── Keyframes ────────────────────────────────────────────────────────────── */
@keyframes float       { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-6px)} }
@keyframes shimmer     { from{background-position:200% 0} to{background-position:-200% 0} }
@keyframes pulse-soft  { 0%,100%{opacity:1; transform:scale(1)} 50%{opacity:.55; transform:scale(.92)} }
@keyframes check-pop   { 0%{transform:scale(0) rotate(-30deg)} 55%{transform:scale(1.35) rotate(8deg)} 100%{transform:scale(1) rotate(0)} }
@keyframes slide-in    { from{opacity:0; transform:translateY(14px)} to{opacity:1; transform:translateY(0)} }
@keyframes view-in     { from{opacity:0; transform:translateY(10px) scale(.995)} to{opacity:1; transform:translateY(0) scale(1)} }
@keyframes fade-in     { from{opacity:0} to{opacity:1} }
@keyframes modal-in    { from{opacity:0; transform:translateY(20px) scale(.96)} to{opacity:1; transform:translateY(0) scale(1)} }
@keyframes toast-in    { from{opacity:0; transform:translateY(16px) scale(.9)} to{opacity:1; transform:translateY(0) scale(1)} }
@keyframes toast-out   { to{opacity:0; transform:translateY(10px) scale(.95)} }
@keyframes count-up    { from{opacity:0; transform:translateY(8px)} to{opacity:1; transform:translateY(0)} }

/* =============================================================================
   Calendar view (views/calendar.js) — full month grid + week strip + day detail
   ============================================================================ */
.cal { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s5); min-height: 0;
  width: 100%; }
/* The header always spans every column so it never steals the month grid's
   track. (Before this, .cal-head occupied column 1 and pushed the main grid
   into the narrow 360px detail column → the famous ~380px squish.) */
.cal-head { grid-column: 1 / -1; }
@media (min-width: 1100px) {
  .cal.has-detail { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
  .cal.has-detail .cal-main   { grid-column: 1; }
  .cal.has-detail .day-detail { grid-column: 2; grid-row: 2; }
}

/* The view host + main column must claim the full content width so the month
   grid's 7 fr-columns have a definite track to fill (otherwise the grid
   collapses toward its chip content and renders ~380px wide). */
.cal-main { width: 100%; min-width: 0; }

/* ── Calendar header: title + month nav + view toggle + legend ─────────────── */
.cal-head { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; }
.cal-title { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-2xl);
  letter-spacing: -.02em; line-height: 1; min-width: 0; color: var(--ink); }
.cal-title .yr { color: var(--ink-3); font-weight: 600; margin-left: .35em; }
.cal-nav { display: inline-flex; gap: var(--s2); align-items: center; }
.cal-spacer { flex: 1 1 auto; }

/* segmented month/week toggle */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-pill);
  background: var(--glass); border: 1px solid var(--stroke); }
.seg button { border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
  padding: var(--s2) var(--s5); border-radius: var(--r-pill); font-weight: 600; font-size: var(--fs-sm);
  transition: color var(--dur-fast), background var(--dur-fast); }
.seg button.on { color: var(--ink-on-accent);
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 6px 16px var(--accent-glow); }

.cal-legend { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: center; }
.cal-legend .lg { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-2xs);
  color: var(--ink-3); font-weight: 600; }
.cal-legend .lg .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--mc, var(--accent)); }

/* ── The month grid ───────────────────────────────────────────────────────── */
.cal-grid-wrap { position: relative; overflow: hidden; border-radius: var(--r-lg); width: 100%; }
/* 7 equal columns that fill the full content width (wall-calendar look).
   Row 1 is the short weekday header; the next 6 are the week rows, each a
   comfortably tall track so every day cell reads like a real wall calendar
   (and they grow to share any extra vertical space on a big TV). */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: auto repeat(6, minmax(clamp(96px, 13.5vh, 168px), 1fr));
  gap: 1px; width: 100%;
  background: var(--stroke); border: 1px solid var(--stroke); border-radius: var(--r-lg); overflow: hidden; }
.cal-grid .dow { background: var(--glass-2); text-align: center; padding: var(--s2) 0; min-height: 0;
  font-size: var(--fs-xs); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }

/* month transition slide animations */
.cal-grid.slide-next { animation: cal-in-next var(--dur-slow) var(--ease-out); }
.cal-grid.slide-prev { animation: cal-in-prev var(--dur-slow) var(--ease-out); }
@keyframes cal-in-next { from { opacity: 0; transform: translateX(5%); } to { opacity: 1; transform: translateX(0); } }
@keyframes cal-in-prev { from { opacity: 0; transform: translateX(-5%); } to { opacity: 1; transform: translateX(0); } }

.cal-cell { background: var(--bg-1); min-height: 0; min-width: 0;
  padding: var(--s2); display: flex; flex-direction: column; gap: 3px; cursor: pointer; position: relative;
  transition: background var(--dur-fast), box-shadow var(--dur-fast); overflow: hidden;
  animation: cell-pop var(--dur) var(--ease-out) backwards; }
.cal-cell:hover { background: var(--glass-2); }
.cal-cell.out { opacity: .4; }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-cell.sel { box-shadow: inset 0 0 0 2px var(--accent-3), inset 0 0 40px var(--accent-soft); background: var(--glass); }
.cal-cell.today.sel { box-shadow: inset 0 0 0 2px var(--accent-3); }
@keyframes cell-pop { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: scale(1); } }

.cal-cell .dn { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums; color: var(--ink-2); align-self: flex-start;
  width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; flex: 0 0 auto; }
.cal-cell.out .dn { color: var(--ink-3); }
.cal-cell.today .dn { background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--ink-on-accent); box-shadow: 0 4px 12px var(--accent-glow); }

.cal-cell .ev-list { display: flex; flex-direction: column; gap: 3px; min-height: 0; flex: 1 1 auto; overflow: hidden; }
.cal-chip { display: flex; align-items: center; gap: 5px; font-size: var(--fs-2xs); font-weight: 600;
  padding: 2px 6px; border-radius: 6px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: color-mix(in oklab, var(--mc, var(--accent)) 20%, transparent);
  border-left: 3px solid var(--mc, var(--accent)); animation: chip-in var(--dur) var(--ease-out) backwards; }
.cal-chip.dot-only { padding: 0; border: 0; background: transparent; gap: 4px; }
.cal-chip .cd { width: 6px; height: 6px; border-radius: 50%; background: var(--mc, var(--accent)); flex: 0 0 auto; }
.cal-chip .ci { width: 13px; height: 13px; flex: 0 0 auto; color: var(--mc, var(--accent-2)); display: inline-flex; }
.cal-chip .ci svg { width: 13px; height: 13px; }
.cal-chip.hw { background: color-mix(in oklab, var(--info) 16%, transparent); border-left-color: var(--info); }
.cal-chip.meal { background: color-mix(in oklab, var(--good) 14%, transparent); border-left-color: var(--good); }
.cal-chip.bday { background: color-mix(in oklab, var(--accent-3) 18%, transparent); border-left-color: var(--accent-3); }
.cal-chip.more { background: transparent; border: 0; color: var(--ink-3); padding: 0 6px; font-weight: 700; }
@keyframes chip-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: translateY(0); } }

/* ── Week strip (toggle view): 7 tall columns spanning the full width ──────── */
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--s2);
  width: 100%; min-height: 0; }
.cal-wcol { display: flex; flex-direction: column; background: var(--bg-1); border: 1px solid var(--stroke);
  border-radius: var(--r-md); overflow: hidden; cursor: pointer;
  transition: border-color var(--dur-fast), transform var(--dur-fast) var(--ease-spring);
  animation: slide-in var(--dur-slow) var(--ease-out) backwards; }
.cal-wcol:hover { transform: translateY(-2px); border-color: var(--stroke-hi); }
.cal-wcol.today { border-color: var(--stroke-hi); box-shadow: inset 0 0 50px var(--accent-soft); }
.cal-wcol.sel { box-shadow: 0 0 0 2px var(--accent-3); }
.cal-whead { padding: var(--s3); text-align: center; border-bottom: 1px solid var(--stroke); }
.cal-whead .wd { font-size: var(--fs-2xs); font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.cal-whead .wn { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-xl); line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--ink); }
.cal-wcol.today .wn { color: var(--accent-2); }
.cal-wbody { padding: var(--s2); display: flex; flex-direction: column; gap: 4px; overflow: auto;
  flex: 1 1 auto; min-height: clamp(220px, 46vh, 560px); }
.cal-wcol:nth-child(1){animation-delay:.02s}.cal-wcol:nth-child(2){animation-delay:.05s}
.cal-wcol:nth-child(3){animation-delay:.08s}.cal-wcol:nth-child(4){animation-delay:.11s}
.cal-wcol:nth-child(5){animation-delay:.14s}.cal-wcol:nth-child(6){animation-delay:.17s}
.cal-wcol:nth-child(7){animation-delay:.2s}

/* ── Day detail panel ─────────────────────────────────────────────────────── */
.day-detail { display: flex; flex-direction: column; gap: var(--s4); animation: slide-in var(--dur) var(--ease-out); }
.dd-head { display: flex; align-items: flex-start; gap: var(--s3); }
.dd-head .dd-when { flex: 1 1 auto; min-width: 0; }
.dd-head .dd-dow { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-xl); line-height: 1; color: var(--ink); }
.dd-head .dd-date { color: var(--ink-3); font-size: var(--fs-sm); font-weight: 600; }
.dd-quick { display: flex; gap: var(--s2); flex-wrap: wrap; }
.dd-section { display: flex; flex-direction: column; gap: var(--s2); }
.dd-section > .lbl { font-size: var(--fs-2xs); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.dd-item { display: flex; align-items: center; gap: var(--s3); padding: var(--s3);
  border-radius: var(--r-sm); background: var(--glass-2); border: 1px solid var(--stroke);
  border-left: 3px solid var(--mc, var(--accent)); animation: slide-in var(--dur) var(--ease-out) backwards; }
.dd-item .di-ic { width: 30px; height: 30px; flex: 0 0 auto; border-radius: 9px; display: grid; place-items: center;
  background: color-mix(in oklab, var(--mc, var(--accent)) 20%, transparent); color: var(--mc, var(--accent-2)); }
.dd-item .di-ic svg { width: 17px; height: 17px; }
.dd-item .di-body { flex: 1 1 auto; min-width: 0; }
.dd-item .di-t { font-weight: 600; font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dd-item .di-sub { font-size: var(--fs-2xs); color: var(--ink-3); }
.dd-item.done .di-t { text-decoration: line-through; color: var(--ink-3); }
.dd-empty { color: var(--ink-3); font-size: var(--fs-sm); padding: var(--s3); text-align: center; }

/* quick-action chooser popover (add event/homework/meal) */
.qa-menu { display: flex; flex-direction: column; gap: var(--s2); }
.qa-menu button { justify-content: flex-start; }

/* =============================================================================
   Members view (views/members.js) — roster cards + premium add/edit modal
   ============================================================================ */
.mem-head { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s5); }
.mem-head .mem-title { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-2xl); letter-spacing: -.02em; color: var(--ink); }
.mem-head .mem-sub { color: var(--ink-3); font-size: var(--fs-sm); }

.mem-grid { display: grid; gap: var(--s5); grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.mem-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: var(--s3);
  padding: var(--s6) var(--s5) var(--s5); text-align: center; overflow: hidden;
  animation: view-in var(--dur-slow) var(--ease-out) backwards; }
.mem-card:nth-child(2){animation-delay:.04s}.mem-card:nth-child(3){animation-delay:.08s}
.mem-card:nth-child(4){animation-delay:.12s}.mem-card:nth-child(5){animation-delay:.16s}
.mem-card:nth-child(6){animation-delay:.2s}
/* accent wash keyed to member color via inline --mc */
.mem-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 84px;
  background: linear-gradient(180deg, color-mix(in oklab, var(--mc, var(--accent)) 28%, transparent), transparent);
  pointer-events: none; }
.mem-card .mem-name { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-lg);
  color: var(--mc, var(--ink)); position: relative; }
.mem-card .mem-uname { font-size: var(--fs-2xs); color: var(--ink-3); margin-top: -4px; }
.mem-card .mem-pills { display: flex; gap: var(--s2); flex-wrap: wrap; justify-content: center; position: relative; }
.mem-card .mem-actions { display: flex; gap: var(--s2); margin-top: auto; padding-top: var(--s2); position: relative; }
.mem-card .pill.you { background: var(--accent-soft); border-color: var(--stroke-hi); color: var(--accent-2); }
.mem-card .pill.admin { color: var(--warn); }
.mem-card .pts-pill { color: var(--warn); font-variant-numeric: tabular-nums; }
.mem-card .pts-pill svg { width: 13px; height: 13px; }

.mem-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s3);
  border-style: dashed !important; cursor: pointer; min-height: 220px; color: var(--ink-3);
  transition: border-color var(--dur-fast), transform var(--dur-fast) var(--ease-spring), color var(--dur-fast); }
.mem-add:hover { transform: translateY(-3px); border-color: var(--accent) !important; color: var(--accent-2); }
.mem-add .mem-add-glyph { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-2); }
.mem-add .mem-add-glyph svg { width: 30px; height: 30px; }

/* avatar with upload-on-hover (in the edit modal) */
.av-edit { position: relative; width: 96px; height: 96px; margin: 0 auto; cursor: pointer; border-radius: 50%; }
.av-edit .avatar { --av: 96px; width: 96px; height: 96px; }
.av-edit .av-cam { position: absolute; inset: auto -2px -2px auto; width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 16px var(--accent-glow); border: 2px solid var(--modal-bg); }
.av-edit .av-cam svg { width: 17px; height: 17px; }
.av-edit .av-over { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center;
  background: rgba(4,3,14,.5); color: #fff; opacity: 0; transition: opacity var(--dur-fast); font-size: var(--fs-2xs); font-weight: 700; }
.av-edit:hover .av-over { opacity: 1; }

/* ── Premium color picker ─────────────────────────────────────────────────── */
.cpick { display: flex; flex-direction: column; gap: var(--s3); }
.cpick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: var(--s2); }
.cpick-sw { aspect-ratio: 1; border-radius: 50%; cursor: pointer; position: relative;
  background: var(--c); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
  transition: transform var(--dur-fast) var(--ease-spring); }
.cpick-sw:hover { transform: scale(1.14); }
.cpick-sw.sel { transform: scale(1.1); box-shadow: 0 0 0 2px var(--modal-bg), 0 0 0 4px var(--c), 0 0 18px var(--c); }
.cpick-sw.sel::after { content: ''; position: absolute; inset: 0; margin: auto; width: 11px; height: 11px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.cpick-foot { display: flex; align-items: center; gap: var(--s3); }
.cpick-custom { width: 44px; height: 44px; padding: 0; border: 1px solid var(--stroke); border-radius: var(--r-sm);
  background: var(--glass-2); cursor: pointer; overflow: hidden; }
.cpick-custom::-webkit-color-swatch-wrapper { padding: 4px; }
.cpick-custom::-webkit-color-swatch { border: 0; border-radius: 8px; }
.cpick-preview { display: inline-flex; align-items: center; gap: var(--s2); font-size: var(--fs-xs); color: var(--ink-3); font-weight: 600; }
.cpick-preview .chip { width: 26px; height: 26px; border-radius: 8px; background: var(--c); box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }

/* emoji quick-pick row */
.emoji-row { display: flex; gap: var(--s2); flex-wrap: wrap; }
.emoji-btn { width: 40px; height: 40px; border-radius: var(--r-sm); border: 1px solid var(--stroke);
  background: var(--glass-2); cursor: pointer; font-size: 20px; line-height: 1;
  transition: transform var(--dur-fast) var(--ease-spring), border-color var(--dur-fast); }
.emoji-btn:hover { transform: translateY(-2px); border-color: var(--stroke-hi); }
.emoji-btn.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

/* destructive confirm: type-the-name input */
.danger-confirm { display: flex; flex-direction: column; gap: var(--s3); }
.danger-confirm .dc-target { font-family: var(--font-display); font-weight: 800; color: var(--bad); }

@media (max-width: 600px) {
  /* phone: compact month rows (dot markers, no chips) + single-column week list */
  .cal-grid { grid-template-rows: auto repeat(6, minmax(56px, 1fr)); }
  .cal-cell { min-height: 56px; }
  .cal-cell .ev-list { display: none; }
  .cal-cell.has-any::after { content: ''; position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%);
    width: 5px; height: 5px; border-radius: 50%; background: var(--accent-3); }
  .cal-week { grid-template-columns: 1fr; }
  .cal-wbody { min-height: 0; }
  .cal-title { font-size: var(--fs-xl); }
}

/* ── Reduced motion: respect the user, kill ambient animation ─────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .aurora-blob { animation: none; }
}

/* =============================================================================
   HOME / BOARD view (views/home.js) — the TV centerpiece
   -----------------------------------------------------------------------------
   Layout: a hero bar on top, then a 2-column main (week grid + calm side rail),
   then an announcements ticker pinned to the bottom. Built to fill the screen
   without page scroll on a TV, but degrades to scrolling on phones/tablets.
   ============================================================================ */
.home {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: clamp(10px, 1.2vw, 20px);
  min-height: 0; height: 100%;
}

/* tiny avatar variant used in homework chips */
.avatar.xs { --av: 24px; box-shadow: 0 0 0 2px color-mix(in oklab, var(--mc) 70%, transparent), 0 0 0 4px var(--bg-1); }

/* ── Hero bar ──────────────────────────────────────────────────────────────── */
.home .hero {
  display: flex; align-items: center; gap: var(--s6);
  padding: var(--s4) var(--s5);
  background: var(--glass); border: 1px solid var(--stroke); border-radius: var(--r-lg);
  backdrop-filter: blur(20px) saturate(1.15); -webkit-backdrop-filter: blur(20px) saturate(1.15);
  box-shadow: var(--sh-2);
  animation: slide-in var(--dur-slow) var(--ease-out) backwards;
}
.home .hero-left { display: flex; align-items: center; min-width: 0; }
.home .hero-clockblock { display: flex; align-items: center; gap: var(--s5); min-width: 0; }
.home .hero-clock {
  font-family: var(--font-display); font-weight: 800; letter-spacing: -.03em; line-height: .9;
  font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: var(--s2);
}
.home .hero-clock .hm { font-size: clamp(2.4rem, 5.2vw, var(--fs-clock));
  background: linear-gradient(180deg, var(--ink), color-mix(in oklab, var(--ink) 55%, var(--ink-3)));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.home .hero-clock .ap { font-size: var(--fs-lg); font-weight: 700; color: var(--ink-2); }
.home .hero-datewx { display: flex; flex-direction: column; gap: var(--s1); min-width: 0; }
.home .hero-date { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-lg); color: var(--ink); white-space: nowrap; }
.home .hero-wx { display: flex; align-items: center; gap: var(--s2); }
.home .hero-wx .hwx-glyph { width: 30px; height: 30px; color: var(--accent-2); flex: 0 0 auto; }
.home .hero-wx .hwx-glyph svg { width: 30px; height: 30px; }
.home .hero-wx .hwx-temp { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }
.home .hero-wx .hwx-label { font-size: var(--fs-sm); white-space: nowrap; }

/* Roster of member chips on the right of the hero */
.home .hero-roster { display: flex; gap: var(--s3); flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
.home .person-chip {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s2) var(--s4) var(--s2) var(--s2);
  border-radius: var(--r-pill);
  background: color-mix(in oklab, var(--mc, var(--accent)) 12%, var(--glass-2));
  border: 1px solid var(--stroke); min-width: 0;
  animation: slide-in var(--dur-slow) var(--ease-out) backwards;
  transition: transform var(--dur-fast) var(--ease-spring), border-color var(--dur-fast);
}
.home .person-chip:hover { transform: translateY(-2px); border-color: var(--stroke-hi); }
.home .person-meta { min-width: 0; }
.home .person-name { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-md);
  line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 12ch; }
.home .person-stats { display: flex; gap: var(--s3); margin-top: 2px; }
.home .stat-bit { display: inline-flex; align-items: center; gap: 3px; font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.home .stat-bit .sb-ic { display: inline-flex; width: 15px; height: 15px; }
.home .stat-bit .sb-ic svg { width: 15px; height: 15px; }
.home .stat-bit .sb-val { font-weight: 700; }
.home .stat-bit.flame .sb-ic { animation: flicker 2.2s var(--ease-in-out) infinite; }

/* ── Main area: week grid (dominant) + side rail ───────────────────────────── */
.home-main {
  display: grid; gap: clamp(10px, 1.1vw, 18px); min-height: 0;
  grid-template-columns: minmax(0, 1fr) clamp(280px, 22vw, 360px);
  align-items: stretch;
}
.home-week { min-height: 0; height: 100%; align-content: stretch; }

/* per-day column refinements layered on the base .day-col */
.home-day { min-height: 0; }
.home-day .day-wx { gap: var(--s2); }
.home-day .day-wx .dwx-glyph { display: inline-flex; width: 22px; height: 22px; color: var(--accent-2); }
.home-day .day-wx .dwx-glyph svg { width: 22px; height: 22px; }
.home-day .day-wx .precip { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; color: var(--info); font-weight: 600; }
.home-day .day-wx .precip .drop { font-size: .85em; }
.home-day .day-empty { padding: var(--s5) 0; font-size: var(--fs-xs); }

/* event/important pills inside a home column */
.home-day .day-event { align-items: center; }
.home-day .day-event.special .et.sp-ic { display: inline-flex; width: 16px; height: 16px; color: var(--accent-3); }
.home-day .day-event.special .et.sp-ic svg { width: 16px; height: 16px; }

/* homework chip */
.hw-chip {
  display: flex; align-items: center; gap: var(--s2); padding: var(--s1) var(--s2);
  border-radius: var(--r-sm); font-size: var(--fs-2xs); color: var(--ink-2);
  background: color-mix(in oklab, var(--mc, var(--info)) 14%, var(--glass-2));
  border: 1px dashed color-mix(in oklab, var(--mc, var(--info)) 40%, var(--stroke));
}
.hw-chip .hw-ic { display: inline-flex; width: 16px; height: 16px; flex: 0 0 auto; color: var(--mc, var(--info)); }
.hw-chip .hw-ic svg { width: 16px; height: 16px; }
.hw-chip .hw-text { font-weight: 600; }

/* dinner at the bottom of a column */
.home-day .day-meal { margin-top: auto; }
.home-day .day-meal .dm-emoji { font-size: 1.15em; }
.home-day .day-meal .dm-title { font-weight: 600; }

/* chore assignee name truncation safety */
.home .chore .asg { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 10ch; }

/* ── Side rail ─────────────────────────────────────────────────────────────── */
.home-rail { display: flex; flex-direction: column; gap: clamp(10px, 1.1vw, 18px); min-height: 0; overflow: auto; padding-right: 2px; }
.home-card { animation: slide-in var(--dur-slow) var(--ease-out) backwards; }
.home-card:nth-child(2) { animation-delay: .08s; }
.home-card .card-title .ct-ic { display: inline-flex; width: 20px; height: 20px; color: var(--accent-2); }
.home-card .card-title .ct-ic svg { width: 20px; height: 20px; }
.home-rail .mini-cal { gap: var(--s1); }
.home-rail .mini-cal .cell { font-size: var(--fs-xs); }

/* "What's coming up" list */
.upcoming { display: flex; flex-direction: column; gap: var(--s2); }
.up-row {
  display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3);
  border-radius: var(--r-sm); background: var(--glass-2); border: 1px solid var(--stroke);
  border-left: 3px solid var(--mc, var(--accent));
  animation: slide-in var(--dur) var(--ease-out) backwards;
}
.up-row .up-ic { display: inline-flex; width: 22px; height: 22px; flex: 0 0 auto; color: var(--mc, var(--accent)); }
.up-row .up-ic svg { width: 22px; height: 22px; }
.up-meta { min-width: 0; }
.up-title { font-weight: 700; font-size: var(--fs-sm); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-date { font-size: var(--fs-2xs); }
.up-count { text-align: center; flex: 0 0 auto; min-width: 42px; }
.up-count .up-n { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-lg); line-height: 1;
  color: var(--mc, var(--accent)); font-variant-numeric: tabular-nums; }
.up-count .up-u { font-size: var(--fs-2xs); }

/* ── Announcements ticker ──────────────────────────────────────────────────── */
.home-ticker {
  display: flex; align-items: center; gap: var(--s3); min-width: 0;
  padding: var(--s2) var(--s3);
  background: var(--glass); border: 1px solid var(--stroke-hi); border-radius: var(--r-pill);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: var(--sh-1);
  animation: slide-in var(--dur-slow) var(--ease-out) backwards;
}
.home-ticker .tick-badge {
  display: inline-flex; width: 26px; height: 26px; flex: 0 0 auto; padding: 4px; border-radius: 50%;
  color: var(--ink-on-accent); background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 14px var(--accent-glow); animation: bell-ring 4s var(--ease-in-out) infinite;
}
.home-ticker .tick-badge svg { width: 18px; height: 18px; }
.tick-window { overflow: hidden; flex: 1 1 auto; -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
.tick-track { display: inline-flex; align-items: center; gap: var(--s8); white-space: nowrap; will-change: transform; }
.tick-track.scroll { animation: ticker 26s linear infinite; }
.tick-window:hover .tick-track.scroll { animation-play-state: paused; }
.tick-item { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 600; font-size: var(--fs-sm); color: var(--ink); }
.tick-item .ti-emoji { font-size: 1.15em; }
.tick-item[style*="--ac"] { color: color-mix(in oklab, var(--ac) 78%, var(--ink)); }

@keyframes ticker  { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes flicker { 0%,100% { transform: scale(1) rotate(0); } 45% { transform: scale(1.12) rotate(-4deg); } 70% { transform: scale(.96) rotate(3deg); } }
@keyframes bell-ring { 0%,88%,100% { transform: rotate(0); } 91% { transform: rotate(12deg); } 95% { transform: rotate(-9deg); } 98% { transform: rotate(5deg); } }

/* ── Responsive: collapse the rail under the grid, stack on phones ──────────── */
@media (max-width: 1279px) {
  .home-main { grid-template-columns: 1fr; }
  .home-rail { flex-direction: row; overflow: visible; flex-wrap: wrap; }
  .home-rail .home-card { flex: 1 1 280px; }
  .home { grid-template-rows: auto auto auto; height: auto; min-height: 100%; }
}
@media (max-width: 820px) {
  .home .hero { flex-wrap: wrap; gap: var(--s4); }
  .home .hero-roster { justify-content: flex-start; }
}
@media (max-width: 600px) {
  .home .hero-clock .hm { font-size: clamp(2rem, 12vw, 3rem); }
  .home .hero-roster { gap: var(--s2); }
  .home .person-chip { padding: var(--s1) var(--s3) var(--s1) var(--s1); }
  .home .person-name { font-size: var(--fs-sm); }
  .home-rail { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  .tick-track.scroll, .stat-bit.flame .sb-ic, .home-ticker .tick-badge { animation: none !important; }
}

/* =============================================================================
   Additional theme palettes (selectable in Settings -> Look & feel).
   Each theme defines a NIGHT (dark) and DAY (light) variant; app.js derives the
   mode from the night window. Only the accent ramp + aurora blobs change per
   theme; every component reads the tokens, so nothing else needs to know.
   ============================================================================ */

/* -- Sunset -- */
[data-theme="sunset"][data-mode="night"] {
  --bg-0:#120710; --bg-1:#1c0a16; --ink:#fff0ef; --ink-2:#f0c9c6; --ink-3:#bd8e92; --ink-on-accent:#2a0a12;
  --glass:rgba(58,26,40,.55); --glass-2:rgba(72,32,48,.66); --glass-hi:rgba(96,44,64,.72);
  --stroke:rgba(255,140,150,.16); --stroke-hi:rgba(255,150,160,.34); --modal-bg:#1b0c14;
  --accent:#ff8b6b; --accent-2:#ff5da2; --accent-3:#ffd166;
  --accent-soft:rgba(255,139,107,.18); --accent-glow:rgba(255,93,162,.5);
  --good:#54e3a8; --warn:#ffd166; --bad:#ff6b8b; --info:#62d2ff;
  --aur-1:#d6453b; --aur-2:#d64b9a; --aur-3:#ff8a3b; --aur-4:#3a1024;
  --sh-1:0 1px 2px rgba(0,0,0,.4); --sh-2:0 8px 30px rgba(0,0,0,.45); --sh-3:0 20px 60px rgba(0,0,0,.55);
  --sh-glow:0 0 0 1px var(--stroke),0 18px 50px rgba(40,6,24,.6);
  --tv-vignette:radial-gradient(120% 90% at 50% -10%,transparent 40%,rgba(0,0,0,.35) 100%);
}
[data-theme="sunset"][data-mode="day"] {
  --bg-0:#fff1ec; --bg-1:#ffe4dc; --ink:#3a1622; --ink-2:#6e3848; --ink-3:#a16f78; --ink-on-accent:#fff;
  --glass:rgba(255,255,255,.62); --glass-2:rgba(255,255,255,.76); --glass-hi:rgba(255,255,255,.9);
  --stroke:rgba(200,90,110,.14); --stroke-hi:rgba(210,80,120,.28); --modal-bg:#fff;
  --accent:#ff6b4d; --accent-2:#f0468f; --accent-3:#e0a020;
  --accent-soft:rgba(255,107,77,.14); --accent-glow:rgba(240,70,143,.4);
  --good:#16b377; --warn:#d99411; --bad:#e23b63; --info:#1796d6;
  --aur-1:#ffb1a0; --aur-2:#ffa6cf; --aur-3:#ffd0a6; --aur-4:#ffdcd6;
  --sh-1:0 1px 2px rgba(120,30,40,.08); --sh-2:0 10px 30px rgba(140,50,60,.12); --sh-3:0 24px 60px rgba(140,50,60,.18);
  --sh-glow:0 0 0 1px var(--stroke),0 18px 50px rgba(200,80,100,.18);
  --tv-vignette:radial-gradient(120% 90% at 50% -10%,transparent 55%,rgba(200,110,120,.12) 100%);
}

/* -- Forest -- */
[data-theme="forest"][data-mode="night"] {
  --bg-0:#06100b; --bg-1:#0a1a12; --ink:#eafff3; --ink-2:#bfe6cf; --ink-3:#84b39a; --ink-on-accent:#06160d;
  --glass:rgba(24,52,38,.55); --glass-2:rgba(30,64,46,.66); --glass-hi:rgba(40,84,60,.72);
  --stroke:rgba(120,230,170,.16); --stroke-hi:rgba(130,255,180,.34); --modal-bg:#0c1a13;
  --accent:#54e3a8; --accent-2:#3fb8af; --accent-3:#a7e34f;
  --accent-soft:rgba(84,227,168,.18); --accent-glow:rgba(63,184,175,.5);
  --good:#54e3a8; --warn:#ffd166; --bad:#ff6b8b; --info:#62d2ff;
  --aur-1:#1f9d6b; --aur-2:#3fb8af; --aur-3:#7bcf3b; --aur-4:#0c2a1c;
  --sh-1:0 1px 2px rgba(0,0,0,.4); --sh-2:0 8px 30px rgba(0,0,0,.45); --sh-3:0 20px 60px rgba(0,0,0,.55);
  --sh-glow:0 0 0 1px var(--stroke),0 18px 50px rgba(4,30,18,.6);
  --tv-vignette:radial-gradient(120% 90% at 50% -10%,transparent 40%,rgba(0,0,0,.35) 100%);
}
[data-theme="forest"][data-mode="day"] {
  --bg-0:#eefcf3; --bg-1:#e0f6e8; --ink:#0f2a1c; --ink-2:#356048; --ink-3:#6f9a82; --ink-on-accent:#06160d;
  --glass:rgba(255,255,255,.62); --glass-2:rgba(255,255,255,.76); --glass-hi:rgba(255,255,255,.9);
  --stroke:rgba(40,150,100,.14); --stroke-hi:rgba(40,160,110,.28); --modal-bg:#fff;
  --accent:#16b377; --accent-2:#1f9d8f; --accent-3:#5aa820;
  --accent-soft:rgba(22,179,119,.14); --accent-glow:rgba(31,157,143,.4);
  --good:#16b377; --warn:#d99411; --bad:#e23b63; --info:#1796d6;
  --aur-1:#a6e3c2; --aur-2:#a6e0dc; --aur-3:#cde6a6; --aur-4:#d6f0e0;
  --sh-1:0 1px 2px rgba(20,80,50,.08); --sh-2:0 10px 30px rgba(30,100,60,.12); --sh-3:0 24px 60px rgba(30,100,60,.18);
  --sh-glow:0 0 0 1px var(--stroke),0 18px 50px rgba(40,140,90,.18);
  --tv-vignette:radial-gradient(120% 90% at 50% -10%,transparent 55%,rgba(80,160,120,.12) 100%);
}

/* -- Ocean -- */
[data-theme="ocean"][data-mode="night"] {
  --bg-0:#050d16; --bg-1:#081626; --ink:#eaf6ff; --ink-2:#bcdcf2; --ink-3:#7fa6c4; --ink-on-accent:#04121e;
  --glass:rgba(20,44,68,.55); --glass-2:rgba(26,56,84,.66); --glass-hi:rgba(36,76,110,.72);
  --stroke:rgba(120,200,255,.16); --stroke-hi:rgba(130,210,255,.34); --modal-bg:#0a1826;
  --accent:#62d2ff; --accent-2:#5b8cff; --accent-3:#54e3c8;
  --accent-soft:rgba(98,210,255,.18); --accent-glow:rgba(91,140,255,.5);
  --good:#54e3a8; --warn:#ffd166; --bad:#ff6b8b; --info:#62d2ff;
  --aur-1:#2e6fff; --aur-2:#3bbfd6; --aur-3:#2eb6ff; --aur-4:#0a2240;
  --sh-1:0 1px 2px rgba(0,0,0,.4); --sh-2:0 8px 30px rgba(0,0,0,.45); --sh-3:0 20px 60px rgba(0,0,0,.55);
  --sh-glow:0 0 0 1px var(--stroke),0 18px 50px rgba(4,18,40,.6);
  --tv-vignette:radial-gradient(120% 90% at 50% -10%,transparent 40%,rgba(0,0,0,.35) 100%);
}
[data-theme="ocean"][data-mode="day"] {
  --bg-0:#ecf6ff; --bg-1:#dcecfb; --ink:#0e2236; --ink-2:#33546f; --ink-3:#6f90a8; --ink-on-accent:#fff;
  --glass:rgba(255,255,255,.62); --glass-2:rgba(255,255,255,.76); --glass-hi:rgba(255,255,255,.9);
  --stroke:rgba(40,120,190,.14); --stroke-hi:rgba(40,130,200,.28); --modal-bg:#fff;
  --accent:#1796d6; --accent-2:#3b6cff; --accent-3:#16b3a0;
  --accent-soft:rgba(23,150,214,.14); --accent-glow:rgba(59,108,255,.4);
  --good:#16b377; --warn:#d99411; --bad:#e23b63; --info:#1796d6;
  --aur-1:#a6c6ff; --aur-2:#a6e0ec; --aur-3:#a6d6ff; --aur-4:#d6e6ff;
  --sh-1:0 1px 2px rgba(30,60,120,.08); --sh-2:0 10px 30px rgba(40,80,140,.12); --sh-3:0 24px 60px rgba(40,80,140,.18);
  --sh-glow:0 0 0 1px var(--stroke),0 18px 50px rgba(50,100,180,.18);
  --tv-vignette:radial-gradient(120% 90% at 50% -10%,transparent 55%,rgba(90,130,200,.12) 100%);
}

/* -- Candy -- */
[data-theme="candy"][data-mode="night"] {
  --bg-0:#0e0716; --bg-1:#170a24; --ink:#fbeeff; --ink-2:#e0c6ef; --ink-3:#a98bc0; --ink-on-accent:#1a0822;
  --glass:rgba(48,26,64,.55); --glass-2:rgba(60,32,82,.66); --glass-hi:rgba(80,44,108,.72);
  --stroke:rgba(220,140,255,.16); --stroke-hi:rgba(230,150,255,.34); --modal-bg:#150a1f;
  --accent:#ff6cc4; --accent-2:#b56cff; --accent-3:#62d2ff;
  --accent-soft:rgba(255,108,196,.18); --accent-glow:rgba(181,108,255,.5);
  --good:#54e3a8; --warn:#ffd166; --bad:#ff6b8b; --info:#62d2ff;
  --aur-1:#d63bb0; --aur-2:#8c3bd6; --aur-3:#3b9fd6; --aur-4:#240a36;
  --sh-1:0 1px 2px rgba(0,0,0,.4); --sh-2:0 8px 30px rgba(0,0,0,.45); --sh-3:0 20px 60px rgba(0,0,0,.55);
  --sh-glow:0 0 0 1px var(--stroke),0 18px 50px rgba(24,6,40,.6);
  --tv-vignette:radial-gradient(120% 90% at 50% -10%,transparent 40%,rgba(0,0,0,.35) 100%);
}
[data-theme="candy"][data-mode="day"] {
  --bg-0:#fdeefb; --bg-1:#f6e0fb; --ink:#2a0e2a; --ink-2:#5c3060; --ink-3:#946f99; --ink-on-accent:#fff;
  --glass:rgba(255,255,255,.62); --glass-2:rgba(255,255,255,.76); --glass-hi:rgba(255,255,255,.9);
  --stroke:rgba(190,90,180,.14); --stroke-hi:rgba(200,80,190,.28); --modal-bg:#fff;
  --accent:#e052b8; --accent-2:#9a52e0; --accent-3:#1796d6;
  --accent-soft:rgba(224,82,184,.14); --accent-glow:rgba(154,82,224,.4);
  --good:#16b377; --warn:#d99411; --bad:#e23b63; --info:#1796d6;
  --aur-1:#f0a6e0; --aur-2:#c6a6f0; --aur-3:#a6d6f0; --aur-4:#f0d6f6;
  --sh-1:0 1px 2px rgba(100,30,90,.08); --sh-2:0 10px 30px rgba(120,50,110,.12); --sh-3:0 24px 60px rgba(120,50,110,.18);
  --sh-glow:0 0 0 1px var(--stroke),0 18px 50px rgba(180,80,160,.18);
  --tv-vignette:radial-gradient(120% 90% at 50% -10%,transparent 55%,rgba(180,110,170,.12) 100%);
}

/* -- Graphite (mono) -- */
[data-theme="mono"][data-mode="night"] {
  --bg-0:#0a0b10; --bg-1:#12131b; --ink:#f2f3f8; --ink-2:#c6c9d8; --ink-3:#878ba0; --ink-on-accent:#0c0e16;
  --glass:rgba(36,38,50,.55); --glass-2:rgba(46,48,64,.66); --glass-hi:rgba(62,64,84,.72);
  --stroke:rgba(160,170,200,.16); --stroke-hi:rgba(170,180,210,.34); --modal-bg:#14151d;
  --accent:#9aa3c0; --accent-2:#c6c3e6; --accent-3:#6f7aa0;
  --accent-soft:rgba(154,163,192,.18); --accent-glow:rgba(154,163,192,.4);
  --good:#54e3a8; --warn:#ffd166; --bad:#ff6b8b; --info:#62d2ff;
  --aur-1:#3a4060; --aur-2:#50567a; --aur-3:#2e3450; --aur-4:#161824;
  --sh-1:0 1px 2px rgba(0,0,0,.4); --sh-2:0 8px 30px rgba(0,0,0,.45); --sh-3:0 20px 60px rgba(0,0,0,.55);
  --sh-glow:0 0 0 1px var(--stroke),0 18px 50px rgba(8,10,20,.6);
  --tv-vignette:radial-gradient(120% 90% at 50% -10%,transparent 40%,rgba(0,0,0,.35) 100%);
}
[data-theme="mono"][data-mode="day"] {
  --bg-0:#f1f2f6; --bg-1:#e6e8ef; --ink:#161824; --ink-2:#444862; --ink-3:#787c92; --ink-on-accent:#fff;
  --glass:rgba(255,255,255,.62); --glass-2:rgba(255,255,255,.76); --glass-hi:rgba(255,255,255,.9);
  --stroke:rgba(80,84,110,.14); --stroke-hi:rgba(80,84,120,.28); --modal-bg:#fff;
  --accent:#5a6080; --accent-2:#7a80a0; --accent-3:#454a66;
  --accent-soft:rgba(90,96,128,.14); --accent-glow:rgba(90,96,128,.34);
  --good:#16b377; --warn:#d99411; --bad:#e23b63; --info:#1796d6;
  --aur-1:#c2c6d6; --aur-2:#d0d2e0; --aur-3:#b6bacc; --aur-4:#dcdee8;
  --sh-1:0 1px 2px rgba(40,44,70,.08); --sh-2:0 10px 30px rgba(50,54,90,.12); --sh-3:0 24px 60px rgba(50,54,90,.18);
  --sh-glow:0 0 0 1px var(--stroke),0 18px 50px rgba(70,74,110,.18);
  --tv-vignette:radial-gradient(120% 90% at 50% -10%,transparent 55%,rgba(110,114,150,.12) 100%);
}

/* =============================================================================
   Settings view (views/settings.js)
   ============================================================================ */
.set-wrap { max-width: 1180px; margin: 0 auto; width: 100%; }
.set-pagehead { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s5); flex-wrap: wrap; }
.set-pagehead h1 { font-size: var(--fs-2xl); }
.set-grid { display: grid; gap: var(--s5); grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); align-items: start; }
.set-card { animation: slide-in var(--dur-slow) var(--ease-out) backwards; }
.set-grid > .set-card:nth-child(2){animation-delay:.04s}.set-grid > .set-card:nth-child(3){animation-delay:.08s}
.set-grid > .set-card:nth-child(4){animation-delay:.12s}.set-grid > .set-card:nth-child(5){animation-delay:.16s}
.set-grid > .set-card:nth-child(6){animation-delay:.2s}
.set-head { display: flex; align-items: flex-start; gap: var(--s3); margin-bottom: var(--s2); }
.set-ic { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-2); }
.set-ic svg { width: 22px; height: 22px; }
.set-ic-sm { display: inline-grid; place-items: center; width: 20px; height: 20px; color: var(--accent-2); flex: 0 0 auto; }
.set-ic-sm svg { width: 18px; height: 18px; }
.set-title { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-md); color: var(--ink); }
.set-sub { color: var(--ink-3); font-size: var(--fs-xs); }
.set-cur { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-sm); color: var(--ink-2);
  padding: var(--s2) var(--s3); border-radius: var(--r-sm); background: var(--glass-2); border: 1px solid var(--stroke); }
.set-coord { font-size: var(--fs-2xs); font-variant-numeric: tabular-nums; margin-left: auto; }
.set-footer { display: flex; justify-content: center; margin-top: var(--s6); }

/* theme picker */
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); }
.theme-tile { display: flex; flex-direction: column; gap: var(--s2); align-items: center; cursor: pointer;
  padding: var(--s2); border-radius: var(--r-md); border: 1px solid transparent; background: transparent;
  transition: border-color var(--dur-fast), transform var(--dur-fast) var(--ease-spring); }
.theme-tile:hover { transform: translateY(-2px); }
.theme-tile.sel { border-color: var(--stroke-hi); background: var(--glass-2); }
.theme-prev { width: 100%; aspect-ratio: 16/10; border-radius: var(--r-sm); position: relative;
  box-shadow: var(--sh-1); display: grid; place-items: center; }
.theme-check { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(0,0,0,.35); color: #fff; opacity: 0; transform: scale(.5);
  transition: opacity var(--dur-fast), transform var(--dur-fast) var(--ease-spring); }
.theme-check svg { width: 16px; height: 16px; }
.theme-tile.sel .theme-check { opacity: 1; transform: scale(1); }
.theme-name { font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); }

/* geocode results */
.geo-results { display: flex; flex-direction: column; gap: 6px; }
.geo-results:empty { display: none; }
.geo-hit { display: flex; align-items: center; gap: var(--s2); width: 100%; text-align: left;
  padding: var(--s2) var(--s3); border-radius: var(--r-sm); cursor: pointer;
  background: var(--glass-2); border: 1px solid var(--stroke); color: var(--ink); font-size: var(--fs-sm);
  transition: border-color var(--dur-fast), transform var(--dur-fast); }
.geo-hit:hover { border-color: var(--stroke-hi); transform: translateX(2px); }

/* in-card toggle row */
.set-toggle { display: flex; align-items: center; gap: var(--s4); padding-top: var(--s2); }
.set-toggle-t { font-weight: 600; font-size: var(--fs-sm); }

/* on/off switch */
.switch { position: relative; display: inline-flex; flex: 0 0 auto; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track { width: 52px; height: 30px; border-radius: var(--r-pill); background: var(--glass-hi);
  border: 1px solid var(--stroke); display: inline-flex; align-items: center; padding: 3px;
  transition: background var(--dur-fast), border-color var(--dur-fast); }
.switch-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--ink-3);
  box-shadow: var(--sh-1); transition: transform var(--dur) var(--ease-spring), background var(--dur-fast); }
.switch input:checked + .switch-track { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(22px); background: #fff; }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px var(--accent-soft); }

/* =============================================================================
   Remote view (views/remote.js)
   ============================================================================ */
.rmt-wrap { max-width: 720px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; gap: var(--s5); }
.rmt-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4); }
.rmt-head h1 { font-size: var(--fs-2xl); }
.rmt-tv-pill { display: inline-flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s4);
  border-radius: var(--r-pill); background: var(--glass); border: 1px solid var(--stroke);
  font-size: var(--fs-xs); font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.rmt-tv-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); flex: 0 0 auto;
  transition: background var(--dur-fast), box-shadow var(--dur-fast); }
.rmt-tv-pill.ok { color: var(--ink); border-color: var(--stroke-hi); }
.rmt-tv-pill.ok .rmt-tv-dot { background: var(--good); box-shadow: 0 0 12px var(--good); animation: pulse-soft 2.4s var(--ease-in-out) infinite; }

.rmt-section-h { display: flex; align-items: center; gap: var(--s2); font-family: var(--font-display);
  font-weight: 700; font-size: var(--fs-sm); color: var(--ink-2); margin-bottom: var(--s3);
  text-transform: uppercase; letter-spacing: .05em; }
.rmt-section-h svg { width: 18px; height: 18px; color: var(--accent-2); }

.rmt-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s3); }
.rmt-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s3);
  min-height: 116px; padding: var(--s5) var(--s4); border-radius: var(--r-lg); cursor: pointer;
  background: var(--glass); border: 1px solid var(--stroke); color: var(--ink);
  box-shadow: var(--sh-1);
  transition: transform var(--dur-fast) var(--ease-spring), border-color var(--dur-fast), box-shadow var(--dur-fast); }
.rmt-tile:hover { transform: translateY(-3px); border-color: var(--stroke-hi); box-shadow: var(--sh-2); }
.rmt-tile:active { transform: scale(.97); }
.rmt-tile-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-2); }
.rmt-tile-ic svg { width: 26px; height: 26px; }
.rmt-tile-label { font-weight: 600; font-size: var(--fs-sm); text-align: center; }
.rmt-tile.add .rmt-tile-ic { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--ink-on-accent);
  box-shadow: 0 6px 16px var(--accent-glow); }

.rmt-amb-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s3); }
.rmt-amb { flex-direction: column; gap: var(--s2); padding: var(--s4) var(--s2); border-radius: var(--r-md); }
.rmt-amb svg { width: 22px; height: 22px; }

@media (max-width: 600px) {
  .rmt-amb-row { grid-template-columns: repeat(2, 1fr); }
}

/* shared emoji picker (used by remote announcement quick-add) */
.emoji-pick { display: flex; flex-wrap: wrap; gap: var(--s2); }
.emoji-opt { width: 44px; height: 44px; border-radius: var(--r-sm); font-size: 1.4rem; cursor: pointer;
  display: grid; place-items: center; background: var(--glass-2); border: 1px solid var(--stroke);
  transition: transform var(--dur-fast) var(--ease-spring), border-color var(--dur-fast); }
.emoji-opt:hover { transform: scale(1.08); }
.emoji-opt.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); transform: scale(1.06); }

/* =============================================================================
   Auth views (views/auth.js — login + setup)
   ============================================================================ */
.auth-card { width: min(440px, 100%); }
.auth-checks { display: flex; flex-direction: column; gap: var(--s2); }
.auth-check { display: flex; align-items: center; gap: var(--s3); cursor: pointer; user-select: none;
  padding: var(--s2) var(--s3); border-radius: var(--r-sm); transition: background var(--dur-fast); }
.auth-check:hover { background: var(--glass-2); }
.auth-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.auth-check-box { width: 24px; height: 24px; flex: 0 0 auto; border-radius: 7px; display: grid; place-items: center;
  border: 2px solid var(--stroke-hi); color: transparent; background: var(--glass-2);
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast); }
.auth-check-box svg { width: 15px; height: 15px; }
.auth-check.on .auth-check-box { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: var(--ink-on-accent); }
.auth-check span:last-child { font-size: var(--fs-sm); color: var(--ink-2); font-weight: 600; }
.auth-collapse { animation: slide-in var(--dur) var(--ease-out); }
.auth-submit { width: 100%; margin-top: var(--s2); }
.auth-shake { animation: auth-shake .42s var(--ease-in-out); }
@keyframes auth-shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-9px)} 40%{transform:translateX(8px)} 60%{transform:translateX(-6px)} 80%{transform:translateX(4px)} }
@media (prefers-reduced-motion: reduce) { .auth-shake { animation: none; } }
