/* Estilos do app RITMU (antes inline em templates/base.html; agora arquivo estático, com cache).
   Ordem de carga: fonts.css, tokens.css, components.css, inputs.css, app.css e, por fim, o <style> de cada tela.
   Regras de uso: DESIGN.md. A única variável dinâmica (--brand-raw, cor do treinador) fica inline em base.html.

   Catálogo (reuse antes de criar):
   - Cores e temas ............ :root, tema escuro e white-label (topo deste arquivo)
   - Texto ..................... h1, h2, rótulos de formulário; tamanhos em tokens.css (--fs-*)
   - Campo ..................... input, select, textarea (aqui) + senha e erro de campo (inputs.css)
   - Botão ..................... button, .btn, .btn.ghost, .btn.sm, .btn.ghost.danger, .btn.ghost.ok
   - Selo ...................... .pill (.green, .amber, .red, .neutral), .status-pill, .trainer-badge
   - Cartões ................... .class-card (aula; faixa lateral por estado), .student-row, .stat-chip,
                                 .hero-card (destaque), .empty (vazio), .notice (aviso), .messages
   - Listas e cabeçalhos ...... .section-block, .screen-head, .list-head, .pager, .week-strip/.day-pill
   - Pessoas ................... .avatar (.sz-*), .avatar-stack, .status-dot
   - Presença .................. .switch-presenca
   - Navegação ................. header.shell, .bottom-nav, dialog.sheet, dialog.confirm-dialog, .sidebar, .topbar
   - Compostos (components.css)  .form-card, .notice.error, .attn-row, .chip/.filter-chips */
/* ===== Cores: paleta Warm Energy (ADR-044, DESIGN.md). Fonte única das cores do app. =====
   Laranja #FF8A3D (ação), Amarelo #FFB347 (acento), Carvão #2B2B2B (estrutura), Neutro Claro #F8F6F4,
   Neutro Suave #EBE3DB. --brand-raw vem do treinador (inline em base.html); sem cor própria = laranja.
   --copper e --night são nomes históricos: hoje valem o amarelo e o carvão. */
