/* ==========================================================================
   Mise · foundation styles: tokens, base, shell, shared components, motion
   ========================================================================== */

/* ---------- Tokens: light ---------- */
:root {
  color-scheme: light;
  --bg: #F7F8F9;
  --surface: #FFFFFF;
  --surface-2: #FAFBFB;
  --surface-3: #F0F2F4;
  --line: #E4E7EB;
  --line-strong: #D0D5DB;
  --ink: #0E1116;
  --ink-2: #2B313A;
  --muted: #5F6772;
  --faint: #9AA1AB;
  --primary: #0F766E;
  --primary-hover: #0D5F59;
  --primary-soft: #E6F4F2;
  --primary-line: #B9E0DB;
  --on-primary: #FFFFFF;
  --copper: #C2410C;
  --copper-ink: #9A3412;
  --copper-soft: #FDEEE6;
  --success: #15803D;
  --success-soft: #E8F5EC;
  --warn: #B45309;
  --warn-ink: #92400E;
  --warn-soft: #FEF3E2;
  --danger: #B91C1C;
  --danger-soft: #FDE8E8;
  --on-fill: #FFFFFF;

  /* brand tints for avatars (never random colours) */
  --t1-bg: #E6F4F2; --t1-fg: #0F766E;
  --t2-bg: #FDEEE6; --t2-fg: #9A3412;
  --t3-bg: #EEF0F3; --t3-fg: #2B313A;
  --t4-bg: #E8F5EC; --t4-fg: #166534;

  /* ink panels (admin sidebar, toasts, auth art) */
  --ink-panel: #0E1116;
  --ink-panel-2: #171B21;
  --ink-panel-line: #262B33;
  --on-ink: #ECEEF1;
  --on-ink-muted: #9AA1AB;
  --on-ink-accent: #5EEAD4;
  --on-ink-warn: #FCD34D;
  --on-ink-hover: rgba(255, 255, 255, .08);
  --on-image: #FFFFFF;
  --on-image-muted: rgba(255, 255, 255, .78);
  --image-fade: linear-gradient(180deg, rgba(11, 13, 16, .05) 30%, rgba(11, 13, 16, .78) 100%);
  --toast-bg: #0E1116;

  /* materials */
  --r-card: 12px;
  --r-ctl: 8px;
  --r-pill: 999px;
  --shadow-card: 0 1px 2px rgba(14, 17, 22, .04), 0 1px 3px rgba(14, 17, 22, .03);
  --shadow-lift: 0 1px 2px rgba(14, 17, 22, .05), 0 12px 32px -12px rgba(14, 17, 22, .18);
  --shadow-pop: 0 0 0 1px rgba(14, 17, 22, .06), 0 4px 8px rgba(14, 17, 22, .04), 0 20px 44px -12px rgba(14, 17, 22, .22);
  --shadow-thumb: 0 1px 2px rgba(14, 17, 22, .08);
  --shadow-float: 0 6px 18px -10px rgba(14, 17, 22, .35);
  --shadow-primary: inset 0 1px 0 rgba(255, 255, 255, .12), 0 1px 2px rgba(15, 118, 110, .2);
  --inset-top: inset 0 1px 0 rgba(255, 255, 255, 0);
  --img-filter: none;
  --scrim: rgba(14, 17, 22, .4);
  --ring-pattern: rgba(14, 17, 22, .05);
  --hl-met: rgba(15, 118, 110, .12);
  --hl-partly: rgba(180, 83, 9, .12);

  /* type */
  --font-display: 'Geist', 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-ui: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* motion */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --ease-draw: cubic-bezier(.4, 0, .2, 1);
  --d-fast: 120ms;
  --d-base: 200ms;
  --d-slow: 320ms;
  --d-draw: 480ms;

  /* focus: two-tone */
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--primary);

  /* layout */
  --side-w: 248px;
  --topbar-h: 64px;
  --tabbar-h: 64px;
  --gutter: 32px;
}

