/* VF Team back office — monochrome sports-retail look (after the Nike design.md
   on getdesign.md) in the Cardápio colours: cream paper, VF red for the action
   and the active menu item, rose for danger. Pill buttons, square cards,
   hairlines instead of shadows. Titles in Anton (uppercase), interface in
   Inter, numbers in DM Mono. Light and dark share everything but the colour tokens;
   the theme follows the phone. */

@font-face { font-family: "Anton"; src: url("fonts/anton-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/inter-var.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "DM Mono"; src: url("fonts/dm-mono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "DM Mono"; src: url("fonts/dm-mono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  color-scheme: light;
  /* Surfaces */
  --bg: #f2e9e1;
  --surface: #fbf8f4;
  --surface-2: #efe4da;
  --surface-3: rgba(19, 21, 22, 0.05);
  --sunken: #e9ded2;
  /* Text. text-3 is darker than the Cardápio value (#8a857d) to reach AA on surface. */
  --text-1: #131516;
  --text-2: #5c5852;
  --text-3: #66615a;
  --text-4: #7e756b;
  /* Borders. input-line is darker than border-strong so controls reach 3:1. */
  --border: #dcd1c6;
  --border-2: #e8dfd5;
  --border-strong: #c9bcae;
  --input-line: #9a8d7f;
  /* Brand: VF red, the action and the active menu item. Danger is rose so "the action"
     and "something is wrong" never share a colour. */
  --primary: #c41e1a;
  --primary-hover: #a91814;
  --primary-active: #8f130f;
  --primary-ink: #fbf8f4;
  --brand: var(--primary);
  --success: #4a7314;
  --warn: #8a6200;
  --danger: #a3166b;
  --info: #0f7ca0;

  /* Shape and rhythm */
  --radius-badge: 999px;
  --radius-control: 999px;
  --radius-field: 24px;
  --radius-alert: 0;
  --radius-card: 0;
  --radius-pill: 999px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --bar-h: 60px;
  --ease: cubic-bezier(0.2, 0, 0, 1);

  --font-sans: "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Anton", "Arial Narrow", Impact, sans-serif;
  --font-mono: "DM Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  -webkit-text-size-adjust: 100%;
}

@media screen and (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0e1011;
    --surface: #171a1b;
    --surface-2: #1f2324;
    --surface-3: rgba(234, 222, 213, 0.06);
    --sunken: #131516;
    --text-1: #eaded5;
    --text-2: #afb0ab;
    --text-3: #8f928e;
    --text-4: #5f6462;
    --border: #2b2f30;
    --border-2: #1f2324;
    --border-strong: #3c4142;
    --input-line: #6b7172;
    /* Red is a light surface on near-black, so it takes ink text. */
    --primary: #ff4a3d;
    --primary-hover: #ff6a5f;
    --primary-active: #e6392d;
    --primary-ink: #131516;
    --success: #94cb45;
    --warn: #e9b949;
    --danger: #f25ca8;
    --info: #45cff4;
  }
}

/* Tints are mixes of the full colour, never extra tokens. */
:root {
  --success-tint: color-mix(in srgb, var(--success) 14%, transparent);
  --warn-tint: color-mix(in srgb, var(--warn) 14%, transparent);
  --danger-tint: color-mix(in srgb, var(--danger) 14%, transparent);
  --info-tint: color-mix(in srgb, var(--info) 14%, transparent);
  --muted-tint: color-mix(in srgb, var(--text-2) 12%, transparent);
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); scroll-padding-top: calc(var(--bar-h) + var(--space-3)); }
/* 15px on body, not html: rems stay 16px so spacing and breakpoints keep their size. */
body {
  margin: 0; min-height: 100dvh;
  background: var(--bg); color: var(--text-1);
  font-family: var(--font-sans); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1 {
  font-family: var(--font-display); font-weight: 400;
  font-size: 30px; line-height: 0.95; letter-spacing: 0; text-transform: uppercase;
  margin: 0 0 var(--space-5); overflow-wrap: anywhere;
}
h2 { font-size: 16px; font-weight: 600; margin: 0 0 var(--space-3); }
/* h3 is the eyebrow: a quiet label above a block. */
h3 {
  font-size: 13px; font-weight: 500; color: var(--text-3); margin: var(--space-5) 0 var(--space-2);
}
p { margin: 0 0 var(--space-3); }
.muted { color: var(--text-2); }
.hint { font-size: 13px; color: var(--text-2); margin: var(--space-2) 0 0; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
a { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
@media (min-width: 1024px) { h1 { font-size: 40px; } }

/* Shell */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--bar-h);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: 0 var(--space-4);
  background: var(--sunken);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  font-family: var(--font-display); font-weight: 400; font-size: 20px;
  text-transform: uppercase; letter-spacing: 0; color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* The logo's red disc with its ring, drawn in CSS. */
/* The logo is a round badge on a white square: clipped to the circle so no corners show in dark mode. */
.brand-logo, .public-logo, .login-logo { display: block; flex: none; border-radius: 50%; }
.brand { text-decoration: none; }
.brand:hover { text-decoration: none; }
.login-logo { margin: 0 auto var(--space-4); }
.public-logo { width: 72px; height: 72px; }

.content { width: 100%; max-width: 760px; min-width: 0; margin: 0 auto; padding: var(--space-4) var(--space-4) calc(var(--space-6) + env(safe-area-inset-bottom)); }
.content-narrow {
  max-width: 400px; min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: center;
  padding-top: var(--space-6); padding-bottom: var(--space-6);
}
.content-public { max-width: 640px; padding-bottom: var(--space-6); }
.public-brand { display: flex; align-items: center; gap: 10px; margin: var(--space-2) 0 var(--space-5); }
.choice-row { display: flex; flex-wrap: wrap; gap: 0 var(--space-4); }
fieldset.field { border: 0; padding: 0; margin: 0 0 var(--space-4); min-width: 0; }
fieldset.field > legend { font-size: 13px; font-weight: 600; padding: 0; margin-bottom: var(--space-1); }
.date-parts { display: grid; grid-template-columns: 1fr 1fr 1.6fr; gap: var(--space-2); }
.date-part { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); }
.date-part input { width: 100%; min-width: 0; min-height: 44px; padding: 0 12px; font: inherit; font-family: var(--font-mono); font-size: 14.5px; color: var(--text-1); background: var(--surface); border: 1px solid var(--input-line); border-radius: var(--radius-field); }
.date-part input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.has-error .date-part input { border-color: var(--danger); }
.error-list { margin: var(--space-2) 0 0; padding-left: 18px; }
.error-list li + li { margin-top: 4px; }
.error-list a { color: var(--danger); text-decoration: underline; text-underline-offset: 2px; }
/* Adults never see the guardian section; it stays visible until a choice is made. */
.signup:has(#f-forWho-self:checked) .guardian { display: none; }
/* Minors are paid for by the guardian; adults name another payer only if they say so. */
.signup:has(#f-forWho-minor:checked) .payer-choice { display: none; }
.signup:not(:has(#f-payerMode-other:checked)) .other-payer { display: none; }
#f-payer:not(:has(input[value="other"]:checked)) .other-payer-select { display: none; }
.cf-turnstile { margin: var(--space-4) 0; min-height: 65px; }
.link-out { overflow-wrap: anywhere; user-select: all; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Menu: every screen, grouped. A sidebar on wide screens; on phones the same list
   slides in from the right under the top bar, opened by the ☰ button. */
.menu-toggle {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 44px; height: 44px; margin-right: calc(-1 * var(--space-2));
  background: none; border: 0; border-radius: var(--radius-control); color: var(--text-1); cursor: pointer;
}
.menu-toggle:hover { background: var(--surface-2); }
.menu-toggle[aria-expanded="true"] .icon-open, .menu-toggle[aria-expanded="false"] .icon-close { display: none; }
.menu-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.nav {
  position: fixed; z-index: 30; top: var(--bar-h); right: 0; bottom: 0;
  width: min(300px, 86vw); overflow-y: auto; overscroll-behavior: contain;
  padding: var(--space-3) var(--space-3) calc(var(--space-5) + env(safe-area-inset-bottom));
  background: var(--sunken); border-left: 1px solid var(--border);
  transform: translateX(100%); visibility: hidden;
  transition: transform 180ms ease-out, visibility 0s linear 180ms;
}
.nav.is-open { transform: none; visibility: visible; transition: transform 180ms ease-out; }
.nav-scrim { position: fixed; z-index: 25; inset: var(--bar-h) 0 0 0; background: rgb(0 0 0 / 0.35); }
@media (prefers-reduced-motion: reduce) { .nav, .nav.is-open { transition: none; } }

.nav-group { display: flex; flex-direction: column; gap: 2px; padding: var(--space-2) 0; }
.nav-group + .nav-group { border-top: 1px solid var(--border-2); }
.nav-title {
  margin: var(--space-1) var(--space-3) var(--space-1);
  font-size: 12px; font-weight: 500; color: var(--text-3);
}
.nav-group form { margin: 0; }
.nav-item {
  position: relative; display: flex; align-items: center; width: 100%;
  min-height: 44px; padding: 0 var(--space-3); border-radius: 0;
  font: inherit; font-size: 15px; text-align: left; color: var(--text-2); text-decoration: none;
  background: none; border: 0; cursor: pointer;
  transition: background 120ms ease-out, color 120ms ease-out;
}
.nav-item:hover { background: var(--surface-3); color: var(--text-1); text-decoration: none; }
.nav-item:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.nav-item[aria-current="page"] { color: var(--text-1); font-weight: 600; }
.nav-item[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 50%; width: 3px; height: 20px; margin-top: -10px; background: var(--brand); }

@media (min-width: 1024px) {
  .menu-toggle, .nav-scrim { display: none; }
  .shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); }
  .nav {
    position: sticky; top: var(--bar-h); z-index: auto; width: auto; height: calc(100dvh - var(--bar-h));
    padding: var(--space-3); border-left: 0; border-right: 1px solid var(--border);
    transform: none; visibility: visible; transition: none;
  }
  /* Pointer targets: 32px rows keep most of the menu on a laptop screen. */
  .nav-item { min-height: 32px; font-size: 14px; }
  .nav-group { gap: 0; padding: var(--space-1) 0; }
  /* The menu scrolls on short screens; the account and Sair stay at its foot. */
  .nav-account { position: sticky; bottom: calc(-1 * var(--space-3)); padding-bottom: var(--space-3); background: var(--sunken); }
  .content { padding: var(--space-6) var(--space-5); }
}

/* Dashboard: the answer first (KPIs, trend), what needs attention beside it.
   Wider than the reading column on large screens, never a narrow strip in white space. */
.dash { display: flex; flex-direction: column; gap: 0 var(--space-4); min-width: 0; }
/* On phones what needs action comes before the trend. */
.dash-side { order: -1; }
.dash-main, .dash-side { min-width: 0; }
@media (min-width: 1024px) {
  /* One width for every signed-in screen, so pages don't jump as you move between them. */
  .content.content-wide { max-width: 1180px; }
  /* Cards span that width; a field as wide as the card would be a 1000px box for "50". */
  .form .field, .form > .button-block, .form > .notice, .form .choice { max-width: 560px; }
  /* Long settings forms fill a wide card in two columns instead of one 560px strip. */
  .form-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--space-5); align-items: start; }
  .form-cols > :not(.field) { grid-column: 1 / -1; }
  .form-cols > .field, .form .form-cols > .field { max-width: none; }
  .dash { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: start; }
  .dash-side { order: 0; }
}
.kpi-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 0; }
.kpi-strip.kpi-1 { grid-template-columns: 1fr; }
.kpi-strip.kpi-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpi-strip.kpi-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { padding: var(--space-4); min-width: 0; }
.kpi + .kpi { border-left: 1px solid var(--border-2); }
.kpi-label { margin: 0; font-size: 13px; font-weight: 500; color: var(--text-3); }
.kpi-value { margin: 6px 0 4px; font-family: var(--font-mono); font-size: clamp(18px, 1.7vw, 26px); font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.15; white-space: nowrap; }
.kpi-sub { margin: 0; font-size: 12px; color: var(--text-2); }
.kpi-alert { color: var(--danger); font-weight: 600; }
/* The first figure is the answer; the rest explain it. */
.kpi-strip.kpi-lead { grid-template-columns: 1.4fr repeat(2, minmax(0, 1fr)); }
.kpi-strip.kpi-lead.kpi-1 { grid-template-columns: 1fr; }
.kpi-strip.kpi-lead.kpi-2 { grid-template-columns: 1.4fr minmax(0, 1fr); }
.kpi-strip.kpi-lead.kpi-4 { grid-template-columns: 1.4fr repeat(3, minmax(0, 1fr)); }
.kpi-lead .kpi:first-child .kpi-value { font-size: clamp(24px, 2.4vw, 34px); }
.kpi-lead .kpi:not(:first-child) .kpi-value { font-size: clamp(16px, 1.3vw, 20px); color: var(--text-2); }
@media (max-width: 559px) {
  .kpi-strip, .kpi-strip.kpi-2, .kpi-strip.kpi-4, .kpi-strip.kpi-lead, .kpi-strip.kpi-lead.kpi-2, .kpi-strip.kpi-lead.kpi-4 { grid-template-columns: 1fr; }
  .kpi + .kpi { border-left: 0; border-top: 1px solid var(--border-2); }
  .kpi { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 0 var(--space-3); padding: 12px var(--space-4); }
  .kpi-label { grid-column: 1; }
  .kpi-value { grid-column: 2; grid-row: 1 / span 2; margin: 0; text-align: right; font-size: 20px; }
  .kpi-sub { grid-column: 1; }
  /* The lead figure is too wide to sit beside its label: it reads top to bottom, like a headline. */
  .kpi-lead .kpi:first-child { grid-template-columns: 1fr; }
  .kpi-lead .kpi:first-child .kpi-value { grid-column: 1; grid-row: auto; margin: 4px 0 2px; text-align: left; }
}

/* Data tables (Cardápio §7.8): hairline rows, header on the background band,
   amounts right-aligned in the number face, the whole row clickable. */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; margin-bottom: var(--space-4); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table thead th {
  background: var(--bg); text-align: left; font-size: 12px; font-weight: 500;
  color: var(--text-3); padding: 10px 18px; border-bottom: 1px solid var(--border);
}
.data-table tbody th, .data-table td { padding: 12px 18px; border-top: 1px solid var(--border-2); text-align: left; vertical-align: middle; font-weight: 400; }
.data-table tbody tr:first-child th, .data-table tbody tr:first-child td { border-top: 0; }
.data-table tbody th { font-weight: 600; color: var(--text-1); }
.data-table .num-cell { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table tbody tr { position: relative; transition: background 120ms ease-out; }
.data-table tbody tr:hover { background: var(--surface-3); }
.data-table tr.is-muted { opacity: 0.6; }
.row-link { color: inherit; text-decoration: none; }
.nav-item, .segmented a, .brand, .list-item, .button, .history-more a { text-decoration: none; }
.row-link::after { content: ""; position: absolute; inset: 0; }
.row-link:hover { text-decoration: none; }
/* Focus outlines the whole row the link covers, not just the name. */
.row-link:focus-visible { outline: none; }
.phone-only { display: none; }
@media (max-width: 1023px) { .phone-only { display: inline; } }
.data-table tbody tr:has(.row-link:focus-visible) { outline: 2px solid var(--primary); outline-offset: -2px; }
.data-table .muted { font-size: 12.5px; }
.data-table .badge { vertical-align: middle; }
/* Below 1024px each row is a list row inside the one card, never a sideways scroll
   and never a card of labeled lines: the first cell is the title, an "aside" cell
   (the amount that matters) sits at its right, the rest are short muted lines. */
@media (max-width: 1023px) {
  .table-card { padding: 0 var(--space-4); }
  .data-table, .data-table tbody { display: block; }
  /* Visually hidden, not removed: screen readers keep the column names. */
  .data-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .data-table tbody tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-auto-flow: row dense; column-gap: var(--space-3); row-gap: 2px;
    padding: 12px 0; border-bottom: 1px solid var(--border-2);
  }
  .data-table tbody tr:last-child { border-bottom: 0; }
  .data-table tbody th, .data-table td { display: block; grid-column: 1; padding: 0; border: 0; min-width: 0; }
  .data-table tbody th { font-size: 15px; }
  .data-table td { font-size: 13px; color: var(--text-2); }
  .data-table td.phone-aside { grid-column: 2; grid-row: 1; align-self: center; text-align: right; color: var(--text-1); }
  .data-table td.phone-aside ~ td.phone-aside { grid-row: 2; }
  .data-table .phone-hidden { display: none; }
}

/* Segmented filter: one row of plain links; the active one carries the wash. */
.segmented { display: flex; gap: var(--space-2); padding: 0; background: none; border: 0; margin-bottom: var(--space-4); min-width: 0; }
.segmented a {
  flex: 1 1 0; min-width: 0; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--radius-control); font-size: 13.5px; line-height: 1.2; color: var(--text-1); text-decoration: none; text-align: center;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--border-strong);
}
/* Small phones: the count goes under the label instead of being cut off. */
@media (max-width: 419px) { .segmented a { flex-direction: column; gap: 0; font-size: 12.5px; } }
.segmented a:hover { box-shadow: inset 0 0 0 1px var(--text-1); text-decoration: none; }
.segmented a[aria-current] { background: var(--primary); color: var(--primary-ink); font-weight: 600; box-shadow: none; }
.segmented a[aria-current] .num { color: inherit; }
.segmented .num { font-size: 12px; color: var(--text-3); }

