/* Studalo: base + components. Values come from tokens.css only. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-block-end: calc(var(--kb, 0px) + var(--s-8)); } /* focusing a field scrolls it above the keyboard */
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ── Type ───────────────────────────────────────── */
.t-display  { font-size: var(--fs-display);  line-height: var(--lh-display);  letter-spacing: var(--tr-display);  font-weight: var(--w-bold); }
.t-title-1  { font-size: var(--fs-title-1);  line-height: var(--lh-title-1);  letter-spacing: var(--tr-title-1);  font-weight: var(--w-semi); text-wrap: balance; }
.t-title-2  { font-size: var(--fs-title-2);  line-height: var(--lh-title-2);  letter-spacing: var(--tr-title-2);  font-weight: var(--w-semi); text-wrap: balance; }
.t-title-3  { font-size: var(--fs-title-3);  line-height: var(--lh-title-3);  letter-spacing: var(--tr-title-3);  font-weight: var(--w-semi); }
.t-headline { font-size: var(--fs-headline); line-height: var(--lh-headline); letter-spacing: var(--tr-headline); font-weight: var(--w-semi); }
.t-body     { font-size: var(--fs-body);     line-height: var(--lh-body);     letter-spacing: var(--tr-body); }
.t-callout  { font-size: var(--fs-callout);  line-height: var(--lh-callout);  letter-spacing: var(--tr-callout); }
.t-footnote { font-size: var(--fs-footnote); line-height: var(--lh-footnote); letter-spacing: var(--tr-footnote); }
.t-caption  { font-size: var(--fs-caption);  line-height: var(--lh-caption);  letter-spacing: var(--tr-caption); font-weight: var(--w-medium); }
.muted { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; }
h1, h2, h3, h4, p { margin: 0; }

/* ── Buttons ────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: var(--hit); padding-inline: var(--s-5);
  border: 0; border-radius: var(--r-control);
  font-size: var(--fs-callout); font-weight: var(--w-semi); line-height: 1;
  cursor: pointer; user-select: none; touch-action: manipulation;
  transition: transform var(--dur-press) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.btn:active, .btn[data-pressed] { transform: scale(var(--press-scale)); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary   { background: var(--accent); color: var(--on-accent); }
.btn-primary:active, .btn-primary[data-pressed] { background: var(--accent-press); }
.btn-secondary { background: var(--sunk); color: var(--ink); }
.btn-quiet     { background: transparent; color: var(--accent-text); padding-inline: var(--s-3); }
.btn-danger    { background: transparent; color: var(--danger); padding-inline: var(--s-3); }
.btn-destroy   { background: color-mix(in oklab, var(--danger) 11%, var(--surface)); color: var(--danger); } /* confirming something you can't undo */
.btn-lg    { min-height: var(--hit-lg); font-size: var(--fs-headline); }
.btn-block { width: 100%; }
.btn-icon  { width: var(--hit); padding: 0; background: transparent; color: var(--ink-2); }
.btn:disabled { opacity: 0.4; pointer-events: none; }
@media (hover: hover) and (pointer: fine) {
  .btn-secondary:hover { background: color-mix(in oklch, var(--sunk), var(--ink) 5%); }
  .btn-quiet:hover, .btn-icon:hover { background: var(--sunk); }
}
kbd {
  font: inherit; font-size: var(--fs-caption); font-weight: var(--w-medium);
  min-width: 20px; padding: 1px var(--s-1); border-radius: var(--r-min);
  background: color-mix(in oklch, currentColor, transparent 85%); text-align: center;
}
.kbd-only { display: none; }
/* Keyboard hints only on wide screens with a mouse. Phones always get touch wording, even in a desktop phone preview. */
@media (hover: hover) and (pointer: fine) and (min-width: 720px) { .kbd-only { display: inline; } .touch-only { display: none; } }