/* ---------- Tokens: dark (system, unless the user picked light) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0B0D10; --surface: #14171C; --surface-2: #101318; --surface-3: #1B1F25;
    --line: #252A31; --line-strong: #343A43;
    --ink: #ECEEF1; --ink-2: #C9CED6; --muted: #8B93A0; --faint: #5B636E;
    --primary: #2DD4BF; --primary-hover: #5EEAD4; --primary-soft: #0F2E2B; --primary-line: #134E48; --on-primary: #04211E;
    --copper: #FB923C; --copper-ink: #FDBA74; --copper-soft: #3A1F10;
    --success: #4ADE80; --success-soft: rgba(74, 222, 128, .16);
    --warn: #FBBF24; --warn-ink: #FCD34D; --warn-soft: rgba(251, 191, 36, .16);
    --danger: #F87171; --danger-soft: rgba(248, 113, 113, .16);
    --on-fill: #0B0D10;
    --t1-bg: #0F2E2B; --t1-fg: #5EEAD4; --t2-bg: #3A1F10; --t2-fg: #FDBA74;
    --t3-bg: #1F242B; --t3-fg: #C9CED6; --t4-bg: #12301C; --t4-fg: #86EFAC;
    --ink-panel: #07090B; --ink-panel-2: #12151A; --ink-panel-line: #1F242B;
    --toast-bg: #1F242B;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lift: 0 1px 2px rgba(0, 0, 0, .4), 0 16px 40px -16px rgba(0, 0, 0, .8);
    --shadow-pop: 0 0 0 1px rgba(255, 255, 255, .07), 0 24px 56px -12px rgba(0, 0, 0, .8);
    --shadow-thumb: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow-float: 0 6px 18px -10px rgba(0, 0, 0, .7);
    --shadow-primary: inset 0 1px 0 rgba(255, 255, 255, .18), 0 1px 2px rgba(0, 0, 0, .4);
    --inset-top: inset 0 1px 0 rgba(255, 255, 255, .04);
    --img-filter: brightness(.88) saturate(.85) contrast(.95);
    --scrim: rgba(0, 0, 0, .62);
    --ring-pattern: rgba(236, 238, 241, .05);
    --hl-met: rgba(45, 212, 191, .16);
    --hl-partly: rgba(251, 191, 36, .16);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B0D10; --surface: #14171C; --surface-2: #101318; --surface-3: #1B1F25;
  --line: #252A31; --line-strong: #343A43;
  --ink: #ECEEF1; --ink-2: #C9CED6; --muted: #8B93A0; --faint: #5B636E;
  --primary: #2DD4BF; --primary-hover: #5EEAD4; --primary-soft: #0F2E2B; --primary-line: #134E48; --on-primary: #04211E;
  --copper: #FB923C; --copper-ink: #FDBA74; --copper-soft: #3A1F10;
  --success: #4ADE80; --success-soft: rgba(74, 222, 128, .16);
  --warn: #FBBF24; --warn-ink: #FCD34D; --warn-soft: rgba(251, 191, 36, .16);
  --danger: #F87171; --danger-soft: rgba(248, 113, 113, .16);
  --on-fill: #0B0D10;
  --t1-bg: #0F2E2B; --t1-fg: #5EEAD4; --t2-bg: #3A1F10; --t2-fg: #FDBA74;
  --t3-bg: #1F242B; --t3-fg: #C9CED6; --t4-bg: #12301C; --t4-fg: #86EFAC;
  --ink-panel: #07090B; --ink-panel-2: #12151A; --ink-panel-line: #1F242B;
  --toast-bg: #1F242B;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lift: 0 1px 2px rgba(0, 0, 0, .4), 0 16px 40px -16px rgba(0, 0, 0, .8);
  --shadow-pop: 0 0 0 1px rgba(255, 255, 255, .07), 0 24px 56px -12px rgba(0, 0, 0, .8);
  --shadow-thumb: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-float: 0 6px 18px -10px rgba(0, 0, 0, .7);
  --shadow-primary: inset 0 1px 0 rgba(255, 255, 255, .18), 0 1px 2px rgba(0, 0, 0, .4);
  --inset-top: inset 0 1px 0 rgba(255, 255, 255, .04);
  --img-filter: brightness(.88) saturate(.85) contrast(.95);
  --scrim: rgba(0, 0, 0, .62);
  --ring-pattern: rgba(236, 238, 241, .05);
  --hl-met: rgba(45, 212, 191, .16);
  --hl-partly: rgba(251, 191, 36, .16);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 88px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  caret-color: var(--primary);
  accent-color: var(--primary);
  min-height: 100vh;
}
html.theme-shift *, html.theme-shift *::before, html.theme-shift *::after {
  transition: background-color var(--d-base) var(--ease-out), border-color var(--d-base) var(--ease-out), color var(--d-base) var(--ease-out) !important;
}
::selection { background: var(--copper-soft); color: var(--ink); }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, h4, p, ol, ul, figure, dl, dd, blockquote { margin: 0; }
ol, ul { padding: 0; list-style: none; }
hr { border: 0; border-top: 1px solid var(--line); margin: 0; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-ctl); }
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { box-shadow: none; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* thin, warm scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

.icon { flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }

/* ---------- Type ---------- */
.h1, .h2, .h3, .display { font-family: var(--font-display); font-weight: 600; letter-spacing: -.02em; color: var(--ink); }
.display { font-size: clamp(30px, 3.4vw, 40px); line-height: 1.08; letter-spacing: -.02em; }
.h1 { font-size: 32px; line-height: 1.12; letter-spacing: -.018em; }
.h2 { font-size: 22px; line-height: 1.27; }
.h3 { font-size: 17px; line-height: 1.35; }
.num, .tnum { font-family: var(--font-display); font-weight: 600; font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; letter-spacing: -.01em; }
.tnum { font-family: inherit; }
.eyebrow { font-size: 12px; line-height: 1.3; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.lede { font-size: 16px; line-height: 1.55; color: var(--ink-2); max-width: 62ch; }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 1.45; }
.xs { font-size: 12px; line-height: 1.4; }
.strong { font-weight: 600; }
.prose p + p { margin-top: 10px; }
.prose { color: var(--ink-2); }

