/* ==========================================================================
   Lectern — design system
   Apple-inspired: content first, quiet surfaces, one accent, glass bars,
   inset-grouped lists, pill buttons and spring motion that respects
   reduced-motion. Light and dark follow the system unless chosen in Profile.
   ========================================================================== */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("inter.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;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f2f2f7;
  --surface-3: #e5e5ea;
  --fill: rgba(118, 118, 128, .12);
  --fill-2: rgba(118, 118, 128, .2);
  --hairline: rgba(60, 60, 67, .12);
  --border: rgba(60, 60, 67, .18);
  --border-strong: rgba(60, 60, 67, .29);
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #8a8a8e;
  --overlay: rgba(0, 0, 0, .28);
  --glass: rgba(250, 250, 252, .72);
  --glass-strong: rgba(255, 255, 255, .86);

  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-press: #0062c4;
  --accent-ink: #0066cc;
  --accent-soft: rgba(0, 113, 227, .1);
  --accent-softer: rgba(0, 113, 227, .06);
  --on-accent: #ffffff;
  --focus: rgba(0, 113, 227, .4);

  --good: #1f8a3c;      --good-bg: rgba(52, 199, 89, .14);     --good-solid: #34c759;
  --warn: #a35a00;      --warn-bg: rgba(255, 149, 0, .15);     --warn-solid: #ff9500;
  --serious: #c03d0f;   --serious-bg: rgba(255, 107, 53, .14);
  --critical: #d70015;  --critical-bg: rgba(255, 59, 48, .11); --critical-solid: #ff3b30;
  --info: #0066cc;      --info-bg: rgba(0, 113, 227, .1);
  --violet: #8944ab;    --violet-bg: rgba(175, 82, 222, .12);
  --neutral: #6e6e73;   --neutral-bg: rgba(118, 118, 128, .12);

  /* chart roles */
  --series-1: #0071e3;
  --st-good: #34c759; --st-warning: #ffb340; --st-serious: #ff7a45; --st-critical: #ff3b30;
  --st-neutral: #c7c7cc; --st-muted: #e5e5ea;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .04), 0 0 0 .5px rgba(0, 0, 0, .04);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, .04), 0 12px 32px rgba(0, 0, 0, .07), 0 0 0 .5px rgba(0, 0, 0, .04);
  --shadow-3: 0 24px 64px rgba(0, 0, 0, .18), 0 4px 14px rgba(0, 0, 0, .08), 0 0 0 .5px rgba(0, 0, 0, .06);

  --r-xs: 8px; --r-s: 10px; --r: 14px; --r-l: 18px; --r-xl: 24px; --r-pill: 999px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;

  /* Motion: springs where supported (see @supports below), curves elsewhere. */
  --ease: cubic-bezier(.25, .1, .25, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);
  --ease-out-expo: cubic-bezier(.16, 1, .3, 1);
  --ease-sheet: cubic-bezier(.32, .72, 0, 1);
  --spring: cubic-bezier(.34, 1.36, .64, 1);
  --spring-soft: cubic-bezier(.22, 1.12, .36, 1);
  --ease-spring: var(--spring);
  --d1: 160ms; --d2: 260ms; --d3: 420ms; --d4: 620ms;
  --ai-colors: #0a84ff, #5e5ce6, #bf5af2, #ff375f, #ff9f0a, #0a84ff;

  --sidebar: 264px;
  --topbar: 54px;
  --tabbar: 62px;
  --content-max: 1120px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@supports (transition-timing-function: linear(0, 1)) {
  :root {
    --spring: linear(0, .006, .025 2.8%, .101 6.1%, .539 18.9%, .721 25.3%, .849 31.5%, .937 38.1%, .968 41.8%, .991 45.7%, 1.006 50.1%, 1.015 55%, 1.017 63.9%, 1.001 85.9%, 1);
    --spring-soft: linear(0, .009, .037 1.9%, .14 4.2%, .618 14.6%, .806 20.2%, .921 26.4%, .983 33.7%, 1.006 41.9%, 1.009 55.3%, 1);
  }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000000; --surface: #1c1c1e; --surface-2: #2c2c2e; --surface-3: #3a3a3c;
    --fill: rgba(118, 118, 128, .24); --fill-2: rgba(118, 118, 128, .32);
    --hairline: rgba(84, 84, 88, .55); --border: rgba(84, 84, 88, .65); --border-strong: rgba(120, 120, 128, .7);
    --text: #f5f5f7; --text-2: #a1a1a6; --text-3: #8e8e93; --overlay: rgba(0, 0, 0, .55);
    --glass: rgba(22, 22, 24, .72); --glass-strong: rgba(28, 28, 30, .86);
    --accent: #0a84ff; --accent-hover: #2b95ff; --accent-press: #0a74e0; --accent-ink: #4da3ff;
    --accent-soft: rgba(10, 132, 255, .18); --accent-softer: rgba(10, 132, 255, .1); --focus: rgba(10, 132, 255, .55);
    --good: #30d158; --good-bg: rgba(48, 209, 88, .16); --good-solid: #30d158;
    --warn: #ffb340; --warn-bg: rgba(255, 159, 10, .17); --warn-solid: #ff9f0a;
    --serious: #ff8a5c; --serious-bg: rgba(255, 122, 69, .17);
    --critical: #ff6961; --critical-bg: rgba(255, 69, 58, .18); --critical-solid: #ff453a;
    --info: #4da3ff; --info-bg: rgba(10, 132, 255, .18);
    --violet: #da8fff; --violet-bg: rgba(191, 90, 242, .18);
    --neutral: #a1a1a6; --neutral-bg: rgba(118, 118, 128, .24);
    --series-1: #0a84ff; --st-neutral: #636366; --st-muted: #2c2c2e;
    --shadow-1: 0 0 0 .5px rgba(255, 255, 255, .08);
    --shadow-2: 0 0 0 .5px rgba(255, 255, 255, .09), 0 12px 32px rgba(0, 0, 0, .45);
    --shadow-3: 0 0 0 .5px rgba(255, 255, 255, .1), 0 28px 72px rgba(0, 0, 0, .7);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000; --surface: #1c1c1e; --surface-2: #2c2c2e; --surface-3: #3a3a3c;
  --fill: rgba(118, 118, 128, .24); --fill-2: rgba(118, 118, 128, .32);
  --hairline: rgba(84, 84, 88, .55); --border: rgba(84, 84, 88, .65); --border-strong: rgba(120, 120, 128, .7);
  --text: #f5f5f7; --text-2: #a1a1a6; --text-3: #8e8e93; --overlay: rgba(0, 0, 0, .55);
  --glass: rgba(22, 22, 24, .72); --glass-strong: rgba(28, 28, 30, .86);
  --accent: #0a84ff; --accent-hover: #2b95ff; --accent-press: #0a74e0; --accent-ink: #4da3ff;
  --accent-soft: rgba(10, 132, 255, .18); --accent-softer: rgba(10, 132, 255, .1); --focus: rgba(10, 132, 255, .55);
  --good: #30d158; --good-bg: rgba(48, 209, 88, .16); --good-solid: #30d158;
  --warn: #ffb340; --warn-bg: rgba(255, 159, 10, .17); --warn-solid: #ff9f0a;
  --serious: #ff8a5c; --serious-bg: rgba(255, 122, 69, .17);
  --critical: #ff6961; --critical-bg: rgba(255, 69, 58, .18); --critical-solid: #ff453a;
  --info: #4da3ff; --info-bg: rgba(10, 132, 255, .18);
  --violet: #da8fff; --violet-bg: rgba(191, 90, 242, .18);
  --neutral: #a1a1a6; --neutral-bg: rgba(118, 118, 128, .24);
  --series-1: #0a84ff; --st-neutral: #636366; --st-muted: #2c2c2e;
  --shadow-1: 0 0 0 .5px rgba(255, 255, 255, .08);
  --shadow-2: 0 0 0 .5px rgba(255, 255, 255, .09), 0 12px 32px rgba(0, 0, 0, .45);
  --shadow-3: 0 0 0 .5px rgba(255, 255, 255, .1), 0 28px 72px rgba(0, 0, 0, .7);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar) + 16px); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font: 400 15px/1.47 var(--font); letter-spacing: -.009em; font-feature-settings: "cv11", "ss01";
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}
img, svg, video, canvas { display: block; max-width: 100%; }
:where(svg[viewBox="0 0 24 24"]:not([width])) { width: 1.25em; height: 1.25em; flex: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font: 700 34px/1.1 var(--font-display); letter-spacing: -.028em; }
h2 { font: 650 21px/1.2 var(--font-display); letter-spacing: -.02em; }
h3 { font-size: 17px; line-height: 1.3; font-weight: 600; letter-spacing: -.016em; }
h4 { font-size: 12.5px; line-height: 1.3; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--text-3); }
small, .small { font-size: 13px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.mono { font-family: var(--mono); font-size: .92em; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.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; }
::selection { background: var(--accent-soft); }

:focus { outline: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; transition: outline-offset var(--d1) var(--ease-out); }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 1000; padding: 10px 14px; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow-2); transition: top var(--d2) var(--spring); }
.skip-link:focus { top: 12px; }

/* ---------- Boot ---------- */
.boot { min-height: 100dvh; display: grid; place-items: center; }
.boot-mark { width: 64px; height: 64px; border-radius: 16px; animation: bootIn 700ms var(--spring) both, bootPulse 1.6s ease-in-out 700ms infinite; }
@keyframes bootIn { from { opacity: 0; transform: scale(.7); filter: blur(6px); } }
@keyframes bootPulse { 50% { transform: scale(.96); opacity: .85; } }