/* Page header: title left, actions right; on phones actions wrap under it. */
.page-head { flex-wrap: wrap; }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.page-head .month-nav { margin-bottom: 0; }

/* Charts: money in one hue, grid quiet, the running month pale. */
.chart { display: block; width: 100%; height: auto; }
.chart-grid { stroke: var(--border-2); stroke-width: 1; }
.chart-tick, .chart-label { font-family: var(--font-mono); font-size: 11px; fill: var(--text-3); }
/* The SVG scales with its card: on a phone (about 340px for 600 units) the text
   is set larger in chart units so it still renders at about 11px. */
@media (max-width: 559px) { .chart-tick, .chart-label { font-size: 19px; } }
.chart-bar rect { fill: var(--success); }
.chart-bar.partial rect { fill: color-mix(in srgb, var(--success) 40%, transparent); stroke: var(--success); stroke-width: 1; stroke-dasharray: 3 3; }

/* Cards: a step in surface plus a 1px border. Never nested, never shadowed. */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: var(--space-4); margin-bottom: var(--space-4); min-width: 0;
}
@media (min-width: 768px) { .card { padding: 20px; } }
details.card > summary { cursor: pointer; font-weight: 600; list-style: none; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin: -10px 0; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: "›"; flex: none; color: var(--text-3); transition: transform 120ms ease-out; }
details.card[open] > summary::after { transform: rotate(90deg); }
details.card[open] > summary { margin-bottom: var(--space-2); }
.observer-on { border-color: color-mix(in srgb, var(--info) 35%, transparent); background: color-mix(in srgb, var(--info) 7%, var(--surface)); }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-5); }
.page-head h1 { margin: 0; min-width: 0; }
.login { text-align: center; margin-bottom: 0; }
.login .hint { text-align: center; }
.login h1 { margin-bottom: var(--space-1); }
.login .muted { margin-bottom: var(--space-5); }