/* ---------- Logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); line-height: 1; }
.logo__mark { width: 26px; height: 26px; color: currentColor; }
.logo--mark .logo__mark { width: 24px; height: 24px; }
.wordmark { font-family: var(--font-display); font-weight: 700; font-size: 23px; letter-spacing: -.045em; line-height: 1; position: relative; top: -1px; }
.wordmark__i { position: relative; display: inline-block; }
.wordmark__i::after {
  content: ''; position: absolute; left: 50%; top: -.06em; width: .27em; height: .27em; margin-left: -.135em;
  border-radius: 50%; border: .062em solid var(--copper); box-sizing: border-box;
}
.logo--light { color: var(--on-image); }

/* ---------- Shell ---------- */
.app { min-height: 100vh; }
.shell--app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px;
  padding: 20px 16px 16px; border-right: 1px solid var(--line); background: var(--bg); overflow-y: auto;
}
.side__brand { display: inline-flex; align-items: center; gap: 10px; padding: 4px 8px 14px; border-radius: var(--r-ctl); align-self: flex-start; }
.side__tag { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--on-ink-muted); padding: 3px 7px; border: 1px solid var(--ink-panel-line); border-radius: var(--r-pill); }
.venue {
  display: grid; gap: 2px; margin: 2px 4px 14px; padding: 2px 0 2px 12px; border-left: 1.5px solid var(--primary); border-radius: 0;
}
.venue:focus-visible { border-radius: 4px; }
.venue__name { font-family: var(--font-display); font-size: 16px; font-weight: 600; line-height: 1.3; color: var(--ink); letter-spacing: -.02em; }
.venue__dot { color: var(--faint); }
.venue__fhrs { color: var(--primary); }
.venue__meta { font-size: 12px; color: var(--muted); }
.side__label { margin: 16px 12px 4px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.side__nav { display: grid; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 8px 12px; border-radius: var(--r-ctl);
  color: var(--ink-2); font-weight: 500; font-size: 14.5px; position: relative;
  transition: background-color var(--d-fast) var(--ease-out), color var(--d-fast) var(--ease-out);
}
.nav-item .icon { color: var(--muted); transition: color var(--d-fast) var(--ease-out); }
.nav-item:hover { background: var(--surface-3); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line), var(--inset-top); }
.nav-item[aria-current="page"] .icon { color: var(--primary); }
.nav-item[aria-current="page"]::before { content: ''; position: absolute; left: -16px; top: 10px; bottom: 10px; width: 2px; border-radius: 2px; background: var(--primary); }
.side__foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.me { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-ctl); }
.me:hover { background: var(--surface-3); }
.me__txt { display: grid; min-width: 0; line-height: 1.3; }
.me__txt b { font-weight: 600; font-size: 14px; }
.me__txt span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* admin: same tokens on an ink sidebar */
.side--ink { background: var(--ink-panel); border-right-color: var(--ink-panel-line); color: var(--on-ink); --focus: 0 0 0 2px var(--ink-panel), 0 0 0 4px var(--on-ink-accent); }
.side--ink .logo { color: var(--on-ink); }
.side--ink .nav-item { color: var(--on-ink-muted); }
.side--ink .nav-item .icon { color: var(--on-ink-muted); }
.side--ink .nav-item:hover { background: var(--ink-panel-2); color: var(--on-ink); }
.side--ink .nav-item[aria-current="page"] { background: var(--ink-panel-2); color: var(--on-ink); box-shadow: 0 0 0 1px var(--ink-panel-line), var(--inset-top); }
.side--ink .nav-item[aria-current="page"] .icon { color: var(--on-ink-accent); }
.side--ink .nav-item[aria-current="page"]::before { background: var(--on-ink-accent); }
.side--ink .side__foot { border-top-color: var(--ink-panel-line); }
.side--ink .me:hover { background: var(--ink-panel-2); }
.side--ink .me__txt span { color: var(--on-ink-muted); }
.side__note { margin: 18px 8px 0; padding: 12px; border: 1px solid var(--ink-panel-line); border-radius: var(--r-ctl); display: grid; gap: 2px; font-size: 13px; color: var(--on-ink); }
.side__note-k { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--on-ink-muted); font-weight: 600; }

.main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 16px;
  padding: 0 var(--gutter); background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
}
.topbar__brand { display: none; }
.topbar__end { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.pop-anchor { position: relative; }

.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-ctl);
  color: var(--ink-2); transition: background-color var(--d-fast) var(--ease-out), color var(--d-fast) var(--ease-out);
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn[aria-expanded="true"] { background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.bell__dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--copper); box-shadow: 0 0 0 2px var(--bg); }
.theme-btn > span { display: grid; place-items: center; grid-area: 1 / 1; transition: opacity var(--d-base) var(--ease-out), transform var(--d-base) var(--ease-out); }
.theme-btn .theme-btn__sun { opacity: 0; transform: rotate(-90deg) scale(.8); }
.theme-btn.is-dark .theme-btn__sun { opacity: 1; transform: none; }
.theme-btn.is-dark .theme-btn__moon { opacity: 0; transform: rotate(90deg) scale(.8); }
.acct-btn { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 4px; border-radius: var(--r-pill); color: var(--muted); transition: background-color var(--d-fast) var(--ease-out); }
.acct-btn:hover, .acct-btn[aria-expanded="true"] { background: var(--surface-3); }
.acct-btn:focus-visible { border-radius: var(--r-pill); }

/* search */
.search { position: relative; flex: 1; max-width: 460px; display: flex; align-items: center; }
.search__icon { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search__input {
  width: 100%; height: 40px; padding: 0 40px 0 38px; border-radius: var(--r-ctl); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: 14px; box-shadow: var(--inset-top);
  transition: border-color var(--d-fast) var(--ease-out), box-shadow var(--d-fast) var(--ease-out);
}
.search__input::placeholder { color: var(--muted); }
.search__input:hover { border-color: var(--line-strong); }
.search__input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.search__input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search__kbd { position: absolute; right: 10px; font: 600 11px/1 var(--font-ui); color: var(--muted); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 3px 6px; background: var(--surface-2); }
.search__input:focus ~ .search__kbd { opacity: 0; }
.search__pop { position: absolute; top: calc(100% + 8px); left: 0; right: 0; padding: 6px; max-height: 420px; overflow: auto; }
.search__opt { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--r-ctl); }
.search__opt[aria-selected="true"], .search__opt:hover { background: var(--surface-2); box-shadow: 0 0 0 1px var(--line); }
.search__opt-txt { display: grid; min-width: 0; flex: 1; line-height: 1.35; }
.search__opt-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search__opt-meta { font-size: 12.5px; color: var(--muted); }
.search__all { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; padding: 10px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--primary); }
.search__none { padding: 14px 12px; font-size: 14px; color: var(--muted); }
.search-toggle { display: none; }