:root {
  color-scheme: light dark;
  --font-display: 'Archivo', system-ui, sans-serif;
  --font-body: 'Manrope', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  /* marca: valores para o treinador com cor própria (white-label); o padrão RITMU vem no bloco seguinte */
  --brand: var(--brand-raw);
  --brand-soft: color-mix(in oklab, var(--brand-raw) 12%, #FFFFFF);
  --brand-ink: color-mix(in oklab, var(--brand-raw) 78%, #2B2B2B);
  --btn-ink: #FFFFFF;
  --copper: #FFB347;
  --night: #2B2B2B;
  --btn-bg: var(--brand);
  --btn-fg: var(--btn-ink);
  --focus: var(--brand-ink);

  --paper: #F8F6F4;
  --surface: #FFFFFF;
  --surface-2: #F3EEE9;
  --ink: #2B2B2B;
  --muted: #524B46;
  --faint: #5E5650;
  --line: #EBE3DB;
  --line-strong: #D6CBC0;
  --ring: #847A72;

  --amber: #774F00;
  --amber-soft: #F6E9D0;
  --red: #962F23;
  --red-soft: #F7DFDC;
  --green: #165A3C;
  --green-soft: #DCEEE4;

  --shadow: 0 1px 2px rgba(43,43,43,.05), 0 10px 26px -14px rgba(43,43,43,.22);
  --shadow-lift: 0 2px 4px rgba(43,43,43,.06), 0 20px 40px -18px rgba(43,43,43,.30);
  --backdrop: rgba(43,43,43,.52);
  --chrome-bg: #2B2B2B;
  --chrome-bg-2: #363534;
  --chrome-ink: #F8F6F4;
  --chrome-muted: #D9D2CB;
  --chrome-faint: #BDB5AE;
  --chrome-line: #45423F;
  --chrome-accent: #FF8A3D;
  --chrome-glow2: rgba(255,179,71,.12);
  --nav-bg: rgba(43,43,43,.95);
  --nav-shadow: 0 14px 34px -14px rgba(0,0,0,.55), 0 0 0 1px rgba(248,246,244,.08);
  --nav-dot-ring: #2B2B2B;
}
/* Padrão RITMU (sem cor própria): botão laranja com texto carvão; destaque de texto em laranja queimado. */
:root:not(.brand-custom) {
  --brand: #FF8A3D; --brand-soft: #FFEBDD; --brand-ink: #A34A12;
  --btn-ink: #2B2B2B; --btn-bg: #FF8A3D; --btn-fg: #2B2B2B; --focus: #A34A12;
}

/* ---------- tema escuro (derivado do carvão) ---------- */
[data-theme="dark"] {
  --brand: color-mix(in oklab, var(--brand-raw) 45%, #FFFFFF);
  --brand-soft: color-mix(in oklab, var(--brand) 16%, transparent);
  --brand-ink: color-mix(in oklab, var(--brand) 82%, #FFFFFF);
  --btn-ink: #2B2B2B;
  --btn-bg: var(--brand);
  --btn-fg: #2B2B2B;
  --focus: var(--brand-ink);

  --paper: #1C1B1A;
  --surface: #2A2928;
  --surface-2: #302E2C;
  --ink: #F8F6F4;
  --muted: #D2CBC4;
  --faint: #B2AAA3;
  --line: #42403D;
  --line-strong: #55514D;
  --ring: #8E857E;

  --amber: #E8B765;
  --amber-soft: rgba(232,183,101,.14);
  --red: #F0968A;
  --red-soft: rgba(240,150,138,.16);
  --green: #72E3B0;
  --green-soft: rgba(91,219,162,.15);

  --shadow: 0 1px 2px rgba(0,0,0,.45), 0 12px 30px -16px rgba(0,0,0,.75);
  --shadow-lift: 0 2px 6px rgba(0,0,0,.5), 0 24px 46px -20px rgba(0,0,0,.85);
  --chrome-bg: #111010;
  --chrome-bg-2: #262524;
  --chrome-line: #3A3735;
  --nav-bg: rgba(38,37,36,.92);
  --nav-dot-ring: #262524;
}
[data-theme="dark"]:not(.brand-custom) {
  --brand: #FF8A3D; --brand-soft: color-mix(in oklab, #FF8A3D 16%, transparent); --brand-ink: #FFB347;
  --btn-ink: #2B2B2B; --btn-bg: #FF8A3D; --btn-fg: #2B2B2B; --focus: #FFB347;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --brand: color-mix(in oklab, var(--brand-raw) 45%, #FFFFFF);
    --brand-soft: color-mix(in oklab, var(--brand) 16%, transparent);
    --brand-ink: color-mix(in oklab, var(--brand) 82%, #FFFFFF);
    --btn-ink: #2B2B2B;
    --btn-bg: var(--brand);
    --btn-fg: #2B2B2B;
    --focus: var(--brand-ink);

    --paper: #1C1B1A;
    --surface: #2A2928;
    --surface-2: #302E2C;
    --ink: #F8F6F4;
    --muted: #D2CBC4;
    --faint: #B2AAA3;
    --line: #42403D;
    --line-strong: #55514D;
    --ring: #8E857E;

    --amber: #E8B765;
    --amber-soft: rgba(232,183,101,.14);
    --red: #F0968A;
    --red-soft: rgba(240,150,138,.16);
    --green: #72E3B0;
    --green-soft: rgba(91,219,162,.15);

    --shadow: 0 1px 2px rgba(0,0,0,.45), 0 12px 30px -16px rgba(0,0,0,.75);
    --shadow-lift: 0 2px 6px rgba(0,0,0,.5), 0 24px 46px -20px rgba(0,0,0,.85);
    --chrome-bg: #111010;
    --chrome-bg-2: #262524;
    --chrome-line: #3A3735;
    --nav-bg: rgba(38,37,36,.92);
    --nav-dot-ring: #262524;
  }
  :root:not([data-theme]):not(.brand-custom) {
    --brand: #FF8A3D; --brand-soft: color-mix(in oklab, #FF8A3D 16%, transparent); --brand-ink: #FFB347;
    --btn-ink: #2B2B2B; --btn-bg: #FF8A3D; --btn-fg: #2B2B2B; --focus: #FFB347;
  }
}

* { box-sizing: border-box; }
/* Sem atraso de duplo toque para zoom e com realce de toque discreto. */
html { font-size: 96%; }
html, body { touch-action: manipulation; -webkit-tap-highlight-color: rgba(0,0,0,.08); }
[x-cloak] { display: none !important; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font-body);
  padding: 0 16px;
}
/* Rodapé reserva espaço para a .bottom-nav fixa (12px de margem + ~62px
   de altura) — sem isso o último botão da tela (ex.: Salvar) fica
   escondido atrás dela no celular. No desktop o padding é redefinido. */
.skip-link { position: absolute; left: 12px; top: -64px; z-index: var(--z-skip); padding: 12px 18px; border-radius: var(--radius-md); background: var(--btn-bg); color: var(--btn-fg); font-weight: 700; text-decoration: none; transition: top .2s cubic-bezier(.16, 1, .3, 1); }
.skip-link:focus { top: 12px; }
main.page:focus { outline: none; }
.page { max-width: 640px; margin: 0 auto; padding-block: 0 calc(110px + env(safe-area-inset-bottom, 0px)); }

h1 {
  font-family: var(--font-display); font-weight: 800; font-size: clamp(1.6rem, 1.25rem + 1.4vw, 2rem); font-stretch: 90%;
  line-height: 1.04; letter-spacing: -.012em; margin: 22px 0 16px; text-wrap: balance;
}
h2 {
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-title); letter-spacing: -.005em;
  margin: 26px 0 12px; text-wrap: balance;
}
a { color: var(--brand-ink); }

form p { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; }
form p label {
  font-family: var(--font-body); font-size: var(--fs-micro); font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
input, select, textarea {
  width: 100%; min-width: 0; padding: 12px 14px; font-size: 15px; font-weight: 500; font-family: var(--font-body);
  border: none; border-radius: 14px; box-shadow: inset 0 0 0 1.5px var(--ring);
  background: var(--surface-2); color: var(--ink); transition: box-shadow .2s;
}
select {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; box-shadow: inset 0 0 0 2px var(--focus);
}
button:focus-visible, a:focus-visible, .btn:focus-visible, summary:focus-visible {
  outline: 2.5px solid var(--focus); outline-offset: 2px;
}
button, .btn {
  padding: 10px 16px; font-size: var(--fs-ui); font-weight: 700; font-family: var(--font-body);
  cursor: pointer; border-radius: 14px; border: 1px solid transparent; letter-spacing: .01em;
  background: var(--btn-bg); color: var(--btn-fg); display: inline-block; text-decoration: none;
  box-shadow: 0 10px 22px -14px rgba(43,43,43,.55);
  transition: transform .2s cubic-bezier(.2,.8,.2,1), box-shadow .2s, filter .2s, background .2s;
}
button:hover, .btn:hover { filter: brightness(1.06); }
/* Elevação só com mouse — no toque o :hover "gruda" depois do clique. */
@media (hover: hover) { button:hover, .btn:hover { transform: translateY(-2px); } }
button:active, .btn:active { transform: translateY(1px) scale(.99); }
@media (prefers-reduced-motion: reduce) {
  button, .btn { transition: filter .2s; }
  button:hover, .btn:hover, button:active, .btn:active { transform: none; }
}
.btn.ghost {
  background: transparent; color: var(--ink); border-color: transparent;
  box-shadow: inset 0 0 0 1.5px var(--ring);
}
.btn.ghost:hover { background: var(--surface-2); filter: none; }

.student-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 12px 14px; margin-bottom: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.student-row::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.student-row.ok::before { background: var(--green); }
.student-row.tight::before { background: var(--amber); }
.student-row.full::before { background: var(--red); }
.status-pending { color: var(--muted); font-size: .82em; }

.status-pill {
  font-family: var(--font-body); font-size: var(--fs-meta); font-weight: 600;
}

.email-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0; padding: 10px 14px; border-radius: var(--radius-md); background: var(--amber-soft); color: var(--amber); font-size: var(--fs-small); }
.email-banner form { margin: 0; }
.email-banner button { min-height: 36px; padding: 0 14px; border: 1px solid currentColor; border-radius: var(--radius-sm); background: transparent; color: inherit; font-weight: 700; cursor: pointer; }
.email-banner a { color: inherit; font-weight: 600; }
.messages { list-style: none; padding: 0; margin: 16px 0; display: flex; flex-direction: column; gap: 8px; }
.messages li {
  padding: 10px 14px; border-radius: 10px; background: var(--brand-soft);
  color: var(--brand-ink); font-size: var(--fs-small); font-weight: 600;
}
.messages li.success { background: var(--green-soft); color: var(--green); }
.messages li.warning { background: var(--amber-soft); color: var(--amber); }
.messages li.error { background: var(--red-soft); color: var(--red); }

.greeting { margin: 18px 0 22px; }
.greeting .date { display: block; font-size: var(--fs-small); color: var(--muted); font-weight: 600; margin-top: 2px; }

.screen-head {
  background: var(--glow); margin: 0 -16px; padding: 18px 16px 6px;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
}
.screen-head .greeting { margin: 0; }
.bell-btn {
  position: relative; width: 38px; height: 38px; flex: none; border-radius: var(--radius-md);
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
  display: flex; align-items: center; justify-content: center; text-decoration: none;
  box-shadow: var(--shadow);
}
.bell-btn svg { width: 18px; height: 18px; }
.bell-btn .bn-dot { top: 6px; right: 6px; }

.section-link { font-family: var(--font-body); font-size: var(--fs-micro); font-weight: 700; color: var(--brand-ink); text-decoration: none; letter-spacing: .02em; }

.list-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap;
  background: var(--glow); margin: 0 -16px 16px; padding: 18px 16px 14px;
}
.list-head h1 { margin: 0; }
.list-head .greeting { margin: 0; }
.pager { display: flex; align-items: center; gap: 8px; }
.pager a {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
  border-radius: 9px; color: var(--muted); text-decoration: none; border: 1px solid var(--line-strong);
  background: var(--surface); font-family: var(--font-body); font-size: var(--fs-ui); line-height: 1;
}
.pager a.today {
  width: auto; padding: 0 12px; font-family: var(--font-body); font-size: var(--fs-micro); font-weight: 700;
}
.pager a:hover { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; }
.pager .label { font-size: var(--fs-meta); color: var(--muted); font-weight: 600; padding: 0 4px; text-transform: capitalize; }

.pill {
  display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-body);
  font-size: var(--fs-micro); font-weight: 600; padding: 3px 10px; border-radius: var(--radius-pill); white-space: nowrap;
}
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.neutral { background: var(--paper); color: var(--muted); border: 1px solid var(--line); }

