/* Estilos do portal. Identidade: branco predominante, detalhes em vermelho e preto (logo e cores aprovados pela escola).
   Sem fontes externas (a CSP só permite arquivos próprios): fonte do sistema. */
:root {
  --red: #c8281c;
  --red-dark: #a31f15;
  --ink: #111111;
  --muted: #595959;
  --line: #e2e2e2;
  --bg: #ffffff;
  --tint: #f6f6f6;
  --accent: var(--red);
  --good: #1f8a5b;
  --accent-text: #ffffff;
  --error-bg: #fdeceb;
  --error-text: #8a1c14;
  --notice-bg: #fff6df;
  --ok-bg: #e3f4ea;
  --ok-text: #0b4d36;
  --radius: 8px;
}
html:not(.ok) body { display: none; }
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}
[hidden] { display: none !important; }
h1, h2 { line-height: 1.25; }

/* ---------- Estrutura ---------- */
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; flex-direction: column; gap: 16px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--bg); padding: 8px; z-index: 10; border: 2px solid var(--ink); }
main { max-width: 1400px; margin: 0 auto; padding: 24px 16px 48px; }
/* Formulários e detalhes continuam estreitos; tabelas e painel usam a largura útil. */
#student-form-section, #student-detail { max-width: 1040px; margin-left: auto; margin-right: auto; }
main:focus { outline: none; }