/* ---------- App shell ---------- */
.app { min-height: 100dvh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 6px;
  padding: 16px 12px 12px; background: var(--glass); border-right: .5px solid var(--hairline);
  -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; z-index: 30;
}
.sidebar::-webkit-scrollbar { display: none; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 12px; color: var(--text); font: 650 17px/1.2 var(--font-display); letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; flex: none; box-shadow: 0 1px 3px rgba(0, 0, 0, .15); transition: transform var(--d3) var(--spring); }
.brand:hover .brand-mark { transform: rotate(-6deg) scale(1.06); }
.brand small { display: block; font: 500 12px/1.3 var(--font); color: var(--text-3); letter-spacing: 0; margin-top: 1px; }
.ask-ai {
  position: relative; display: flex; align-items: center; gap: 10px; margin: 2px 2px 8px; padding: 9px 12px; border-radius: 12px; border: 0; width: calc(100% - 4px);
  background: var(--surface); box-shadow: var(--shadow-1); color: var(--text-2); font-size: 14px; text-align: left; isolation: isolate;
  transition: transform var(--d3) var(--spring), box-shadow var(--d2) var(--ease), color var(--d1);
}
.ask-ai::before { content: ""; position: absolute; inset: -1px; z-index: -1; border-radius: 13px; padding: 1px; background: linear-gradient(120deg, var(--ai-colors)); background-size: 300% 100%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; opacity: .55; animation: flow 8s linear infinite; }
.ask-ai:hover { color: var(--text); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.ask-ai:active { transform: scale(.97); }
.ask-ai kbd { margin-left: auto; }
.nav { display: flex; flex-direction: column; gap: 1px; position: relative; }
.nav-label { padding: 14px 12px 6px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.nav-item {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 11px; min-height: 38px; padding: 7px 12px;
  border-radius: 10px; color: var(--text); font-weight: 500; font-size: 14.5px;
  transition: color var(--d1) var(--ease), background var(--d1) var(--ease), transform var(--d3) var(--spring);
}
.nav-item:hover { text-decoration: none; background: var(--fill); }
.nav-item:active { transform: scale(.97); }
.nav-item[aria-current="page"] { color: var(--accent-ink); font-weight: 600; background: transparent; }
.nav-item svg { width: 20px; height: 20px; flex: none; color: var(--accent); transition: transform var(--d3) var(--spring); }
.nav-item:hover svg { transform: scale(1.08); }
.nav-item .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--critical-solid); color: #fff; font-size: 11.5px; font-weight: 650; display: grid; place-items: center; animation: pop 420ms var(--spring) both; }
.nav-indicator.instant { transition: none; }
.nav-indicator {
  position: absolute; left: 0; right: 0; top: 0; height: 38px; border-radius: 10px; background: var(--accent-soft);
  transition: transform 520ms var(--spring), height 520ms var(--spring), opacity var(--d1); pointer-events: none; z-index: 0;
}
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding-top: 12px; }
.me { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; color: var(--text); transition: background var(--d1), transform var(--d3) var(--spring); }
.me:hover { background: var(--fill); text-decoration: none; }
.me:active { transform: scale(.98); }
.me .ellipsis small { display: block; color: var(--text-3); font-size: 12px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 12.5px; font-weight: 650; color: #fff; background: linear-gradient(145deg, #64aaff, #0071e3); letter-spacing: 0;
}
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40; height: calc(var(--topbar) + var(--safe-t)); padding-top: var(--safe-t); display: flex; align-items: center; gap: var(--s2);
  padding-inline: var(--s6); background: transparent; border-bottom: .5px solid transparent;
  transition: background var(--d2) var(--ease), border-color var(--d2) var(--ease), -webkit-backdrop-filter var(--d2), backdrop-filter var(--d2);
}
.topbar.scrolled { background: var(--glass); border-bottom-color: var(--hairline); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
.topbar-title { font-weight: 600; font-size: 15.5px; letter-spacing: -.015em; opacity: 0; transform: translateY(6px); transition: opacity var(--d2) var(--ease), transform var(--d3) var(--spring); }
.topbar.scrolled .topbar-title { opacity: 1; transform: none; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.topbar .brand-mobile { display: none; }
.content { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: 0 var(--s6) var(--s8); flex: 1; }
.view { animation: viewIn 560ms var(--ease-out) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px); } }

.page-head { display: flex; align-items: flex-end; gap: var(--s4); flex-wrap: wrap; margin: var(--s2) 0 var(--s5); }
.page-head .eyebrow { font-size: 13px; font-weight: 600; color: var(--text-3); margin-bottom: 2px; letter-spacing: -.005em; }
.page-head .actions { margin-left: auto; display: flex; gap: var(--s2); flex-wrap: wrap; }

.tabbar { display: none; }

/* ---------- Icon buttons ---------- */
.icon-btn {
  position: relative; width: 38px; height: 38px; border: 0; border-radius: 50%; background: transparent; color: var(--accent);
  display: grid; place-items: center; transition: background var(--d1) var(--ease), color var(--d1), transform var(--d3) var(--spring);
}
.icon-btn:hover { background: var(--fill); }
.icon-btn:active { transform: scale(.86); }
.icon-btn svg { width: 21px; height: 21px; }
.icon-btn .dot {
  position: absolute; top: 3px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--critical-solid); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; white-space: nowrap; line-height: 1;
  box-shadow: 0 0 0 2px var(--bg); animation: pop 460ms var(--spring) both;
}
@keyframes pop { from { transform: scale(0); } }
.icon-btn.spinning svg { animation: spin 900ms linear infinite; }
.icon-btn.ringing svg { animation: bellRing 900ms var(--ease) both; transform-origin: 50% 10%; }
@keyframes bellRing { 15% { transform: rotate(14deg); } 30% { transform: rotate(-12deg); } 45% { transform: rotate(8deg); } 60% { transform: rotate(-5deg); } 75% { transform: rotate(2deg); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Buttons ---------- */
.btn {
  --h: 40px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: var(--h); min-width: 44px;
  padding: 0 18px; border: 0; border-radius: var(--r-pill); font-weight: 590; font-size: 14.5px; line-height: 1; letter-spacing: -.01em;
  white-space: nowrap; user-select: none; text-decoration: none !important; position: relative; overflow: hidden; isolation: isolate;
  transition: background var(--d1) var(--ease), color var(--d1), box-shadow var(--d2), transform var(--d3) var(--spring), opacity var(--d1), filter var(--d1);
}
.btn:active:not(:disabled) { transform: scale(.95); transition-duration: 90ms, 90ms, 90ms, 120ms; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex: none; margin-left: -2px; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:active:not(:disabled) { background: var(--accent-press); }
.btn-secondary { background: var(--fill); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: var(--fill-2); }
.btn-tinted { background: var(--accent-soft); color: var(--accent-ink); }
.btn-tinted:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.btn-plain { background: transparent; color: var(--accent-ink); padding: 0 10px; }
.btn-plain:hover:not(:disabled) { background: var(--accent-softer); }
.btn-danger { background: var(--critical-bg); color: var(--critical); }
.btn-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--critical-solid) 22%, transparent); }
.btn-danger-solid { background: var(--critical-solid); color: #fff; }
.btn-good { background: var(--good-solid); color: #fff; }
.btn-good:hover:not(:disabled) { filter: brightness(1.05); }
.btn-sm { --h: 32px; padding: 0 13px; font-size: 13.5px; gap: 5px; }
.btn-sm svg { width: 16px; height: 16px; }
.btn-lg { --h: 50px; padding: 0 26px; font-size: 16.5px; }
.btn-block { width: 100%; }
.btn .spinner { width: 18px; height: 18px; }
.btn.is-loading > :not(.btn-state) { opacity: 0; }
.btn-state { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; animation: fadeIn var(--d1) var(--ease); }
.btn.is-done { background: var(--good-solid); color: #fff; animation: donePop 520ms var(--spring); }
@keyframes donePop { 40% { transform: scale(1.04); } }

.spinner { width: 20px; height: 20px; animation: spin 760ms linear infinite; }
.spinner circle { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 44 100; }
.check-draw path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: draw 420ms var(--ease-out) 40ms forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- Cards & lists ---------- */
.card { background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-1); }
.card-pad { padding: var(--s5); }
.card-head { display: flex; align-items: center; gap: var(--s3); padding: var(--s4) var(--s5); border-bottom: .5px solid var(--hairline); }
.card-head h3 { font-size: 16px; }
.card-head .actions { margin-left: auto; display: flex; gap: 6px; }
.card-body { padding: var(--s4) var(--s5); }
.card + .card { margin-top: var(--s4); }
.section { margin-top: var(--s6); }
.section-head { display: flex; align-items: baseline; gap: var(--s2); margin: 0 4px var(--s3); }
.section-head h2 { font-size: 20px; }
.section-head h3 { font-size: 16px; }
.section-head .actions { margin-left: auto; }
.stagger > * { animation: rise 640ms var(--ease-out) both; animation-delay: calc(min(var(--i, 0), 14) * 40ms); }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.985); } }