.btn.sm { padding: 6px 11px; font-size: var(--fs-meta); border-radius: var(--radius-md); }
.btn.ghost.danger { color: var(--red); box-shadow: inset 0 0 0 1px var(--red-soft); }
.btn.ghost.ok { color: var(--green); box-shadow: inset 0 0 0 1px var(--green-soft); }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ---- avatar: iniciais + cor derivada do nome, ou foto (ADR-015) ---- */
.avatar {
  --h: 118;
  display: inline-flex; align-items: center; justify-content: center; flex: none; position: relative;
  border-radius: var(--radius-pill); font-family: var(--font-body); font-weight: 800; line-height: 1;
  background: oklch(93% .045 var(--h)); color: oklch(42% .08 var(--h));
  box-shadow: inset 0 0 0 1px oklch(80% .055 var(--h));
}
[data-theme="dark"] .avatar {
  background: oklch(34% .05 var(--h)); color: oklch(88% .06 var(--h));
  box-shadow: inset 0 0 0 1px oklch(48% .06 var(--h));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .avatar {
    background: oklch(34% .05 var(--h)); color: oklch(88% .06 var(--h));
    box-shadow: inset 0 0 0 1px oklch(48% .06 var(--h));
  }
}
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.avatar.logo img { object-fit: contain; background: #fff; }
.avatar.sz-18 { width: 18px; height: 18px; font-size: 7px; }
.avatar.sz-26 { width: 26px; height: 26px; font-size: 9.4px; }
/* ---- selo do treinador no portal do aluno (ADR-021) ---- */
.trainer-badge {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  padding: 2px 8px 2px 2px; border-radius: var(--radius-pill); vertical-align: middle;
  background: color-mix(in srgb, var(--tb) 14%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tb) 40%, transparent);
  font-size: var(--fs-micro); font-weight: 700; color: var(--ink); line-height: 1.2;
}
.trainer-badge .tb-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trainer-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 16px; }
.trainer-chips a {
  padding: 6px 12px; border-radius: var(--radius-pill); font-size: var(--fs-meta); font-weight: 700; text-decoration: none;
  background: var(--surface-2); color: var(--muted);
}
.trainer-chips a.on { background: var(--brand-soft); color: var(--brand-ink); box-shadow: inset 0 0 0 1px var(--brand); }
.trainer-group-head { display: flex; align-items: center; gap: 8px; margin: 20px 0 10px; }
.trainer-group-head:first-of-type { margin-top: 0; }
.avatar.sz-32 { width: 32px; height: 32px; font-size: 11.5px; }
.avatar.sz-36 { width: 36px; height: 36px; font-size: 13px; }
.avatar.sz-38 { width: 38px; height: 38px; font-size: 13.7px; }
.avatar.sz-40 { width: 40px; height: 40px; font-size: 14.4px; }
.avatar.sz-46 { width: 46px; height: 46px; font-size: 16.6px; }
.avatar.stack { box-shadow: inset 0 0 0 1px oklch(80% .055 var(--h)), 0 0 0 2px var(--surface); }
[data-theme="dark"] .avatar.stack { box-shadow: inset 0 0 0 1px oklch(48% .06 var(--h)), 0 0 0 2px var(--surface); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .avatar.stack { box-shadow: inset 0 0 0 1px oklch(48% .06 var(--h)), 0 0 0 2px var(--surface); }
}
.avatar-stack { display: flex; }
.avatar-stack .avatar:not(:last-child) { margin-right: -9px; }
.avatar .status-dot {
  position: absolute; right: -1px; bottom: -1px; border-radius: var(--radius-pill); box-shadow: 0 0 0 2px var(--surface);
}
.avatar.sz-26 .status-dot, .avatar.sz-32 .status-dot { width: 7px; height: 7px; }
.avatar.sz-36 .status-dot, .avatar.sz-38 .status-dot, .avatar.sz-40 .status-dot { width: 9px; height: 9px; }
.avatar.sz-46 .status-dot { width: 12px; height: 12px; }
.status-dot.ok { background: var(--green); }
.status-dot.tight { background: var(--amber); }
.status-dot.full { background: var(--red); }

/* ---- switch de presença ---- */
.switch-presenca { display: inline-flex; gap: 4px; }
.switch-presenca button {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: var(--radius-pill);
  font-family: var(--font-body); font-size: var(--fs-micro); font-weight: 700;
  background: var(--surface-2); color: var(--muted); box-shadow: none; border: 1px solid transparent;
  transition: background .3s, color .3s;
}
.switch-presenca button:hover { transform: none; filter: none; }
.switch-presenca button .dot { width: 8px; height: 8px; border-radius: var(--radius-pill); background: var(--faint); flex: none; }
.switch-presenca button.present.on { background: var(--green-soft); color: var(--green); }
.switch-presenca button.present.on .dot { background: var(--green); }
.switch-presenca button.absent.on { background: var(--red-soft); color: var(--red); }
.switch-presenca button.absent.on .dot { background: var(--red); }

.empty {
  padding: 28px 18px; text-align: center; color: var(--muted); font-size: var(--fs-small);
  background: var(--surface); border: 1px dashed var(--line-strong); border-radius: 14px; margin-bottom: 10px;
}

.notice {
  display: flex; gap: 8px; padding: 10px 12px; border-radius: 10px;
  background: var(--amber-soft); color: var(--amber); font-size: var(--fs-meta); margin: 10px 0; line-height: 1.4;
}

.unread-dot { display: inline-block; width: 7px; height: 7px; border-radius: var(--radius-pill); background: var(--brand); margin-right: 7px; flex: none; }