/* ---------- Estrutura do aplicativo: menu à esquerda, conteúdo à direita ---------- */
.shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; padding: 16px 10px 12px; background: #161616; color: #e8e8e8; overflow-y: auto; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.brand { height: 30px; width: auto; display: block; }
.side-title { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.side-title h1 { margin: 0; font-size: .875rem; font-weight: 700; letter-spacing: .01em; color: #fff; overflow-wrap: anywhere; }
.badge { background: #f0b429; color: var(--ink); padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.tabs { display: flex; flex-direction: column; gap: 2px; }
.tab { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: transparent; color: #cfcfcf; border: 0; border-radius: 8px; padding: 8px 10px; min-height: 44px; font-weight: 500; font-size: .85rem; box-shadow: inset 3px 0 0 transparent; }
.tab .ico { flex: none; opacity: .9; width: 18px; height: 18px; }
.tab:hover { filter: none; color: #fff; background: rgba(255, 255, 255, .08); }
.tab[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, .13); box-shadow: inset 3px 0 0 var(--red); }
.tab[aria-current="page"]:hover { background: rgba(255, 255, 255, .13); }
.tab:focus-visible, .sidebar .link:focus-visible, .nav-toggle:focus-visible { outline: 3px solid #fff; outline-offset: -3px; }
.side-user { margin-top: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px 6px 0; border-top: 1px solid #333; }
.user-line { font-size: .78rem; color: #b8b8b8; overflow-wrap: anywhere; }
.sidebar button.link { color: #fff; border-color: #555; padding: 3px 12px; min-height: 32px; font-size: .82rem; font-weight: 500; }
.sidebar button.link:hover { background: rgba(255, 255, 255, .1); }
.content { min-width: 0; background: #f4f4f5; min-height: 100vh; }
.topbar { display: none; }
.nav-toggle { display: inline-flex; align-items: center; justify-content: center; width: 44px; min-height: 44px; padding: 0; background: transparent; color: #fff; border: 1px solid #444; border-radius: 8px; }
.nav-toggle:hover { filter: none; background: rgba(255, 255, 255, .1); }
.side-backdrop { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 15; padding: 8px 12px; background: #161616; color: #fff; }
  .topbar-name { font-weight: 600; font-size: .9rem; }
  .sidebar { position: fixed; z-index: 30; left: 0; top: 0; bottom: 0; width: min(290px, 86vw); height: auto; transform: translateX(-100%); visibility: hidden; box-shadow: 6px 0 24px rgba(0, 0, 0, .35); }
  .sidebar[data-open="true"] { transform: none; visibility: visible; }
  .side-backdrop { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .45); }
  .side-backdrop[hidden] { display: none; }
}
@media (max-width: 860px) and (prefers-reduced-motion: no-preference) {
  .sidebar { transition: transform .2s ease, visibility 0s linear .2s; }
  .sidebar[data-open="true"] { transition: transform .2s ease, visibility 0s; }
}

/* ---------- Cartões e avisos ---------- */
.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card h1, .card h2 { margin: 0 0 8px; font-size: 1.05rem; }
.card-error { background: var(--error-bg); color: var(--error-text); border-color: var(--error-text); }
.card-error .muted { color: var(--error-text); }
.error-box { background: var(--error-bg); color: var(--error-text); border: 1px solid var(--error-text); border-radius: 6px; padding: 10px 14px; margin: 0 0 12px; }
.notice { background: var(--notice-bg); border-color: #e8d49a; }
.muted { color: var(--muted); font-size: .9rem; }
.success { background: var(--ok-bg); color: var(--ok-text); border: 1px solid #0b6e4f; border-radius: 6px; padding: 10px 14px; margin: 0 0 12px; }
.form-error { background: var(--error-bg); color: var(--error-text); border: 1px solid var(--error-text); border-radius: 6px; padding: 10px 14px; margin-bottom: 12px; }
.form-error:focus { outline: none; }
.error { margin: 0; color: var(--error-text); font-size: .9rem; }
.warnings { margin: 0 0 12px; padding: 10px 14px 10px 30px; background: var(--notice-bg); border-radius: 6px; }
.warnings:empty { display: none; }

/* ---------- Login ---------- */
.login { width: 100%; max-width: 400px; padding: 28px 24px; border-top: 4px solid var(--red); box-shadow: 0 6px 24px rgba(0, 0, 0, .06); }
.login .logo { display: block; width: 100%; max-width: 220px; height: auto; margin: 0 auto 12px; }
.login h1 { font-size: 1.25rem; text-align: center; margin-bottom: 4px; }
.login .muted { text-align: center; margin: 0 0 20px; }

/* ---------- Painel ---------- */
.total { font-size: 2.6rem; font-weight: 800; line-height: 1.1; margin: 0 0 12px; }
.total .muted { font-size: .95rem; font-weight: 400; }
.status-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.status-list li { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--tint); border-left: 4px solid var(--red); border-radius: 6px; }
.status-list li span { color: var(--muted); font-size: .9rem; }
.status-list li strong { font-size: 1.6rem; line-height: 1.2; }

/* ---------- Formulários ---------- */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
label { font-size: .9rem; font-weight: 600; }
input, select, textarea { font: inherit; padding: 10px; border: 1px solid #767676; border-radius: 6px; background: #fff; color: var(--ink); width: 100%; }
input, select { min-height: 44px; }
textarea { resize: vertical; }
input:disabled, select:disabled, textarea:disabled { background: #eeeeee; color: var(--muted); cursor: not-allowed; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters .field, .grid .field { flex: 1 1 200px; margin-bottom: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }
.grid .wide { grid-column: 1 / -1; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { min-height: 0; width: 20px; height: 20px; margin-top: 2px; accent-color: var(--red); }
.toolbar-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar-row .secondary { margin-bottom: 0; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }

/* ---------- Botões ---------- */
button { font: inherit; font-weight: 600; padding: 10px 18px; border: 1px solid var(--accent); border-radius: 6px; cursor: pointer; background: var(--accent); color: var(--accent-text); min-height: 44px; }
button:hover { background: var(--red-dark); border-color: var(--red-dark); }
button:disabled { opacity: .6; cursor: progress; }
button.secondary { background: transparent; color: var(--ink); border-color: var(--ink); }
button.secondary:hover { background: var(--tint); }
button.link { background: transparent; color: var(--ink); border: 1px solid #b0b0b0; padding: 6px 14px; min-height: 36px; }
button.link:hover { background: var(--tint); }
.tab:focus-visible, button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

/* ---------- Lista e detalhe de alunos ---------- */
.student-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.student-row { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-left: 4px solid var(--line); padding: 12px 14px; font-weight: 400; }
.student-row:hover { background: var(--tint); border-color: var(--line); border-left-color: var(--red); }
.student-name { font-weight: 700; }
.fields { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
.fields dt { font-weight: 600; color: var(--muted); }
.fields dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Painel gerencial ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.dash-head h2 { margin: 0; font-size: 1.4rem; }
.dash-controls { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.dash-controls .field { margin-bottom: 0; }
.dash-controls input[type="month"] { min-width: 170px; }
.kpi-grid { display: grid; gap: 12px; margin-bottom: 16px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.kpi-grid-main { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.kpi { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; width: 100%; min-height: 96px; padding: 14px 16px; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-top: 4px solid #b9b9b9; border-radius: var(--radius); font-weight: 400; }
button.kpi { cursor: pointer; }
button.kpi:hover { background: var(--tint); border-color: var(--line); }
.kpi-title { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi-main { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.kpi-prev { font-size: .85rem; color: var(--muted); }
.kpi-good { border-top-color: var(--good); }
.kpi-bad { border-top-color: var(--red); }
.delta { display: inline-block; padding: 2px 10px; border-radius: 6px; font-size: .85rem; font-weight: 800; white-space: nowrap; }
.delta-good { background: var(--ok-bg); color: var(--ok-text); }
.delta-bad { background: var(--error-bg); color: var(--error-text); }
.delta-flat { background: var(--tint); color: var(--muted); }
.kpi-value { font-size: 1.7rem; line-height: 1.2; }
.kpi-big { min-height: 124px; }
.kpi-big .kpi-value { font-size: 2.2rem; }
.kpi-pending { border-top-color: var(--line); background: var(--tint); }
.kpi-msg { font-size: .95rem; color: var(--muted); }
.dash-cols { display: grid; gap: 16px; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); align-items: start; }
.dash-cols h3 { margin: 0 0 8px; font-size: 1rem; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bars li { display: grid; grid-template-columns: 110px 1fr 40px; gap: 10px; align-items: center; }
.bar { width: 100%; height: 16px; accent-color: var(--red); }
.bar-count { text-align: right; }
.bars-pair li { grid-template-columns: 60px 1fr minmax(120px, auto); align-items: center; }
.bar-pair { display: grid; gap: 3px; }
.bar-pair .bar { height: 10px; }
.bar-prev { accent-color: #8a8a8a; }
.bar-rec { accent-color: var(--red); }
.bar-values { font-size: .8rem; color: var(--muted); text-align: right; white-space: nowrap; }
.warnings-list { margin: 0; padding-left: 20px; }
.bday-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bday-row { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; background: var(--bg); color: var(--ink); border: 1px solid var(--line); padding: 8px 12px; font-weight: 400; }
.bday-row:hover { background: var(--tint); border-color: var(--line); }
.bday-info { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.avatar { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--ink); color: #fff; font-weight: 700; font-size: .9rem; }
.tag { flex: 0 0 auto; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.tag-today { background: var(--red); color: #fff; }
.tag-soon { background: var(--notice-bg); color: var(--ink); border: 1px solid #e8d49a; }
.drawer { position: fixed; inset: 0; z-index: 20; display: flex; justify-content: flex-end; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); }
.drawer-panel { position: relative; width: min(480px, 100%); height: 100%; overflow-y: auto; background: var(--bg); padding: 20px; box-shadow: -6px 0 24px rgba(0, 0, 0, .2); }
.drawer-panel:focus { outline: none; }
.drawer-panel h3 { margin: 0; font-size: 1.1rem; }
.mens-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.mens-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px 16px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.mens-main { display: flex; flex-direction: column; min-width: 0; }
.mens-value { white-space: nowrap; }
.mens-chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.mens-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
.mens-actions button { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.chip { padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; border: 1px solid transparent; white-space: nowrap; }
.chip-paga { background: var(--ok-bg); color: var(--ok-text); }
.chip-pendente { background: var(--notice-bg); color: #6b4a00; border-color: #e8d49a; }
.chip-pacote { background: #e8eef7; color: #1d3a6b; }
.chip-vencida { background: var(--error-bg); color: var(--error-text); border-color: var(--error-text); }
.chip-neutro { background: var(--tint); color: var(--muted); border-color: var(--line); }
.total-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.total-card { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--bg); border: 1px solid var(--line); border-top: 4px solid #b9b9b9; border-radius: var(--radius); }
.total-good { border-top-color: var(--good); }
.total-bad { border-top-color: var(--red); }
.total-label { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.total-main { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.total-card strong { font-size: 1.3rem; }
.total-prev { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.mens-pend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.mens-pend-label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.chip-btn { cursor: pointer; font: inherit; font-size: .8rem; font-weight: 700; min-height: 0; padding: 2px 10px; }
.chip-btn.chip-vencida { background: var(--error-bg); color: var(--error-text); border-color: var(--error-text); }
.chip-btn.chip-pendente { background: var(--notice-bg); color: #6b4a00; border-color: #e8d49a; }
.chip-btn:hover { filter: brightness(.96); background-image: none; }
.chip-btn[aria-current="true"] { outline: 2px solid var(--ink); outline-offset: 1px; }
.mens-warn { font-size: .85rem; font-weight: 600; color: var(--error-text); }
.dt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.dt-bar button { min-height: 40px; }
.dt-count { margin-left: auto; }
.dt-picker { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px; background: var(--bg); }
.dt-picker-list { list-style: none; margin: 8px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 16px; }
.dt-picker-list li { display: flex; align-items: center; gap: 6px; }
.dt-picker-list .check { flex: 1 1 auto; }
.dt-move { min-height: 32px; padding: 2px 10px; }
.dt-table { min-width: 720px; }
.dt-table td:first-child, .dt-table th:first-child { white-space: nowrap; }
.dt-table td { min-width: 90px; }
.dt-name { background: transparent; border: 0; padding: 0; min-height: 0; font-weight: 700; color: var(--ink); text-align: left; cursor: pointer; }
.dt-name:hover { background: transparent; text-decoration: underline; }
.dt-filters th { position: sticky; top: 41px; background: var(--bg); z-index: 1; font-weight: 400; padding: 6px 8px; }
.dt-filters input, .dt-filters select { min-height: 34px; padding: 4px 8px; font-size: .85rem; width: 100%; }
.dt-num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Cartão clicável abre a área de trabalho ---------- */
.kpi:not(.kpi-big) .kpi-open { font-size: .78rem; }
.rev-card { margin-bottom: 16px; }
.kpi-open { margin-top: auto; font-size: .85rem; font-weight: 600; color: var(--red); }
button.kpi:hover .kpi-open, button.kpi:focus-visible .kpi-open { text-decoration: underline; }

/* ---------- Receita prevista × recebida ---------- */
.rev-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.rev-legend { display: flex; gap: 16px; margin: 0; font-size: .9rem; }
.rev-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.rev-key { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.rev-key-prev, .rev-bar-prev { background: #d4d4d4; fill: #d4d4d4; }
.rev-key-rec, .rev-bar-rec { background: var(--red); fill: var(--red); }
.rev-body { display: grid; grid-template-columns: minmax(250px, 320px) minmax(0, 1fr); gap: 24px; align-items: start; }
.rev-ring-box { position: relative; width: 190px; height: 190px; margin: 0 auto 12px; }
.rev-ring { width: 100%; height: 100%; }
.rev-ring-track { stroke: #e9e9e9; }
.rev-ring-bar { stroke: var(--red); }
.rev-ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 28px; }
.rev-ring-pct { font-size: 1.9rem; line-height: 1.1; font-weight: 800; }
.rev-parts { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.rev-parts li { display: grid; grid-template-columns: 12px 1fr auto; gap: 8px; align-items: center; font-size: .92rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-rec, .rev-seg.dot-rec { background: var(--red); fill: var(--red); }
.dot-pacote, .rev-seg.dot-pacote { background: #3d5f9e; fill: #3d5f9e; }
.dot-avencer, .rev-seg.dot-avencer { background: #e0a020; fill: #e0a020; }
.dot-vencido, .rev-seg.dot-vencido { background: #6e0f09; fill: #6e0f09; }
.rev-stack { width: 100%; height: 8px; border-radius: 4px; background: #e9e9e9; display: block; }
.rev-callout { margin: 0 0 6px; padding: 6px 10px; background: var(--tint); border-radius: 6px; font-size: .9rem; font-weight: 600; }
.rev-chart { width: 100%; height: auto; display: block; }
.rev-grid { stroke: #e6e6e6; stroke-width: 1; }
.rev-axis, .rev-month { font-size: 12px; fill: #595959; }
.rev-month-selected { fill: var(--ink); font-weight: 700; }
.rev-band { fill: transparent; }
.rev-group-selected .rev-band { fill: #f3f3f3; }
.rev-group:hover .rev-band { fill: #f3f3f3; }
.rev-group:focus { outline: none; }
.rev-group:focus-visible .rev-band { stroke: var(--ink); stroke-width: 2; fill: #f3f3f3; }
.rev-chips { list-style: none; margin: 6px 1.7% 0 8.9%; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.rev-chips li { display: flex; justify-content: center; }

/* ---------- Área de trabalho ---------- */
.ws { display: block; }
.ws-crumb { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.ws-crumb .secondary { margin: 0; }
.ws-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.ws-head h2 { margin: 0; font-size: 1.5rem; }
.ws-head h2:focus { outline: none; }
.ws-switch { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.ws-tab { background: var(--bg); color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; min-height: 38px; font-weight: 600; font-size: .9rem; }
.ws-tab:hover { background: var(--tint); border-color: var(--line); color: var(--ink); }
.ws-tab[aria-current="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.ws .filters { align-items: flex-end; }
.ws-views { display: flex; gap: 0; }
.ws-views button { border-radius: 0; min-height: 44px; }
.ws-views button:first-child { border-radius: 6px 0 0 6px; }
.ws-views button:last-child { border-radius: 0 6px 6px 0; margin-left: -1px; }
.ws-views button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.ws-bulk { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 14px; background: var(--notice-bg); border: 1px solid #e8d49a; border-radius: 6px; margin-bottom: 8px; font-weight: 600; }
.ws-table-wrap { overflow: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.ws-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.ws-table th, .ws-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ws-table thead th { position: sticky; top: 0; background: var(--tint); z-index: 1; font-size: .85rem; }
.ws-table tbody tr:hover { background: #fafafa; }
.ws-num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ws-check { width: 40px; }
.ws-check input { min-height: 0; width: 18px; height: 18px; accent-color: var(--red); }
.ws-sort { background: transparent; color: var(--ink); border: 0; padding: 0; min-height: 0; font-weight: 700; font-size: inherit; cursor: pointer; }
.ws-sort:hover { background: transparent; text-decoration: underline; }
.ws-sub { display: block; font-size: .8rem; }
.ws-actions { white-space: nowrap; }
.ws-actions button { min-height: 34px; padding: 4px 10px; font-size: .85rem; margin-right: 6px; }
.ws-foot { position: sticky; bottom: 0; margin: 0; padding: 10px 14px; background: var(--bg); border: 1px solid var(--line); border-top: 2px solid var(--red); border-radius: 0 0 var(--radius) var(--radius); font-weight: 700; }
.ws-board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; align-items: start; }
.ws-col { background: var(--tint); border-radius: var(--radius); border-top: 4px solid #e0a020; padding: 10px; display: grid; gap: 8px; }
.ws-col-1 { border-top-color: #d9741a; }
.ws-col-2 { border-top-color: #c8281c; }
.ws-col-3 { border-top-color: #6e0f09; }
.ws-col-head { display: flex; flex-direction: column; }
.ws-card { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.ws-card:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.ws-card-value { font-weight: 800; font-size: 1.1rem; margin-top: 4px; }
.ws-card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.ws-card-actions button { min-height: 32px; padding: 3px 8px; font-size: .8rem; }
@media (prefers-reduced-motion: no-preference) { .ws-tab, .ws-tab:hover { transition: background-color .15s; } }

@media (max-width: 800px) {
  .dash-cols { grid-template-columns: 1fr; }
  .rev-body { grid-template-columns: 1fr; }
  .ws-board { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
}
@media (max-width: 480px) {
  .kpi-grid, .kpi-grid-main { grid-template-columns: 1fr; }
  .kpi, .kpi-big { min-height: 0; }
  .mens-row { grid-template-columns: minmax(0, 1fr) auto; }
  .ws-board { grid-template-columns: 1fr; }
  .rev-chips { margin-left: 0; margin-right: 0; }
  .ws-table th:nth-child(n+4):not(.ws-num), .ws-table td:nth-child(n+4):not(.ws-num):not(.ws-actions) { display: none; }
  .mens-chips { grid-column: 1 / -1; justify-content: flex-start; }
  .bars li { grid-template-columns: 90px 1fr 32px; }
  .bars-pair li { grid-template-columns: 52px 1fr; }
  .bars-pair .bar-values { grid-column: 1 / -1; text-align: left; }
}

@media (max-width: 480px) {
  main { padding: 16px 12px 40px; }
  .fields { grid-template-columns: 1fr; gap: 2px; }
  .fields dd { margin-bottom: 8px; }
}

/* ---------- Tabelas: visual suave (controles discretos, bordas finas, leitura leve) ---------- */
.btn-soft { min-height: 32px; padding: 0 12px; font-size: .84rem; font-weight: 500; background: var(--bg); color: var(--ink); border: 1px solid #dedede; border-radius: 6px; box-shadow: none; }
.btn-soft:hover { background: #f6f6f6; border-color: #cfcfcf; color: var(--ink); }
.btn-soft[aria-pressed="true"], .btn-soft[aria-expanded="true"] { background: #f0f0f0; border-color: #bdbdbd; }
.btn-soft:disabled { opacity: .45; cursor: not-allowed; }
.btn-xs { min-height: 28px; padding: 0 10px; font-size: .8rem; }
.btn-accent { color: var(--red); border-color: #ebc3bf; }
.btn-accent:hover { background: #fdf3f2; border-color: #dba19b; color: var(--red-dark); }
.btn-quiet { border-color: transparent; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.btn-quiet:hover { background: transparent; border-color: transparent; color: var(--ink); }
.dt-bar { gap: 6px; margin-bottom: 10px; }
.dt-bar .btn-soft { min-height: 32px; }
.dt-picker { border-color: #ececec; border-radius: 10px; padding: 10px 14px; }
.dt-link { background: none; border: 0; padding: 0; min-height: 0; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; text-align: left; }
.dt-link:hover { background: none; color: var(--ink); text-decoration: underline; text-decoration-color: var(--red); text-underline-offset: 3px; }
.ws-views button { min-height: 32px; padding: 0 14px; font-size: .84rem; font-weight: 500; border-color: #dedede; background: var(--bg); color: var(--ink); }
.ws-views button:hover { background: #f6f6f6; border-color: #cfcfcf; }
.ws-views button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.ws-table-wrap { border-color: #ececec; border-radius: 10px; box-shadow: 0 1px 2px rgba(0, 0, 0, .03); }
.ws-table { font-size: .88rem; }
.ws-table th, .ws-table td { padding: 9px 14px; border-bottom: 1px solid #f1f1f1; }
.ws-table thead th { background: #fff; color: #6b6b6b; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid #e6e6e6; }
.ws-sort { font-size: inherit; font-weight: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; }
.ws-sort:hover { color: var(--ink); }
.ws-table tbody tr:last-child td { border-bottom: 0; }
.ws-table tbody tr:hover { background: #fafafa; }
.ws-table tbody td strong { font-weight: 600; }
.ws-actions button, .ws-card-actions button { min-height: 28px; padding: 0 10px; font-size: .8rem; font-weight: 500; }
.dt-filters th { top: 38px; background: #fcfcfc; text-transform: none; letter-spacing: 0; padding: 6px 10px; font-weight: 400; }
.dt-filters input, .dt-filters select { min-height: 28px; height: 28px; padding: 0 8px; font-size: .8rem; border: 1px solid #e0e0e0; border-radius: 6px; width: 100%; margin: 0; }
.dt-range { display: flex; gap: 4px; }
.dt-range input { min-width: 62px; }
.dt-filters input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.dt-filters input[type="number"]::-webkit-outer-spin-button, .dt-filters input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ws-foot { font-weight: 600; font-size: .88rem; border-top: 1px solid #e6e6e6; }
.chip { font-weight: 600; }

/* Barra de busca e ações das telas de lista: mais discreta, numa só linha */
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.toolbar > button:not(.btn-soft) { min-height: 36px; padding: 0 16px; font-size: .9rem; }
.filters label { font-size: .8rem; color: var(--muted); font-weight: 600; }
.filters input, .filters select { min-height: 38px; font-size: .92rem; }
.filters > button { min-height: 38px; padding: 0 16px; font-size: .9rem; }
.dt-range { align-items: center; }
.dt-range input { height: 28px; margin: 0; }

/* Aluno Full: leitura minimalista, famílias em blocos leves */
.af-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 12px; }
.af-search { flex: 1 1 240px; margin-bottom: 0; }
.af-toolbar .ws-views button { min-height: 40px; }
.af-family { margin-bottom: 20px; }
.af-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 6px; }
.af-name { margin: 0; font-size: 1.05rem; }
.af-wrap { max-height: none; }
.af-table th { background: transparent; position: static; font-weight: 600; color: var(--muted); }
.af-student { font-weight: 600; }
.af-table { table-layout: fixed; }
.af-table th:nth-child(1) { width: 30%; }
.af-table th:nth-child(2) { width: 10%; }
.af-table th:nth-child(3) { width: 14%; }
.af-table th:nth-child(4) { width: 16%; }
.af-table th:nth-child(5) { width: 6%; }
.af-table th:nth-child(6) { width: 11%; }
.af-table th:nth-child(7) { width: 13%; }
.af-sub { margin: 16px 0 8px; font-size: .95rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.af-student.dt-link { font-weight: 600; }

/* ---------- Seletor de meses (lista suspensa com vários meses) ---------- */
.ms { position: relative; }
.ms-btn { display: inline-flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 190px; max-width: 100%; text-align: left; background: var(--bg); color: var(--ink); border: 1px solid #b0b0b0; font-weight: 500; }
.ms-btn:hover { background: var(--tint); border-color: #8c8c8c; color: var(--ink); }
.ms-btn::after { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); flex: none; }
.ms-backdrop { position: fixed; inset: 0; z-index: 18; background: transparent; }
.ms-panel { position: absolute; z-index: 19; top: calc(100% + 4px); left: 0; width: min(300px, 90vw); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0, 0, 0, .16); padding: 8px; }
.ms-all, .ms-item { display: flex; align-items: center; gap: 10px; margin: 0; padding: 6px 10px; min-height: 36px; border-radius: 6px; cursor: pointer; font-weight: 500; line-height: 1.2; }
.ms-all { font-weight: 700; border-bottom: 1px solid var(--line); border-radius: 6px 6px 0 0; }
.ms-all:hover, .ms-item:hover { background: var(--tint); }
.ms-all input, .ms-item input { width: 18px; height: 18px; min-height: 0; margin: 0; padding: 0; flex: none; accent-color: var(--red); }
.ms-list { max-height: 280px; overflow-y: auto; padding: 4px 0; }
.ms-msg { margin: 6px 4px; color: var(--error-text); font-size: .85rem; }
.ms-actions { display: flex; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.ms-actions button { flex: 1; min-height: 38px; padding: 6px 12px; font-size: .9rem; }

/* ---------- Pacote da família: alunos e valor de cada um ---------- */
.pk-members { display: flex; flex-direction: column; margin-bottom: 4px; }
.pk-member { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 2px 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.pk-member label { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 500; min-width: 0; }
.pk-member label input { width: 18px; height: 18px; min-height: 0; margin: 0; padding: 0; flex: none; accent-color: var(--red); }
.pk-member > input { min-height: 38px; text-align: right; }
.pk-member .muted { grid-column: 1 / -1; font-size: .8rem; }
.pk-member-off { opacity: .65; }
.pk-total { font-weight: 700; margin: 8px 0 0; }

/* ---------- Quadro mensal (Aluno Full): aluno × mês ---------- */
.qd-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; margin-bottom: 10px; }
.qd-tools .field { margin: 0; }
.qd-check { min-height: 44px; }
.qd-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; list-style: none; padding: 0; margin: 0 0 10px; font-size: .8rem; color: var(--muted); }
.qd-legend li { display: flex; align-items: center; gap: 6px; }
.qd-chip { width: 14px; height: 14px; border-radius: 4px; border: 1px solid transparent; display: inline-block; }
.qd-wrap { overflow: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.qd-table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .85rem; }
.qd-table th, .qd-table td { padding: 4px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; text-align: center; }
.qd-table thead th { position: sticky; top: 0; z-index: 3; background: #f0f0f1; font-weight: 600; }
.qd-table .qd-name { position: sticky; left: 0; z-index: 2; background: var(--bg); text-align: left; min-width: 190px; max-width: 260px; border-right: 1px solid var(--line); white-space: normal; }
.qd-table thead .qd-name { z-index: 4; background: #f0f0f1; }
.qd-student { display: block; font-weight: 600; }
.qd-sub { display: block; font-size: .72rem; }
.qd-table .dt-num { font-variant-numeric: tabular-nums; }
.qd-cell { display: block; width: 100%; min-width: 78px; min-height: 30px; padding: 3px 8px; border-radius: 6px; border: 1px solid transparent; font-size: .8rem; font-weight: 600; line-height: 1.2; text-align: center; cursor: pointer; }
span.qd-cell { cursor: default; }
button.qd-cell:hover { filter: brightness(.96); }
.qd-pago { background: #e6f4ea; color: #0b4d36; border-color: #c9e6d3; }
.qd-pacote { background: #ddebf7; color: #1b3f6b; border-color: #bfd6ec; }
.qd-pend { background: #fce8e6; color: #8a1c14; border-color: #f4c9c4; }
.qd-venc { background: #f9c9c4; border-color: #c8281c; }
.qd-isento { background: #eceff1; color: #4a4f52; border-color: #d9dee1; }
.qd-susp { background: #fff2cc; color: #6b5200; border-color: #f0dc9a; }
.qd-canc { background: #eceff1; color: #6c7275; text-decoration: line-through; border-color: #d9dee1; }
.qd-vazio { background: transparent; color: #8a8a8a; font-weight: 500; border: 1px dashed #d0d0d0; }
button.qd-vazio:hover { background: var(--tint); }
.qd-off { border-style: dotted; opacity: .75; }
.qd-chip.qd-vazio { border: 1px dashed #b0b0b0; }
.qd-actions { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.qd-actions button { width: 100%; text-align: left; }
.qd-lbl, .qd-val { display: block; }
.qd-val { font-size: .7rem; font-weight: 500; }
.qd-primary { background: var(--red); color: #fff; border-color: var(--red); }
@media (max-width: 860px) {
  .qd-table .qd-name { min-width: 130px; }
  .qd-cell { min-width: 64px; font-size: .75rem; }
}


/* ---------- Login: mostrar senha, lembrar-me e recuperação ---------- */
.field-inline { display: flex; gap: 8px; align-items: stretch; }
.field-inline input { flex: 1 1 auto; min-width: 0; }
.field-inline button { flex: none; min-width: 96px; }
.login-remember { margin: 4px 0 12px; }
.login-submit { width: 100%; }
.login-links { margin: 10px 0 0; text-align: center; }
.login-links .link { border: 0; background: transparent; padding: 6px 8px; min-height: 36px; text-decoration: underline; font-weight: 500; }
.login-support { margin: 12px 0 0; font-size: .85rem; text-align: center; }
.card-inset { border: 1px solid var(--line); border-radius: 6px; padding: 12px; margin-top: 12px; background: var(--tint); }
#view-boot-error .card { max-width: 480px; }
#view-boot-error h1 { font-size: 1.1rem; margin-top: 0; }

/* ---------- Atalho de busca ---------- */
.kbd { margin-left: auto; font-size: .7rem; border: 1px solid #555; border-radius: 4px; padding: 1px 6px; color: #cfcfcf; }
.search-trigger { margin-bottom: 6px; }
.search { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; }
.search-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); }
.search-panel { position: relative; width: min(640px, 100%); max-height: 80vh; overflow-y: auto; background: var(--bg); border-radius: var(--radius); padding: 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, .25); }
.search-panel input[type="search"] { font-size: 1.05rem; }
.search-results { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.search-item { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; background: var(--bg); color: var(--ink); border: 1px solid var(--line); font-weight: 400; padding: 10px 12px; min-height: 52px; }
.search-item[aria-selected="true"] { border-color: var(--red); box-shadow: inset 3px 0 0 var(--red); background: var(--tint); }
#search-hint { margin: 6px 0; font-size: .82rem; }

/* ---------- Aviso curto (toast) ---------- */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 80; max-width: min(560px, calc(100vw - 32px)); background: #143d2c; color: #fff; padding: 12px 16px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); font-size: .92rem; }
.toast[data-kind="error"] { background: #7a1a12; }

/* ---------- Ações rápidas do Início ---------- */
.home-actions { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 480px) {
  .toast { left: 16px; right: 16px; transform: none; max-width: none; }
  .search-panel { padding: 12px; }
}


/* Nome do aluno no quadro mensal: link para o cadastro, sem cara de botão */
.qd-student-link { background: transparent; border: 0; padding: 0; min-height: 0; color: var(--ink); font: inherit; font-weight: 600; text-align: left; cursor: pointer; text-decoration: none; border-radius: 2px; }
.qd-student-link:hover { background: transparent; color: var(--red-dark); text-decoration: underline; }
.qd-student-link:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
