/* Aurelis Chat — mobile-first.
   data-mode (light|schemer|donker) owns surfaces.
   data-theme tints accents and a light wash via --season-tint / --wash.
   Registered colors so a mode change eases instead of flashing. */
@property --bg { syntax: "<color>"; inherits: true; initial-value: #18191a; }
@property --panel { syntax: "<color>"; inherits: true; initial-value: #242526; }
@property --card { syntax: "<color>"; inherits: true; initial-value: #242526; }
@property --text { syntax: "<color>"; inherits: true; initial-value: #e4e6eb; }
@property --muted { syntax: "<color>"; inherits: true; initial-value: #b0b3b8; }
@property --border { syntax: "<color>"; inherits: true; initial-value: #3e4042; }
@property --compose-bg { syntax: "<color>"; inherits: true; initial-value: #242526; }
@property --msg-me { syntax: "<color>"; inherits: true; initial-value: #3a3b3c; }
@property --input-bg { syntax: "<color>"; inherits: true; initial-value: #3a3b3c; }
@property --hover { syntax: "<color>"; inherits: true; initial-value: #3a3b3c; }
@property --link { syntax: "<color>"; inherits: true; initial-value: #8ab4f8; }
@property --chip-bg { syntax: "<color>"; inherits: true; initial-value: #3a3b3c; }

@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
  --accent: #6366f1;
  --accent-2: #a855f7;
  --yellow: #ffcc00;
  --bot: #22c55e;
  --danger: #ef4444;
  --season-tint: #6366f1;
  --wash: 0%;
  --radius-sm: 8px;
  --radius: 16px;
  --space: 8px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 560ms;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --touch: 44px;
  --check: 20px;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  letter-spacing: -0.011em;
  color-scheme: dark;
  /* Donker fallback so the first paint stays dark if mode JS has not run. */
  --bg: color-mix(in srgb, var(--season-tint) var(--wash), #18191a);
  --panel: color-mix(in srgb, var(--season-tint) var(--wash), #242526);
  --card: color-mix(in srgb, var(--season-tint) var(--wash), #242526);
  --text: #e4e6eb;
  --muted: #b0b3b8;
  --border: color-mix(in srgb, var(--season-tint) var(--wash), #3e4042);
  --compose-bg: color-mix(in srgb, var(--season-tint) var(--wash), #242526);
  --msg-me: color-mix(in srgb, var(--season-tint) var(--wash), #3a3b3c);
  --input-bg: color-mix(in srgb, var(--season-tint) var(--wash), #3a3b3c);
  --hover: color-mix(in srgb, var(--season-tint) var(--wash), #3a3b3c);
  --link: #8ab4f8;
  --chip-bg: color-mix(in srgb, var(--season-tint) var(--wash), #3a3b3c);
  --avatar-bg: #3a3b3c;
  --avatar-fg: #fff;
  --pill-bg: #3a3b3c;
  --pill-fg: #e4e6eb;
  --theme-color: #18191a;
  --badge-fg: var(--yellow);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 12px 28px rgba(0, 0, 0, .28);
  --on-accent: #fff;
}

[data-mode="donker"] {
  color-scheme: dark;
  --bg: color-mix(in srgb, var(--season-tint) var(--wash), #18191a);
  --panel: color-mix(in srgb, var(--season-tint) var(--wash), #242526);
  --card: color-mix(in srgb, var(--season-tint) var(--wash), #242526);
  --text: #e4e6eb;
  --muted: #b0b3b8;
  --border: color-mix(in srgb, var(--season-tint) var(--wash), #3e4042);
  --compose-bg: color-mix(in srgb, var(--season-tint) var(--wash), #242526);
  --msg-me: color-mix(in srgb, var(--season-tint) var(--wash), #3a3b3c);
  --input-bg: color-mix(in srgb, var(--season-tint) var(--wash), #3a3b3c);
  --hover: color-mix(in srgb, var(--season-tint) var(--wash), #3a3b3c);
  --link: #8ab4f8;
  --chip-bg: color-mix(in srgb, var(--season-tint) var(--wash), #3a3b3c);
  --avatar-bg: #3a3b3c;
  --avatar-fg: #fff;
  --pill-bg: #3a3b3c;
  --pill-fg: #e4e6eb;
  --theme-color: #18191a;
  --badge-fg: #f7f8fa;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 12px 28px rgba(0, 0, 0, .28);
  --on-accent: #fff;
}

[data-mode="schemer"] {
  color-scheme: dark;
  --bg: color-mix(in srgb, var(--season-tint) var(--wash), #1c1822);
  --panel: color-mix(in srgb, var(--season-tint) var(--wash), #2a2432);
  --card: color-mix(in srgb, var(--season-tint) var(--wash), #322b3a);
  --text: #f5f0ea;
  --muted: #c9beb4;
  --border: color-mix(in srgb, var(--season-tint) var(--wash), #4a4152);
  --compose-bg: color-mix(in srgb, var(--season-tint) var(--wash), #2a2432);
  --msg-me: color-mix(in srgb, var(--season-tint) var(--wash), #3d3450);
  --input-bg: color-mix(in srgb, var(--season-tint) var(--wash), #241f2c);
  --hover: color-mix(in srgb, var(--season-tint) var(--wash), #3a3344);
  --link: #f0d2b0;
  --chip-bg: color-mix(in srgb, var(--season-tint) var(--wash), #241f2c);
  --avatar-bg: #4a4158;
  --avatar-fg: #fff;
  --pill-bg: #3a3344;
  --pill-fg: #f5f0ea;
  --theme-color: #1c1822;
  --badge-fg: #f7f1ea;
  --shadow: 0 1px 2px rgba(0, 0, 0, .28), 0 12px 28px rgba(28, 16, 32, .24);
  --on-accent: #fff;
}

[data-mode="light"] {
  color-scheme: light;
  --bg: color-mix(in srgb, var(--season-tint) var(--wash), #f0f2f5);
  --panel: color-mix(in srgb, var(--season-tint) var(--wash), #ffffff);
  --card: color-mix(in srgb, var(--season-tint) var(--wash), #ffffff);
  --text: #050505;
  --muted: #65676b;
  --border: color-mix(in srgb, var(--season-tint) var(--wash), #e4e6eb);
  --compose-bg: color-mix(in srgb, var(--season-tint) var(--wash), #ffffff);
  --msg-me: color-mix(in srgb, var(--season-tint) var(--wash), #e7f3ff);
  --input-bg: color-mix(in srgb, var(--season-tint) var(--wash), #f0f2f5);
  --hover: color-mix(in srgb, var(--season-tint) var(--wash), #f2f3f5);
  --link: #0866ff;
  --chip-bg: color-mix(in srgb, var(--season-tint) var(--wash), #f0f2f5);
  --avatar-bg: #e4e6eb;
  --avatar-fg: #050505;
  --pill-bg: #e4e6eb;
  --pill-fg: #050505;
  --theme-color: #f0f2f5;
  --badge-fg: #050505;
  --shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 8px 24px rgba(0, 0, 0, .06);
  --on-accent: #fff;
}

/* Seasons tint accents. Surfaces stay with data-mode. */
[data-theme="default"] { --wash: 0%; }
[data-theme="halloween"] {
  --accent: #f97316; --accent-2: #a855f7; --yellow: #fb923c; --bot: #84cc16;
  --season-tint: #7c3aed; --wash: 16%;
}
[data-theme="christmas"] {
  --accent: #dc2626; --accent-2: #16a34a; --yellow: #fbbf24; --bot: #22c55e;
  --season-tint: #166534; --wash: 12%;
}
[data-theme="newyear"] {
  --accent: #d4af37; --accent-2: #f5e6c8; --yellow: #f0d78c; --bot: #e8c547;
  --season-tint: #a16207; --wash: 10%;
}
[data-theme="spring"] {
  --accent: #f9a8d4; --accent-2: #86efac; --yellow: #fde68a; --bot: #4ade80;
  --season-tint: #f9a8d4; --wash: 14%;
}
[data-theme="summer"] {
  --accent: #fb923c; --accent-2: #38bdf8; --yellow: #fbbf24; --bot: #34d399;
  --season-tint: #fb923c; --wash: 12%;
}
/* Light surfaces need a lighter wash so text contrast holds. */
[data-mode="light"][data-theme="halloween"] { --wash: 8%; }
[data-mode="light"][data-theme="christmas"] { --wash: 7%; }
[data-mode="light"][data-theme="newyear"] { --wash: 6%; }
[data-mode="light"][data-theme="spring"] { --wash: 8%; }
[data-mode="light"][data-theme="summer"] { --wash: 7%; }
[data-mode="schemer"][data-theme="halloween"] { --wash: 12%; }
[data-mode="schemer"][data-theme="christmas"] { --wash: 9%; }
[data-mode="schemer"][data-theme="newyear"] { --wash: 8%; }
[data-mode="schemer"][data-theme="spring"] { --wash: 10%; }
[data-mode="schemer"][data-theme="summer"] { --wash: 9%; }

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--text);
  overflow-x: hidden;
}
html[data-mode-animate] {
  transition:
    --bg var(--dur) var(--ease), --panel var(--dur) var(--ease), --card var(--dur) var(--ease),
    --text var(--dur) var(--ease), --muted var(--dur) var(--ease), --border var(--dur) var(--ease),
    --compose-bg var(--dur) var(--ease), --msg-me var(--dur) var(--ease), --input-bg var(--dur) var(--ease),
    --hover var(--dur) var(--ease), --link var(--dur) var(--ease), --chip-bg var(--dur) var(--ease),
    background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
html[data-mode-animate] .card,
html[data-mode-animate] .sidebar,
html[data-mode-animate] .family-side,
html[data-mode-animate] .msg,
html[data-mode-animate] .top,
html[data-mode-animate] .compose,
html[data-mode-animate] .season-badge,
html[data-mode-animate] .moon-badge {
  transition:
    background-color var(--dur) var(--ease),
    color var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}
body {
  min-height: 100dvh;
  padding: var(--safe-top) var(--safe-right) 0 var(--safe-left);
}
a { color: var(--link); }
button, a, input, textarea { touch-action: manipulation; }

/* Login */
.login-wrap { max-width: 400px; margin: 8vh auto; padding: 1rem; width: 100%; }
.brand { display: flex; gap: .75rem; align-items: center; margin-bottom: 1rem; }
.mark {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.brand h1 { margin: 0; font-size: 1.2rem; }
.brand p { margin: 0; color: var(--muted); font-size: .85rem; }
.card {
  background: var(--card); border: 0;
  border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow);
}
label { display: block; font-size: .8rem; color: var(--muted); margin: .6rem 0 .25rem; }
input, textarea, select {
  width: 100%; padding: 8px 12px; border-radius: var(--radius-sm);
  border: 0; background: var(--input-bg); color: var(--text);
  font: inherit; font-size: 16px; min-height: var(--touch);
  box-shadow: inset 0 0 0 1px var(--border);
}
input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: var(--check);
  height: var(--check);
  min-width: var(--check);
  min-height: var(--check);
  max-width: var(--check);
  flex: 0 0 var(--check);
  margin: 0;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 2px solid color-mix(in srgb, var(--accent) 55%, var(--border));
  background-color: var(--input-bg);
  background-image: none;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px 12px;
  display: inline-block;
  vertical-align: middle;
  cursor: pointer;
  accent-color: var(--accent);
}
input[type="checkbox"]:checked {
  background-color: var(--accent);
  border-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E");
}
input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn {
  border: none; border-radius: var(--radius-sm); padding: 8px 16px;
  min-height: var(--touch); min-width: var(--touch);
  background: var(--accent); color: var(--on-accent, #fff); font-weight: 600; cursor: pointer;
  font-size: 15px; letter-spacing: -0.01em;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}
.btn:active { transform: scale(0.98); }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); box-shadow: none; }
[data-theme="spring"] .btn:not(.ghost):not(.danger) { color: #4a1942; }
[data-theme="newyear"] .btn:not(.ghost):not(.danger) { color: #1c1404; }
.btn.danger { background: var(--danger); }
.err { color: var(--danger); min-height: 1.2em; margin-top: .5rem; font-size: .9rem; }

/* App shell — mobile: single column, sidebar drawer */
.app {
  display: grid;
  grid-template-columns: 1fr;
  height: 100dvh;
  height: calc(100dvh - var(--safe-top));
  max-width: 100vw;
  overflow: hidden;
  position: relative;
}

.nav-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--touch); height: var(--touch); min-width: var(--touch);
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--card); color: var(--text); cursor: pointer;
  font-size: 1.25rem; line-height: 1; padding: 0; flex-shrink: 0;
}
.nav-toggle[aria-expanded="true"] {
  background: var(--accent); color: #fff; border-color: var(--accent);
}

.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,.45);
  -webkit-tap-highlight-color: transparent;
}
.app.nav-open .sidebar-backdrop { display: block; }

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 16px;
  padding-bottom: calc(16px + var(--safe-bottom));
  display: flex; flex-direction: column; gap: 16px;
  position: fixed;
  top: var(--safe-top); left: 0; bottom: 0;
  width: min(280px, 86vw);
  z-index: 100;
  transform: translateX(-105%);
  transition: transform .22s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.app.nav-open .sidebar {
  transform: translateX(0);
  box-shadow: 8px 0 32px rgba(0,0,0,.35);
}

.room {
  padding: .65rem .7rem; border-radius: 10px; cursor: pointer;
  color: var(--muted); min-height: var(--touch);
  display: flex; align-items: center;
}
.room.active, .room:hover { background: var(--hover); color: var(--text); }
.links {
  font-size: .85rem; display: flex; flex-direction: column; gap: .35rem; margin-top: auto;
}
.links a {
  min-height: var(--touch); display: flex; align-items: center;
  text-decoration: none; color: var(--link);
  padding: .35rem .6rem; border-radius: 10px;
  font-weight: 600;
}
.links a:hover, .links a:focus-visible { background: var(--hover); }

.main {
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  height: 100%; width: 100%;
}

.top {
  display: flex; justify-content: space-between; align-items: center;
  gap: .5rem;
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  flex-shrink: 0;
  min-height: calc(var(--touch) + .5rem);
  position: relative;
}
.top-left { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.top-left strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-bots {
  color: var(--muted); font-size: .75rem; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 42vw;
}
.badge-row {
  display: flex; align-items: center; justify-content: flex-end;
  gap: .3rem;   flex-shrink: 0; flex-wrap: wrap;
}
.season-badge,
.moon-badge {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; line-height: 1.2; padding: 4px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  color: var(--badge-fg, var(--text));
  border: 0;
  box-shadow: var(--shadow);
  flex-shrink: 0; white-space: nowrap;
}
.season-badge[hidden],
.moon-badge[hidden] { display: none !important; }
.moon-svg {
  width: 20px; height: 20px; display: block; flex: 0 0 20px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .28));
}
.moon-shade { opacity: .94; }
.moon-ring { fill: none; stroke: rgba(255, 255, 255, .55); stroke-width: .8; }
.moon-glint { fill: rgba(255, 255, 255, .7); }
.moon-copy { display: inline-flex; align-items: baseline; gap: 4px; }
.moon-pct { font-variant-numeric: tabular-nums; font-weight: 500; color: var(--muted); }
.sidebar .moon-svg { width: 28px; height: 28px; flex-basis: 28px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Seasonal header decorations (CSS-only) */
.top::after {
  content: "";
  pointer-events: none;
  position: absolute;
  right: .75rem; top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  opacity: .85;
  letter-spacing: .15rem;
}
[data-theme="halloween"] .top::after { content: "🎃 🦇"; }
[data-theme="christmas"] .top::after { content: "🎄 ✨"; }
[data-theme="newyear"] .top::after { content: "🥂 ✨"; }
[data-theme="spring"] .top::after { content: "🌸"; opacity: .7; }
[data-theme="summer"] .top::after { content: "☀️"; opacity: .7; }
[data-theme="halloween"] .mark,
[data-theme="christmas"] .mark,
[data-theme="newyear"] .mark {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 40%, transparent);
}

.msgs {
  flex: 1; overflow: auto; padding: .75rem;
  display: flex; flex-direction: column; gap: .65rem;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}
.msg {
  max-width: min(85%, 560px); padding: 8px 12px; border-radius: 16px;
  background: var(--card); border: 0;
  box-shadow: var(--shadow);
  word-break: break-word;
}
.msg.me { align-self: flex-end; background: var(--msg-me); }
.msg.bot { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bot) 55%, transparent), var(--shadow); }
.msg .meta {
  font-size: .72rem; color: var(--muted); margin-bottom: .25rem;
  display: flex; gap: .4rem; align-items: center; flex-wrap: wrap;
}
.avatar {
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700; background: var(--avatar-bg); color: var(--avatar-fg);
}
.avatar.bot { background: #166534; color: #fff; }

.compose {
  display: flex; gap: .5rem; align-items: flex-end;
  padding: .65rem .75rem;
  padding-bottom: calc(.65rem + var(--safe-bottom));
  border-top: 1px solid var(--border);
  background: var(--compose-bg);
  flex-shrink: 0;
  position: sticky; bottom: 0; z-index: 10;
}
.compose textarea {
  resize: none; min-height: var(--touch); max-height: 120px;
  line-height: 1.35; padding-top: .7rem;
}
.compose .btn { flex-shrink: 0; }

.brein {
  font-size: .8rem; color: var(--muted); background: var(--chip-bg);
  border: 1px dashed var(--border); border-radius: 10px; padding: .6rem;
}
.brein strong { color: var(--yellow); display: block; margin-bottom: .25rem; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td {
  text-align: left; padding: .45rem .35rem; border-bottom: 1px solid var(--border);
}
.wrap { max-width: 960px; margin: 0 auto; padding: 1rem; }
.pill {
  font-size: .7rem; padding: .1rem .4rem; border-radius: 999px;
  background: var(--pill-bg); color: var(--pill-fg);
}
.pill.admin { background: #3b2f0b; color: var(--yellow); }
.pill.bot { background: #14532d; color: #86efac; }
.pill.user { background: #1e3a5f; color: #93c5fd; }

/* Desktop ≥769px: 2-column, sidebar always visible */
@media (min-width: 769px) {
  .app { grid-template-columns: 240px 1fr; }
  .nav-toggle { display: none; }
  .sidebar-backdrop { display: none !important; }
  .sidebar {
    position: relative;
    top: auto; left: auto; bottom: auto;
    width: auto;
    transform: none !important;
    box-shadow: none !important;
    z-index: auto;
    height: 100%;
  }
  .app.nav-open .sidebar-backdrop { display: none; }
  .top { padding: .75rem 1rem; }
  .top-bots { max-width: none; font-size: .85rem; }
  .top::after { right: 1.25rem; }
  .msgs { padding: 1rem; }
  .compose {
    padding: .75rem 1rem;
    padding-bottom: calc(.75rem + var(--safe-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar, .btn { transition: none; }
  html[data-mode-animate],
  html[data-mode-animate] .card,
  html[data-mode-animate] .sidebar,
  html[data-mode-animate] .family-side,
  html[data-mode-animate] .msg,
  html[data-mode-animate] .top,
  html[data-mode-animate] .compose,
  html[data-mode-animate] .season-badge,
  html[data-mode-animate] .moon-badge { transition: none; }
  [data-theme="halloween"] body::before { animation: none; }
}
@media (max-width: 768px) {
  .top .moon-label {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
  }
}
@media (min-width: 769px) {
  #moon-badge-side { display: none !important; }
}


/* Nav / mobile polish (2026-09-26) */
.top-titles {
  display: flex; flex-direction: column; gap: .1rem; min-width: 0; flex: 1;
}
.top-titles strong {
  font-size: 1rem; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.top-bots {
  color: var(--muted); font-size: .68rem; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}
.nav-hint {
  margin: .35rem 0 0; padding: .45rem .55rem;
  font-size: .72rem; line-height: 1.35; color: var(--muted);
  background: var(--chip-bg); border: 1px dashed var(--border); border-radius: 8px;
}
.links a[hidden] { display: none !important; }
.msg { padding: .55rem .7rem; }
.msg .meta { margin-bottom: .15rem; gap: .3rem; }
.top::after { display: none; } /* avoid clipping bots/title on narrow screens */
@media (max-width: 420px) {
  .top { padding: .45rem .55rem; }
  .compose { gap: .4rem; padding: .55rem; padding-bottom: calc(.55rem + var(--safe-bottom, 0px)); }
  .compose .btn { padding: .65rem .85rem; }
  .pill { font-size: .65rem; }
}
@media (min-width: 769px) {
  .top::after { display: block; }
  .top-bots { font-size: .75rem; }
}

/* Family hub strip + side panel */
.hub-strip {
  display: flex; gap: .4rem; flex-wrap: wrap;
  padding: .45rem .65rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 92%, var(--accent));
  flex-shrink: 0;
}
.hub-chip {
  font-size: .72rem; line-height: 1.3;
  padding: .35rem .55rem; border-radius: 999px;
  background: var(--card); border: 1px solid var(--border);
  color: var(--text); max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.news-strip {
  display: flex; gap: .5rem; overflow-x: auto;
  padding: .4rem .65rem; border-bottom: 1px solid var(--border);
  font-size: .72rem; color: var(--muted);
  -webkit-overflow-scrolling: touch; flex-shrink: 0;
}
.news-strip a { color: var(--link); text-decoration: none; white-space: nowrap; }
.family-side {
  display: flex; flex-direction: column; gap: 8px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--card);
  border: 0;
  box-shadow: var(--shadow);
}
.family-side[hidden] { display: none !important; }
.side-kicker {
  margin: 0;
  font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted);
}
.side-list {
  display: flex; flex-direction: column;
  font-size: .92rem; color: var(--text);
}
.side-list label,
.check-row,
li:has(> input[type="checkbox"]) {
  display: flex; align-items: center; gap: .7rem;
  min-height: var(--touch); margin: 0; padding: .15rem .1rem;
  border-radius: 10px; color: var(--text); cursor: pointer;
  font-size: .92rem; line-height: 1.3;
}
.check-label { flex: 1; min-width: 0; }
.side-list label:active { background: var(--hover); }
input[type="checkbox"],
.check-compact {
  width: 16px; height: 16px; min-width: 16px; min-height: 16px;
  padding: 0; margin: 0; flex: 0 0 16px; accent-color: var(--accent);
}
.check-row span { min-width: 0; }
.side-empty { margin: .15rem 0 .25rem; color: var(--muted); font-size: .82rem; line-height: 1.35; }
.side-note { margin-top: .15rem; display: flex; flex-direction: column; gap: .2rem; }
.side-note input { min-height: var(--touch); font-size: .9rem; }
.side-note-status { min-height: 1em; margin: 0; color: var(--muted); font-size: .72rem; }
.pill.partner { background:#4c1d95; color:#e9d5ff; }
.pill.root { background:#3b2f0b; color:var(--yellow); }


/* Subtle Halloween particles (CSS-only) */
[data-mode="light"][data-theme="halloween"] body::before { opacity: 0.55; }
[data-theme="halloween"] body::before {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.18;
  background-image:
    radial-gradient(2px 2px at 20% 30%, #f97316, transparent),
    radial-gradient(2px 2px at 70% 60%, #a855f7, transparent),
    radial-gradient(1.5px 1.5px at 40% 80%, #fbbf24, transparent),
    radial-gradient(2px 2px at 85% 20%, #fb923c, transparent);
  background-size: 100% 100%;
  animation: aurelis-float 18s linear infinite;
}
@keyframes aurelis-float {
  from { transform: translateY(0); }
  to { transform: translateY(-40px); }
}
.pill.root {
  background: linear-gradient(135deg, #5b4a12, #3b2f0b);
  color: #fbbf24;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.35);
}