/* Lists: hairline rows */
.list { list-style: none; margin: 0; padding: 0; }
.list-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) 0; border-bottom: 1px solid var(--border-2);
  color: inherit; text-decoration: none;
}
li.list-item:last-child { border-bottom: 0; padding-bottom: 0; }
li.list-item:first-child { padding-top: 0; }
.list > a.list-item:last-child, .list > li:last-child > a.list-item { border-bottom: 0; }
.list-item > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-item strong { font-weight: 600; }
.list-item .muted { font-size: 13.5px; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
a.list-item { min-height: 44px; margin: 0 calc(-1 * var(--space-3)); padding-left: var(--space-3); padding-right: var(--space-3); transition: background 120ms ease-out; }
a.list-item:hover { background: var(--surface-3); text-decoration: none; }
.list-item.inactive > div { opacity: 0.6; }
/* A name that opens its page inside a row: reads as text, not as a red warning, and pads out to a finger. */
.name-link { color: inherit; display: inline-block; padding: 10px 0; margin: -10px 0; text-decoration: underline; text-decoration-color: var(--text-3); text-underline-offset: 3px; }
.name-link:hover { text-decoration-color: currentColor; }
/* Two actions beside the text squeeze it on a phone: the text takes its own line. */
.list-item:has(details), .list-item:has(> :is(form, a.button) + :is(form, a.button)), .list-item:has(> .badge + form) { flex-wrap: wrap; }
.list-item > form { margin: 0; }
.list-item:has(> :is(form, a.button) + :is(form, a.button)) > div,
.list-item:has(> .badge + form) > div { flex-basis: 100%; }
.list-item > .inline-form { flex: 1; margin: 0; }
.inline-form .muted { flex-basis: 100%; font-size: 13.5px; }

/* Facts: the menu line — label ……… value — for summaries. */
.facts { margin: 0; }
.facts div { display: flex; align-items: baseline; gap: var(--space-2); padding: 9px 0; }
.facts div:first-child { padding-top: 0; }
.facts div:last-child { padding-bottom: 0; }
.facts dt { color: var(--text-2); flex: 0 1 auto; min-width: 0; }
.facts div::after { content: ""; order: 1; flex: 1; min-width: 16px; border-bottom: 1px dotted var(--border-strong); transform: translateY(-4px); }
.facts dd { order: 2; margin: 0; font-weight: 600; text-align: right; overflow-wrap: break-word; min-width: 0; max-width: 70%; }

/* Forms */
.field { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-4); min-width: 0; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-1); }
.field .hint { margin: 0; }
.field input, .field select, .field textarea,
.toolbar input, .toolbar select, .inline-form input, .inline-form select, .inline-actions input,
.alloc-row input[inputmode] {
  width: 100%; min-width: 0; font: inherit; font-size: 14.5px; color: var(--text-1);
  min-height: 44px; padding: 0 15px;
  background: var(--surface); border: 1px solid var(--input-line); border-radius: var(--radius-field);
  transition: border-color 120ms ease-out, box-shadow 120ms ease-out;
}
.field input, .field select, .toolbar input, .toolbar select, .inline-form input, .inline-form select, .inline-actions input { padding: 0 18px; }
.field textarea { min-height: 92px; padding: 12px 18px; resize: none; border-radius: 18px; }
/* iOS Safari zooms into any focused field under 16px; must follow the 14.5px rules above. */
@media (max-width: 559px) {
  .field input, .field select, .field textarea, .date-part input,
  .toolbar input, .toolbar select, .inline-form input, .inline-form select, .inline-actions input,
  .alloc-row input[inputmode] { font-size: 16px; }
}
.field select, .toolbar select, .inline-form select {
  appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M4 6l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 16px;
}
/* Examples must not pass for typed values: fainter, italic, and they start with "Ex.:". */
.field input::placeholder, .field textarea::placeholder { color: var(--text-3); opacity: 0.75; font-style: italic; }
.field input:focus, .field select:focus, .field textarea:focus,
.toolbar input:focus, .toolbar select:focus, .inline-form input:focus, .inline-form select:focus,
.inline-actions input:focus, .alloc-row input:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary);
}
.field input[type="file"] { padding: 9px; }
.field input[type="date"], .field input[type="time"], .field input[inputmode="decimal"], .inline-form input[inputmode="decimal"] { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 25%, transparent); }
.field-error { font-size: 13px; color: var(--danger); margin: 0; }
.form h2:not(:first-of-type) { margin-top: var(--space-5); }
/* A card's one-line description sits under its title, apart from the first field. */
.card > h2 + .hint { margin: calc(-1 * var(--space-1)) 0 var(--space-4); }
/* A save button for several cards closes the form; keep it off the next card. */
.form > .card + .button-block { margin: 0 0 var(--space-6); }