/* ── Chips ──────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: var(--s-1);
  min-height: 32px; padding: 0 var(--s-3); border: 0; border-radius: var(--r-chip);
  background: var(--accent-tint); color: var(--accent-text);
  font-size: var(--fs-callout); font-weight: var(--w-semi); cursor: pointer;
  transition: transform var(--dur-press) var(--ease-out);
}
.chip:active { transform: scale(var(--press-scale)); }
.badge {
  display: inline-flex; align-items: center; gap: var(--s-1);
  padding: 2px var(--s-2); border-radius: var(--r-chip);
  background: var(--sunk); color: var(--ink-2);
  font-size: var(--fs-caption); font-weight: var(--w-medium); line-height: var(--lh-caption);
}

/* ── Surfaces ───────────────────────────────────── */
.card  { background: var(--surface); border: 1px solid var(--edge); border-radius: var(--r-card); padding: var(--s-5); box-shadow: var(--shadow-low); }
.group { background: var(--surface); border-radius: var(--r-group); overflow: hidden; box-shadow: var(--shadow-low); }
.row {
  display: flex; align-items: center; gap: var(--s-3);
  min-height: 56px; padding: var(--s-2) var(--s-4);
  color: inherit; text-decoration: none; background: var(--surface);
  border: 0; width: 100%; text-align: left; cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  position: relative;
}
.row + .row::before { content: ""; position: absolute; top: 0; right: 0; left: 52px; height: 1px; background: var(--line); }
.row:active { background: var(--sunk); }
.row[aria-selected="true"] { background: var(--accent-tint); }
.row-icon { width: 24px; height: 24px; color: var(--ink-2); flex: none; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: var(--w-medium); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { font-size: var(--fs-footnote); line-height: var(--lh-footnote); color: var(--ink-2); }
.row-end { color: var(--ink-2); display: flex; align-items: center; gap: var(--s-2); flex: none; }
.row-end svg { width: 18px; height: 18px; color: var(--line-strong); }
.check {
  width: 22px; height: 22px; border-radius: var(--r-pill); flex: none;
  border: 1.5px solid var(--line-strong); display: grid; place-items: center;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.check svg { width: 14px; height: 14px; color: var(--on-accent); opacity: 0; }
:is([aria-selected="true"], [aria-checked="true"]) .check { background: var(--accent); border-color: var(--accent); }
:is([aria-selected="true"], [aria-checked="true"]) .check svg { opacity: 1; }
@media (hover: hover) and (pointer: fine) { .row:hover:not([aria-selected="true"]) { background: color-mix(in oklch, var(--surface), var(--ink) 3%); } }

/* ── Concentric nesting ─────────────────────────── */
/* Parent sets --r and --pad. Direct children get radius = --r − --pad. */
.nest { border-radius: var(--r); padding: var(--pad); --r-child: max(var(--r-min), calc(var(--r) - var(--pad))); }
.nest > * { border-radius: var(--r-child); }

/* ── Progress ───────────────────────────────────── */
.progress { height: 4px; border-radius: var(--r-pill); background: var(--line); overflow: hidden; }
.progress > i {
  display: block; height: 100%; background: var(--accent); border-radius: inherit;
  transform-origin: left; transform: scaleX(var(--p, 0));
  transition: transform var(--dur-base) var(--ease-out);
}

/* ── Streak (week row) ──────────────────────────── */
.kept { display: grid; gap: var(--s-4); }
.kept-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-3); }
.kept-count { display: flex; align-items: baseline; gap: var(--s-2); }
.kept-num { font-variant-numeric: tabular-nums; display: inline-block; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--s-1); list-style: none; margin: 0; padding: 0; }
.week li { display: grid; justify-items: center; gap: var(--s-1); font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--ink-2); font-weight: var(--w-medium); }
.dot { width: 28px; height: 28px; border-radius: var(--r-pill); border: 2px solid var(--line); display: grid; place-items: center; color: var(--on-accent); }
.dot svg { width: 14px; height: 14px; }
[data-day="done"] .dot  { background: var(--accent); border-color: var(--accent); }
[data-day="today"] .dot { border-color: var(--accent); }
[data-day="today"]      { color: var(--accent-text); }
[data-day="saved"] .dot { border-style: dashed; border-color: var(--accent); color: var(--accent-text); }
[data-day="rest"] .dot  { border-color: transparent; background: var(--sunk); color: var(--ink-2); }
[data-day="missed"] .dot { border-color: var(--line); background: transparent; }
.saves { display: inline-flex; align-items: center; gap: var(--s-1); font-size: var(--fs-footnote); color: var(--ink-2); font-weight: var(--w-medium); }
.saves svg { width: 16px; height: 16px; }

