:root {
  color-scheme: light;
  font: 15px Inter, "Segoe UI", sans-serif;
  color: #13151a;
  background: #f3f5f8;
  --yellow: #ffe000;
  --line: #dce1ea;
  --muted: #515965;
  --surface: #fbfcfe;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid #775d00; outline-offset: 3px; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 205px;
  padding: 20px 12px; background: #1a1a1a; color: white; overflow-y: auto;
}
.brand { display: block; position: relative; overflow: hidden; height: 48px; margin: 0 0 25px; }
.brand img { position: absolute; width: 117%; max-width: none; top: 50%; left: 50%; transform: translate(-50%, -50%); }
nav { display: grid; gap: 5px; }
nav a, .nav-group summary { display: flex; gap: 11px; align-items: center; padding: 12px 13px; text-decoration: none; border-radius: 8px; font-weight: 600; font-size: .9rem; }
nav a:hover, .nav-group summary:hover { background: #333; }
nav a[aria-current="page"] { background: var(--yellow); color: #151515; }
.nav-icon {
  width: 19px; height: 19px; flex: 0 0 19px;
  fill: none; stroke: var(--icon-color); stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round;
}
nav a[aria-current="page"] .nav-icon {
  background: #252525; border-radius: 5px; padding: 2px;
}
.nav-group summary { cursor: pointer; list-style: none; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after { content: ""; width: 6px; height: 6px; margin-left: auto; border: solid currentColor; border-width: 0 1px 1px 0; transform: rotate(-45deg); }
.nav-group[open] summary::after { transform: rotate(45deg); }
.nav-group ul { list-style: none; margin: 2px 0 2px 10px; padding: 0 0 0 5px; border-left: 1px solid #484848; }
.nav-group a { padding: 8px; font-size: .83rem; }
.workspace { margin-left: 205px; }
.login-page :is(.sidebar, .topbar, footer) { display: none; }
.login-page .workspace { margin: 0; }
.login-page main {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: #201e1b
    linear-gradient(rgba(15, 14, 12, .32), rgba(15, 14, 12, .56)) center / cover no-repeat;
  background-image: linear-gradient(rgba(15, 14, 12, .32), rgba(15, 14, 12, .56)),
    url("/marca/login-academia.jpg");
}
.login-page .login-card {
  width: min(100%, 420px);
  padding: clamp(22px, 5vw, 36px);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 22px;
  background: rgba(23, 24, 26, .94);
  color: #f7f7f8;
  color-scheme: dark;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .48);
  backdrop-filter: blur(12px);
}
.login-brand { background: #1a1a1a; padding: 8px 12px; border-radius: 10px; margin-bottom: 22px; }
.login-brand img { display: block; width: min(100%, 240px); height: 52px; object-fit: cover; margin: auto; }
.login-card h1 { margin: 0; text-align: center; font-size: 1.45rem; }
.login-form { display: grid; gap: 16px; margin-top: 24px; }
.login-form label { display: grid; gap: 7px; color: #e1e2e5; font-weight: 600; }
.login-form :is(input, select) {
  min-height: 46px;
  padding: 10px 12px;
  color: #f7f7f8;
  background: #292b30;
  border: 1px solid #555860;
  border-radius: 10px;
}
.login-form input:-webkit-autofill {
  -webkit-text-fill-color: #f7f7f8;
  box-shadow: 0 0 0 1000px #292b30 inset;
  caret-color: #f7f7f8;
}
.login-form :is(input, select, button):focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 2px;
}
.login-password { position: relative; display: block; }
.login-password input { padding-right: 51px; }
.login-password button {
  position: absolute;
  inset: 2px 2px 2px auto;
  width: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #e1e2e5;
  border: 0;
  border-radius: 8px;
  background: transparent;
}
.login-password button:hover { background: #3b3e45; }
.login-password svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.login-password .eye-slash { display: none; }
.login-password button[aria-pressed="true"] .eye-slash { display: inline; }
.login-form > .primary {
  width: 100%;
  min-height: 46px;
  margin-top: 4px;
  border-radius: 10px;
  color: #181818;
  font-weight: 700;
}
.login-form > .primary:hover { background: #ffeb51; border-color: #ffeb51; }
.login-form .error { color: #ffb7bb; margin: 0; }
.login-form .sub { color: #c5c7cc; }
#account-actions { flex-wrap: wrap; font-size: .85rem; }
.topbar { display: flex; align-items: center; gap: 22px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.unit { border: 1px solid var(--line); border-radius: 8px; padding: 9px 16px; white-space: nowrap; }
#global-search { display: flex; flex: 1; max-width: 440px; gap: 7px; position: relative; }
#search-suggestions {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 50; margin: 0; padding: 6px; list-style: none;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(20, 28, 40, .16);
  max-height: 420px; overflow-y: auto; overflow-x: hidden; min-width: min(440px, calc(100vw - 28px));
}
#search-suggestions a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: inherit; text-decoration: none;
}
#search-suggestions a:hover, #search-suggestions a[aria-selected="true"] { background: #f2f4f8; }
#search-suggestions a > span:not(.student-avatar):not(.badge) { display: grid; flex: 1; min-width: 0; }
#search-suggestions strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#search-suggestions small { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#search-suggestions .badge { flex: none; }
#search-suggestions .empty { padding: 10px; color: var(--muted); }
#search-suggestions .more button { width: 100%; margin-top: 4px; }
.demo { margin-left: auto; color: var(--muted); font-size: .82rem; }
main, footer { max-width: 1500px; margin: auto; padding: 24px; }
footer { color: var(--muted); font-size: .82rem; padding-top: 0; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.65rem, 3vw, 2.25rem); line-height: 1.12; letter-spacing: -.04em; }
h2 { font-size: 1.1rem; letter-spacing: -.02em; }
p { line-height: 1.45; }
.sub { color: var(--muted); font-size: .87rem; margin-top: 4px; }
.heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.actions { display: flex; align-items: center; gap: 8px; }
.client-registration .heading .actions { flex-wrap: wrap; }
.dashboard-actions { flex-wrap: wrap; }
.dashboard-actions .button { display: inline-flex; align-items: center; gap: 7px; }
.dashboard-actions svg { width: 19px; height: 19px; flex: none; }
.actions[hidden] { display: none; }
.button, button { display: inline-block; background: var(--surface); color: inherit; border: 1px solid #ced5e0; border-radius: 8px; text-decoration: none; padding: 9px 13px; font-weight: 650; white-space: nowrap; }
.primary { background: var(--yellow); border-color: var(--yellow); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 16px; box-shadow: 0 1px 2px #141b2a09; min-width: 0; }
.metrics, .details { display: grid; gap: 14px; margin-bottom: 14px; }
.metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.metric { display: grid; justify-items: start; gap: 6px; }
a.metric { text-decoration: none; }
a.metric:hover h2 { text-decoration: underline; }
.metric strong { font-size: clamp(1.4rem, 3vw, 2.1rem); letter-spacing: -.045em; }
.symbol { display: inline-grid; place-items: center; flex: 0 0 auto; width: 35px; height: 35px; border-radius: 9px; background: #fff5bd; font-weight: 750; }
.metric-active-clients { --metric-background: #14774e; }
.metric-new-clients { --metric-background: #246cc0; }
.metric-today-access { --metric-background: #484848; }
.metric:is(.metric-active-clients, .metric-new-clients, .metric-today-access) {
  background: var(--metric-background);
  border-color: var(--metric-background);
  color: #fff;
}
.metric:is(.metric-active-clients, .metric-new-clients, .metric-today-access) .sub { color: inherit; }
.metric:is(.metric-active-clients, .metric-new-clients, .metric-today-access) .symbol { background: rgb(0 0 0 / 18%); }
.danger { color: #b51620; background: #ffe2e3; }
.positive { color: #146126; }
.negative { color: #b51620; }
.rows { list-style: none; margin: 12px 0 0; padding: 0; }
.rows li { display: flex; justify-content: space-between; align-items: center; gap: 9px; padding: 10px 0; border-top: 1px solid var(--line); font-size: .88rem; }
.rows .total { padding-inline: 8px; background: #fff3b0; font-weight: 750; }
.badge { display: inline-block; padding: 4px 8px; font-size: .76rem; font-weight: 700; border-radius: 14px; background: #e8ebf0; }
.badge.active { background: #d8f3df; color: #155a29; }
.badge.pending { background: #fff0aa; color: #4c3d00; }
.details .rows .total, .dashboard-devices .badge.pending { background: #666; color: #fff; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; margin-top: 12px; font-size: .9rem; }
th, td { padding: 9px 8px; border-bottom: 1px solid var(--line); }
th { background: #f1f4f8; font-size: .8rem; }
tbody tr:last-child td { border-bottom: 0; }
.client-registration { max-width: 1035px; margin: 0 auto; }
.client-section + .client-section { margin-top: 24px; }
.client-section h2 { margin-bottom: 11px; color: var(--muted); }
.client-fields {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 20px 22px;
  padding: 22px;
  background: white;
}
.client-fields label {
  display: grid;
  align-content: start;
  min-width: 0;
  gap: 2px;
  color: var(--muted);
  font-size: .85rem;
}
.client-fields label:focus-within { color: #6c5400; }
.client-fields :is(input, select) {
  padding: 6px 0;
  height: 34px;
  border: 0;
  border-bottom: 1px solid #cbd2df;
  border-radius: 0;
  color: #13151a;
  font-size: 1rem;
}
.client-fields :is(input, select):focus {
  border-bottom: 2px solid #a27c00;
  outline: none;
}
.client-fields .span-2 { grid-column: span 2; }
.client-fields .span-4 { grid-column: span 4; }
.client-fields .span-6 { grid-column: span 6; }
.client-fields .span-8 { grid-column: span 8; }
.client-form-actions { justify-content: flex-end; margin-top: 20px; }
.contract-list { max-width: 1080px; margin: 0 auto; }
.contract-toolbar > div:first-child { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.contract-toolbar input { width: 185px; background: transparent; border-width: 0 0 1px; border-radius: 0; }
#contract-filters { margin-bottom: 12px; }
#contract-filters select { display: inline-block; width: auto; margin-left: 8px; }
#contract-results table { margin-top: 0; }
#contract-results :is(th, td) { padding-block: 12px; }
#contract-results th { background: transparent; }
.contract-editor { max-width: 820px; margin: 0 auto; }
.contract-editor h1 { margin-bottom: 14px; }
.contract-editor form > .card + .card { margin-top: 10px; }
.contract-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.contract-fields input, .template-setting input {
  padding-inline: 0; border-width: 0 0 1px; border-radius: 0; background: transparent;
}
.contract-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#modality-empty { text-align: center; margin-top: 10px; }
.modality-row { display: flex; gap: 8px; margin-top: 8px; }
.contract-settings label:not([hidden]) { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.contract-settings input[type="checkbox"] { width: auto; margin: 0; accent-color: #ac8300; }
.contract-settings label:has(:disabled) { color: var(--muted); }
.contract-settings .dependent-setting { margin-left: 18px; }
.contract-settings input[type="number"] { width: 80px; }
.template-setting input { max-width: 240px; }
.contract-settings .sub { margin-top: 12px; }
.contract-editor summary { cursor: pointer; font-weight: 650; }
.contract-editor summary span { margin-left: 8px; }
.contract-editor details[open] summary { margin-bottom: 12px; }
.fields label[hidden] { display: none; }
.fields textarea { resize: vertical; border: 1px solid #cbd2df; border-radius: 6px; padding: 7px 9px; }
.operations-total { margin-bottom: 12px; }
.financial-totals { display: flex; flex-wrap: wrap; gap: 12px 28px; padding: 4px 8px 14px; }
.financial-totals div { display: grid; gap: 4px; }
.financial-totals span { color: var(--muted); font-size: .85rem; }
.financial-totals strong { font-size: 1.15rem; }
#operation-filters { margin-top: 12px; }
.contract-list details summary { cursor: pointer; font-weight: 650; }
.row-actions { display: flex; gap: 8px 13px; flex-wrap: wrap; }
.sale-item { grid-template-columns: minmax(0, 2fr) minmax(80px, 1fr) auto; align-items: end; }
.add-row { margin-top: 12px; }
.facial-preview :is(video, img) { display: block; width: min(100%, 480px); border-radius: 8px; margin: 12px 0; }
.facial-preview [hidden] { display: none; }
.training-row { border: 1px solid var(--line); padding: 12px; margin-top: 12px; border-radius: 8px; }
.training-row h3 { margin: 0; font-size: 1rem; }
/* Visor de vídeo para montar as sessões */
.exercise-picker { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); gap: 16px; margin-top: 16px; align-items: start; }
.exercise-picker-viewer { position: sticky; top: 12px; display: grid; gap: 8px; }
.exercise-viewer { position: relative; aspect-ratio: 9 / 16; max-height: 70vh; border-radius: 10px; overflow: hidden; background: #111;
  display: grid; place-items: center; margin: 0 auto; width: 100%; }
.exercise-viewer :is(video, iframe) { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: contain; background: #000; }
.exercise-viewer-empty { color: #bbb; text-align: center; padding: 16px; margin: 0; }
.exercise-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; max-height: 460px; overflow: auto;
  margin-top: 12px; padding: 2px; }
.exercise-card { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 4px; padding: 4px;
  min-width: 0; min-height: 0; height: auto; width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  color: inherit; font-size: .75rem; font-weight: 600; line-height: 1.2; text-align: left; white-space: normal; cursor: pointer; }
.exercise-card > span:last-child { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.exercise-card img, .exercise-card-empty { display: block; width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: cover;
  border-radius: 6px; background: #222; color: #ddd; }
.exercise-card-empty { display: grid; place-items: center; }
.exercise-card.selected { outline: 3px solid var(--yellow); border-color: #b59f00; }
.watch-video { display: block; width: max-content; margin-top: 8px; }
.exercise-video-dialog { border: 0; border-radius: 12px; padding: 16px; width: min(92vw, 420px); }
.exercise-video-dialog::backdrop { background: rgb(0 0 0 / .6); }
.exercise-video-dialog h2 { margin: 0; font-size: 1.05rem; }
.exercise-video-dialog .exercise-viewer { margin-top: 12px; max-height: 75vh; }
@media (max-width: 760px) { .exercise-picker { grid-template-columns: 1fr; } .exercise-picker-viewer { position: static; } }
.training-series { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); margin-top: 12px; }
.series-row { min-width: 0; display: grid; gap: 6px; border: 1px solid var(--line); border-radius: 6px; font-size: .85rem; }
.series-row label[hidden] { display: none; }
.fields label.training-check { display: flex; align-items: center; }
.training-check input { width: auto; }
@media print {
  body:has(.training-print) :is(.sidebar, .topbar, footer, .training-print .actions) { display: none; }
  body:has(.training-print) .workspace { margin: 0; }
  .training-print .card { break-inside: avoid; box-shadow: none; }
}
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 14px; margin-top: 8px; }
.fields label { display: grid; align-content: start; gap: 4px; font-weight: 650; font-size: .85rem; }
.fields label.wide { grid-column: 1 / -1; }
/* Formulários curtos (troca de senha): um campo embaixo do outro. */
.fields.stacked { grid-template-columns: minmax(0, 1fr); max-width: 420px; }
.required { color: #b51620; }
input, select { min-width: 0; width: 100%; padding: 7px 9px; border: 1px solid #cbd2df; border-radius: 6px; color: inherit; background: white; }
.list-search { max-width: 390px; }
.student-list-name { display: flex; align-items: center; gap: 10px; }
.student-list-name .sub { margin: 2px 0 0; }
.student-avatar {
  position: relative; display: grid; place-items: center; overflow: hidden;
  width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%;
  background: #e9edf5; color: #424f65; font-size: .8rem; font-weight: 700;
}
.student-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.student-avatar img.loaded { opacity: 1; }
.error { color: #a71c26; margin-top: 10px; }
#notice:empty { display: none; }
#notice { position: fixed; right: 20px; bottom: 20px; background: #1a1a1a; color: white; border-radius: 8px; padding: 14px 18px; }
@media (max-width: 900px) {
  .sidebar { position: static; width: auto; padding: 8px 14px; }
  .brand { width: 160px; height: 37px; margin-bottom: 4px; }
  nav { display: flex; align-items: flex-start; overflow: auto; }
  nav a, .nav-group summary { white-space: nowrap; }
  .workspace { margin-left: 0; }
}
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
  #global-search { order: 1; flex-basis: 100%; max-width: none; }
  main, footer { padding: 16px 14px; }
  .heading { align-items: flex-start; flex-wrap: wrap; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .details { grid-template-columns: 1fr; }
  .client-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 16px; }
  .client-fields :is(.span-2, .span-4, .span-6) { grid-column: span 1; }
  .client-fields .span-8 { grid-column: 1 / -1; }
  .contract-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sale-item { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 380px) {
  .fields { grid-template-columns: 1fr; }
  .client-fields { grid-template-columns: 1fr; }
}

/* --- Telas de gestão (gestao.js) --- */
.button.whatsapp { background: #128c56; border-color: #128c56; color: #fff; text-decoration: none; }
.button.whatsapp:hover { background: #0f7547; }
.gestao-dialog { max-width: min(720px, calc(100vw - 32px)); width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.gestao-dialog::backdrop { background: rgb(0 0 0 / .45); }
.gestao-dialog input[readonly] { width: 100%; }
.signed-contract pre { white-space: pre-wrap; font: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px; max-height: 45vh; overflow: auto; }
.signed-contract img { display: block; max-width: 320px; width: 100%; border-bottom: 1px solid #13151a; margin: 16px 0 6px; }
.bar-chart { display: flex; align-items: flex-end; gap: 12px; height: 220px; padding: 10px 0 0; }
.bar-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; min-width: 0; }
.bar { width: 100%; max-width: 64px; background: #1a1a1a; border-top: 4px solid var(--yellow); border-radius: 6px 6px 0 0; }
.bar-value { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.bar-label { font-size: .8rem; font-weight: 600; text-transform: capitalize; }
@media (max-width: 640px) { .bar-chart { gap: 4px; } .bar-value { display: none; } }

/* --- Comunidade: moderação --- */
.mod-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; display: block; }
.mod-report { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.mod-report:last-child { border-bottom: 0; }
.mod-text { white-space: pre-wrap; margin: 8px 0; padding: 10px; border-radius: 8px; background: var(--surface); }
.mod-preview { max-width: 320px; border-radius: 10px; margin-top: 12px; display: block; }

/* Vendas online (pedidos do app) */
.online-order { display: grid; gap: 10px; padding: 14px 0; border-top: 1px solid var(--line); }
.online-order:first-of-type { border-top: 0; }
.online-order-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }

/* Rostos nos leitores */
.badge.danger { background: #fde4e4; color: #a71c26; }
.face-readers { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.face-readers .card h2 { margin-bottom: 2px; }

/* Pagamentos (Asaas) */
.payment-ok { color: #1f7a3d; font-weight: 600; }
.payment-warn { background: #fff6e0; border: 1px solid #f0d58a; border-radius: 8px; padding: 10px 12px; }
.payment-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 0 0 16px; }
.payment-facts dt { font-size: .8rem; color: #6b7280; }
.payment-facts dd { margin: 2px 0 0; font-weight: 600; }
.payment-charge .actions { flex-wrap: wrap; margin-top: 12px; }
.payment-charge #charge-link { width: 100%; }
label.check { display: flex; gap: 8px; align-items: center; }
label.check input { width: auto; }