.toolbar { display: flex; gap: var(--space-2); margin-bottom: var(--space-4); }
.toolbar input, .toolbar select { flex: 1; }
.toolbar label { align-self: center; font-size: 14px; color: var(--text-2); }
.inline-form, .inline-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
.inline-form input, .inline-form select, .inline-actions input { flex: 1; min-width: 150px; width: auto; }
.inline-form form { margin: 0; }

.choice { border: 1px solid var(--border-strong); border-radius: var(--radius-card); padding: var(--space-3) var(--space-4); margin: 0 0 var(--space-4); min-width: 0; }
.choice legend { font-size: 13px; font-weight: 600; padding: 0 var(--space-1); }
.choice .sub { margin: var(--space-1) 0 var(--space-2) 30px; }
/* Only the chosen option's fields show, so nothing typed is silently ignored on save. */
.choice:not(:has(input[name="payerMode"][value="existing"]:checked)) .payer-existing,
.choice:not(:has(input[name="payerMode"][value="new"]:checked)) .payer-new { display: none; }
label.radio, label.check { display: flex; gap: var(--space-3); align-items: center; min-height: 44px; font-weight: 500; cursor: pointer; }
label.check input, label.radio input { width: 20px; height: 20px; flex: none; accent-color: var(--primary); margin: 0; }