.section-block { margin-bottom: 26px; }
.section-block h2 { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.section-block h2 .count { font-family: var(--font-body); font-size: var(--fs-meta); font-weight: 600; color: var(--muted); }

.stat-row { display: flex; gap: 10px; margin-bottom: 22px; }
.stat-chip {
  flex: 1; min-width: 0; container-type: inline-size; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-xl); padding: 14px; box-shadow: var(--shadow); text-decoration: none; color: inherit;
  display: flex; flex-direction: column; gap: 2px;
}
.stat-chip .n {
  font-family: var(--font-mono); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
  font-size: clamp(1.05rem, 15cqw, 1.875rem);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stat-chip .l {
  font-size: clamp(.72rem, 7.5cqw, .75rem); color: var(--muted); font-weight: 600; line-height: 1.3;
  overflow-wrap: break-word;
}
.stat-chip.amber .n { color: var(--amber); }
.stat-chip.red .n { color: var(--red); }
.stat-chip.green .n { color: var(--green); }

/* Celular estreito: 2x2, para número e rótulo caberem sem quebrar no meio da palavra. */
@media (max-width: 520px) {
  .stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
}

.class-card {
  display: flex; gap: 12px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 13px 14px; margin-bottom: 9px; box-shadow: var(--shadow);
  position: relative; overflow: hidden; text-decoration: none; color: inherit;
  transition: transform .25s cubic-bezier(.2,.8,.2,1), border-color .25s;
}
a.class-card:hover, a.class-card:active { border-color: var(--brand); }
@media (hover: hover) { a.class-card:hover { transform: translateX(3px); } }
@media (prefers-reduced-motion: reduce) { a.class-card:hover, a.class-card:active { transform: none; } }
.class-card::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; }
.class-card.ok::before { background: var(--green); }
.class-card.tight::before { background: var(--amber); }
.class-card.full::before { background: var(--red); }
/* Estado da aula que já começou (attendance.services.session_states). */
.class-card.now::before { background: var(--green); }
.class-card.pending::before { background: var(--amber); }
.class-card.past { background: var(--surface-2); box-shadow: none; }
.class-card.past::before { background: var(--faint); }
.class-card.past .class-time, .class-card.past .class-name { color: var(--muted); }
.class-card.archived { opacity: .55; }
.class-card.archived::before { background: var(--faint); }
.class-card .avatar-stack { margin-left: 8px; }
.class-time { font-family: var(--font-mono); font-weight: 600; color: var(--brand-ink); flex: none; width: 46px; padding-top: 1px; }
.class-body { flex: 1; min-width: 0; }
.class-name { font-weight: 700; font-size: var(--fs-ui); }
.class-meta { font-size: var(--fs-meta); color: var(--muted); margin-top: 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.class-occ { flex: none; font-family: var(--font-body); font-weight: 600; font-size: var(--fs-small); text-align: right; padding-top: 1px; }
.class-occ .cap { color: var(--faint); }

.week-strip { display: flex; gap: 6px; margin-bottom: 18px; }
.day-pill {
  flex: 1; text-align: center; padding: 10px 2px; border-radius: var(--radius-md);
  background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: inherit;
  box-shadow: var(--shadow); transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s;
}
.day-pill.active {
  background: var(--brand); border-color: var(--brand); transform: translateY(-3px);
  box-shadow: 0 12px 26px -14px var(--brand);
}
@media (prefers-reduced-motion: reduce) { .day-pill.active { transform: none; } }
.day-pill .dn { font-size: var(--fs-micro); font-weight: 700; color: var(--faint); text-transform: uppercase; }
.day-pill.active .dn { color: color-mix(in oklab, var(--btn-ink) 75%, transparent); }
.day-pill .dd { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-body); margin-top: 2px; }
.day-pill.active .dd { color: var(--btn-ink); }
.day-pill .dp-dot { width: 4px; height: 4px; border-radius: var(--radius-pill); background: var(--brand); margin: 4px auto 0; }
.day-pill.active .dp-dot { background: var(--btn-ink); }
/* Faixa de dias da agenda diária: 7 pílulas sem rolagem; "hoje" ganha só um ponto discreto. */
.day-nav { margin-bottom: 14px; }
.day-nav .day-pill { min-width: 0; min-height: 44px; position: relative; }
.day-nav .day-pill.is-today::after { content: ""; position: absolute; left: 50%; bottom: 4px; width: 4px; height: 4px; margin-left: -2px; border-radius: var(--radius-pill); background: var(--brand); }
.day-nav .day-pill.is-today.active::after { background: var(--btn-ink); }
.day-nav .day-pill.is-today { padding-bottom: 14px; }

.credit-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
.credit-card.compact { background: var(--amber-soft); border-color: transparent; }
.credit-card.full-warning { border-color: var(--red); background: var(--red-soft); }

.hero-card {
  background: var(--brand); color: var(--btn-ink); border-radius: 22px; padding: 18px 20px;
  margin-bottom: 14px; box-shadow: var(--shadow-lift);
}
.hero-label {
  font-family: var(--font-body); font-size: var(--fs-micro); font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; opacity: .95;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.hero-badge {
  background: rgba(0,0,0,.2); border-radius: var(--radius-pill); padding: 3px 10px;
  font-size: var(--fs-micro); letter-spacing: .04em;
}
.hero-time { font-family: var(--font-mono); font-size: 2.3rem; font-weight: 700; line-height: 1.1; margin-top: 6px; }
.hero-meta { font-size: var(--fs-small); opacity: .95; margin-top: 2px; }
.hero-actions { display: flex; gap: 8px; margin-top: 14px; }
.hero-actions .btn { background: rgba(255,255,255,.16); border-color: transparent; color: var(--btn-ink); box-shadow: none; }
.hero-actions .btn.ghost { background: transparent; border: 1px solid rgba(255,255,255,.4); }

.credit-strip {
  background: var(--brand-soft); color: var(--brand-ink); border-radius: var(--radius-lg);
  padding: 12px 16px; margin-bottom: 20px; font-size: var(--fs-small); font-weight: 600;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.credit-strip a { color: inherit; font-family: var(--font-body); font-size: var(--fs-micro); text-decoration: underline; }
.credit-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.credit-top .who-wrap { display: flex; align-items: center; gap: 9px; min-width: 0; }
.credit-top .who { font-weight: 700; font-size: var(--fs-small); }
.credit-top .when { font-family: var(--font-body); font-size: var(--fs-micro); color: var(--faint); white-space: nowrap; }
.credit-note { font-size: var(--fs-meta); color: var(--muted); margin-top: 6px; line-height: 1.45; }
.credit-actions { display: flex; gap: 8px; margin-top: 12px; }
.credit-actions.round { margin-top: 0; flex: none; }
.credit-actions.round button {
  width: 34px; height: 34px; padding: 0; border-radius: var(--radius-pill); display: inline-flex;
  align-items: center; justify-content: center; box-shadow: none;
}
.credit-actions.round button svg { width: 16px; height: 16px; }

.row-del-btn {
  width: 32px; height: 32px; padding: 0; border-radius: var(--radius-pill); display: inline-flex;
  align-items: center; justify-content: center; border: none; box-shadow: none;
  background: var(--red-soft); color: var(--red); flex: none;
}
.row-del-btn svg { width: 15px; height: 15px; }

header.shell {
  position: sticky; top: 0; z-index: var(--z-sticky); background: var(--paper);
  padding-top: 14px; padding-bottom: 10px; margin-bottom: 4px;
}
.shell-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* ---- busca de treinador no cabeçalho (ADR-013, Ponto 3) ----
   Um textbox discreto, não um item de nav com ícone+rótulo — pedido
   explícito de Fabricio pra "não poluir a página". Mesmo destino
   (accounts:trainer-search) nas três posições abaixo. */
.header-search {
  display: flex; align-items: center; gap: 7px; padding: 9px 13px; border-radius: var(--radius-pill);
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); color: var(--faint);
}
.header-search svg { width: 15px; height: 15px; flex: none; }
.header-search input[type="search"] {
  border: none; box-shadow: none; background: transparent; padding: 0; width: 100%; min-width: 0;
  font-family: var(--font-body); font-size: var(--fs-small); color: var(--ink);
}
@media (max-width: 760px) { .header-search input[type="search"] { font-size: 16px; } }
.header-search input[type="search"]::placeholder { color: var(--faint); }
.header-search:focus-within { box-shadow: inset 0 0 0 1.5px var(--brand); color: var(--muted); }
.shell-search { margin: 10px 0 2px; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.brand img { height: 26px; width: 26px; object-fit: cover; border-radius: 7px; box-shadow: var(--shadow); }
.brand strong { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-body); letter-spacing: -.01em; }
.account-menu, .sidebar-account, .topbar-account { position: relative; }
.account-menu summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line-strong); color: var(--muted);
}
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu summary:hover { background: var(--surface); }
.account-menu[open] summary { background: var(--surface); border-color: var(--brand); color: var(--brand-ink); }
.account-menu summary svg { width: 18px; height: 18px; }
.account-menu .menu, .sidebar-account .menu, .topbar-account .menu {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 172px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow); padding: 6px; z-index: var(--z-popover);
}
.account-menu .menu form, .sidebar-account .menu form, .topbar-account .menu form { margin: 0; }
.account-menu .menu a, .account-menu .menu button,
.sidebar-account .menu a, .sidebar-account .menu button,
.topbar-account .menu a, .topbar-account .menu button {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; padding: 9px 10px;
  border-radius: var(--radius-sm); font-size: var(--fs-small); font-weight: 600; color: var(--ink); background: transparent;
  border: none; text-decoration: none; cursor: pointer; font-family: var(--font-body);
}
.account-menu .menu a:hover, .account-menu .menu button:hover,
.sidebar-account .menu a:hover, .sidebar-account .menu button:hover,
.topbar-account .menu a:hover, .topbar-account .menu button:hover { background: var(--paper); filter: none; }
.account-menu .menu button.danger, .sidebar-account .menu button.danger, .topbar-account .menu button.danger { color: var(--red); }
.account-menu .menu svg, .sidebar-account .menu svg, .topbar-account .menu svg { width: 15px; height: 15px; flex: none; }