/* popovers */
.pop {
  position: absolute; z-index: 60; background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-pop);
  animation: pop-in var(--d-base) var(--ease-out);
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.985); } }
.pop--notif { right: 0; top: calc(100% + 8px); width: 360px; }
.pop--acct { right: 0; top: calc(100% + 8px); width: 330px; max-height: calc(100vh - 84px); overflow: auto; padding: 6px; }
.pop__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.pop__title { font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.pop__list { padding: 6px; display: grid; gap: 2px; }
.notif { display: flex; gap: 12px; padding: 10px; border-radius: var(--r-ctl); align-items: flex-start; }
.notif:hover { background: var(--surface-2); }
.notif__icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); color: var(--muted); flex: none; }
.notif.is-unread .notif__icon { color: var(--primary); border-color: var(--primary-line); }
.notif__txt { display: grid; gap: 2px; flex: 1; font-size: 14px; line-height: 1.4; }
.notif__txt small { font-size: 12px; color: var(--muted); }
.notif.is-unread .notif__txt > span { font-weight: 600; }
.notif__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--copper); margin-top: 6px; flex: none; }

.acct__head { display: flex; gap: 12px; align-items: center; padding: 12px 10px 14px; }
.acct__who { display: grid; min-width: 0; line-height: 1.35; }
.acct__who b { font-weight: 600; }
.acct__who .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct__plan { margin-top: 4px; font-size: 12px; color: var(--primary); font-weight: 500; }
.acct__plan.is-danger { color: var(--danger); }
.acct__links { display: grid; gap: 1px; padding: 6px 0; border-top: 1px solid var(--line); }
.acct__links--end { border-top: 1px solid var(--line); }
.acct__switch { border-top: 1px solid var(--line); padding: 6px 0; }
.acct__summary { list-style: none; cursor: pointer; }
.acct__summary::-webkit-details-marker { display: none; }
.acct__summary > span { flex: 1; }
.acct__chev { transition: transform var(--d-base) var(--ease-out); }
.acct__switch[open] .acct__chev { transform: rotate(180deg); }
.acct__switch .acct__section { border-top: 0; padding-top: 6px; }
@keyframes fade-in { from { opacity: 0; } }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 8px 10px; border-radius: var(--r-ctl); font-size: 14px; color: var(--ink-2); text-align: left; }
.menu-item .icon { color: var(--muted); }
.menu-item:hover { background: var(--surface-2); color: var(--ink); }
.acct__section { padding: 10px 10px 12px; border-top: 1px solid var(--line); }
.menu-label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.menu-roles { display: grid; gap: 2px; margin: 0 -4px; }
.menu-role { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--r-ctl); font-size: 14px; text-align: left; }
.menu-role:hover { background: var(--surface-2); }
.menu-role__radio { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; flex: none; }
.menu-role[aria-checked="true"] .menu-role__radio { border-color: var(--primary); }
.menu-role[aria-checked="true"] .menu-role__radio::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.menu-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.menu-choice { padding: 5px 10px; border-radius: var(--r-pill); border: 1px solid var(--line); font-size: 12.5px; font-weight: 500; color: var(--ink-2); background: var(--surface); transition: border-color var(--d-fast) var(--ease-out), background-color var(--d-fast) var(--ease-out); }
.menu-choice:hover { border-color: var(--line-strong); }
.menu-choice[aria-checked="true"] { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary); }
.menu-choice:focus-visible { border-radius: var(--r-pill); }

.shell__banner { margin: 0 var(--gutter); }
.view { flex: 1; min-width: 0; }
.view:focus { box-shadow: none; }

.foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 22px var(--gutter) 28px; margin-top: 24px;
  border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted);
}
.foot__sep { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }
.foot__links { margin-left: auto; display: flex; flex-wrap: wrap; gap: 4px 16px; }

.tabbar { display: none; }

/* ---------- Auth layout ---------- */
.shell--auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.auth__art { position: relative; overflow: hidden; background: var(--ink-panel); color: var(--on-image); min-height: 100vh; position: sticky; top: 0; height: 100vh; }
.auth__img { position: absolute; inset: 0; border-radius: 0; }
.auth__art::after { content: ''; position: absolute; inset: 0; background: var(--image-fade); pointer-events: none; }
.auth__art-copy { position: absolute; left: 48px; right: 48px; bottom: 44px; z-index: 1; display: grid; gap: 12px; }
.auth__logo .logo { color: var(--on-image); }
.auth__quote { font-family: var(--font-display); font-size: 30px; line-height: 1.15; letter-spacing: -.02em; max-width: 18ch; font-weight: 600; }
.auth__cite { color: var(--on-image-muted); max-width: 44ch; font-size: 14.5px; }
.auth__main { display: flex; flex-direction: column; min-height: 100vh; padding: 24px 40px; }
.auth__top { display: flex; align-items: center; justify-content: space-between; }
.auth__brand { border-radius: var(--r-ctl); }
.auth__view { flex: 1; display: flex; flex-direction: column; justify-content: center; width: 100%; max-width: 420px; margin: 0 auto; padding: 40px 0; }
.auth__foot { font-size: 12.5px; color: var(--muted); text-align: center; }

