/* P15 CORRIDA — folha de estilo
   Layout: barra lateral fixa no desktop, barra inferior no celular; conteúdo em cartões sobre fundo escuro.
   Marca: preto + verde-limão (#C4EA33), Raleway para texto, Michroma como substituto da Konexy nos destaques. */
:root {
  --bg: #0b0b0b;
  --surface: #141414;
  --surface-2: #1c1c1c;
  --line: #262626;
  --line-strong: #333;
  --fg: #f1f1f1;
  --muted: #a8a8a8;
  --faint: #6b6b6b;
  --accent: #c4ea33;
  --accent-ink: #0b0b0b;
  --accent-text: #c4ea33;
  --accent-soft: rgba(196, 234, 51, 0.12);
  --good: #7ddc8a;
  --warn: #f2b84b;
  --bad: #ff6b6b;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --font-body: 'Raleway', 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Michroma', 'Raleway', system-ui, sans-serif;
  --radius: 14px;
  --radius-sm: 8px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f1f1f1; --surface: #ffffff; --surface-2: #f6f6f3; --line: #e2e2dd; --line-strong: #cfcfc8;
    --fg: #0b0b0b; --muted: #5b5b57; --faint: #9a9a94;
    --accent: #c4ea33; --accent-ink: #0b0b0b; --accent-text: #5e7a00; --accent-soft: rgba(196, 234, 51, 0.28);
    --good: #2f8f45; --warn: #a86b00; --bad: #c43a3a;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f1f1f1; --surface: #ffffff; --surface-2: #f6f6f3; --line: #e2e2dd; --line-strong: #cfcfc8;
  --fg: #0b0b0b; --muted: #5b5b57; --faint: #9a9a94;
  --accent: #c4ea33; --accent-ink: #0b0b0b; --accent-text: #5e7a00; --accent-soft: rgba(196, 234, 51, 0.28);
  --good: #2f8f45; --warn: #a86b00; --bad: #c43a3a;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--font-body); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; text-wrap: balance; line-height: 1.2; }
h1 { font-size: 1.7rem; font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0; }
a { color: var(--accent-text); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.num { font-variant-numeric: tabular-nums; }
.eyebrow {
  font-family: var(--font-display); font-size: 0.62rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted);
}
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Login ---------- */
.login {
  min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr;
}
.login-brand {
  background: #0b0b0b; color: #f1f1f1; position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  padding-block: 48px; padding-left: max(40px, env(safe-area-inset-left, 0px)); padding-right: 40px;
}
.login-brand::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.08;
  background-image: url('../assets/p15-white.png'); background-size: 220px auto; background-repeat: repeat;
  transform: rotate(-12deg) scale(1.4);
}
.login-brand .logo { width: 180px; position: relative; z-index: 1; }
.login-brand h1 { font-family: var(--font-display); font-size: clamp(1.6rem, 3.5vw, 2.6rem); font-weight: 400; letter-spacing: 0.04em; position: relative; z-index: 1; }
.login-brand h1 span { color: #c4ea33; }
.login-brand p { color: #a8a8a8; max-width: 38ch; position: relative; z-index: 1; margin-top: 12px; }
.login-form {
  display: flex; align-items: center; justify-content: center;
  padding-block: 40px; padding-left: 24px; padding-right: max(24px, env(safe-area-inset-right, 0px));
}
.login-card { width: min(420px, 100%); display: grid; gap: 18px; }
.login-card h2 { font-size: 1.5rem; }
.field { display: grid; gap: 6px; }
.field label { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.field input, .field select {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 12px 14px; min-height: 46px;
}
.field input:focus { border-color: var(--accent); outline: none; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px; padding: 11px 20px; border: 1px solid transparent; font-weight: 700; min-height: 44px;
  background: var(--surface-2); color: var(--fg); border-color: var(--line-strong); transition: transform 0.08s ease, background 0.15s ease;
}
.btn:hover { background: var(--line); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { background: #d4f455; }
.btn-ghost { background: transparent; border-color: var(--line-strong); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-sm { padding: 7px 14px; min-height: 36px; font-size: 0.85rem; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: 50%; }
.login-error { color: var(--bad); font-size: 0.9rem; min-height: 1.3em; }
.demo-accounts { border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 8px; }
.demo-accounts .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 999px; padding: 4px 10px;
  font-size: 0.8rem; font-family: ui-monospace, 'SF Mono', Menlo, monospace; cursor: pointer;
}
.chip:hover { border-color: var(--accent); }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100%; }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; background: #0b0b0b; color: #f1f1f1;
  border-right: 1px solid #1f1f1f; display: flex; flex-direction: column; gap: 22px;
  padding-block: 24px; padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: 18px;
}
.sidebar .brand { display: flex; align-items: center; gap: 12px; padding: 0 6px; }
.sidebar .brand img { width: 74px; display: block; }
.sidebar .brand .name { font-family: var(--font-display); font-size: 0.68rem; letter-spacing: 0.22em; color: #a8a8a8; }
.nav { display: grid; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; text-decoration: none;
  color: #a8a8a8; font-weight: 600;
}
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: #161616; color: #f1f1f1; }
.nav a.active { background: #c4ea33; color: #0b0b0b; }
.sidebar .spacer { flex: 1; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: #141414; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 0.85rem;
}
.avatar.alt { background: #262626; color: #f1f1f1; }
.user-card .who { min-width: 0; flex: 1; }
.user-card .who b { display: block; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card .who span { font-size: 0.75rem; color: #a8a8a8; }
.user-card button { color: #a8a8a8; background: transparent; border: 0; padding: 6px; border-radius: 8px; }
.user-card button:hover { color: #f1f1f1; background: #1c1c1c; }
.sidebar-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #6b6b6b; font-size: 0.75rem; }
.theme-toggle { background: transparent; border: 1px solid #262626; color: #a8a8a8; border-radius: 999px; padding: 6px 10px; font-size: 0.75rem; display: inline-flex; gap: 6px; align-items: center; }
.theme-toggle:hover { color: #f1f1f1; border-color: #444; }

.main { min-width: 0; padding-block: 28px 48px; padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)); }
.main > .wrap { max-width: 1180px; margin: 0 auto; display: grid; gap: 22px; }
.topbar { display: none; }
.tabbar { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head .eyebrow { margin-bottom: 6px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Cards & grids ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
  min-width: 0;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid-kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.kpi .label { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.kpi .value { font-size: 2rem; font-weight: 800; line-height: 1.1; margin-top: 6px; }
.kpi .value small { font-size: 0.9rem; font-weight: 600; color: var(--muted); margin-left: 4px; }
.kpi .delta { font-size: 0.8rem; margin-top: 6px; color: var(--muted); }
.kpi .delta.up { color: var(--good); }
.kpi .delta.down { color: var(--bad); }
.kpi.accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.kpi.accent .label, .kpi.accent .delta, .kpi.accent .value small { color: rgba(11, 11, 11, 0.7); }
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 320px; }
.chart-box.short { height: 180px; }

/* ---------- Status pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px; font-size: 0.75rem; font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--good); background: rgba(125, 220, 138, 0.12); }
.pill.warn { color: var(--warn); background: rgba(242, 184, 75, 0.14); }
.pill.bad { color: var(--bad); background: rgba(255, 107, 107, 0.14); }
.pill.neutral { color: var(--muted); background: var(--surface-2); }
.tag { display: inline-block; border: 1px solid var(--line-strong); border-radius: 6px; padding: 2px 8px; font-size: 0.75rem; color: var(--muted); font-weight: 600; }
.tag.phase-1 { color: var(--accent-text); border-color: var(--accent-text); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
td.right, th.right { text-align: right; }
.person { display: flex; align-items: center; gap: 10px; }
.person .avatar { width: 32px; height: 32px; font-size: 0.75rem; }
.person b { display: block; }
.person span { font-size: 0.78rem; color: var(--muted); }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; min-width: 90px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.bar.warn i { background: var(--warn); }
.bar.bad i { background: var(--bad); }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select {
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 999px; padding: 9px 14px; min-height: 40px;
}
.toolbar input { flex: 1 1 220px; min-width: 0; }
.toolbar .count { color: var(--muted); font-size: 0.85rem; margin-left: auto; }

/* ---------- Lists ---------- */
.list { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); min-width: 0; }
.list-item .pill, .list-item .tag { flex: none; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item b { display: block; }
.list-item span { font-size: 0.8rem; color: var(--muted); }
.list-item.clickable { cursor: pointer; }
.list-item.clickable:hover { outline: 1px solid var(--line-strong); }

/* ---------- Student header ---------- */
.student-hero { display: grid; grid-template-columns: auto 1fr auto; gap: 20px; align-items: center; }
.student-hero .avatar { width: 64px; height: 64px; font-size: 1.3rem; }
.student-hero .meta { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--muted); font-size: 0.9rem; margin-top: 6px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.fact { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; }
.fact .k { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.fact .v { font-size: 1.15rem; font-weight: 800; margin-top: 2px; }
.fact .v small { font-size: 0.8rem; color: var(--muted); font-weight: 600; margin-left: 3px; }

/* ---------- Week / sessions ---------- */
.week-strip { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; }
.week-strip .wk { border-radius: 8px; padding: 8px 4px; text-align: center; background: var(--surface-2); border: 1px solid transparent; cursor: pointer; }
.week-strip .wk b { display: block; font-size: 0.95rem; }
.week-strip .wk span { font-size: 0.7rem; color: var(--muted); }
.week-strip .wk.cur { border-color: var(--accent); }
.week-strip .wk.sel { background: var(--accent); color: var(--accent-ink); }
.week-strip .wk.sel span { color: rgba(11, 11, 11, 0.7); }
.week-strip .wk.past { opacity: 0.75; }
.sessions { display: grid; gap: 10px; }
.session {
  display: grid; grid-template-columns: 54px 1fr auto; gap: 14px; align-items: center;
  padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid transparent;
}
.session.today { border-color: var(--accent); }
.session .day { text-align: center; }
.session .day b { display: block; font-size: 1.2rem; line-height: 1; }
.session .day span { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.session .what b { display: block; }
.session .what span { font-size: 0.85rem; color: var(--muted); }
.session .nums { display: flex; gap: 14px; text-align: right; }
.session .nums div b { display: block; font-size: 1rem; }
.session .nums div span { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.session .state { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 10px; border-top: 1px dashed var(--line-strong); font-size: 0.85rem; }
.fartlek-parts { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 3px; margin-top: 8px; }
.fartlek-parts i { display: block; height: 10px; border-radius: 3px; background: var(--line-strong); }
.fartlek-parts i.hot { background: var(--accent); }

/* Hoje (aluno) */
.today-card { background: linear-gradient(135deg, #0b0b0b, #1a1f08); color: #f1f1f1; border: 1px solid #2a3310; }
.today-card .eyebrow { color: #c4ea33; }
.today-card .big { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; line-height: 1.05; margin: 8px 0 6px; }
.today-card .row { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 16px; }
.today-card .row div b { display: block; font-size: 1.4rem; }
.today-card .row div span { font-size: 0.75rem; color: #a8a8a8; text-transform: uppercase; letter-spacing: 0.08em; }
.today-card .actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.ring { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--line) 0); position: relative; flex: none; }
.ring::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--surface); }
.ring b { position: relative; font-size: 1.2rem; }

/* Goal */
.goal-card .goal-title { font-size: 1.3rem; font-weight: 800; margin-top: 4px; }
.goal-row { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 14px; }
.goal-row div b { display: block; font-size: 1.3rem; }
.goal-row div span { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.progress-line { display: grid; gap: 6px; margin-top: 14px; }
.progress-line .bar { height: 8px; }
.progress-line .ends { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--muted); }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 16px; padding: 22px; width: min(460px, 100%); display: grid; gap: 14px; box-shadow: var(--shadow); max-height: 90vh; overflow: auto; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.range-row output { min-width: 2ch; font-weight: 800; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 700; font-size: 0.9rem;
  box-shadow: var(--shadow); z-index: 60; opacity: 0; transition: opacity 0.2s; pointer-events: none;
}
.toast.show { opacity: 1; }
.invite-box { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px 8px 8px 14px; }
.invite-box code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.85rem; }
.empty { color: var(--muted); text-align: center; padding: 24px; }

/* ---------- Zones ---------- */
.zone-row td:first-child { font-weight: 800; }
.zone-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }

/* ---------- Print (exportar PDF) ---------- */
.print-only { display: none; }
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  :root, :root[data-theme="dark"] {
    --bg: #fff; --surface: #fff; --surface-2: #f4f4f1; --line: #ddd; --line-strong: #bbb; --fg: #000; --muted: #444; --faint: #888;
    --accent: #c4ea33; --accent-ink: #000; --accent-text: #4e6500; --shadow: none; color-scheme: light;
  }
  body { background: #fff; color: #000; font-size: 11pt; }
  .sidebar, .topbar, .tabbar, .no-print, .toast, .modal-bg { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .main > .wrap { max-width: none; gap: 12px; }
  .card { break-inside: avoid; border-color: #ccc; padding: 12px 14px; border-radius: 6px; }
  .grid-main { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-kpi { grid-template-columns: repeat(4, 1fr); }
  .chart-box { height: 200px; }
  .print-only { display: block; }
  .print-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 6px; }
  .print-head img { height: 22px; }
  .print-head .eyebrow { color: #000; }
  table { font-size: 9.5pt; }
  th, td { padding: 5px 8px; }
  .week-strip .wk { border: 1px solid #ccc; }
  .week-strip .wk.sel { background: #c4ea33 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pill, .bar i, .avatar, .fartlek-parts i { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .grid-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .login { grid-template-columns: 1fr; }
  .login-brand { padding-block: 28px; min-height: 0; }
  .login-brand p { display: none; }
  .login-brand .logo { width: 120px; }
  .login-brand h1 { margin-top: 22px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: #0b0b0b; color: #f1f1f1;
    padding-block: 12px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
    border-bottom: 1px solid #1f1f1f;
  }
  body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: #0b0b0b; }
  .topbar img { width: 64px; display: block; }
  .topbar .name { font-family: var(--font-display); font-size: 0.6rem; letter-spacing: 0.2em; color: #a8a8a8; }
  .topbar .right { display: flex; align-items: center; gap: 8px; }
  .topbar .avatar { width: 34px; height: 34px; font-size: 0.75rem; }
  .topbar button { background: transparent; border: 1px solid #262626; color: #a8a8a8; border-radius: 999px; padding: 6px 10px; font-size: 0.75rem; }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: #0b0b0b; border-top: 1px solid #1f1f1f;
    padding-left: max(8px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .tabbar a { display: grid; justify-items: center; gap: 3px; padding: 10px 4px 8px; text-decoration: none; color: #a8a8a8; font-size: 0.65rem; font-weight: 700; }
  .tabbar a svg { width: 20px; height: 20px; }
  .tabbar a.active { color: #c4ea33; }
  .main { padding-block: 18px 92px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .main > .wrap { gap: 14px; }
  .card { padding: 16px; border-radius: 16px; }
  .page-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .page-head .actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .page-head .actions > :only-child { grid-column: 1 / -1; }
  .hide-m { display: none !important; }
  .toolbar select { flex: 1 1 45%; min-width: 0; }
  .modal-bg { align-items: end; padding: 0; }
  .modal { width: 100%; max-height: 92vh; max-height: 92dvh; border-radius: 20px 20px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px)); }
  .student-hero { grid-template-columns: 1fr; }
  .student-hero .avatar { width: 52px; height: 52px; font-size: 1.1rem; }
  .page-head .actions .btn { width: 100%; padding-inline: 10px; }
  .student-hero .actions { grid-column: 1 / -1; }
  .table-wrap table th:first-child, .table-wrap table td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
  .table-wrap table td:first-child { box-shadow: 8px 0 12px -10px rgba(0, 0, 0, 0.6); }
  .toolbar .count { width: 100%; margin-left: 0; text-align: right; }
  .tabbar a { position: relative; }
  .tabbar a.active::before { content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 2px; background: #c4ea33; border-radius: 0 0 2px 2px; }
  .kpi .value { font-size: 1.8rem; }
  .today-card .row { gap: 14px 18px; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fact .v { font-size: 1.05rem; }
  .login-form { padding-block: 24px 40px; }
  .login-card { gap: 14px; }
  .btn { min-height: 46px; }
  .student-hero { grid-template-columns: auto 1fr; }
  .student-hero .side { grid-column: 1 / -1; }
  .week-strip { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .session { grid-template-columns: 46px 1fr; }
  .session .nums { grid-column: 1 / -1; justify-content: flex-start; text-align: left; }
}
@media (max-width: 480px) {
  .grid-kpi, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kpi .value { font-size: 1.7rem; }
  h1 { font-size: 1.4rem; }
}
/* ---------- Motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.main > .wrap > * { animation: rise 0.35s ease both; }
.main > .wrap > *:nth-child(2) { animation-delay: 0.04s; }
.main > .wrap > *:nth-child(3) { animation-delay: 0.08s; }
.main > .wrap > *:nth-child(4) { animation-delay: 0.12s; }
.main > .wrap > *:nth-child(n+5) { animation-delay: 0.16s; }
.modal { animation: rise 0.2s ease both; }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