.theme-toggle { display: flex; gap: 2px; background: var(--paper); border-radius: var(--radius-sm); padding: 3px; margin: 2px 2px 8px; }
.theme-toggle button {
  flex: 1; width: auto; display: flex; align-items: center; justify-content: center; padding: 6px 0; border-radius: var(--radius-xs);
  font-size: var(--fs-micro); font-weight: 700; color: var(--muted);
}
.theme-toggle button svg { width: 15px; height: 15px; }
.theme-toggle button.active { background: var(--surface); color: var(--brand-ink); box-shadow: var(--shadow); }
.menu-divider { height: 1px; background: var(--line); margin: 4px 2px 6px; }

/* ---- alternância de dashboard (dual role, fluxo 16) ---- */
.role-switch { display: flex; gap: 2px; background: var(--paper); border-radius: var(--radius-sm); padding: 3px; margin: 2px 2px 8px; }
.role-switch form { flex: 1; margin: 0; }
.role-switch button {
  width: 100%; padding: 6px 0; border-radius: var(--radius-xs); border: none; background: transparent;
  font-size: var(--fs-micro); font-weight: 700; color: var(--muted); box-shadow: none;
}
.role-switch button:hover { filter: none; transform: none; }
.role-switch button.active { background: var(--surface); color: var(--brand-ink); box-shadow: var(--shadow); }

/* ---- navegação mobile: barra inferior flutuante ---- */
.bottom-nav {
  position: fixed; left: 14px; right: 14px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: var(--z-overlay);
  display: flex; gap: 2px; padding: 6px; border-radius: 26px;
  background: var(--nav-bg); -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--nav-shadow); max-width: 460px; margin: 0 auto;
}
.bn-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 2px 5px; border-radius: 14px; color: var(--muted); text-decoration: none;
  background: transparent; border: none; cursor: pointer; font-family: var(--font-body);
  transition: color .28s cubic-bezier(.2,.8,.2,1), transform .28s cubic-bezier(.2,.8,.2,1);
  transform: scale(.96);
}
.bn-cap {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 44px; height: 28px; border-radius: 14px; transition: background .28s cubic-bezier(.2,.8,.2,1);
}
.bn-cap svg { width: 20px; height: 20px; }
.bn-item.active { color: var(--brand-ink); transform: scale(1); }
.bn-item.active .bn-cap { background: var(--brand-soft); }
.bn-label { font-size: var(--fs-micro); font-weight: 700; letter-spacing: .01em; }
.bn-dot {
  position: absolute; top: -1px; right: 6px; width: 6px; height: 6px; border-radius: var(--radius-pill);
  background: var(--red); box-shadow: 0 0 0 2px var(--nav-dot-ring);
}