/* Buttons. Default is secondary; one primary per region; danger is outline plus a word. */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 48px; padding: 8px var(--space-5); text-align: center;
  font: inherit; font-size: 15px; font-weight: 500; line-height: 1.3; text-decoration: none; cursor: pointer;
  color: var(--text-1); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-control);
  transition: background 120ms ease-out, border-color 120ms ease-out, color 120ms ease-out, transform 120ms ease-out;
}
.button:hover { border-color: var(--text-1); text-decoration: none; }
.button:active { transform: scale(0.97); }
.button:disabled { background: var(--border); color: var(--text-4); border-color: var(--border); cursor: not-allowed; }
/* While htmx waits for the server: the tapped control dims, so a slow phone shows something is happening. */
.htmx-request.button, .htmx-request .button, .htmx-request.history-toggle { opacity: 0.6; cursor: progress; }
.button-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); font-weight: 500; }
.button-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.button-primary:active { background: var(--primary-active); }
.button-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.button-danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); border-color: var(--danger); }
.button-block { width: 100%; margin-top: var(--space-2); }
.page-head + .button-block { margin: 0 0 var(--space-4); }
.button-small { min-height: 44px; padding: 0 var(--space-4); font-size: 14px; }
.month-arrow { width: 48px; padding: 0; font-size: 1.25rem; }