/* ---------- Focus layout (player) ---------- */
.shell--focus { min-height: 100vh; display: flex; flex-direction: column; }
.focusbar {
  position: sticky; top: 0; z-index: 30; height: 56px; display: flex; align-items: center; gap: 14px; padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.focusbar__exit { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px 0 8px; border-radius: var(--r-ctl); font-size: 14px; font-weight: 500; color: var(--ink-2); }
.focusbar__exit:hover { background: var(--surface-3); color: var(--ink); }
.focusbar__brand { color: var(--ink); padding-left: 14px; border-left: 1px solid var(--line); height: 24px; display: inline-flex; align-items: center; }
.focusbar__slot { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; }
.focusbar__end { display: flex; align-items: center; gap: 6px; }
.view--focus { flex: 1; }

/* ---------- Page scaffolding ---------- */
.page { width: 100%; max-width: 1240px; margin: 0 auto; padding: 24px var(--gutter) 40px; }
.page--narrow { max-width: 860px; }
.page--wide { max-width: 1400px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 24px; }
.page-head > div:first-child { display: grid; gap: 6px; min-width: 0; }
.page-head .lede { margin-top: 2px; }
.page-head__actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.page-body { display: grid; gap: 24px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.stack-s { display: grid; gap: 8px; }
.stack-m { display: grid; gap: 16px; }
.stack-l { display: grid; gap: 24px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.row--top { align-items: flex-start; }
.spacer { flex: 1; }

/* ---------- Surfaces ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: var(--shadow-card), var(--inset-top); min-width: 0;
}
a.card, .card--link { transition: border-color var(--d-base) var(--ease-out); }
a.card:hover, .card--link:hover { border-color: var(--line-strong); }
.card-pad { padding: 20px; }
.card--flat { box-shadow: var(--inset-top); background: var(--surface-2); }
.card--lifted { box-shadow: var(--shadow-lift), var(--inset-top); }
.card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card__head .h2, .card__head .h3 { margin: 0; }
.divider { height: 1px; background: var(--line); border: 0; margin: 16px 0; }
.divider--dashed { background: none; border-top: 1px dashed var(--line-strong); }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--ink); --btn-bd: var(--line-strong);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border-radius: var(--r-ctl); border: 1px solid var(--btn-bd); background: var(--btn-bg); color: var(--btn-fg);
  font-size: 14px; font-weight: 600; line-height: 1; white-space: nowrap; letter-spacing: -.003em; user-select: none;
  transition: background-color var(--d-fast) var(--ease-out), border-color var(--d-fast) var(--ease-out), color var(--d-fast) var(--ease-out), transform 100ms var(--ease-out);
}
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: scale(.98); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn--primary[disabled], .btn--primary[aria-disabled="true"] { --btn-bg: var(--primary); --btn-bd: var(--primary); --btn-fg: var(--on-primary); filter: none; }
.btn--primary { --btn-bg: var(--primary); --btn-fg: var(--on-primary); --btn-bd: var(--primary); box-shadow: var(--shadow-primary); }
.btn--primary:hover { --btn-bg: var(--primary-hover); --btn-bd: var(--primary-hover); }
.btn--ghost { --btn-bg: transparent; --btn-bd: var(--line-strong); }
.btn--ghost:hover { --btn-bg: var(--surface); border-color: var(--ink-2); }
.btn--quiet { --btn-bg: transparent; --btn-bd: transparent; color: var(--ink-2); padding: 0 10px; }
.btn--quiet:hover { --btn-bg: var(--surface-3); border-color: transparent; color: var(--ink); }
.btn--danger { --btn-bg: var(--danger); --btn-fg: var(--on-fill); --btn-bd: var(--danger); }
.btn--danger:hover { filter: brightness(.94); border-color: var(--danger); }
.btn--copper { --btn-bg: var(--copper); --btn-fg: var(--on-fill); --btn-bd: var(--copper); }
.btn--sm { min-height: 32px; padding: 0 12px; font-size: 13px; gap: 6px; }
.btn--lg { min-height: 46px; padding: 0 20px; font-size: 15px; }
.btn--block { display: flex; width: 100%; }
.btn .icon { width: 18px; height: 18px; }
.btn--sm .icon { width: 16px; height: 16px; }
.link { display: inline-flex; align-items: center; gap: 6px; color: var(--primary); font-weight: 600; font-size: inherit; border-radius: 4px; text-underline-offset: 3px; }
.link:hover { text-decoration: underline; text-decoration-thickness: 1px; }
.link .icon { transition: transform var(--d-base) var(--ease-out); }
.link:hover .icon--nudge, a:hover > .icon--nudge { transform: translateX(2px); }
.link--quiet { color: var(--muted); font-weight: 500; }
.link--quiet:hover { color: var(--ink); }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; }
.label { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.label .muted { font-weight: 400; }
.input, .textarea, .select {
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: var(--r-ctl); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font-size: 15px; box-shadow: var(--inset-top);
  transition: border-color var(--d-fast) var(--ease-out), box-shadow var(--d-fast) var(--ease-out);
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .textarea:hover, .select:hover { border-color: var(--muted); }
.input:focus, .textarea:focus, .select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
.select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%235F6772' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5.5 8 4.5 4.5L14.5 8'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.hint { font-size: 13px; color: var(--muted); }
.error { font-size: 13px; color: var(--danger); display: flex; gap: 6px; align-items: center; font-weight: 500; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14.5px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; border-radius: 5px; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 40px; height: 24px; margin: 0; cursor: pointer; }
.switch__track { width: 40px; height: 24px; border-radius: 12px; background: var(--line-strong); position: relative; transition: background-color var(--d-base) var(--ease-out); flex: none; }
.switch__track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-thumb); transition: transform var(--d-base) var(--ease-out); }
.switch input:checked + .switch__track { background: var(--primary); }
.switch input:checked + .switch__track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch__track { box-shadow: var(--focus); }
.radio-card { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 16px; border: 1px solid var(--line-strong); border-radius: var(--r-card); background: var(--surface); cursor: pointer; transition: border-color var(--d-fast) var(--ease-out), box-shadow var(--d-fast) var(--ease-out); }
.radio-card:hover { border-color: var(--muted); }
.radio-card input { margin: 3px 0 0; width: 18px; height: 18px; flex: none; }
.radio-card:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), var(--inset-top); background: color-mix(in srgb, var(--primary-soft) 45%, var(--surface)); }
.radio-card:has(input:focus-visible) { box-shadow: var(--focus); }

/* ---------- Status ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap; background: var(--surface-3); color: var(--ink-2);
}
.pill .icon { width: 14px; height: 14px; stroke-width: 1.75; }
.pill--ok { background: var(--success-soft); color: var(--success); }
.pill--warn { background: var(--warn-soft); color: var(--warn-ink); }
.pill--danger { background: var(--danger-soft); color: var(--danger); }
.pill--copper { background: var(--copper-soft); color: var(--copper-ink); }
.pill--primary { background: var(--primary-soft); color: var(--primary); }
.pill--neutral { background: var(--surface-3); color: var(--ink-2); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 3px 10px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--surface); font-size: 12.5px; font-weight: 500; color: var(--ink-2); white-space: nowrap;
}
.chip .icon { width: 14px; height: 14px; color: var(--muted); }
.chip--reg { border-color: var(--line); color: var(--ink-2); background: var(--surface-2); }
.chip--quiet { background: transparent; }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--copper); color: var(--on-fill); font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Avatars (4 brand tints) ---------- */
.avatar {
  --av: 32px; width: var(--av); height: var(--av); border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  font-size: calc(var(--av) * .38); font-weight: 600; letter-spacing: .01em; line-height: 1;
}
.avatar--t1 { background: var(--t1-bg); color: var(--t1-fg); }
.avatar--t2 { background: var(--t2-bg); color: var(--t2-fg); }
.avatar--t3 { background: var(--t3-bg); color: var(--t3-fg); }
.avatar--t4 { background: var(--t4-bg); color: var(--t4-fg); }
.avatar--anon { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }

/* ---------- The plate ring ---------- */
.ring { position: relative; display: inline-grid; place-items: center; width: var(--ring); height: var(--ring); flex: none; color: var(--primary); }
.ring svg { width: 100%; height: 100%; overflow: visible; }
.ring circle, .ring path { fill: none; }
.ring__track { stroke: var(--line); }
.ring__well { stroke: var(--line); opacity: .9; }
.ring__arc { stroke: currentColor; stroke-linecap: round; }
.ring__dot { fill: var(--primary) !important; }
.ring__tick { stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.ring__fill { fill: currentColor !important; }
.ring--filled .ring__track, .ring--filled .ring__well { stroke: transparent; }
.ring--filled .ring__tick { stroke: var(--surface); }
.ring--filled .ring__arc { stroke: currentColor; }
.ring--copper { color: var(--copper); }
.ring--muted { color: var(--muted); }
.ring--muted .ring__track { stroke: var(--line-strong); }
.ring__num { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-variant-numeric: tabular-nums; font-weight: 600; font-size: calc(var(--ring) * .42); line-height: 1; color: var(--ink-2); letter-spacing: -.02em; }
.ring--draw .ring__arc { animation: ring-draw 700ms var(--ease-draw) both; }
@keyframes ring-draw { from { stroke-dasharray: 0 100; } }

/* step meter */
.steps { display: inline-flex; align-items: center; gap: 5px; }
.steps__dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--line-strong); flex: none; position: relative; }
.steps__dot.is-done { background: var(--primary); box-shadow: none; }
.steps__dot.is-active { box-shadow: inset 0 0 0 1.5px var(--primary); }
.steps__dot.is-active::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--primary); }