.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-1); overflow: hidden; }
.row {
  position: relative; display: flex; align-items: center; gap: var(--s3); min-height: 56px; padding: 11px var(--s4);
  color: inherit; text-decoration: none !important; background: transparent; width: 100%; border: 0; text-align: left;
  transition: background var(--d1) var(--ease), transform var(--d3) var(--spring);
}
/* iOS-style inset separators */
.list > .row + .row::before, .list > li + li > .row::before {
  content: ""; position: absolute; left: var(--sep-inset, 16px); right: 0; top: 0; height: .5px; background: var(--hairline);
}
.list > .row:has(.row-icon), .list > li > .row:has(.row-icon) { --sep-inset: 64px; }
.list > .session-row { --sep-inset: 92px; }
button.row, a.row { cursor: pointer; }
button.row:hover, a.row:hover { background: var(--surface-2); }
button.row:active, a.row:active { background: var(--surface-3); transform: scale(.99); transition-duration: 80ms; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 590; display: flex; align-items: center; gap: 8px; min-width: 0; letter-spacing: -.012em; }
.row-sub { color: var(--text-2); font-size: 13.5px; margin-top: 1px; }
.row-meta { color: var(--text-3); font-size: 13px; white-space: nowrap; text-align: right; }
.row-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--accent); color: #fff; }
.row-icon.tone-good { background: var(--good-solid); } .row-icon.tone-warn { background: var(--warn-solid); } .row-icon.tone-critical { background: var(--critical-solid); }
.row-icon.tone-violet { background: #af52de; } .row-icon.tone-neutral { background: #8e8e93; } .row-icon.tone-teal { background: #30b0c7; }
.row-icon svg { width: 19px; height: 19px; }
.row .chev { color: var(--text-3); width: 16px; height: 16px; flex: none; opacity: .7; transition: transform var(--d3) var(--spring); }
a.row:hover .chev, button.row:hover .chev { transform: translateX(2px); }
.btn.file-btn { max-width: 100%; justify-content: flex-start; }
.btn.file-btn span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.row-btn { flex: 1; min-width: 0; background: none; border: 0; padding: 0; margin: 0; text-align: left; color: inherit; font: inherit; cursor: pointer; border-radius: 8px; }
.row-end { display: flex; align-items: center; gap: 8px; flex: none; }
.row-end:empty { display: none; }

.grid { display: grid; gap: var(--s4); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--s5); align-items: start; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); gap: var(--s3); }
.kpi { background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-1); padding: 16px 18px; min-width: 0; position: relative; overflow: hidden; }
a.kpi { color: inherit; transition: transform var(--d3) var(--spring), box-shadow var(--d2) var(--ease); }
a.kpi:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-2); }
a.kpi:active { transform: scale(.97); }
.kpi-label { font-size: 13px; font-weight: 550; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.kpi-label svg { width: 15px; height: 15px; color: var(--accent); }
.kpi-value { font: 700 32px/1.1 var(--font-display); letter-spacing: -.035em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 17px; font-weight: 600; color: var(--text-3); margin-left: 2px; letter-spacing: 0; }
.kpi-note { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.kpi.attention .kpi-value { color: var(--warn-solid); }

/* ---------- Chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: var(--r-pill);
  font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--neutral-bg); color: var(--neutral); letter-spacing: -.005em;
  transition: background var(--d2) var(--ease), color var(--d2) var(--ease);
}
.chip svg { width: 13px; height: 13px; flex: none; }
.chip.good { background: var(--good-bg); color: var(--good); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.serious { background: var(--serious-bg); color: var(--serious); }
.chip.critical { background: var(--critical-bg); color: var(--critical); }
.chip.info { background: var(--info-bg); color: var(--info); }
.chip.violet { background: var(--violet-bg); color: var(--violet); }
.chip.outline { background: transparent; box-shadow: inset 0 0 0 1px var(--border); color: var(--text-2); }
.chip.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.6s var(--ease) infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.75); } }
.chip.swap { animation: chipSwap 420ms var(--spring); }
@keyframes chipSwap { from { transform: scale(.8); opacity: .3; } }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ---------- Forms ---------- */
.form { display: grid; gap: var(--s4); }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-size: 13px; font-weight: 600; color: var(--text-2); padding-left: 2px; }
.field .hint { font-size: 12.5px; color: var(--text-3); padding-left: 2px; }
.field .error { font-size: 12.5px; color: var(--critical); display: flex; gap: 5px; align-items: center; padding-left: 2px; animation: rise var(--d3) var(--spring); }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 11px 14px; border: 1px solid transparent; border-radius: 12px;
  background: var(--fill); color: var(--text); font-size: 15.5px;
  transition: border-color var(--d1) var(--ease), box-shadow var(--d2) var(--ease), background var(--d1);
}
.card .input, .card .select, .card .textarea, .sheet .input, .sheet .select, .sheet .textarea, .auth-card .input { background: var(--surface-2); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { background: var(--fill-2); }
.input:focus, .select:focus, .textarea:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.field.invalid .input, .field.invalid .select, .field.invalid .textarea { border-color: var(--critical-solid); box-shadow: 0 0 0 4px var(--critical-bg); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m8 10 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 18px;
}
.input-group { position: relative; }
.input-group .input { padding-right: 48px; }
.input-group .icon-btn { position: absolute; right: 4px; top: 4px; color: var(--text-3); }
.code-input { font-size: 28px; letter-spacing: .34em; text-align: center; font-family: var(--mono); font-weight: 600; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 14.5px; line-height: 1.4; }
.check input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); flex: none; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; min-height: 32px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 51px; height: 31px; border-radius: 16px; background: var(--fill-2); position: relative; flex: none; transition: background var(--d2) var(--ease); }
.switch .track::after {
  content: ""; position: absolute; left: 2px; top: 2px; width: 27px; height: 27px; border-radius: 14px; background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 1px 1px rgba(0, 0, 0, .16), 0 0 0 .5px rgba(0, 0, 0, .04);
  transition: transform var(--d3) var(--spring), width var(--d2) var(--ease);
}
.switch input:checked + .track { background: var(--good-solid); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 3px solid var(--focus); outline-offset: 2px; }
.switch:active .track::after { width: 33px; }
.switch input:checked:active + .track::after { transform: translateX(14px); }

/* Segmented control */
.seg {
  position: relative; display: inline-flex; padding: 2px; border-radius: 10px; background: var(--fill); gap: 0; max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg button {
  position: relative; z-index: 1; border: 0; background: transparent; min-height: 30px; padding: 0 15px; border-radius: 8px;
  font-size: 13.5px; font-weight: 550; color: var(--text); white-space: nowrap; transition: color var(--d1) var(--ease), transform var(--d3) var(--spring);
}
.seg button:active { transform: scale(.95); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { font-weight: 650; }
.seg button .count { margin-left: 6px; font-size: 12px; color: var(--text-3); font-weight: 600; }
.seg-thumb {
  position: absolute; z-index: 0; top: 2px; bottom: 2px; left: 0; border-radius: 8px; background: var(--surface);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04), 0 0 0 .5px rgba(0, 0, 0, .04);
  transition: transform 520ms var(--spring), width 520ms var(--spring);
}
:root[data-theme="dark"] .seg-thumb { background: #636366; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg-thumb { background: #636366; } }

.toolbar { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s4); }
.toolbar .grow { flex: 1; }
.search { position: relative; min-width: 200px; flex: 1; max-width: 380px; }
.search svg { position: absolute; left: 12px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 38px; min-height: 40px; border-radius: 11px; }
.toolbar .select, .toolbar .input { min-height: 40px; width: auto; border-radius: 11px; font-size: 14.5px; }

/* ---------- Tables ---------- */
.table-wrap { background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-1); overflow: hidden; }
.table-scroll { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-weight: 600; font-size: 12px; color: var(--text-3); padding: 12px 16px 10px; white-space: nowrap; text-transform: uppercase; letter-spacing: .03em;
  background: var(--surface); border-bottom: .5px solid var(--hairline); position: sticky; top: 0;
}
.table th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.table th button:focus-visible { outline: 2px solid var(--focus); border-radius: 4px; }
.table td { padding: 12px 16px; border-bottom: .5px solid var(--hairline); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--d1) var(--ease); }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--surface-2); }
.table tbody tr.clickable:active { background: var(--surface-3); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.primary { font-weight: 590; }
.table .actions { text-align: right; white-space: nowrap; }
.table-foot { display: flex; align-items: center; gap: var(--s2); padding: 10px 16px; border-top: .5px solid var(--hairline); font-size: 13px; color: var(--text-2); }
.table-foot .pager { margin-left: auto; display: flex; gap: 4px; }
.table.loading tbody { opacity: .45; transition: opacity var(--d2); }

/* ---------- Banners & callouts ---------- */
.banner {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 14px; font-size: 14px; font-weight: 500; margin-bottom: var(--s4);
  background: var(--info-bg); color: var(--info); animation: rise var(--d3) var(--spring);
}
.banner svg { width: 18px; height: 18px; flex: none; }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.critical { background: var(--critical-bg); color: var(--critical); }
.banner .btn { margin-left: auto; flex: none; }
a.banner { transition: transform var(--d3) var(--spring), filter var(--d1); }
a.banner:hover { text-decoration: none; filter: brightness(.98); }
a.banner:active { transform: scale(.985); }
.offline-pill {
  position: fixed; left: 50%; top: calc(10px + var(--safe-t)); z-index: 90; transform: translate(-50%, -90px) scale(.8); display: flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--r-pill); background: #1d1d1f; color: #fff; font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow-3); opacity: 0; visibility: hidden; pointer-events: none;
  transition: transform 560ms var(--spring), opacity var(--d2) var(--ease), visibility 0s linear 560ms;
}
.offline-pill.show { transform: translate(-50%, 0) scale(1); opacity: 1; visibility: visible; transition-delay: 0s; }
.offline-pill svg { width: 16px; height: 16px; color: #ffb340; }
.callout { border-radius: 14px; padding: 14px 16px; background: var(--surface-2); font-size: 14px; }
.callout.ai { background: linear-gradient(160deg, var(--violet-bg), var(--accent-softer) 70%); box-shadow: inset 0 0 0 .5px color-mix(in srgb, var(--violet) 30%, transparent); }
.callout-head { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 8px; }
.callout-head svg { width: 18px; height: 18px; color: var(--violet); }
.callout ul { margin: 6px 0 0; padding-left: 18px; }
.callout li + li { margin-top: 3px; }

/* ---------- Empty, skeleton ---------- */
.empty { text-align: center; padding: 52px 24px; color: var(--text-2); animation: rise var(--d4) var(--ease-out) both; }
.empty .empty-icon { width: 60px; height: 60px; margin: 0 auto 14px; border-radius: 18px; display: grid; place-items: center; background: var(--fill); color: var(--text-3); }
.empty .empty-icon svg { width: 28px; height: 28px; }
.empty h3 { color: var(--text); margin-bottom: 4px; }
.empty p { font-size: 14px; max-width: 360px; margin: 0 auto; }
.empty .btn { margin-top: 18px; }
.skel { position: relative; overflow: hidden; background: var(--fill); border-radius: 10px; }
.skel::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 60%, transparent), transparent);
  animation: shimmer 1.5s var(--ease) infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.skel-line { height: 12px; margin: 8px 0; }
.skel-title { height: 30px; width: 40%; margin-bottom: 16px; }
.skel-card { height: 96px; border-radius: var(--r-l); }