/* ---- sheet "Mais" (bottom sheet nativo, <dialog>) ---- */
dialog.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; top: auto; margin: 0 auto; width: 100%;
  max-width: 640px; border: none; padding: 10px 18px calc(20px + env(safe-area-inset-bottom, 0px));
  border-radius: 34px 34px 0 0; background: var(--surface); box-shadow: var(--shadow-lift); color: var(--ink);
}
dialog.sheet::backdrop { background: var(--backdrop); }
dialog.sheet[open] { animation: sheet-rise .5s cubic-bezier(.2,.8,.2,1); }
@keyframes sheet-rise { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-handle { width: 44px; height: 4px; border-radius: var(--radius-pill); background: var(--line-strong); margin: 0 auto 14px; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
.sheet-head h2 { margin: 0; }
.sheet-sub { font-family: var(--font-body); font-size: var(--fs-micro); color: var(--muted); }
.sheet-close {
  width: 32px; height: 32px; padding: 0; border-radius: 10px; background: var(--surface-2);
  color: var(--muted); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
}
.sheet-close svg { width: 16px; height: 16px; }
.sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.sheet-card {
  display: flex; flex-direction: column; gap: 3px; padding: 14px; border-radius: var(--radius-lg);
  background: var(--surface-2); border: 1px solid transparent; text-decoration: none; color: inherit;
  transition: border-color .25s, transform .25s;
}
.sheet-card:hover, .sheet-card:active { border-color: var(--brand); }
@media (hover: hover) { .sheet-card:hover { transform: translateY(-3px); } }
.sheet-icon {
  position: relative; width: 34px; height: 34px; border-radius: 10px; background: var(--brand-soft);
  color: var(--brand-ink); display: flex; align-items: center; justify-content: center; margin-bottom: 4px;
}
.sheet-icon svg { width: 17px; height: 17px; }
.sheet-account { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.sheet-account > form > button {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-md); font-weight: 600;
}
.sheet-account > form > button svg { width: 17px; height: 17px; }
.sheet-link {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  color: var(--muted); font-size: var(--fs-small); font-weight: 600; text-decoration: none;
}
.sheet-link svg { width: 17px; height: 17px; }
.sheet-badge {
  position: absolute; top: -6px; right: -6px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: var(--radius-pill); background: var(--red); color: #fff; font-family: var(--font-body);
  font-size: var(--fs-micro); font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.sheet-card strong { font-family: var(--font-body); font-size: var(--fs-small); }
.sheet-card span:last-child { font-size: var(--fs-micro); color: var(--muted); }

/* ---- diálogo de confirmação compartilhado (<dialog>, mesmos tokens do sheet "Mais") ---- */
dialog.confirm-dialog {
  position: fixed; inset: 0; margin: auto; width: calc(100% - 32px); max-width: 380px;
  height: fit-content; border: none; padding: 22px; border-radius: 24px;
  background: var(--surface); box-shadow: var(--shadow-lift); color: var(--ink);
}
dialog.confirm-dialog::backdrop { background: var(--backdrop); }
dialog.confirm-dialog[open] { animation: confirm-rise .22s cubic-bezier(.2,.8,.2,1); }
@keyframes confirm-rise { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }
.confirm-dialog-message { margin: 0 0 20px; font-size: var(--fs-ui); line-height: 1.5; }
.confirm-dialog-actions { display: flex; gap: 10px; }
.confirm-dialog-actions .btn { flex: 1; text-align: center; }

body.sheet-open .shell-mobile, body.sheet-open .sidebar, body.sheet-open .topbar, body.sheet-open .app-shell {
  filter: blur(3px); opacity: .45; transition: filter .3s, opacity .3s;
}

/* ---- entrada de listas (rise) ---- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.student-row, .class-card, .credit-card {
  animation: rise .45s cubic-bezier(.2,.8,.2,1) backwards;
}
.student-row:nth-of-type(1), .class-card:nth-of-type(1), .credit-card:nth-of-type(1) { animation-delay: .02s; }
.student-row:nth-of-type(2), .class-card:nth-of-type(2), .credit-card:nth-of-type(2) { animation-delay: .06s; }
.student-row:nth-of-type(3), .class-card:nth-of-type(3), .credit-card:nth-of-type(3) { animation-delay: .10s; }
.student-row:nth-of-type(4), .class-card:nth-of-type(4), .credit-card:nth-of-type(4) { animation-delay: .14s; }
.student-row:nth-of-type(5), .class-card:nth-of-type(5), .credit-card:nth-of-type(5) { animation-delay: .18s; }
.student-row:nth-of-type(n+6), .class-card:nth-of-type(n+6), .credit-card:nth-of-type(n+6) { animation-delay: .2s; }
@media (prefers-reduced-motion: reduce) {
  .student-row, .class-card, .credit-card { animation: none; }
}

/* ---- mobile: campos 16px (iOS não dá zoom ao focar) ---- */
@media (max-width: 760px) {
  input, select, textarea { font-size: 16px; }
}

/* ---- toque: alvos de pelo menos 44px (mouse no desktop não muda) ---- */
@media (pointer: coarse) {
  .btn, button { min-height: 44px; }
  .brand { min-height: 44px; }
  .theme-toggle button, .guest-theme button { min-width: 44px; min-height: 44px; }
  .section-link, .day-title-link { display: inline-flex; align-items: center; min-height: 44px; }
  .btn.sm { min-height: 44px; padding-inline: 14px; display: inline-flex; align-items: center; justify-content: center; }
  .switch-presenca button { min-height: 44px; min-width: 44px; justify-content: center; }
  .pager a { width: 44px; height: 44px; }
  .pager a.today { width: auto; }
  .row-del-btn, .credit-actions.round button { width: 44px; height: 44px; }
  .sheet-close { width: 44px; height: 44px; }
  .bell-btn { width: 44px; height: 44px; }
  .account-menu summary { width: 44px; height: 44px; }
  .account-menu .menu a, .account-menu .menu button,
  .sidebar-account .menu a, .sidebar-account .menu button,
  .topbar-account .menu a, .topbar-account .menu button { min-height: 44px; }
  .theme-toggle button, .role-switch button { min-height: 44px; }
  .bn-item { min-height: 48px; justify-content: center; }
}

/* ---- navegação desktop: sidebar (professor) / topbar (aluno) ---- */
.sidebar, .topbar { display: none; }
.desktop-only { display: none; }

@media (min-width: 901px) {
  body { padding: 0; }
  .bottom-nav, dialog.sheet { display: none; }
  .shell-mobile { display: none; }
  .app-shell { margin-left: 236px; padding: 0 24px; }
  body.no-sidebar .app-shell { margin-left: 0; }
  .page { max-width: 760px; margin: 0 auto; padding-block: 28px 48px; }
  .page.wide { max-width: 1180px; }
  .desktop-only { display: block; }
  .mobile-only { display: none; }

  .sidebar {
    display: flex; flex-direction: column; position: fixed; left: 0; top: 0; bottom: 0; width: 236px;
    background: var(--surface); border-right: 1px solid var(--line); padding: 18px 14px;
  }
  .sidebar-brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 22px; text-decoration: none; color: var(--ink); }
  .sidebar-brand img { width: 30px; height: 30px; border-radius: var(--radius-sm); object-fit: cover; box-shadow: var(--shadow); }
  .sidebar-brand strong { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-lead); letter-spacing: -.01em; }
  .sidebar .header-search { margin: 0 2px 14px; }
  .sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
  .sidebar-nav a {
    display: flex; align-items: center; gap: 11px; padding: 10px 11px; border-radius: 11px;
    color: var(--muted); text-decoration: none; font-size: var(--fs-small); font-weight: 600;
  }
  .sidebar-nav a svg { width: 18px; height: 18px; flex: none; }
  .sidebar-nav a span.name { flex: 1; }
  .sidebar-nav a.active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; }
  .sidebar-badge {
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill); background: var(--red-soft);
    color: var(--red); font-family: var(--font-body); font-size: var(--fs-micro); font-weight: 700;
    display: flex; align-items: center; justify-content: center;
  }
  .sidebar-account { position: relative; }
  .sidebar-account summary {
    display: flex; align-items: center; gap: 9px; padding: 10px 11px; border-radius: 11px;
    cursor: pointer; list-style: none;
  }
  .sidebar-account summary::-webkit-details-marker { display: none; }
  .sidebar-account summary:hover { background: var(--surface-2); }
  .sidebar-account .avatar {
    width: 32px; height: 32px; border-radius: var(--radius-pill); object-fit: cover; flex: none; box-shadow: var(--shadow);
  }
  .sidebar-account .who { flex: 1; min-width: 0; }
  .sidebar-account .who strong { display: block; font-size: var(--fs-meta); font-weight: 700; color: var(--ink); }
  .sidebar-account .who span { font-family: var(--font-body); font-size: var(--fs-micro); color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }
  .sidebar-account summary svg.chev { width: 14px; height: 14px; color: var(--faint); flex: none; }
  .sidebar-account .menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); top: auto; }

  .topbar {
    display: flex; align-items: center; gap: 18px; position: sticky; top: 0; z-index: var(--z-sticky);
    background: var(--surface); border-bottom: 1px solid var(--line); padding: 12px 24px;
  }
  .topbar-brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); }
  .topbar-brand img { width: 28px; height: 28px; border-radius: var(--radius-sm); object-fit: cover; box-shadow: var(--shadow); }
  .topbar-brand strong { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-body); }
  .topbar-nav { display: flex; gap: 4px; flex: 1; }
  .topbar-nav a {
    display: flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: var(--radius-pill);
    color: var(--muted); text-decoration: none; font-size: var(--fs-small); font-weight: 600;
  }
  .topbar-nav a svg { width: 16px; height: 16px; }
  .topbar-nav a.active { background: var(--brand-soft); color: var(--brand-ink); }
  .topbar .header-search { flex: none; width: 190px; }
  .topbar-account { position: relative; }
  .topbar-account summary {
    display: flex; align-items: center; justify-content: center; cursor: pointer; list-style: none;
    width: 36px; height: 36px; border-radius: var(--radius-pill); overflow: hidden; border: 1px solid var(--line-strong);
  }
  .topbar-account summary::-webkit-details-marker { display: none; }
  .topbar-account img.avatar { width: 100%; height: 100%; object-fit: cover; }
  .topbar-account .menu { position: absolute; top: calc(100% + 8px); right: 0; }
}
/* desktop: telas largas — Financeiro/Alunos viram tabela; Hoje, presença e Configurações em 2 colunas.
   Só apresentação (ver ADR-038). No celular nada disto vale: continuam os cartões. */