/* meter bar */
.meter-bar { position: relative; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.meter-bar > i { position: absolute; inset: 0; border-radius: inherit; background: var(--primary); transform-origin: left; transform: scaleX(var(--v, 0)); animation: meter-in var(--d-draw) var(--ease-out) both; animation-delay: calc(260ms + var(--i, 0) * 60ms); }
.meter-bar--copper > i { background: var(--copper); }
@keyframes meter-in { from { transform: scaleX(0); } }

/* ---------- Tick and line ---------- */
.tickline { position: relative; display: inline-flex; align-items: center; gap: 7px; padding-bottom: 3px; font-size: 13px; color: var(--muted); }
.tickline__mark { width: 16px; height: 16px; flex: none; }
.tickline__mark circle { fill: none; stroke: currentColor; stroke-width: 1.25; opacity: .55; }
.tickline__mark path { fill: none; stroke: var(--primary); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.tickline__line { position: absolute; left: 23px; right: 0; bottom: 0; height: 1.5px; border-radius: 1px; background: var(--primary); transform-origin: left; transform: scaleX(0); opacity: 0; }
.tickline.is-playing .tickline__line { animation: tl-line 1600ms var(--ease-draw) both; }
.tickline.is-playing .tickline__mark path { animation: tl-tick 180ms var(--ease-draw) 280ms both; }
.tickline.is-playing .tickline__mark circle { animation: tl-ring 460ms var(--ease-out) both; }
@keyframes tl-line { 0% { transform: scaleX(0); opacity: 1; } 17.5% { transform: scaleX(1); opacity: 1; } 75% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(1); opacity: 0; } }
@keyframes tl-tick { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes tl-ring { from { opacity: .2; } }
.tickline--bare .tickline__text { display: none; }
.tickline--bare .tickline__line { display: none; }

/* autosave */
.autosave { display: inline-flex; align-items: center; gap: 8px; min-height: 24px; font-size: 13px; color: var(--muted); transition: opacity var(--d-slow) var(--ease-out); }
.autosave[data-state="idle"] { opacity: .72; }
.autosave[data-state="saved"] .tickline { color: var(--ink-2); }
.autosave__spin { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--line-strong); border-top-color: var(--primary); animation: spin 800ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Data ---------- */
.table-wrap { width: 100%; overflow-x: auto; border-radius: var(--r-card); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color var(--d-fast) var(--ease-out); }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button { position: relative; padding: 10px 12px; font-size: 14px; font-weight: 500; color: var(--muted); white-space: nowrap; border-radius: var(--r-ctl) var(--r-ctl) 0 0; }
.tabs a:hover, .tabs button:hover { color: var(--ink); }
.tabs [aria-selected="true"], .tabs [aria-current="page"] { color: var(--ink); }
.tabs [aria-selected="true"]::after, .tabs [aria-current="page"]::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--primary); }