/* ---------- Toasts (top "island") ---------- */
.toasts[popover] { top: auto; right: auto; bottom: auto; margin: 0; border: 0; padding: 0; background: transparent; overflow: visible; color: inherit; }
.toasts { position: fixed; z-index: 200; left: 50%; top: calc(12px + var(--safe-t)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(440px, calc(100vw - 24px)); }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 100%; padding: 11px 14px 11px 14px; border-radius: 22px;
  background: rgba(18, 18, 20, .92); color: #fff; box-shadow: 0 14px 40px rgba(0, 0, 0, .28), 0 0 0 .5px rgba(255, 255, 255, .08); font-size: 14.5px; font-weight: 550;
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  animation: islandIn 620ms var(--spring) both; transform-origin: 50% 0;
}
.toast.leaving { animation: islandOut 280ms var(--ease-in) both; }
.toast svg { width: 20px; height: 20px; flex: none; }
.toast.good svg { color: #30d158; } .toast.critical svg { color: #ff6961; } .toast.warn svg { color: #ffb340; } .toast.info svg { color: #4da3ff; }
.toast > span { flex: 1; min-width: 0; }
.toast .btn-plain { color: #4da3ff; margin: -4px -6px -4px auto; flex: none; }
.toast .btn-plain:hover { background: rgba(255, 255, 255, .1); }
@keyframes islandIn { 0% { opacity: 0; transform: translateY(-18px) scaleX(.55) scaleY(.7); filter: blur(4px); } 60% { opacity: 1; filter: none; } }
@keyframes islandOut { to { opacity: 0; transform: translateY(-12px) scale(.85); filter: blur(3px); } }

/* ---------- Dialogs, sheets, drawers ---------- */
dialog.sheet {
  border: 0; padding: 0; margin: auto; max-height: min(88dvh, 880px); width: min(560px, calc(100vw - 32px));
  border-radius: var(--r-xl); background: var(--surface); color: var(--text); box-shadow: var(--shadow-3); overflow: hidden;
  display: flex; flex-direction: column;
}
dialog.sheet:not([open]) { display: none; }
dialog.sheet.wide { width: min(900px, calc(100vw - 32px)); }
dialog.sheet::backdrop { background: var(--overlay); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fadeIn var(--d2) var(--ease); }
dialog.sheet[open] { animation: sheetIn 560ms var(--spring) both; }
dialog.sheet.closing { animation: sheetOut 220ms var(--ease-in) both; }
dialog.sheet.closing::backdrop { animation: fadeOut 220ms var(--ease-in) both; }
@keyframes sheetIn { from { opacity: 0; transform: scale(.9) translateY(10px); } 40% { opacity: 1; } }
@keyframes sheetOut { to { opacity: 0; transform: scale(.96) translateY(6px); } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 12px; }
.sheet-head h2 { font-size: 19px; flex: 1; min-width: 0; }
.sheet-head .sub { font-size: 13px; color: var(--text-2); font-weight: 500; margin-top: 2px; }
.sheet-head .icon-btn { background: var(--fill); width: 30px; height: 30px; color: var(--text-2); }
.sheet-head .icon-btn svg { width: 16px; height: 16px; }
.sheet-body { padding: 6px 20px 20px; overflow-y: auto; overscroll-behavior: contain; flex: 1; }
.sheet-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 20px calc(14px + var(--safe-b)); border-top: .5px solid var(--hairline); background: var(--surface); flex-wrap: wrap; }
.sheet-foot .left { margin-right: auto; }
.grabber { display: none; }

dialog.sheet.drawer {
  margin: 0 0 0 auto; height: 100dvh; max-height: none; width: min(640px, 100vw); border-radius: var(--r-xl) 0 0 var(--r-xl); animation-name: drawerIn;
}
dialog.sheet.drawer.closing { animation-name: drawerOut; }
@keyframes drawerIn { from { transform: translateX(60px); opacity: 0; } }
@keyframes drawerOut { to { transform: translateX(40px); opacity: 0; } }

/* Popover menus */
.menu {
  position: fixed; z-index: 120; min-width: 220px; max-width: min(360px, calc(100vw - 24px)); padding: 6px; border-radius: 16px;
  background: var(--glass-strong); box-shadow: var(--shadow-3); transform-origin: top right; animation: menuIn 420ms var(--spring) both;
  -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
}
.menu.leaving { animation: menuOut 160ms var(--ease-in) both; }
@keyframes menuIn { from { opacity: 0; transform: scale(.88) translateY(-6px); } }
@keyframes menuOut { to { opacity: 0; transform: scale(.94); } }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 8px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--text); text-align: left; font-size: 14.5px; transition: background var(--d1); }
.menu-item:hover { background: var(--fill); text-decoration: none; }
.menu-item svg { width: 18px; height: 18px; color: var(--accent); }
.menu-item.danger { color: var(--critical); }
.menu-item.danger svg { color: var(--critical); }
.menu-sep { height: .5px; background: var(--hairline); margin: 6px 4px; }
.notif-panel { width: min(400px, calc(100vw - 24px)); max-height: min(560px, 80dvh); display: flex; flex-direction: column; padding: 0; }
.notif-panel .menu-head { display: flex; align-items: center; padding: 14px 12px 10px 16px; border-bottom: .5px solid var(--hairline); }
.notif-panel .menu-head h3 { font-size: 16px; flex: 1; }
.notif-list { overflow-y: auto; padding: 6px; }
.notif { display: flex; gap: 10px; padding: 10px; border-radius: 12px; color: inherit; transition: background var(--d1); }
.notif:hover { background: var(--fill); text-decoration: none; }
.notif .dotmark { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 7px; flex: none; transition: transform var(--d3) var(--spring), opacity var(--d2); }
.notif.read .dotmark { transform: scale(0); opacity: 0; }
.notif-title { font-weight: 600; font-size: 14px; }
.notif-body { font-size: 13px; color: var(--text-2); }
.notif-time { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ---------- Today (faculty) ---------- */
.hero-card {
  position: relative; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-2); padding: 26px; overflow: hidden; isolation: isolate;
}
.hero-card::after {
  content: ""; position: absolute; z-index: -1; inset: -40% -10% auto auto; width: 70%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--hero-accent, var(--accent)) 16%, transparent), transparent 65%); pointer-events: none;
  animation: heroGlow 9s ease-in-out infinite alternate;
}
@keyframes heroGlow { to { transform: translate(-12%, 10%) scale(1.15); } }
.hero-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--hero-accent, var(--accent));
  transform-origin: left; transform: scaleX(var(--progress, 0)); transition: transform 900ms var(--ease-out);
}
.hero-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hero-time { font-size: 14px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.hero-title { font: 700 28px/1.12 var(--font-display); letter-spacing: -.03em; margin-top: 12px; }
.hero-sub { color: var(--text-2); margin-top: 4px; font-size: 15.5px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; align-items: center; }
.hero-actions .btn-lg { min-width: 190px; }
.hero-note { font-size: 13.5px; color: var(--text-2); display: flex; gap: 8px; align-items: center; }
.hero-note svg { width: 16px; height: 16px; }
.steps { display: flex; gap: 6px; margin-top: 22px; }
.step { flex: 1; min-width: 0; }
.step-bar { height: 5px; border-radius: 3px; background: var(--fill); overflow: hidden; }
.step-bar i { display: block; height: 100%; width: 0; background: var(--good-solid); border-radius: 3px; transition: width 700ms var(--ease-out); }
.step.active .step-bar i { width: 55%; background: var(--accent); animation: pulseBar 1.6s var(--ease) infinite; }
.step.done .step-bar i { width: 100%; }
@keyframes pulseBar { 50% { opacity: .5; } }
.step-label { font-size: 12px; font-weight: 600; color: var(--text-3); margin-top: 6px; }
.step.done .step-label, .step.active .step-label { color: var(--text-2); }

.timeline-list { position: relative; }
.session-row .time { width: 68px; flex: none; font-variant-numeric: tabular-nums; white-space: nowrap; }
.session-row .time b { display: block; font-size: 14.5px; font-weight: 650; letter-spacing: -.01em; }
.session-row .time span { font-size: 12.5px; color: var(--text-3); }
.session-row.now::after { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); animation: nowBar 2s ease-in-out infinite; }
@keyframes nowBar { 50% { opacity: .45; } }
.row-title .name { color: var(--text-2); font-weight: 500; }