.cr-who { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; flex: 1 1 0; min-width: 0; }
.cr-who .avatar { grid-row: 1 / span 3; }
.cr-who > :not(.avatar) { grid-column: 2; }
.col-situacao { display: none; }
@media (min-width: 901px) {
  .fin-head {
    display: grid; gap: 14px; align-items: end; padding: 0 15px 6px;
    font-size: var(--fs-meta); font-weight: 700; color: var(--muted);
  }
  .fin-head .h-aluno { grid-column: span 2; }
  .fin-head { grid-template-columns: 38px minmax(0, 1.6fr) minmax(0, 1.2fr) minmax(0, 1.5fr) 110px 340px; }
  .students-table, .fin-table { margin-bottom: 4px; }
  .fin-table .student-row, .students-table .student-row { display: grid; gap: 14px; align-items: center; margin-bottom: 6px; }
  .fin-table .student-row { grid-template-columns: 38px minmax(0, 1.6fr) minmax(0, 1.2fr) minmax(0, 1.5fr) 110px 340px; }
  .fin-table .cr-who { display: contents; }
  .fin-table .cr-who > :not(.avatar) { grid-column: auto; }
  .fin-table .cr-who .avatar { grid-row: auto; }
  .fin-table .pill { justify-self: start; }
  .fin-table .pay-inline { flex: none; margin: 0; flex-wrap: nowrap; grid-column: 6; }
  .fin-table .pay-inline .pay-amount, .fin-table .pay-inline .pay-method { flex: 1 1 0; min-width: 0; }
  /* alunos: nome | situação | ações */
  .alunos-head .h-aluno { grid-column: auto; }
  .fin-head.alunos-head, .students-table .student-row { grid-template-columns: minmax(0, 1fr) minmax(0, 220px) 140px 300px; }
  .col-situacao, .col-plano { display: block; }
  .students-table .row-actions { justify-content: flex-start; }

  .today-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; align-items: start; }
  .today-cols > .section-block:only-child { grid-column: 1 / -1; }
  .attendance-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }

  .settings-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; align-items: start; margin-bottom: 14px; }
  .settings-cols > .settings-group:first-child { grid-row: span 3; }
  .settings-save { width: auto; min-width: 280px; padding-inline: 28px; }
}

/* desktop: acabamento */
@media (min-width: 901px) {
  /* No celular o cabeçalho vai de ponta a ponta (compensa o padding de 16px do body);
     no desktop o body não tem padding, então a margem negativa vazava 32px. */
  .screen-head, .list-head { margin-inline: 0; border-radius: 18px; }
  /* Sidebar: em janela baixa só a navegação rola; marca, busca e conta (rodapé) ficam à vista. */
  .sidebar-brand, .sidebar .header-search, .sidebar-account { flex: none; }
  .sidebar-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .sidebar-account .menu { max-height: calc(100vh - 96px); overflow-y: auto; }
  .topbar-account .menu { max-height: calc(100vh - 72px); overflow-y: auto; }
  .topbar-nav a .sidebar-badge { margin-left: 2px; }
}

/* desktop: públicas e teclado */
.kbd-hint { display: none; }
@media (min-width: 901px) {
  .kbd-hint { display: block; flex: none; margin: 0 2px 8px; padding: 6px 11px; text-align: left; font-size: var(--fs-meta); font-weight: 600; color: var(--faint); background: transparent; box-shadow: none; min-height: 0; }
  .kbd-hint:hover { color: var(--ink); }
  dialog.kbd-help[open] { display: block; position: fixed; inset: 0; margin: auto; height: fit-content; width: 340px; padding: 20px; border: none; border-radius: var(--radius-xl); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lift); }
  dialog.kbd-help::backdrop { background: var(--backdrop); }
  .kbd-help h2 { margin: 0 0 12px; font-size: var(--fs-lead); }
  .kbd-help dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0 0 14px; font-size: var(--fs-small); }
  .kbd-help dt { white-space: nowrap; }
  .kbd-help dd { margin: 0; color: var(--muted); }
  .kbd-help kbd { font-family: var(--font-body); font-size: var(--fs-meta); padding: 2px 6px; border-radius: var(--radius-xs); border: 1px solid var(--line); background: var(--bg); }
}

/* ============ Acabamento comum (app e landing) ============ */
html { scrollbar-width: thin; scrollbar-color: color-mix(in oklab, var(--ink) 30%, transparent) transparent; }
body { font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; accent-color: var(--brand); }
::selection { background: var(--copper); color: var(--night); }
input, select, textarea { caret-color: var(--brand); }
option { background: var(--surface); color: var(--ink); }
.class-time { font-weight: 700; letter-spacing: .01em; }
.hero-time { font-stretch: 90%; letter-spacing: -.02em; }
.stat-chip .n { font-stretch: 100%; }

/* ---- chrome escuro: barra superior (celular), menu lateral e barra superior (computador), barra inferior ---- */
@media (max-width: 900px) {
  header.shell {
    margin: 0 -16px; padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px;
    background: var(--chrome-bg); color: var(--chrome-ink);
  }
}
header.shell .brand { color: var(--chrome-ink); }
header.shell .brand strong { font-size: var(--fs-lead); }
header.shell .brand img { box-shadow: none; }
header.shell .account-menu summary { border-color: var(--chrome-line); color: var(--chrome-muted); }
header.shell .account-menu summary:hover { background: var(--chrome-bg-2); color: var(--chrome-ink); }
header.shell .account-menu[open] summary { background: var(--chrome-bg-2); border-color: var(--chrome-accent); color: var(--chrome-accent); }
header.shell .header-search { background: var(--chrome-bg-2); box-shadow: inset 0 0 0 1px var(--chrome-line); color: var(--chrome-faint); }
header.shell .header-search input[type="search"] { color: var(--chrome-ink); }
header.shell .header-search input[type="search"]::placeholder { color: var(--chrome-faint); }
header.shell .header-search:focus-within { box-shadow: inset 0 0 0 1.5px var(--chrome-accent); color: var(--chrome-muted); }
.bottom-nav .bn-item { color: var(--chrome-muted); }
.bottom-nav .bn-item.active { color: var(--chrome-accent); }
.bottom-nav .bn-item.active .bn-cap { background: color-mix(in srgb, var(--chrome-accent) 22%, transparent); }