/* Alerts */
.notice {
  padding: 14px var(--space-4); border-radius: var(--radius-alert); margin: 0 0 var(--space-4); font-size: 14px;
  border: 1px solid; color: var(--text-1);
}
.notice p { margin: 0; }
.notice p + p { margin-top: var(--space-1); }
/* What a student or payer owes, at the top of their page. */
.money-lead strong { font-size: 17px; }
.money-lead .button { margin-top: var(--space-3); }
.money-line { margin: 0 0 var(--space-1); font-size: 17px; }
/* A second, wrapping line under an amount in a narrow column (the amount itself never wraps). */
.aside-note { display: block; max-width: 11em; margin-left: auto; white-space: normal; font-size: 12px; line-height: 1.3; }
/* One line under a page title: pulled up to it, then the usual gap before the cards. */
.lead { margin: calc(var(--space-2) - var(--space-5)) 0 var(--space-5); font-size: 15px; color: var(--text-2); }
.notice-ok { background: color-mix(in srgb, var(--success) 9%, var(--surface)); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.notice-error { background: color-mix(in srgb, var(--danger) 9%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.notice-info, .notice-progress { background: color-mix(in srgb, var(--info) 7%, var(--surface)); border-color: color-mix(in srgb, var(--info) 30%, transparent); }

/* Badges: mono, uppercase, tinted for states */
.badge {
  display: inline-flex; align-items: center; white-space: nowrap;
  font-size: 12px; font-weight: 500;
  padding: 3px 12px; border-radius: var(--radius-badge);
  background: var(--muted-tint); color: var(--text-2);
}
.badge-warn, .status-partial, .status-open { background: var(--warn-tint); color: var(--warn); }
.status-paid { background: var(--success-tint); color: var(--success); }
.status-overdue { background: var(--danger-tint); color: var(--danger); }
.status-waived { background: var(--muted-tint); color: var(--text-2); }

/* Belts: a stripe in the belt colour beside plain text */
.belt { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 13px; color: var(--text-2); }
.belt::before { content: ""; width: 18px; height: 6px; border-radius: 3px; background: var(--belt, #ddd); box-shadow: inset 0 0 0 1px var(--border-strong); }
.belt-branca { --belt: #ffffff; }
.belt-cinza { --belt: #a3a6ab; }
.belt-amarela { --belt: #e8c547; }
.belt-laranja { --belt: #e08a3c; }
.belt-verde { --belt: #3f8f5b; }
.belt-azul { --belt: #2f5b86; }
.belt-roxa { --belt: #6a4a8c; }
.belt-marrom { --belt: #6e4a2f; }
.belt-preta { --belt: #131516; }

/* Painel */
.briefing { white-space: pre-line; margin: 0 0 var(--space-2); color: var(--text-2); line-height: 1.7; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { position: relative; padding: 8px 0 8px 30px; }
.checklist li::before { content: ""; position: absolute; left: 0; top: 11px; width: 18px; height: 18px; border: 1.5px solid var(--border-strong); border-radius: 50%; }
.checklist li.done { color: var(--text-3); }
.checklist li.done::before { border-color: var(--success); background: var(--success) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>") center / 12px no-repeat; }

/* Money: every amount in mono, tabular */
.headline-label { margin: 0; font-size: 13px; font-weight: 500; color: var(--text-3); }
.headline-value { margin: 4px 0 var(--space-2); font-family: var(--font-mono); font-size: 27px; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.2; }
.month-nav { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); margin-bottom: var(--space-5); }
.month-nav h1, .month-nav h2 { margin: 0; font-size: 24px; text-align: center; }
.charge-line { display: flex; justify-content: space-between; gap: var(--space-2); font-size: 13.5px; color: var(--text-2); }
.owed { white-space: nowrap; font-family: var(--font-mono); font-weight: 500; font-variant-numeric: tabular-nums; }
.owed-paid, .owed-waived { color: var(--text-3); font-weight: 400; }
.owed-overdue { color: var(--danger); }
.total { display: flex; justify-content: space-between; align-items: baseline; padding-top: var(--space-3); margin-top: var(--space-3); border-top: 1px solid var(--border); font-family: var(--font-mono); font-size: 18px; font-weight: 500; font-variant-numeric: tabular-nums; }
.running-total { font-family: var(--font-mono); font-weight: 500; font-variant-numeric: tabular-nums; padding: var(--space-3) var(--space-4); border-radius: 0; background: var(--surface-2); margin: var(--space-3) 0; }
.running-total.over { background: var(--danger-tint); color: var(--danger); }
.alloc-row { display: grid; grid-template-columns: minmax(0, 1fr) 112px; gap: 2px var(--space-3); align-items: center; padding: var(--space-2) 0; border-bottom: 1px solid var(--border-2); }
.alloc-row .muted { grid-column: 1 / -1; font-size: 12px; }
.alloc-row input[inputmode] { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; padding: 0 12px; }

.regularity { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.regularity li { text-align: center; border-radius: 0; padding: var(--space-2) 2px; background: var(--muted-tint); }
.regularity span { display: block; font-size: 11px; font-weight: 500; color: var(--text-3); }
.regularity strong { font-weight: 600; font-size: 13px; color: var(--text-2); }
.reg-on_time { background: var(--success-tint) !important; }
.reg-on_time strong { color: var(--success); }
.reg-late { background: var(--warn-tint) !important; }
.reg-late strong { color: var(--warn); }
.reg-open { background: var(--muted-tint) !important; }
.reg-open strong { color: var(--text-2); }
.reg-overdue { background: var(--danger-tint) !important; }
.reg-overdue strong { color: var(--danger); }
.reg-covered { background: var(--success-tint) !important; }
.reg-covered strong { color: var(--success); }
/* Presença: name on its own line on phones, belt, status and the button below it. */
@media (max-width: 559px) {
  .attendance-row { flex-wrap: wrap; }
  .attendance-row > div { flex-basis: 100%; }
  .attendance-row form { margin-left: auto; }
}

.row-actions summary {
  cursor: pointer; color: var(--primary); font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px;
  min-height: 44px; display: flex; align-items: center; list-style: none;
}
.row-actions summary::-webkit-details-marker { display: none; }
.row-actions { flex-basis: 100%; }

/* Receipts, WhatsApp and misc */
.receipt-image { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto var(--space-3); border-radius: 0; border: 1px solid var(--border); }
.ocr { white-space: pre-wrap; font-family: var(--font-mono); font-size: 12px; color: var(--text-2); margin: var(--space-3) 0 0; }
.qr { display: flex; justify-content: center; margin: var(--space-4) 0; }
/* The QR stays dark on white in both themes so phones can read it. */
.qr svg { width: min(260px, 100%); height: auto; border-radius: 0; background: #fff; padding: 8px; }
.status { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 600; margin-bottom: var(--space-2); }
.status::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--text-3); }
.wa-open { color: var(--success); }
.wa-open::before { background: var(--success); }
.wa-connecting, .wa-qr { color: var(--warn); }
.wa-connecting::before, .wa-qr::before { background: var(--warn); }
.wa-stopped, .wa-logged_out { color: var(--danger); }
.wa-stopped::before, .wa-logged_out::before { background: var(--danger); }
.count { font-family: var(--font-mono); font-weight: 500; font-variant-numeric: tabular-nums; min-width: 28px; text-align: center; padding: 2px 8px; border-radius: var(--radius-badge); background: var(--warn-tint); color: var(--warn); }
.steps { margin: 0 0 var(--space-3); padding-left: 20px; line-height: 1.7; color: var(--text-2); }

/* Focus is always visible; deliberately last so nothing overrides it. */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

@media print {
  :root { color-scheme: light; }
  .topbar, .nav, .button, form { display: none !important; }
  .card { break-inside: avoid; }
  * { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* Long plain-language text (privacy notice). */
.prose ul { padding-left: 1.25rem; margin: 0 0 var(--space-4); }
.prose li { margin-block: 0.4rem; }
.prose h2 { margin-top: 1.5rem; }
.prose h2:first-child { margin-top: 0; }

/* Agenda: the fixed week, Monday to Sunday. Columns from tablet width; on phones
   each day is a row with its classes beside the name. */
.week { list-style: none; margin: 0 0 var(--space-3); padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--space-2); }
.week-day { min-width: 0; padding-top: var(--space-2); border-top: 2px solid var(--border); }
.week-day.is-today { border-top-color: var(--primary); }
.week-name { margin: 0 0 var(--space-2); font-size: 13px; font-weight: 600; }
.is-today .week-name { color: var(--primary); }
.week-today { display: block; font-size: 11px; font-weight: 500; color: var(--text-3); }
.week-classes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.week-class { padding: 6px 8px; background: var(--surface-2); font-size: 13px; line-height: 1.3; overflow-wrap: anywhere; }
.week-class .num { display: block; font-size: 12px; color: var(--text-2); }
.week-off { margin: 0; font-size: 13px; color: var(--text-3); }
.week-date { font-weight: 400; font-size: 12px; color: var(--text-3); }
/* Events stand apart from the fixed classes: white with a red edge, and they open their page. */
.week-event { padding: 0; background: var(--surface); box-shadow: inset 3px 0 0 var(--primary), inset 0 0 0 1px var(--border); }
.week-event a { display: block; padding: 6px 8px 6px 11px; color: var(--text-1); text-decoration: none; }
.week-event a:hover { background: var(--surface-3); }
@media (max-width: 767px) {
  .week { grid-template-columns: 1fr; gap: 0; }
  .week-day { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: var(--space-3); align-items: start; padding: 10px 0; border-top: 1px solid var(--border-2); }
  .week-day:first-child { border-top: 0; padding-top: 0; }
  .week-day.is-today { border-top-color: var(--border-2); }
  .week-name { margin: 6px 0 0; }
  .week-classes { flex-direction: row; flex-wrap: wrap; }
  .week-class .num { display: inline; margin-right: 4px; }
  .week-date { display: block; }
  .week-off { margin-top: 6px; }
}

/* Timetable on the Agenda: one small heading per weekday. */
.weekday { font-size: 0.95rem; margin: var(--space-4) 0 var(--space-1); color: var(--text-2); }
.weekday:first-of-type { margin-top: var(--space-2); }
details.card > summary .summary-title { margin: 0; font-size: inherit; }

/* Mensalidades: the payer's name opens a row below with their last six months. */
.history-toggle { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; font-weight: 600; color: var(--text-1); }
.history-toggle::after { content: "›"; color: var(--text-3); transition: transform 120ms ease-out; }
.history-toggle[aria-expanded="true"]::after { transform: rotate(90deg); }
.history-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.data-table tr.history-row, .data-table tr.history-row:hover { background: var(--surface-2); }
.data-table .history-table { width: 100%; max-width: 36rem; border-collapse: collapse; display: table; }
.data-table .history-table thead { position: static; width: auto; height: auto; overflow: visible; clip: auto; display: table-header-group; }
.data-table .history-table tbody { display: table-row-group; }
.data-table .history-table tr { display: table-row; background: none; border: 0; padding: 0; margin: 0; }
.data-table .history-table th, .data-table .history-table td { display: table-cell; padding: 8px 10px; border-top: 1px solid var(--border-2); font-size: 13.5px; margin: 0; }
.data-table .history-table thead th { background: none; padding-top: 0; border: 0; }
.data-table .history-table tbody th { font-weight: 400; }
.data-table .history-table td::before { content: none; }
.data-table .history-table td > * { text-align: inherit; }
.history-pager { display: flex; justify-content: space-between; gap: var(--space-2); margin-top: var(--space-3); max-width: 36rem; }
.history-more { margin: var(--space-2) 0 0; font-size: 14px; }
/* A link alone on its line still needs a finger-sized target. */
.history-more a { display: inline-flex; align-items: center; min-height: 44px; }
@media (max-width: 1023px) {
  .data-table tr.history-row { margin: 0 calc(-1 * var(--space-4)); padding: var(--space-3) var(--space-4); }
  .data-table tr.history-row > td { grid-column: 1 / -1; padding: 0; color: var(--text-1); }
}