/* ── Flashcard ──────────────────────────────────── */
.stage { perspective: 1400px; position: relative; }
.swipe { position: relative; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; will-change: transform; transition: scale var(--dur-press) var(--ease-out); }
.swipe[data-pressed] { scale: 0.985; }
/* The pile: the next cards peek out behind this one (two at most) and it thins as the round goes. data-left on .stage. */
.stage::before, .stage::after {
  content: ''; position: absolute; inset: 0 var(--s-3); z-index: -1; pointer-events: none;
  border: 1px solid var(--edge); border-radius: var(--r-card); background: var(--surface); box-shadow: var(--shadow-low);
  opacity: 0; transition: opacity var(--dur-base) var(--ease-out), translate var(--dur-base) var(--ease-out);
}
.stage::before { inset-inline: var(--s-6); } /* the one further back */
.stage:is([data-left="1"], [data-left="2"])::after { opacity: 1; translate: 0 calc(var(--s-3) * -1); }
.stage[data-left="2"]::before { opacity: 1; translate: 0 calc(var(--s-5) * -1); }
.flash {
  position: relative; height: clamp(280px, 56dvh, 480px);
  transform-style: preserve-3d; transition: transform var(--dur-flip) var(--ease-in-out); cursor: pointer;
}
.flash[data-flipped] { transform: rotateY(180deg); }
.flash[data-instant], .flash[data-instant] * { transition: none !important; }
.face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: grid; grid-template-rows: auto 1fr auto; gap: var(--s-3);
  padding: var(--s-5); background: var(--surface); border: 1px solid var(--edge);
  border-radius: var(--r-card); box-shadow: var(--shadow-card);
}
.face.back { transform: rotateY(180deg); }
.face-top { display: flex; justify-content: space-between; align-items: center; gap: var(--s-2); min-height: 24px; color: var(--ink-2); font-size: var(--fs-footnote); }
.star { width: var(--hit); height: var(--hit); margin: calc(var(--s-3) * -1); display: grid; place-items: center; border: 0; background: none; color: var(--ink-2); cursor: pointer; border-radius: var(--r-pill); }
.star svg { width: 20px; height: 20px; transition: transform var(--dur-press) var(--ease-out); }
.star:active svg { transform: scale(0.85); }
.star[aria-pressed="true"] { color: var(--accent); }
.star[aria-pressed="true"] svg { fill: currentColor; }
.face-text {
  align-self: center; justify-self: center; text-align: center; max-width: 28ch;
  font-size: var(--fs-card); line-height: 1.25; letter-spacing: -0.015em; font-weight: var(--w-semi); text-wrap: balance;
}
.face.back .face-text { font-weight: var(--w-regular); }
.face-text.long { font-size: var(--fs-title-3); line-height: var(--lh-title-3); letter-spacing: var(--tr-title-3); }
.face-hint { justify-self: center; color: var(--ink-2); font-size: var(--fs-footnote); }
.verdict {
  position: absolute; bottom: var(--s-4); left: 50%; translate: -50% 0; padding: var(--s-1) var(--s-3); border-radius: var(--r-chip);
  font-size: var(--fs-callout); font-weight: var(--w-semi); opacity: 0; pointer-events: none; z-index: 2;
}
.verdict.again { background: var(--again-tint); color: var(--again); }
.verdict.good  { background: var(--accent-tint); color: var(--accent-text); }

/* Grade dock: concentric. r-card 22 − pad 8 = 14 */
.dock { --r: var(--r-card); --pad: var(--s-2); background: var(--sunk); display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); }
.dock .btn { min-height: var(--hit-lg); font-size: var(--fs-headline); }
.dock .btn-secondary { background: var(--surface); }
.dock .btn[data-armed] { transform: scale(1.03); }  /* swipe passed the commit point */
.dock .btn-secondary[data-armed] { background: var(--again-tint); color: var(--again); }
.dock .btn-primary[data-armed] { background: var(--accent-press); }
.dot-again { width: 8px; height: 8px; border-radius: var(--r-pill); background: var(--again); }