@media (min-width: 901px) {
  .sidebar { background: var(--chrome-bg); border-right: 1px solid var(--chrome-line); color: var(--chrome-ink); }
  .sidebar-brand, .topbar-brand { color: var(--chrome-ink); }
  .sidebar-brand strong, .topbar-brand strong { font-size: var(--fs-title); }
  .sidebar-brand img, .topbar-brand img { box-shadow: none; }
  .sidebar .header-search, .topbar .header-search { background: var(--chrome-bg-2); box-shadow: inset 0 0 0 1px var(--chrome-line); color: var(--chrome-faint); }
  .sidebar .header-search input[type="search"], .topbar .header-search input[type="search"] { color: var(--chrome-ink); }
  .sidebar .header-search input[type="search"]::placeholder, .topbar .header-search input[type="search"]::placeholder { color: var(--chrome-faint); }
  .sidebar .header-search:focus-within, .topbar .header-search:focus-within { box-shadow: inset 0 0 0 1.5px var(--chrome-accent); }
  .sidebar-nav a, .topbar-nav a { color: var(--chrome-muted); position: relative; transition: background-color .2s, color .2s; }
  .sidebar-nav a:hover, .topbar-nav a:hover { background: var(--chrome-bg-2); color: var(--chrome-ink); }
  .sidebar-nav a.active, .topbar-nav a.active { background: color-mix(in srgb, var(--chrome-accent) 14%, transparent); color: var(--chrome-accent); }
  .sidebar-nav a::before {
    content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0;
    background: var(--chrome-accent); transform: scaleY(0); transition: transform .25s cubic-bezier(.16, 1, .3, 1);
  }
  .sidebar-nav a.active::before { transform: scaleY(1); }
  .sidebar-nav a svg, .topbar-nav a svg { transition: transform .25s cubic-bezier(.16, 1, .3, 1); }
  .sidebar-nav a:hover svg, .topbar-nav a:hover svg { transform: translateX(2px); }
  .sidebar-badge { background: rgba(240,150,138,.18); color: #F0968A; }
  .sidebar-account summary:hover { background: var(--chrome-bg-2); }
  .sidebar-account .who strong { color: var(--chrome-ink); }
  .sidebar-account .who span, .sidebar-account summary svg.chev { color: var(--chrome-faint); }
  .kbd-hint { color: var(--chrome-faint); }
  .kbd-hint:hover { color: var(--chrome-ink); }
  .topbar { background: var(--chrome-bg); border-bottom: 1px solid var(--chrome-line); color: var(--chrome-ink); }
  .topbar-account summary { border-color: var(--chrome-line); }
}

/* ---- faixas de título (como o hero da landing): carvão com névoa laranja e amarela ---- */
.screen-head, .list-head {
  --ink: var(--chrome-ink); --muted: var(--chrome-muted); --faint: var(--chrome-faint);
  --surface: var(--chrome-bg-2); --surface-2: var(--chrome-bg-2); --line: var(--chrome-line); --line-strong: var(--chrome-line);
  --ring: var(--chrome-faint); --brand-ink: var(--chrome-accent); --brand-soft: color-mix(in srgb, var(--chrome-accent) 14%, transparent);
  --btn-bg: var(--copper); --btn-fg: var(--night); --focus: var(--copper);
  color: var(--ink);
  background:
    radial-gradient(80% 150% at 100% 0%, color-mix(in srgb, var(--chrome-accent) 17%, transparent), transparent 60%),
    radial-gradient(70% 130% at 0% 100%, var(--chrome-glow2), transparent 64%),
    var(--chrome-bg);
}
.screen-head .greeting .date { color: var(--muted); }
.notice { align-items: center; }
.notice .trainer-badge, .credit-top .trainer-badge { flex: none; }
.pager a { font-size: var(--fs-title); }
.screen-head { margin-bottom: 14px; }

/* ---- cartão de destaque (próxima aula): laranja com névoa amarela; texto e botões em carvão ---- */
.hero-card {
  background:
    radial-gradient(120% 130% at 100% 0%, color-mix(in oklab, var(--copper) 26%, transparent), transparent 62%),
    var(--brand);
}

/* ---- luz que segue o cursor nos cartões (só com mouse) ---- */
@media (hover: hover) and (pointer: fine) {
  .class-card, .student-row, .credit-card, .stat-chip, .sheet-card {
    background-image: radial-gradient(320px circle at var(--mx, -400px) var(--my, -400px), color-mix(in oklab, var(--brand) 10%, transparent), transparent 70%);
  }
  .stat-chip { transition: transform .25s cubic-bezier(.16, 1, .3, 1), border-color .25s; }
  a.stat-chip:hover { transform: translateY(-2px); border-color: var(--brand); }
}

/* ---- botão em espera: barra fina enquanto a página troca ---- */
.btn.is-busy, button.is-busy, button.htmx-request, .btn.htmx-request { position: relative; overflow: hidden; }
.btn.is-busy::after, button.is-busy::after, button.htmx-request::after, .btn.htmx-request::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: currentColor; opacity: .75;
  transform: scaleX(.4); transform-origin: left;
}

@media (prefers-reduced-motion: no-preference) {
  /* entrada da página: o conteúdo sobe em cascata curta (só na carga) */
  @keyframes ux-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
  .page:not(.landing) > * { animation: ux-in .55s cubic-bezier(.16, 1, .3, 1) backwards; }
  .page:not(.landing) > *:nth-child(2) { animation-delay: .05s; } .page:not(.landing) > *:nth-child(3) { animation-delay: .1s; }
  .page:not(.landing) > *:nth-child(4) { animation-delay: .15s; } .page:not(.landing) > *:nth-child(n+5) { animation-delay: .2s; }
  @keyframes ux-busy { 0% { transform: translateX(-100%) scaleX(.4); } 100% { transform: translateX(100%) scaleX(.4); } }
  .btn.is-busy::after, button.is-busy::after, button.htmx-request::after, .btn.htmx-request::after { animation: ux-busy 1.1s cubic-bezier(.4, 0, .2, 1) infinite; }
  /* troca de tema: cruzamento curto de cor (a classe é posta e tirada por static/js/ui-fx.js) */
  html.theme-fade, html.theme-fade *, html.theme-fade *::before, html.theme-fade *::after {
    transition: background-color .35s ease, color .35s ease, border-color .35s ease, box-shadow .35s ease !important;
  }
}

/* ---- padrão RITMU (sem cor própria): o cartão de destaque é laranja, então texto e botões são carvão ---- */
:root:not(.brand-custom) .day-pill.active .dn { color: var(--btn-ink); }
:root:not(.brand-custom) .hero-card { color: #2B2B2B; }
:root:not(.brand-custom) .hero-badge { background: rgba(43,43,43,.14); }
:root:not(.brand-custom) .hero-actions .btn { background: rgba(43,43,43,.12); }
:root:not(.brand-custom) .hero-actions .btn.ghost { background: transparent; border-color: rgba(43,43,43,.65); }
/* Botão de excluir a conta: vermelho com texto branco no claro (o texto de ação padrão é carvão). */
:root .danger-zone button.danger-submit { color: #FFFFFF; }
[data-theme="dark"] .danger-zone button.danger-submit { color: var(--btn-ink); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .danger-zone button.danger-submit { color: var(--btn-ink); }
}


/* Link discreto da aula para a tela da sua turma (agenda e Hoje). */
.turma-link { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; min-height: 44px; border-radius: 12px; color: var(--faint); }
.turma-link:hover { color: var(--brand); background: var(--surface-2); }
.turma-link svg { width: 18px; height: 18px; }