.seg { position: relative; display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line); isolation: isolate; }
.seg__thumb { position: absolute; top: 3px; bottom: 3px; left: 0; width: 0; border-radius: 7px; background: var(--surface); box-shadow: var(--shadow-thumb), 0 0 0 1px var(--line), var(--inset-top); transition: transform 240ms var(--ease-out), width 240ms var(--ease-out); z-index: -1; }
.seg__btn { position: relative; padding: 6px 14px; min-height: 32px; border-radius: 7px; font-size: 13.5px; font-weight: 600; color: var(--muted); transition: color var(--d-base) var(--ease-out); white-space: nowrap; }
.seg__btn:hover { color: var(--ink-2); }
.seg__btn[aria-checked="true"] { color: var(--ink); }
.seg--sm .seg__btn { padding: 4px 11px; min-height: 28px; font-size: 12.5px; }
.seg--block { display: flex; }
.seg--block .seg__btn { flex: 1; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); font-weight: 500; }

.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--r-card); border: 1px solid var(--line); background: var(--surface); font-size: 14px; }
.banner > .icon { flex: none; }
.banner__msg { flex: 1; min-width: 0; }
.banner--info { background: var(--primary-soft); border-color: var(--primary-line); color: var(--ink); }
.banner--info > .icon { color: var(--primary); }
.banner--warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.banner--warn > .icon { color: var(--warn); }
.banner--danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.banner--danger > .icon { color: var(--danger); }
.shell__banner { margin-top: 4px; margin-bottom: 4px; }

/* ---------- Media (images + intentional linen placeholder) ---------- */
.media { position: relative; display: block; overflow: hidden; background: var(--surface-3); border-radius: inherit; }
.media img { width: 100%; height: 100%; object-fit: cover; object-position: var(--pos, 50% 50%); filter: var(--img-filter); }
.media--empty {
  background-color: color-mix(in srgb, var(--surface-3) 70%, var(--bg));
  background-image:
    radial-gradient(circle at 50% 50%, transparent 30px, var(--ring-pattern) 30.5px, var(--ring-pattern) 32px, transparent 32.5px, transparent 38px, var(--ring-pattern) 38.5px, var(--ring-pattern) 39px, transparent 39.5px);
  background-size: 96px 96px;
  background-position: center;
}
.media__plate { position: absolute; inset: 0; background: radial-gradient(120% 90% at 70% 20%, transparent 40%, color-mix(in srgb, var(--bg) 50%, transparent) 100%); }

/* ---------- Skeleton / shimmer ---------- */
.skeleton { border-radius: 6px; background: var(--surface-3); min-height: 12px; }
.shimmer { position: relative; overflow: hidden; }
.shimmer::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 70%, transparent), transparent); animation: shimmer 1.4s var(--ease-in-out) infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* ---------- Empty state ---------- */
.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 48px 24px; }
.empty__art { width: 48px; height: 48px; color: var(--muted); margin-bottom: 8px; }
.empty__art use { color: var(--muted); }
.empty__title { font-family: var(--font-display); font-weight: 600; font-size: 22px; line-height: 1.25; letter-spacing: -.02em; }
.empty__body { color: var(--muted); max-width: 46ch; }
.empty__action { margin-top: 12px; display: flex; gap: 8px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 90; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 10px 12px 14px; border-radius: var(--r-card);
  background: var(--toast-bg); color: var(--on-ink); box-shadow: var(--shadow-pop); font-size: 14px;
  opacity: 0; transform: translateY(8px); transition: opacity var(--d-base) var(--ease-out), transform var(--d-slow) var(--ease-out);
}
.toast.is-in { opacity: 1; transform: none; }
.toast.is-out { opacity: 0; transform: translateY(4px); }
.toast__icon { display: grid; place-items: center; color: var(--on-ink-accent); }
.toast__icon .tickline__mark path { stroke: var(--on-ink-accent); }
.toast__icon .tickline { color: var(--on-ink-accent); padding: 0; }
.toast--danger .toast__icon, .toast--warn .toast__icon { color: var(--on-ink-warn); }
.toast__msg { flex: 1; }
.toast__action { font-weight: 600; color: var(--on-ink-accent); padding: 4px 6px; border-radius: 6px; }
.toast__close { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; color: var(--on-ink-muted); }
.toast__close:hover { background: var(--on-ink-hover); color: var(--on-ink); }

/* ---------- Modal / sheet ---------- */
.layer { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; }
.layer__scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity var(--d-base) var(--ease-out); }
.layer__panel {
  position: relative; width: min(520px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-pop), var(--inset-top);
  opacity: 0; transform: translateY(8px) scale(.985); transition: opacity var(--d-base) var(--ease-out), transform var(--d-slow) var(--ease-out);
}
.layer--sm .layer__panel { width: min(420px, 100%); }
.layer--lg .layer__panel { width: min(720px, 100%); }
.layer.is-in .layer__scrim { opacity: 1; }
.layer.is-in .layer__panel { opacity: 1; transform: none; }
.layer__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 16px 6px 22px; }
.layer__title { font-family: var(--font-display); font-size: 21px; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; }
.layer__body { padding: 8px 22px 20px; overflow: auto; }
.layer__foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 14px 22px 18px; border-top: 1px solid var(--line); }
.layer__grab { display: none; }
html.has-layer { overflow: hidden; }

/* ---------- Reveal (load choreography: 320ms, 40ms stagger, ≤640ms) ---------- */
[data-reveal] { opacity: 0; transform: translateY(6px); transition: opacity var(--d-slow) var(--ease-out), transform var(--d-slow) var(--ease-out); transition-delay: var(--reveal-delay, 0ms); }
[data-reveal].is-in { opacity: 1; transform: none; }