/* ── Sheet ──────────────────────────────────────── */
.scrim {
  position: fixed; inset: 0; background: var(--scrim); z-index: var(--z-sheet);
  opacity: 0; transition: opacity var(--dur-sheet) var(--ease-out);
}
.scrim[data-open] { opacity: 1; }
.sheet {
  /* Sits on the live bottom inset and rides above the on-screen keyboard (--kb, from the visual viewport). */
  position: fixed; left: 0; right: 0; z-index: var(--z-sheet);
  bottom: calc(env(safe-area-inset-bottom, 0px) - var(--safe-b-max) + var(--kb, 0px));
  margin-inline: auto; max-width: 560px; max-height: min(85dvh, calc(var(--vvh, 100dvh) - var(--s-8))); overflow: auto;
  --r: var(--r-sheet); --pad: var(--s-4);
  border-radius: var(--r) var(--r) 0 0; background: var(--surface); box-shadow: var(--shadow-float);
  padding: var(--s-2) var(--pad) calc(var(--pad) + var(--safe-b-max));
  transform: translateY(100%);
  transition: transform var(--dur-sheet) var(--ease-sheet);
  touch-action: none;
}
.sheet[data-open] { transform: translateY(0); }
.sheet[data-closing] { transition-duration: var(--dur-fast); }
.sheet .group { border-radius: calc(var(--r) - var(--pad)); background: var(--sunk); box-shadow: none; }
.sheet .group .row { background: transparent; }
.grabber { width: 36px; height: 5px; border-radius: var(--r-pill); background: var(--line); margin: 0 auto var(--s-3); }
@media (min-width: 1024px) {
  .sheet { bottom: auto; top: 50%; border-radius: var(--r); padding-bottom: var(--pad); transform: translate(0, -46%) scale(0.97); opacity: 0;
    transition: transform var(--dur-base) var(--ease-out), opacity var(--dur-base) var(--ease-out); }
  .sheet[data-open] { transform: translate(0, -50%); opacity: 1; }
  .sheet { --pad: var(--s-5); }
  .grabber { display: none; }
}

/* ── Toast ──────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; z-index: var(--z-toast);
  bottom: calc(var(--tabbar-h) + var(--s-4) + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-2) var(--s-2) var(--s-2) var(--s-4); border-radius: var(--r-group);
  background: var(--ink); color: var(--paper); box-shadow: var(--shadow-float);
  font-size: var(--fs-callout); font-weight: var(--w-medium);
  transform: translate(-50%, calc(100% + var(--s-8))); opacity: 0;
  transition: transform var(--dur-base) var(--ease-out), opacity var(--dur-base) var(--ease-out);
  pointer-events: none; /* taps go through the message to what's under it; only Undo catches them */
}
.toast[data-open] { transform: translate(-50%, 0); opacity: 1; }
.toast .btn { pointer-events: auto; min-height: 36px; color: var(--paper); background: color-mix(in oklch, var(--paper), transparent 84%); }
@media (min-width: 1024px) { .toast { bottom: var(--s-6); } }

/* ── Loading ──────────────────────────────────────
   Skeletons only for data that has to load (groups, shared links), never for your own library, and only when
   loading takes over 300ms. Spinners only inside the button you pressed. */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sk-region { display: grid; gap: var(--s-3); }
.sk { display: block; border-radius: var(--r-min); background: var(--sunk); animation: sk-pulse 1400ms var(--ease-in-out) infinite; } /* design-ok: slow ambient loop while waiting */
.sk-stack { display: grid; gap: var(--s-2); }
.sk-title { height: 14px; width: 60%; }
.sk-meta { height: 10px; width: 36%; }
.sk-line { height: 12px; }
.sk-block { height: 44px; border-radius: var(--r-control); }
.sk-ic { width: 24px; height: 24px; flex: none; }
.sk-av { width: 32px; height: 32px; border-radius: var(--r-pill); box-shadow: 0 0 0 2px var(--surface); }
.sk-av + .sk-av { margin-left: calc(var(--s-2) * -1); }
.sk-bar { height: 6px; border-radius: var(--r-pill); }
.sk-btn { height: var(--hit-lg); border-radius: var(--r-control); }
@keyframes sk-pulse { 50% { opacity: 0.45; } }
.spin { width: 16px; height: 16px; flex: none; border-radius: var(--r-pill); border: 2px solid currentColor; border-right-color: transparent; animation: spin 700ms linear infinite; } /* design-ok: spinner loop */
@keyframes spin { to { transform: rotate(360deg); } }
.btn[aria-busy="true"], .btn[aria-busy="true"]:disabled { cursor: progress; opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion="full"]) .sk { animation: none; }
  :root:not([data-motion="full"]) .spin { animation-duration: 1400ms; } /* design-ok: slower spin, still shows work */
}

/* ── Tab bar (phones, tablets) ──────────────────── */
/* Browser bars: Safari 26 floats its bar at the bottom and tints it from the solid element at that edge
   (it ignores see-through backgrounds and theme-color). Chrome 135+ draws a sliding "chin". So the bar is solid paper,
   padded by the max inset and moved by the live inset (Chrome's recommended pattern, no reflow while bars slide). */