/* Class cards (secretary & faculty lists on phones) */
.class-card { position: relative; background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-1); overflow: hidden; transition: transform var(--d3) var(--spring); }
.class-card + .class-card { margin-top: 10px; }
.class-card.now { box-shadow: var(--shadow-1), inset 3px 0 0 var(--accent); }
.class-card .cc-open {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 14px; align-items: center; width: 100%; padding: 14px 16px;
  background: none; border: 0; text-align: left; color: inherit; font: inherit; cursor: pointer; transition: background var(--d1);
}
.class-card .cc-open:hover { background: var(--surface-2); }
.class-card:has(.cc-open:active) { transform: scale(.985); }
.class-card .cc-time { grid-row: span 2; text-align: center; min-width: 56px; padding: 7px 6px; border-radius: 12px; background: var(--fill); font-variant-numeric: tabular-nums; }
.class-card.now .cc-time { background: var(--accent); color: #fff; }
.class-card.now .cc-time span { color: rgba(255, 255, 255, .8); }
.class-card .cc-time b { display: block; font-size: 16px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.class-card .cc-time span { display: block; font-size: 11px; color: var(--text-3); font-weight: 600; }
.class-card .cc-title { font-weight: 650; font-size: 16px; letter-spacing: -.015em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.class-card .cc-sub { font-size: 13.5px; color: var(--text-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.class-card .cc-side { grid-column: 3; grid-row: 2; display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.class-card .cc-title { grid-column: 2 / span 2; }
.class-card .cc-side .chip { height: 22px; font-size: 12px; padding: 0 8px; }
.class-card .cc-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 16px 14px; }
.class-card .cc-actions .btn { flex: 1; }

/* Big confirmation card (secretary "Needs you") */
.confirm-card { position: relative; padding: 20px; border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--shadow-2); overflow: hidden; isolation: isolate; animation: rise 640ms var(--spring) both; }
.confirm-card::before { content: ""; position: absolute; z-index: -1; inset: 0; background: linear-gradient(140deg, var(--accent-softer), transparent 55%); }
.confirm-card .who-line { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.confirm-card .who-line .avatar { width: 46px; height: 46px; font-size: 16px; }
.confirm-card h3 { font-size: 20px; letter-spacing: -.02em; }
.confirm-card .meta { color: var(--text-2); font-size: 14px; }
.confirm-card .cc-buttons { display: grid; grid-template-columns: 1.6fr 1fr; gap: 10px; margin-top: 18px; }

/* Week schedule */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day-col { min-width: 0; }
.day-head { font-size: 12.5px; font-weight: 600; color: var(--text-3); padding: 0 4px 8px; display: flex; justify-content: space-between; align-items: center; }
.day-head.today { color: var(--accent-ink); }
.day-head .d { font-size: 18px; color: var(--text); font-weight: 650; }
.day-head.today .d { color: #fff; background: var(--critical-solid); border-radius: 50%; width: 30px; height: 30px; display: grid; place-items: center; font-size: 15px; }
.slot {
  display: block; width: 100%; text-align: left; border: 0; padding: 10px 10px 10px 12px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-1);
  margin-bottom: 8px; color: inherit; font-size: 13px; transition: transform var(--d3) var(--spring), box-shadow var(--d2) var(--ease); position: relative; overflow: hidden;
}
.slot::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--slot, var(--accent)); }
.slot:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.slot:active { transform: scale(.97); }
.slot b { display: block; font-size: 13.5px; }
.slot .t { color: var(--text-2); font-variant-numeric: tabular-nums; }
.slot .chip { margin-top: 6px; height: 20px; font-size: 11.5px; padding: 0 7px; }

/* Calendar month */
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-radius: var(--r-l); overflow: hidden; background: var(--hairline); gap: 1px; box-shadow: var(--shadow-1); }
.month .dow { background: var(--surface); padding: 10px; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .03em; }
.month .cell { background: var(--surface); min-height: 96px; padding: 6px 8px; display: flex; flex-direction: column; gap: 3px; min-width: 0; transition: background var(--d1); }
.month .cell:hover { background: var(--surface-2); }
.month .cell.out { background: var(--surface-2); }
.month .cell.out .n { color: var(--text-3); }
.month .cell .n { font-size: 13px; font-weight: 600; color: var(--text-2); }
.month .cell.today .n { color: #fff; background: var(--critical-solid); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; }
.month .ev { font-size: 11.5px; font-weight: 600; padding: 2px 6px; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 0; text-align: left; cursor: pointer; transition: transform var(--d3) var(--spring); }
.month .ev:hover { transform: scale(1.03); }

/* ---------- Upload & redaction ---------- */
.dropzone {
  position: relative; display: grid; place-items: center; text-align: center; gap: 6px; padding: 30px 16px; border-radius: 18px;
  border: 1.5px dashed var(--border-strong); background: var(--surface-2); color: var(--text-2); cursor: pointer;
  transition: border-color var(--d2) var(--ease), background var(--d2) var(--ease), transform var(--d3) var(--spring);
}
.dropzone:hover { border-color: var(--accent); }
.dropzone.over { border-color: var(--accent); background: var(--accent-softer); transform: scale(1.015); }
.dropzone .dz-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--accent); box-shadow: var(--shadow-1); color: #fff; transition: transform var(--d3) var(--spring); }
.dropzone:hover .dz-icon, .dropzone.over .dz-icon { transform: translateY(-3px) scale(1.06); }
.dropzone .dz-icon svg { width: 22px; height: 22px; }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone b { color: var(--text); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; margin-top: 12px; }
.thumb { position: relative; aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden; background: var(--surface-2); box-shadow: var(--shadow-1); animation: thumbIn 520ms var(--spring) both; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .file-tile { height: 100%; display: grid; place-items: center; align-content: center; gap: 6px; padding: 8px; text-align: center; font-size: 12px; color: var(--text-2); word-break: break-all; }
.thumb .file-tile svg { width: 28px; height: 28px; color: var(--text-3); }
.thumb .tools { position: absolute; inset: auto 6px 6px 6px; display: flex; gap: 6px; justify-content: flex-end; }
.thumb .tools button { width: 30px; height: 30px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(20, 20, 22, .72); color: #fff; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: transform var(--d3) var(--spring); }
.thumb .tools button:active { transform: scale(.85); }
.thumb .tools svg { width: 15px; height: 15px; }
.thumb .badge { position: absolute; left: 6px; top: 6px; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 8px; background: rgba(20, 20, 22, .72); color: #fff; }
@keyframes thumbIn { from { opacity: 0; transform: scale(.8); } }
.progress { height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width 200ms linear; }
.redactor { display: grid; gap: 12px; }
.redactor-stage { position: relative; border-radius: 14px; overflow: hidden; background: #111; touch-action: none; cursor: crosshair; max-height: 62dvh; display: grid; place-items: center; }
.redactor-stage canvas { max-width: 100%; max-height: 62dvh; width: auto; height: auto; }

/* ---------- Evidence viewer ---------- */
.evidence-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--s5); }
.shot { display: block; border-radius: 14px; overflow: hidden; background: var(--surface-2); box-shadow: var(--shadow-1); cursor: zoom-in; border: 0; padding: 0; width: 100%; transition: transform var(--d3) var(--spring); }
.shot:hover { transform: scale(1.01); }
.shot img { width: 100%; height: auto; }
.shots { display: grid; gap: 10px; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 16px; font-size: 14px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.pdf-frame { width: 100%; height: 60dvh; border: 0; border-radius: 14px; background: var(--surface-2); }
dialog.lightbox { border: 0; padding: 24px; margin: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; background: transparent; display: grid; place-items: center; cursor: zoom-out; }
dialog.lightbox:not([open]) { display: none; }
dialog.lightbox::backdrop { background: rgba(0, 0, 0, .88); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); animation: fadeIn var(--d2) var(--ease); }
dialog.lightbox img { max-width: 100%; max-height: calc(100dvh - 48px); border-radius: 10px; animation: sheetIn 560ms var(--spring); }

/* Timeline (audit/status history) */
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { position: relative; padding: 0 0 14px 22px; font-size: 13.5px; }
.tl li::before { content: ""; position: absolute; left: 5px; top: 7px; bottom: -7px; width: 2px; background: var(--hairline); }
.tl li:last-child::before { display: none; }
.tl li::after { content: ""; position: absolute; left: 1px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 2px var(--accent); }
.tl .when { color: var(--text-3); font-size: 12.5px; }

/* ---------- Room code / QR ---------- */
.roomcode { text-align: center; display: grid; gap: 18px; justify-items: center; padding: 8px 0 4px; }
.roomcode .qr { width: 220px; height: 220px; padding: 12px; background: #fff; border-radius: 22px; box-shadow: var(--shadow-2); animation: sheetIn 600ms var(--spring) both; }
.roomcode .digits { font-family: var(--mono); font-size: 46px; font-weight: 700; letter-spacing: .18em; transition: opacity var(--d2); }
.ring { width: 44px; height: 44px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4; }
.ring .bg { stroke: var(--fill); }
.ring .fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }

/* ---------- Camera ---------- */
.camera { position: relative; border-radius: 22px; overflow: hidden; background: #0b0b0c; aspect-ratio: 3 / 4; max-height: 56dvh; margin: 0 auto; width: 100%; max-width: 360px; }
.camera video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.camera .oval { position: absolute; inset: 12% 18%; border-radius: 50%; box-shadow: 0 0 0 2000px rgba(0, 0, 0, .45); border: 2px solid rgba(255, 255, 255, .85); transition: border-color var(--d2); }
.camera .oval.ok { border-color: #30d158; }
.camera .prompt { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; color: #fff; font-weight: 600; text-shadow: 0 1px 3px rgba(0, 0, 0, .5); }

/* ---------- Charts ---------- */
.chart { position: relative; width: 100%; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--hairline); stroke-width: 1; }
.chart .axis-text { fill: var(--text-3); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.chart .series-line { fill: none; stroke: var(--series-1); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .series-area { fill: var(--series-1); opacity: .1; }
.chart .series-dot { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.chart .end-label { fill: var(--text); font-size: 12.5px; font-weight: 650; }
.chart .crosshair { stroke: var(--border-strong); stroke-width: 1; }
.chart .draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: drawLine 1.1s var(--ease-out) forwards; }
@keyframes drawLine { to { stroke-dashoffset: 0; } }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 120px; padding: 8px 10px; border-radius: 12px; background: var(--glass-strong);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  box-shadow: var(--shadow-3); font-size: 12.5px; transform: translate(-50%, -100%) scale(.95); opacity: 0; transition: opacity 140ms var(--ease), transform 260ms var(--spring);
}
.chart-tip.show { opacity: 1; transform: translate(-50%, -100%) scale(1); }
.chart-tip strong { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.chart-tip .k { display: inline-block; width: 12px; height: 2px; background: var(--series-1); vertical-align: middle; margin-right: 6px; }
.statusbar { display: flex; gap: 2px; height: 12px; border-radius: 6px; overflow: hidden; background: var(--st-muted); }
.statusbar i { display: block; height: 100%; transition: flex-grow 800ms var(--ease-out); min-width: 3px; }
.statusbar i:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 13px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend b { color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- Auth ---------- */
.auth { position: relative; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; overflow: hidden; isolation: isolate; background: var(--bg); }
.auth::before, .auth::after { content: ""; position: absolute; z-index: -1; width: 70vmax; aspect-ratio: 1; border-radius: 50%; filter: blur(80px); opacity: .5; pointer-events: none; }
.auth::before { background: radial-gradient(circle, rgba(10, 132, 255, .55), transparent 60%); left: -25vmax; top: -30vmax; animation: drift 18s ease-in-out infinite alternate; }
.auth::after { background: radial-gradient(circle, rgba(191, 90, 242, .4), transparent 60%); right: -30vmax; bottom: -35vmax; animation: drift 22s ease-in-out infinite alternate-reverse; }
@keyframes drift { to { transform: translate(8vmax, 6vmax) scale(1.1); } }
.auth-card {
  width: min(400px, 100%); background: var(--glass-strong); border-radius: 28px; box-shadow: var(--shadow-3); padding: 36px 30px 30px;
  -webkit-backdrop-filter: saturate(180%) blur(30px); backdrop-filter: saturate(180%) blur(30px); animation: sheetIn 760ms var(--spring) both;
}
.auth-card .brand-mark { width: 64px; height: 64px; border-radius: 16px; margin: 0 auto 18px; animation: bootIn 900ms var(--spring) 120ms both; }
.auth-card h1 { font-size: 26px; text-align: center; letter-spacing: -.025em; }
.auth-card .lead { text-align: center; color: var(--text-2); margin: 6px 0 26px; }
.auth-card .form > * { animation: rise 640ms var(--ease-out) both; }
.auth-card .form > :nth-child(1) { animation-delay: 180ms; } .auth-card .form > :nth-child(2) { animation-delay: 240ms; }
.auth-card .form > :nth-child(3) { animation-delay: 300ms; } .auth-card .form > :nth-child(4) { animation-delay: 360ms; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 12.5px; color: var(--text-3); }
.auth .error:not([hidden]) { display: flex; gap: 6px; align-items: center; font-size: 13.5px; color: var(--critical); background: var(--critical-bg); padding: 9px 12px; border-radius: 12px; animation: rise var(--d3) var(--spring); }
.shake { animation: shake 460ms var(--ease) !important; }
@keyframes shake { 15%, 55% { transform: translateX(-8px); } 35%, 75% { transform: translateX(7px); } 90% { transform: translateX(-2px); } }
.caps { display: none; align-items: center; gap: 6px; width: fit-content; padding: 4px 10px 4px 8px; border-radius: var(--r-pill);
  font-size: 12.5px; font-weight: 600; line-height: 1.2; color: var(--warn); background: var(--warn-bg); }
.caps.show { display: inline-flex; animation: capsIn 420ms var(--spring) both; }
.caps svg { width: 14px; height: 14px; flex: none; }
@keyframes capsIn { from { opacity: 0; transform: translateY(-4px) scale(.9); } }

/* ---------- Misc ---------- */
.divider { height: .5px; background: var(--hairline); margin: var(--s4) 0; }
.stack { display: flex; flex-direction: column; gap: var(--s3); }
.hstack { display: flex; align-items: center; gap: var(--s2); }
.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.mt-1 { margin-top: var(--s2); } .mt-2 { margin-top: var(--s4); } .mt-3 { margin-top: var(--s5); }
.pill-count { font-size: 12px; font-weight: 650; color: var(--text-2); background: var(--fill); padding: 1px 8px; border-radius: 10px; font-variant-numeric: tabular-nums; }
.queue-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--warn); }
.diff { font-family: var(--mono); font-size: 12px; background: var(--surface-2); border-radius: 10px; padding: 8px 10px; white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow: auto; }
.prose p + p { margin-top: 8px; }
kbd { font-family: var(--font); font-size: 11.5px; font-weight: 600; color: var(--text-3); background: var(--fill); border-radius: 6px; padding: 2px 6px; }
.print-only { display: none; }

/* View Transitions (progressive enhancement) */
::view-transition-old(root) { animation: 200ms var(--ease-in) both vtOut; }
::view-transition-new(root) { animation: 520ms var(--ease-out) both vtIn; }
@keyframes vtOut { to { opacity: 0; transform: scale(.985); } }
@keyframes vtIn { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Responsive ---------- */
@media (max-width: 1099px) {
  :root { --sidebar: 76px; }
  .sidebar { padding: 14px 10px; align-items: center; }
  .brand { padding: 4px 0 12px; }
  .brand span, .nav-label, .nav-item span, .nav-item .count, .me .ellipsis, .ask-ai span, .ask-ai kbd { display: none; }
  .ask-ai { width: 44px; height: 44px; padding: 0; justify-content: center; border-radius: 50%; margin: 0 0 8px; }
  .ask-ai::before { border-radius: 50%; }
  .nav { width: 100%; }
  .nav-item { justify-content: center; padding: 10px; min-height: 44px; }
  .nav-indicator { height: 44px; }
  .content { padding: 0 var(--s5) var(--s7); }
  .topbar { padding-inline: var(--s5); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .evidence-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  body { font-size: 16px; }
  h1 { font-size: 32px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar { padding-inline: var(--s3); height: calc(48px + var(--safe-t)); }
  .topbar .brand-mobile { display: flex; padding: 0 4px; transition: opacity var(--d2); }
  .topbar .brand-mobile .brand-mark { width: 30px; height: 30px; }
  .topbar-title { position: absolute; left: 50%; transform: translate(-50%, 6px); max-width: 52vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; bottom: 13px; }
  .topbar.scrolled .topbar-title { transform: translate(-50%, 0); }
  .topbar.scrolled .brand-mobile { opacity: 0; }
  .content { padding: 0 var(--s4) calc(var(--tabbar) + 36px + var(--safe-b)); }
  .page-head { margin-bottom: var(--s4); }
  .page-head .actions { margin-left: 0; width: 100%; }
  .page-head .actions .btn { flex: 1; }
  .tabbar {
    position: fixed; left: 10px; right: 10px; bottom: calc(10px + var(--safe-b)); z-index: 50; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    height: var(--tabbar); padding: 5px; border-radius: 31px; background: var(--glass-strong); box-shadow: 0 10px 34px rgba(0, 0, 0, .14), 0 0 0 .5px var(--hairline);
    -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
  }
  .tab-indicator { position: absolute; z-index: 0; top: 5px; bottom: 5px; left: 0; border-radius: 26px; background: var(--fill); transition: transform 560ms var(--spring), width 560ms var(--spring); pointer-events: none; }
  .tab {
    position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; background: none;
    color: var(--text); font-size: 10.5px; font-weight: 600; min-height: 44px; text-decoration: none !important; letter-spacing: 0; border-radius: 26px;
  }
  .tab svg { width: 24px; height: 24px; transition: transform 520ms var(--spring); }
  .tab[aria-current="page"] { color: var(--accent); }
  .tab[aria-current="page"] svg { animation: tabBounce 620ms var(--spring); }
  @keyframes tabBounce { 30% { transform: scale(.82); } 65% { transform: scale(1.12); } }
  .tab:active svg { transform: scale(.85); }
  .tab .count { position: absolute; top: 3px; left: calc(50% + 7px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--critical-solid); color: #fff; font-size: 10px; display: grid; place-items: center; animation: pop 460ms var(--spring) both; }
  .tab.ai-tab svg { color: var(--violet); }
  .grid-2, .grid-3, .form-row { grid-template-columns: minmax(0, 1fr); }
  .row-title .name { display: none; }
  .row.wrap-mobile { flex-wrap: wrap; }
  .row.wrap-mobile .row-main { flex: 1 1 calc(100% - 60px); }
  .row.wrap-mobile .row-end { flex: 1 1 100%; padding-left: 48px; }
  .row.wrap-mobile .row-end .btn { flex: 1; }
  .session-row .time { width: 62px; }
  .session-row .time b { font-size: 14px; }
  .session-row .chip { height: 22px; padding: 0 7px; font-size: 11.5px; }
  .list > .session-row { --sep-inset: 88px; flex-wrap: wrap; row-gap: 4px; }
  .list > .session-row .row-main { flex: 1 1 calc(100% - 110px); }
  .list > .session-row .chev { order: 2; }
  .list > .session-row > .chip, .list > .session-row > .queue-badge { order: 3; margin-left: 72px; }
  .row { gap: 10px; padding: 12px 14px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 28px; }
  .hero-card { padding: 22px 20px; border-radius: 24px; }
  .hero-title { font-size: 24px; }
  .hero-actions .btn-lg { flex: 1; min-width: 0; }
  .card-pad, .card-body { padding: var(--s4); }
  .card-head { padding: 14px var(--s4); }
  .week { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .day-head { padding-top: 12px; }
  .month .cell { min-height: 58px; padding: 4px; }
  .month .ev { font-size: 0; height: 6px; padding: 0; border-radius: 3px; }
  dialog.sheet, dialog.sheet.wide, dialog.sheet.drawer {
    width: 100vw; max-width: 100vw; margin: auto 0 0; max-height: 94dvh; height: auto; border-radius: 26px 26px 0 0; animation-name: sheetUp;
  }
  dialog.sheet.closing, dialog.sheet.drawer.closing { animation-name: sheetDown; }
  @keyframes sheetUp { from { transform: translateY(100%); } }
  @keyframes sheetDown { to { transform: translateY(100%); } }
  dialog.sheet[open] { animation-duration: 560ms; animation-timing-function: var(--spring-soft); }
  .grabber { display: block; width: 38px; height: 5px; border-radius: 3px; background: var(--fill-2); margin: 8px auto -8px; }
  .sheet-foot .btn { flex: 1; }
  .table.stack-mobile thead { display: none; }
  .table.stack-mobile tr { display: block; padding: 12px 16px; border-bottom: .5px solid var(--hairline); }
  .table.stack-mobile tr:last-child { border-bottom: 0; }
  .table.stack-mobile td { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border: 0; text-align: right; }
  .table.stack-mobile td::before { content: attr(data-label); color: var(--text-3); font-size: 13px; text-align: left; font-weight: 500; }
  .table.stack-mobile td.primary { font-weight: 650; font-size: 16px; text-align: left; padding-bottom: 4px; }
  .table.stack-mobile td.primary::before { display: none; }
  .table.stack-mobile td.actions { justify-content: flex-end; }
  .table.stack-mobile td.actions::before { display: none; }
  .table.stack-mobile td:empty { display: none; }
  .toolbar .search { max-width: none; flex-basis: 100%; }
  .seg { width: 100%; }
  .seg button { flex: 1; padding: 0 10px; }
  .confirm-card .cc-buttons { grid-template-columns: minmax(0, 1fr); }
  .confirm-card .btn-lg { width: 100%; }
}
@media (max-width: 380px) {
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .hero-actions .btn { width: 100%; }
  h1 { font-size: 28px; }
}
@media (hover: none) {
  a.kpi:hover, .slot:hover, .ask-ai:hover { transform: none; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; animation-delay: 0ms !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
  .skel::after, .auth::before, .auth::after, .hero-card::after { display: none; }
}

/* ---------- Forced colors ---------- */
@media (forced-colors: active) {
  .chip, .btn, .card, .kpi, .list { border: 1px solid CanvasText; }
  .statusbar i { forced-color-adjust: none; }
}

/* ---------- Print ---------- */
/* Reports print through a clean print root (see printSection in ui.js);
   these rules also keep a plain browser print free of app chrome. */
#print-root { display: none; }
@media print {
  @page { margin: 14mm; }
  :root, :root[data-theme="dark"] {
    color-scheme: light; --bg: #fff; --surface: #fff; --surface-2: #f3f3f3; --surface-3: #e6e6e6; --text: #000; --text-2: #222; --text-3: #555;
    --hairline: #d9d9d9; --border: #c8c8c8; --shadow-1: none; --shadow-2: none; --shadow-3: none; --fill: #eee;
  }
  html, body { background: #fff !important; color: #000; font-size: 10.5pt; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .sidebar, .topbar, .tabbar, .toolbar, .seg, .no-print, .toasts, .offline-pill, .skip-link, .route-progress, .page-head .actions, .ai-glow,
  .btn, button, input, select, textarea, dialog, .menu, .chev, .pager, .icon-btn, .composer { display: none !important; }
  .app, .main { display: block; }
  .content { padding: 0; max-width: none; }
  .card, .table-wrap, .list, .kpi { box-shadow: none !important; border: 1px solid #ccc; break-inside: avoid; }
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
  .split { grid-template-columns: minmax(0, 1fr) !important; }
  .table th { position: static; white-space: nowrap; }
  .table-wrap, .table-scroll { overflow: visible !important; }
  .table { font-size: 8.8pt; }
  .table th, .table td { padding: 5px 6px !important; }
  .table td.primary { white-space: nowrap; }
  .table thead { display: table-header-group; }
  .table tr { break-inside: avoid; }
  .table.stack-mobile thead { display: table-header-group !important; }
  .table.stack-mobile tr { display: table-row !important; padding: 0 !important; }
  .table.stack-mobile td { display: table-cell !important; text-align: left; padding: 6px 8px !important; border-bottom: 1px solid #ddd !important; }
  .table.stack-mobile td::before { display: none !important; }
  .table td.num, .table th.num { text-align: right !important; }
  .print-only { display: block !important; }
  a { color: inherit; text-decoration: none; }
  html.print-clean body > *:not(#print-root) { display: none !important; }
  html.print-clean #print-root { display: block !important; }
}
.print-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding-bottom: 10px; margin-bottom: 14px; border-bottom: 2px solid #000; }
.print-header .ph-brand { display: flex; align-items: center; gap: 8px; font-size: 9pt; color: #444; }
.print-header .ph-brand img { width: 22px; height: 22px; border-radius: 5px; }
.print-header .ph-brand b { display: block; color: #000; font-size: 10pt; }
.print-header h1 { font-size: 17pt; line-height: 1.15; margin: 0; }
.print-header p { margin: 2px 0 0; font-size: 9.5pt; color: #333; }
.print-meta { text-align: right; font-size: 8.5pt; color: #555; }
.print-foot { margin-top: 16px; padding-top: 8px; border-top: 1px solid #ccc; font-size: 8pt; color: #666; display: flex; justify-content: space-between; }

@media (min-width: 768px) { .mobile-only { display: none !important; } }
@media (max-width: 767px) { .desktop-only { display: none !important; } }
/* Settings rows: label left, control right (wraps on narrow screens). */
.row.field { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; }
.row.field > div:last-child { margin-left: auto; }
.row.field .error { flex-basis: 100%; }

/* ==========================================================================
   Motion & AI — fluid, looping feedback while work happens
   ========================================================================== */

/* Route progress: a thin bar that eases toward the end while a page loads. */
.route-progress { position: fixed; z-index: 400; left: 0; right: 0; top: 0; height: 3px; pointer-events: none; opacity: 0; transition: opacity 360ms var(--ease) 120ms; }
.route-progress i { position: absolute; inset: 0; transform-origin: left; transform: scaleX(0); border-radius: 0 3px 3px 0;
  background: linear-gradient(90deg, var(--ai-colors)); background-size: 200% 100%; animation: flow 2.4s linear infinite; }
html.routing .route-progress { opacity: 1; transition-delay: 0s; }
html.routing .route-progress i { transform: scaleX(.82); transition: transform 2.6s cubic-bezier(.08, .7, .2, 1); }
html.routed .route-progress i { transform: scaleX(1); transition: transform 240ms var(--ease-out); }
@keyframes flow { to { background-position: -200% 0; } }

.row, .kpi, .slot, .tab, .nav-item, .chip-btn, .intro-card { -webkit-tap-highlight-color: transparent; }

/* Looping "thinking" indicators */
.ai-orb { display: inline-block; vertical-align: middle; position: relative; width: 56px; height: 56px; border-radius: 50%; flex: none; isolation: isolate; animation: orbBreathe 2.6s ease-in-out infinite; }
.ai-orb::before, .ai-orb::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, var(--ai-colors)); animation: spin 3.2s linear infinite; }
.ai-orb::after { inset: -12%; filter: blur(12px); opacity: .6; z-index: -1; animation-duration: 4.4s; animation-direction: reverse; }
.ai-orb > i { position: absolute; inset: 16%; border-radius: 50%; background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .95), rgba(255, 255, 255, .25) 45%, transparent 70%); mix-blend-mode: soft-light; z-index: 1; }
.ai-orb.sm { width: 22px; height: 22px; }
.ai-orb.sm::after { filter: blur(5px); }
.ai-orb.md { width: 36px; height: 36px; }
.ai-orb.xl { width: 88px; height: 88px; }
.ai-orb.xl::after { filter: blur(22px); }
.ai-orb.idle { animation: none; }
.ai-orb.idle::before, .ai-orb.idle::after { animation-duration: 12s; }
@keyframes orbBreathe { 50% { transform: scale(1.08); } }

.shimmer-text { background: linear-gradient(100deg, var(--text-3) 20%, var(--text) 45%, var(--text-3) 70%); background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmerText 1.9s linear infinite; }
@keyframes shimmerText { from { background-position: 120% 0; } to { background-position: -120% 0; } }

.typing { display: inline-flex; gap: 4px; align-items: center; height: 18px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .35; animation: typing 1.25s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: .16s; }
.typing i:nth-child(3) { animation-delay: .32s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: .3; } 30% { transform: translateY(-4px); opacity: 1; } }

.progress.indeterminate i { width: 38%; animation: indeterminate 1.3s var(--ease) infinite; }
@keyframes indeterminate { from { transform: translateX(-110%); } to { transform: translateX(280%); } }

/* Animated multicolor edge for AI surfaces (the border flows while working). */
.ai-ring { position: relative; isolation: isolate; overflow: hidden; }
.ai-ring::before { content: ""; position: absolute; z-index: -2; left: 50%; top: 50%; width: 220%; aspect-ratio: 1; translate: -50% -50%;
  background: conic-gradient(from 0deg, var(--ai-colors)); opacity: 0; transition: opacity 500ms var(--ease); animation: spin 4.5s linear infinite; }
.ai-ring::after { content: ""; position: absolute; z-index: -1; inset: 1.5px; border-radius: inherit; background: var(--surface); }
.ai-ring.active::before { opacity: 1; }
.ai-ring.soft::before { opacity: .35; }
.callout.ai.running { animation: aiPulse 2.4s ease-in-out infinite; }
@keyframes aiPulse { 50% { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--violet) 40%, transparent), 0 8px 28px -12px color-mix(in srgb, var(--violet) 60%, transparent); } }

/* Siri-style edge glow around the whole window while the AI works. */
.ai-glow { position: fixed; inset: 0; z-index: 300; pointer-events: none; opacity: 0; transition: opacity 600ms var(--ease); }
.ai-glow::before { content: ""; position: absolute; inset: 0; padding: 3px; background: conic-gradient(from var(--glow-a, 0deg), var(--ai-colors));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; filter: blur(2px); }
.ai-glow::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 40px 6px rgba(94, 92, 230, .35), inset 0 0 90px 10px rgba(191, 90, 242, .16); }
html.ai-busy .ai-glow { opacity: 1; }
html.ai-busy .ai-glow::before { animation: glowSpin 4s linear infinite; }
@property --glow-a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes glowSpin { to { --glow-a: 360deg; } }

/* ---------- Face check (Face ID–style) ---------- */
.face-flow { display: grid; justify-items: center; gap: 14px; padding: 4px 0 2px; text-align: center; }
.face-cam { position: relative; width: min(272px, 70vw); aspect-ratio: 1; }
.face-cam .ticks { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.face-cam .ticks line { stroke: var(--surface-3); stroke-width: 3; stroke-linecap: round; transition: stroke 260ms var(--ease), opacity 260ms; }
.face-cam .ticks line.on { stroke: var(--accent); }
.face-cam.done .ticks line { stroke: #30d158; transition-delay: calc(var(--i) * 6ms); }
.face-cam.warn .ticks line { stroke: #ff9f0a; }
.face-cam.scanning .ticks line { animation: tickWave 1.2s linear infinite; animation-delay: calc(var(--i) * -16.6ms); }
@keyframes tickWave { 0% { stroke: var(--accent); opacity: 1; } 35% { stroke: #bf5af2; opacity: .9; } 70%, 100% { stroke: var(--surface-3); opacity: .5; } }
.face-cam .lens { position: absolute; inset: 9%; border-radius: 50%; overflow: hidden; background: radial-gradient(circle at 50% 40%, #26262b, #0b0b0c);
  transform: scale(.9); opacity: .6; transition: transform 700ms var(--spring), opacity 500ms var(--ease), filter 500ms; }
.face-cam.live .lens, .face-cam.scanning .lens, .face-cam.done .lens, .face-cam.warn .lens { transform: none; opacity: 1; }
.face-cam video, .face-cam .still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.face-cam .still { opacity: 0; transition: opacity 300ms; }
.face-cam.scanning .still, .face-cam.done .still, .face-cam.warn .still { opacity: 1; }
.face-cam.scanning .lens { filter: saturate(.6) brightness(.85); }
.face-cam .scan { position: absolute; inset: 0; opacity: 0; transition: opacity 300ms; pointer-events: none;
  background: linear-gradient(180deg, transparent 0%, rgba(191, 90, 242, 0) 40%, rgba(191, 90, 242, .55) 50%, rgba(10, 132, 255, 0) 60%, transparent 100%);
  background-size: 100% 220%; }
.face-cam.scanning .scan { opacity: 1; animation: scanSweep 1.6s ease-in-out infinite; }
@keyframes scanSweep { 0% { background-position: 0 120%; } 100% { background-position: 0 -20%; } }
.face-cam .mesh { position: absolute; inset: 0; opacity: 0; transition: opacity 400ms; pointer-events: none;
  background-image: radial-gradient(circle, rgba(255, 255, 255, .55) 1px, transparent 1.6px); background-size: 14px 14px;
  -webkit-mask: radial-gradient(ellipse 46% 56% at 50% 46%, #000 60%, transparent 100%); mask: radial-gradient(ellipse 46% 56% at 50% 46%, #000 60%, transparent 100%); }
.face-cam.scanning .mesh { opacity: .6; animation: meshDrift 3s linear infinite; }
@keyframes meshDrift { to { background-position: 14px 14px; } }
.face-cam .badge { position: absolute; inset: 9%; border-radius: 50%; display: grid; place-items: center; opacity: 0; transform: scale(.8); pointer-events: none;
  transition: opacity 360ms var(--ease), transform 600ms var(--spring); }
.face-cam.done .badge, .face-cam.warn .badge { opacity: 1; transform: none; }
.face-cam.done .badge { background: rgba(48, 209, 88, .5); }
.face-cam.warn .badge { background: rgba(255, 159, 10, .45); }
.face-cam .badge svg { width: 38%; height: 38%; color: #fff; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .3)); }
.face-cam .badge .check-draw path { stroke-dasharray: 24; stroke-dashoffset: 24; }
.face-cam.done .badge .check-draw path { animation: draw 520ms var(--ease) 180ms forwards; }
.face-cam .guide { position: absolute; inset: 22% 26% 18%; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, .35); opacity: 0; transition: opacity 300ms, border-color 300ms; }
.face-cam.live .guide { opacity: 1; }
.face-cam.live.steady .guide { border-color: rgba(48, 209, 88, .85); border-style: solid; }
.face-status { min-height: 46px; display: grid; gap: 2px; justify-items: center; }
.face-status b { font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.face-status span { font-size: 13.5px; color: var(--text-2); max-width: 320px; }
.face-status.swap { animation: statusSwap 420ms var(--ease-out); }
@keyframes statusSwap { from { opacity: 0; transform: translateY(6px); filter: blur(2px); } }
.face-note { font-size: 12.5px; color: var(--text-3); max-width: 340px; }

.face-enroll { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 16px; align-items: center; }
.face-thumb { position: relative; width: 112px; height: 112px; border-radius: 50%; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; color: var(--text-3); box-shadow: var(--shadow-1); }
.face-thumb img { width: 100%; height: 100%; object-fit: cover; color: transparent; animation: fadeIn 400ms var(--ease); }
.face-thumb svg { width: 40px; height: 40px; }
.face-thumb.busy::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, var(--ai-colors)); opacity: .55; mix-blend-mode: screen; animation: spin 1.6s linear infinite; }
.feature-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.feature-chips .chip { animation: rise 520ms var(--spring) both; animation-delay: calc(var(--i, 0) * 45ms); text-transform: none; }
@media (max-width: 480px) { .face-enroll { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; } .feature-chips { justify-content: center; } }

/* ==========================================================================
   Lectern AI (chat)
   ========================================================================== */
.ai-chat { display: flex; flex-direction: column; gap: 16px; min-height: calc(100dvh - var(--topbar) - 40px); padding-bottom: 8px; }
.ai-chat.in-sheet { min-height: 0; height: 100%; padding: 0; }
.ai-hero { display: grid; justify-items: center; text-align: center; gap: 14px; padding: 6vh 0 8px; }
.ai-hero h1 { font-size: 36px; background: linear-gradient(100deg, var(--text) 30%, #5e5ce6 60%, #bf5af2 80%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ai-hero p { color: var(--text-2); font-size: 16px; max-width: 460px; }
.in-sheet .ai-hero { padding: 10px 0 4px; }
.in-sheet .ai-hero h1 { font-size: 26px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip-btn { display: inline-flex; align-items: center; gap: 7px; border: 0; min-height: 36px; padding: 8px 14px; line-height: 1.3; text-align: left; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-1);
  font-size: 14px; font-weight: 550; color: var(--text); transition: transform 420ms var(--spring), background var(--d1), box-shadow var(--d2); }
.chip-btn svg { width: 16px; height: 16px; color: var(--accent); }
.chip-btn:hover { background: var(--surface-2); transform: translateY(-1px); }
.chip-btn:active { transform: scale(.95); }
.chat { display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 10px; align-items: flex-end; animation: msgIn 620ms var(--spring) both; }
.msg.user { flex-direction: row-reverse; }
@keyframes msgIn { from { opacity: 0; transform: translateY(16px) scale(.96); } }
.msg .who { width: 32px; height: 32px; flex: none; display: grid; place-items: center; }
.msg .who .ai-orb { width: 28px; height: 28px; }
.bubble { max-width: min(680px, 86%); padding: 10px 15px; border-radius: 20px; font-size: 15.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user .bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
.msg.ai .bubble { background: var(--surface); box-shadow: var(--shadow-1); border-bottom-left-radius: 6px; }
.msg .attach { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 4px 9px; border-radius: 10px; background: rgba(255, 255, 255, .18); font-size: 12.5px; font-weight: 600; }
.msg .attach svg { width: 14px; height: 14px; }
.msg .attach img { width: 44px; height: 44px; object-fit: cover; border-radius: 7px; }
.msg.thinking .bubble { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; color: var(--text-2); min-width: 200px; }
.steps-live { display: grid; gap: 4px; font-size: 13.5px; }
.steps-live div { display: flex; align-items: center; gap: 8px; color: var(--text-2); animation: rise 420ms var(--spring) both; }
.steps-live div svg { width: 15px; height: 15px; color: var(--good-solid); }
.steps-live div.now { color: var(--text); }
.steps-live .spinner { width: 15px; height: 15px; color: var(--accent); }

.ai-cards { display: grid; gap: 8px; margin-left: 42px; width: min(640px, calc(100% - 42px)); }
.change-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-1);
  animation: rise 620ms var(--spring) both; animation-delay: calc(var(--i, 0) * 70ms); transition: opacity var(--d2), transform var(--d3) var(--spring); }
.change-card .cc-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--good-solid); color: #fff; }
.change-card .cc-icon svg { width: 18px; height: 18px; }
.change-card.pending .cc-icon { background: var(--warn-solid); }
.change-card.undone { opacity: .55; }
.change-card.undone .cc-icon { background: #8e8e93; }
.change-card .cc-main { flex: 1; min-width: 0; }
.change-card .cc-title { font-weight: 600; font-size: 14.5px; letter-spacing: -.01em; }
.change-card .cc-detail { font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.change-card.undone .cc-title { text-decoration: line-through; }
.change-card .btn { flex: none; }
.cred-card { padding: 14px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-1); animation: rise 620ms var(--spring) both; }
.cred { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 9px 12px; border-radius: 12px; background: var(--surface-2); font-size: 13.5px; }
.cred + .cred { margin-top: 6px; }
.cred .mono { user-select: all; font-weight: 600; }

.plan { width: min(760px, 100%); margin-left: 42px; border-radius: var(--r-l); background: var(--surface); box-shadow: var(--shadow-2); overflow: hidden; animation: msgIn 700ms var(--spring) 80ms both; }
.plan-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: .5px solid var(--hairline); flex-wrap: wrap; }
.plan-head h3 { font-size: 15.5px; }
.plan-group + .plan-group { border-top: .5px solid var(--hairline); }
.plan-group > summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 12px 16px; cursor: pointer; font-weight: 600; font-size: 14px; }
.plan-group > summary::-webkit-details-marker { display: none; }
.plan-group > summary .chev { width: 16px; height: 16px; color: var(--text-3); transition: transform 420ms var(--spring); margin-left: auto; }
.plan-group[open] > summary .chev { transform: rotate(90deg); }
.plan-item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 16px; font-size: 14px; animation: rise 520ms var(--ease-out) both; animation-delay: calc(min(var(--i, 0), 14) * 22ms); }
.plan-item + .plan-item { border-top: .5px solid var(--hairline); }
.plan-item input { width: 19px; height: 19px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.plan-item .pi-main { flex: 1; min-width: 0; }
.plan-item .pi-main b { font-weight: 600; }
.plan-item .pi-sub { color: var(--text-2); font-size: 13px; }
.plan-item .pi-note { font-size: 12.5px; margin-top: 2px; }
.plan-item.error .pi-note { color: var(--critical); }
.plan-item.warn .pi-note { color: var(--warn); }
.plan-item.exists { opacity: .6; }
.plan-foot { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: .5px solid var(--hairline); background: var(--surface-2); flex-wrap: wrap; }
.plan-foot .spacer { flex: 1; }
.plan.applied { box-shadow: var(--shadow-1); }
.result-card { width: min(760px, 100%); margin-left: 42px; padding: 16px; border-radius: var(--r-l); background: var(--surface); box-shadow: var(--shadow-1); animation: msgIn 620ms var(--spring) both; }
.result-card .big-check { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--good-solid); color: #fff; animation: pop 620ms var(--spring) both; }

.composer-wrap { position: sticky; bottom: 16px; z-index: 5; margin-top: auto; }
.in-sheet .composer-wrap { bottom: 0; }
.composer { display: grid; gap: 8px; padding: 7px; border-radius: 26px; background: var(--glass-strong); box-shadow: var(--shadow-3);
  -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px); transition: box-shadow var(--d2), transform var(--d3) var(--spring); }
.composer:focus-within { box-shadow: var(--shadow-3), 0 0 0 4px var(--accent-softer); }
.composer.ai-ring { border-radius: 26px; }
.composer.ai-ring::after { background: var(--glass-strong); }
.composer-row { display: flex; align-items: flex-end; gap: 4px; }
.composer textarea { flex: 1; min-width: 0; border: 0; outline: none; resize: none; background: transparent; padding: 9px 6px; min-height: 42px; max-height: 180px; font-size: 16px; line-height: 1.45; }
.composer .icon-btn { width: 42px; height: 42px; color: var(--text-2); }
.send-btn { width: 40px; height: 40px; margin: 1px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--accent); color: #fff; flex: none;
  transition: transform 460ms var(--spring), opacity var(--d1), background var(--d1); }
.send-btn:disabled { opacity: .3; cursor: default; transform: scale(.9); }
.send-btn:not(:disabled):active { transform: scale(.85); }
.send-btn svg { width: 18px; height: 18px; }
.file-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 6px 6px 6px 8px; border-radius: 16px; background: var(--fill); font-size: 13px; animation: thumbIn 520ms var(--spring) both; }
.file-chip img { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; }
.file-chip .fc-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--surface); color: var(--accent); }
.file-chip .fc-icon svg { width: 18px; height: 18px; }
.file-chip .ellipsis { max-width: 220px; }
.file-chip button { width: 26px; height: 26px; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; color: var(--text-3); }
.file-chip button svg { width: 15px; height: 15px; }
.assistant-drop { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 60%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); opacity: 0; pointer-events: none; transition: opacity 260ms var(--ease); }
.assistant-drop.show { opacity: 1; }
.assistant-drop .dz { display: grid; justify-items: center; gap: 10px; padding: 36px 44px; border-radius: 30px; border: 2px dashed var(--accent); background: var(--surface); box-shadow: var(--shadow-3);
  transform: scale(.92); transition: transform 560ms var(--spring); }
.assistant-drop.show .dz { transform: none; }
dialog.sheet.ai-sheet { width: min(720px, calc(100vw - 32px)); height: min(84dvh, 820px); }
dialog.sheet.ai-sheet .sheet-body { display: flex; flex-direction: column; padding-bottom: 14px; }
@media (max-width: 767px) {
  .ai-cards, .plan, .result-card { margin-left: 0; width: 100%; }
  .ai-chat { min-height: calc(100dvh - 48px - var(--tabbar) - 60px - var(--safe-b)); }
  .composer-wrap { bottom: calc(var(--tabbar) + 18px + var(--safe-b)); }
  .in-sheet .composer-wrap { bottom: 0; }
  .ai-hero { padding-top: 3vh; }
  .ai-hero h1 { font-size: 30px; }
  dialog.sheet.ai-sheet { height: 94dvh; width: 100vw; }
  .change-card { flex-wrap: wrap; }
  .change-card .btn { margin-left: 46px; }
}

/* ---------- Setup checklist (admin dashboard) ---------- */
.setup-card { position: relative; overflow: hidden; }
.setup-ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums;
  background: conic-gradient(var(--good-solid) calc(var(--p) * 1%), var(--fill) 0); transition: --p 1s var(--ease-out); position: relative; }
.setup-ring::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--surface); }
.setup-ring span { position: relative; }
@property --p { syntax: "<number>"; inherits: false; initial-value: 0; }
.setup-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.setup-step { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); color: inherit; font-size: 13.5px; font-weight: 560;
  transition: transform 420ms var(--spring), background var(--d1); }
.setup-step:hover { text-decoration: none; background: var(--surface-3); }
.setup-step:active { transform: scale(.96); }
.setup-step .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--border-strong); }
.setup-step.done .dot { background: var(--good-solid); box-shadow: none; color: #fff; animation: pop 520ms var(--spring) both; }
.setup-step .dot svg { width: 13px; height: 13px; }
.setup-step small { display: block; color: var(--text-3); font-weight: 500; font-size: 12px; }
.inline-add { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; font-size: 12.5px; font-weight: 600; border: 0; background: none; color: var(--accent-ink); padding: 0; cursor: pointer; }
.inline-add svg { width: 13px; height: 13px; }
.inline-add:hover { text-decoration: underline; }
.field > label .inline-add { float: right; }