/* ---------- Shared mobile utilities ---------- */
/* .hscroll: a sideways scroller with a right-edge fade while more content remains (M.ui.hscroll adds .is-end). */
.hscroll {
  display: flex; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity;
  scroll-padding-inline: 16px; padding-right: 16px; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent);
}
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { flex: none; scroll-snap-align: start; }
.hscroll.is-end, .hscroll.is-static { -webkit-mask-image: none; mask-image: none; }
.link--tap { padding: 10px 0; margin: -10px 0; }

/* ---------- Responsive shell ---------- */
@media (max-width: 1180px) {
  :root { --gutter: 24px; }
}
@media (max-width: 860px) {
  :root { --gutter: 16px; }
  .seg__btn { min-height: 40px; }
  .seg--sm .seg__btn { min-height: 40px; }
  .btn--sm { min-height: 40px; }
  .focusbar__exit { width: 44px; height: 44px; padding: 0; justify-content: center; }
  .shell--app { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .topbar { gap: 8px; padding: 0 12px 0 16px; height: 58px; border-bottom-color: var(--line); }
  .topbar__brand { display: inline-flex; border-radius: var(--r-ctl); }
  .topbar__brand .wordmark { font-size: 21px; }
  .topbar__brand .logo__mark { width: 24px; height: 24px; }
  .search { display: none; }
  .search-toggle { display: inline-grid; }
  .shell.is-searching .search { display: flex; position: absolute; left: 12px; right: 12px; top: 9px; max-width: none; z-index: 2; }
  .shell.is-searching .search__input { height: 40px; box-shadow: var(--shadow-pop); }
  .shell.is-searching .search__kbd { display: none; }
  .theme-btn { display: none; }
  .main { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .foot { padding-bottom: 20px; }
  .foot__links { margin-left: 0; }
  .shell__banner { margin: 8px 16px 0; }
  .shell__banner .banner__msg { font-size: 13.5px; }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 6px 4px env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: saturate(1.4) blur(16px); backdrop-filter: saturate(1.4) blur(16px);
    border-top: 1px solid var(--line);
  }
  .tabbar__item { display: grid; justify-items: center; align-content: center; gap: 3px; padding: 4px 2px; border-radius: var(--r-ctl); font-size: 11px; font-weight: 500; color: var(--muted); position: relative; min-width: 0; }
  .tabbar__item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .tabbar__item[aria-current="page"] { color: var(--ink); font-weight: 600; }
  .tabbar__item[aria-current="page"] .icon { color: var(--primary); }
  .tabbar__item[aria-current="page"]::before { content: ''; position: absolute; top: -6px; left: 30%; right: 30%; height: 2px; border-radius: 0 0 2px 2px; background: var(--primary); }
  .tabbar--six .tabbar__item { font-size: 10.5px; }

  /* menus become sheets on phones */
  .pop--acct, .pop--notif {
    position: fixed; left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; max-height: calc(100vh - 80px); border-radius: 16px;
    animation: sheet-in var(--d-slow) var(--ease-out);
  }
  .topbar { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--bg); }
  .pop-scrim { position: fixed; inset: 0; z-index: 55; background: var(--scrim); animation: fade-in var(--d-base) var(--ease-out); }
  body > .pop { z-index: 60; }
  .pop--acct .menu-item, .pop--acct .menu-role { min-height: 44px; }
  .pop--acct .menu-choice { min-height: 36px; }

  .layer { place-items: end stretch; padding: 0; }
  .layer__panel { width: 100% !important; max-height: 92vh; border-radius: 18px 18px 0 0; transform: translateY(24px); padding-bottom: env(safe-area-inset-bottom); }
  .layer--modal .layer__panel { border-radius: 18px 18px 0 0; }
  .layer__grab { display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 8px auto 0; }
  .layer__foot .btn { flex: 1; }

  .shell--auth { grid-template-columns: minmax(0, 1fr); }
  .auth__art { display: none; }
  .auth__main { padding: 16px 20px 24px; }
  .auth__view { padding: 24px 0; justify-content: flex-start; }

  .focusbar { padding: 0 10px; gap: 8px; }
  .focusbar__exit span { display: none; }
  .focusbar__brand { display: none; }

  .page { padding: 18px 16px 32px; }
  .page-head { margin-bottom: 18px; }
  .h1 { font-size: 27px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .toasts { bottom: calc(var(--tabbar-h) + 12px); }

  /* tables become lists */
  .table-wrap--stack .table thead { display: none; }
  .table-wrap--stack .table, .table-wrap--stack .table tbody, .table-wrap--stack .table tr, .table-wrap--stack .table td { display: block; width: 100%; }
  .table-wrap--stack .table tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table-wrap--stack .table td { padding: 2px 0; border: 0; text-align: left; }
  .table-wrap--stack .table td[data-label]::before { content: attr(data-label) ' · '; color: var(--muted); font-size: 12.5px; }
}
@media (max-width: 720px) {
  .table-wrap--stack .table thead { display: none; }
  .table-wrap--stack .table, .table-wrap--stack .table tbody, .table-wrap--stack .table tr, .table-wrap--stack .table td { display: block; width: 100%; }
  .table-wrap--stack .table tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table-wrap--stack .table td { padding: 2px 0; border: 0; text-align: left; }
}
@keyframes sheet-in { from { transform: translateY(16px); opacity: 0; } }

/* ---------- Reduced motion: only fades remain ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  [data-reveal] { transform: none; transition: opacity 150ms linear; }
}
html[data-motion="reduced"] *, html[data-motion="reduced"] *::before, html[data-motion="reduced"] *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; animation-delay: 0ms !important; }
html[data-motion="reduced"] [data-reveal] { transform: none; transition: opacity 150ms linear; transition-delay: 0ms; }
html[data-motion="reduced"] .seg__thumb { transition: none; }
html[data-motion="reduced"] .layer__panel, html[data-motion="reduced"] .toast { transition-property: opacity; transform: none; }