.tabbar {
  position: fixed; left: 0; right: 0; z-index: var(--z-bar);
  bottom: calc(env(safe-area-inset-bottom, 0px) - var(--safe-b-max));
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  padding: 0 max(var(--s-2), env(safe-area-inset-right, 0px)) var(--safe-b-max) max(var(--s-2), env(safe-area-inset-left, 0px));
  background: var(--paper);
  box-shadow: inset 0 1px 0 var(--line);
}
.tab {
  display: grid; justify-items: center; align-content: center; gap: 2px; height: var(--tabbar-h);
  border: 0; background: none; color: var(--ink-2); cursor: pointer;
  font-size: var(--fs-caption); font-weight: var(--w-medium); line-height: var(--lh-caption);
  transition: transform var(--dur-press) var(--ease-out);
}
.tab svg { width: 24px; height: 24px; }
.tab:active { transform: scale(0.94); }
.tab[aria-current="page"] { color: var(--accent-text); }

/* ── Reduced motion / transparency ──────────────── */
/* [data-motion="full"] is set only on the local test server (kit.js), so the
   designer sees real motion. The shipped app always honors this setting. */
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion="full"]) .flash { transition: none; }
  :root:not([data-motion="full"]) .flash .face { transition: opacity var(--dur-fast) ease; }
  :root:not([data-motion="full"]) .flash[data-flipped] { transform: none; }
  :root:not([data-motion="full"]) .flash .face.back { transform: none; opacity: 0; }
  :root:not([data-motion="full"]) .flash[data-flipped] .face.front { opacity: 0; }
  :root:not([data-motion="full"]) .flash[data-flipped] .face.back { opacity: 1; }
  :root:not([data-motion="full"]) .sheet { transition: opacity var(--dur-fast) ease; transform: none; opacity: 0; }
  :root:not([data-motion="full"]) .sheet[data-open] { opacity: 1; }
  :root:not([data-motion="full"]) .toast { transition: opacity var(--dur-fast) ease; transform: translate(-50%, 0); }
  :root:not([data-motion="full"]) :is(.btn:active, .btn[data-pressed], .chip:active, .tab:active) { transform: none; }
  :root:not([data-motion="full"]) .swipe[data-pressed] { scale: none; }
  :root:not([data-motion="full"]) .stage::before, :root:not([data-motion="full"]) .stage::after { transition: opacity var(--dur-fast) ease; }
}
@media (prefers-reduced-motion: reduce) and (min-width: 1024px) {
  :root:not([data-motion="full"]) :is(.sheet, .sheet[data-open]) { transform: translate(0, -50%); }
}
@media (prefers-reduced-transparency: reduce) {
  .tabbar { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* Static rows (not tappable) */
.row:not(button, a) { cursor: default; }
.row:not(button, a):active { background: var(--surface); }

/* Streak flame (two tones) */
.flame-out { fill: var(--streak); }
.flame-in  { fill: var(--streak-light); }

/* ── Avatars ────────────────────────────────────── */
.avatar {
  width: 40px; height: 40px; flex: none; border: 0; border-radius: var(--r-pill); display: grid; place-items: center;
  background: var(--sunk); color: var(--ink-2); font-size: var(--fs-callout); font-weight: var(--w-semi);
}
.avatar svg { width: 22px; height: 22px; }
.avatar.sm { width: 32px; height: 32px; font-size: var(--fs-footnote); }
.avatar.xs { width: 26px; height: 26px; font-size: var(--fs-caption); }
.avatar.lg { width: 56px; height: 56px; }
.avatar.lg svg { width: 28px; height: 28px; }
.avatar.me { background: var(--accent-tint); color: var(--accent-text); }
button.avatar { padding: 0; cursor: pointer; transition: transform var(--dur-press) var(--ease-out); }
.appbar .avatar { width: var(--hit); height: var(--hit); background: var(--surface); border: 1px solid var(--edge); box-shadow: var(--shadow-low); color: var(--ink); }
button.avatar:active { transform: scale(var(--press-scale)); }
.avatars { display: flex; }
.avatars .avatar { box-shadow: 0 0 0 2px var(--surface); }
.avatars .avatar + .avatar { margin-left: calc(var(--s-2) * -1); } /* overlap needs a negative offset */

/* ── Text field ─────────────────────────────────── */
.field-label { font-size: var(--fs-footnote); line-height: var(--lh-footnote); font-weight: var(--w-semi); color: var(--ink-2); }
.field {
  width: 100%; min-height: 48px; padding: 0 var(--s-4);
  border: 1px solid var(--line-strong); border-radius: var(--r-control); background: var(--surface);
  font-size: var(--fs-body); /* 16px stops iOS zoom */
}
.field:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }

/* ── Segmented control (concentric: r-control − 3px) ── */
.seg { --r: var(--r-control); --pad: 3px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; background: var(--sunk); }
.seg button { min-height: 40px; border: 0; background: none; color: var(--ink-2); font-size: var(--fs-callout); font-weight: var(--w-medium); cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-low); }

/* ── Section heading with optional action ──────── */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); min-height: 32px; padding-inline: var(--s-1); }
.section-head .btn-quiet { min-height: 32px; font-size: var(--fs-callout); padding-inline: var(--s-2); }
.row.danger, .row.danger .row-icon { color: var(--danger); }

/* Meter: thin progress bar */
.meter { height: 6px; border-radius: var(--r-pill); background: var(--sunk); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transform-origin: left; transform: scaleX(var(--v, 0)); }

/* Folders read as real folders: filled two-tone, in the accent color */
.side-item > svg.ic-folder, svg.ic-folder { color: var(--accent); }

/* Flame: three layers */
.flame-mid { fill: var(--streak-mid); }

/* Wordmark: the logo. "Studalo" as real text, except the S: drawn in two tones, Mauve over deep plum.
   The drawn S matches Figtree Bold's S (0.735em tall, 0.517em wide, strokes about 0.13em), so it sits in the word like a letter. */
.wordmark { display: inline-flex; align-items: baseline; font-weight: var(--w-bold); letter-spacing: -0.02em; line-height: 1; color: var(--ink); white-space: nowrap; }
.wordmark-s { display: inline-block; width: 0.515em; height: 0.735em; vertical-align: -0.016em; margin: 0 0.026em 0 0.046em; overflow: visible; pointer-events: none;
  fill: none; stroke-width: 18; stroke-linecap: round; }
.wordmark-s-top { stroke: var(--accent); }
.wordmark-s-bot { stroke: var(--brand-deep); }

/* Generated avatars fill their circle */
.avatar:has(.avatar-art) { background: none; }
.avatar-art { width: 100%; height: 100%; display: block; }
.av-ink { fill: var(--ink); }
.av-line { fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }

/* ── States: empty · error · offline · not found ── */
.state { display: grid; justify-items: center; text-align: center; gap: var(--s-3); padding: var(--s-8) var(--s-4); }
.state p { max-width: 38ch; }
.state-ic { width: 64px; height: 64px; border-radius: var(--r-pill); display: grid; place-items: center; background: var(--sunk); color: var(--ink-2); }
.state-ic svg { width: 30px; height: 30px; }
.state-error .state-ic { background: color-mix(in oklab, var(--danger) 12%, var(--surface)); color: var(--danger); }
.state-accent .state-ic { background: var(--accent-tint); color: var(--accent-text); }
.state-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-2); margin-top: var(--s-1); }
.state-actions .btn svg { width: 18px; height: 18px; }
.state.compact { padding: var(--s-5) var(--s-4); gap: var(--s-2); }
.state.compact .state-ic { width: 48px; height: 48px; }
.state.compact .state-ic svg { width: 24px; height: 24px; }

/* Inline field errors */
.field[aria-invalid="true"] { border-color: var(--danger); }
.field[aria-invalid="true"]:focus { outline-color: var(--danger); }
.field-error { display: flex; align-items: flex-start; gap: var(--s-1); margin-top: calc(var(--s-1) * -1); color: var(--danger); font-size: var(--fs-footnote); line-height: var(--lh-footnote); font-weight: var(--w-medium); }
.field-error svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.form-error { display: flex; align-items: flex-start; gap: var(--s-2); padding: var(--s-3) var(--s-4); border-radius: var(--r-group);
  background: color-mix(in oklab, var(--danger) 9%, var(--surface)); color: var(--danger); font-size: var(--fs-callout); font-weight: var(--w-medium); }
.form-error svg { width: 20px; height: 20px; flex: none; }

/* Offline bar */
.offline-bar { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-4); border-radius: var(--r-group);
  background: var(--ink); color: var(--paper); font-size: var(--fs-footnote); line-height: var(--lh-footnote); font-weight: var(--w-medium); }
.offline-bar svg { width: 18px; height: 18px; flex: none; }
.avatar svg.avatar-art { width: 100%; height: 100%; } /* beats the icon-size rules above */
.appbar .avatar:has(.avatar-art) { padding: 2px; }
