:root {
  /* Identidade Crosslytics: ver DESIGN.md. --brand é o vermelho do logo (gráficos); --accent é a versão para texto/botões (AA). */
  --brand: #e42626; --bg: #f5f5f4; --surface: #ffffff; --ink: #121212; --muted: #5c5c5c; --line: #e2e1de;
  --accent: #c81e1e; --accent-ink: #ffffff; --good: #167a3c; --warn: #b4440b; --bad: #9b1c1c;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --brand: #ff5a52; --bg: #0e0e0e; --surface: #181818; --ink: #f5f5f4; --muted: #a3a3a3; --line: #2c2c2c;
    --accent: #ff5a52; --accent-ink: #121212; --good: #4ade80; --warn: #fb923c; --bad: #fca5a5; color-scheme: dark; }
}
:root[data-theme="dark"] { --brand: #ff5a52; --bg: #0e0e0e; --surface: #181818; --ink: #f5f5f4; --muted: #a3a3a3; --line: #2c2c2c;
  --accent: #ff5a52; --accent-ink: #121212; --good: #4ade80; --warn: #fb923c; --bad: #fca5a5; color-scheme: dark; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Tela inteira: sem largura máxima, com margem lateral que acompanha a tela. */
.wrap { max-width: none; margin: 0; padding: 20px clamp(12px, 3vw, 48px) 48px; }
@media (max-width: 480px) { .wrap { padding: 12px 10px 40px; } .panel { padding: 12px; border-radius: 10px; } .grid { gap: 12px; } }
header.top { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
h1 { margin: 0; font-size: 22px; letter-spacing: .01em; }
h2 { margin: 0 0 12px; font-size: 16px; }
.muted { color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; min-width: 0; grid-column: span 12; }
@media (min-width: 900px) { .s5 { grid-column: span 5; } .s7 { grid-column: span 7; } .s6 { grid-column: span 6; } }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input, select, textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
textarea { min-height: 120px; resize: vertical; }
.fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 12px; }
button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 14px; cursor: pointer; font-weight: 600; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
button.small { padding: 4px 10px; font-size: 13px; }
button[disabled] { opacity: .5; cursor: default; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 6px; border-top: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border-top: 0; }
td.r, th.r { text-align: right; }
.table-scroll { overflow-x: auto; }
.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; border: 1px solid currentColor; color: var(--muted); }
.pill.good { color: var(--good); } .pill.warn { color: var(--warn); } .pill.acc { color: var(--accent); }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid currentColor; }
.flash.error { color: var(--bad); } .flash.ok { color: var(--good); }
.login { max-width: 380px; margin: 14vh auto 0; text-align: center; }
.code { font: 700 26px ui-monospace, Menlo, monospace; letter-spacing: .08em; user-select: all; }
.sel { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.nowrap { white-space: nowrap; }
.roster { padding: 8px 0 4px; }
.cut { display: flex; align-items: center; gap: 10px; margin: 14px 0 8px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.cut::before, .cut::after { content: ""; flex: 1; border-top: 2px dashed var(--line); }
button.danger { color: var(--bad); }
.mono { font-family: ui-monospace, Menlo, monospace; letter-spacing: .04em; }
.heat td, .heat th { padding: 5px 6px; }
.heat-cell { background: color-mix(in srgb, var(--accent) var(--p), transparent); font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 16px; scrollbar-width: thin; }
.tab { border: 0; border-bottom: 3px solid transparent; border-radius: 8px 8px 0 0; background: transparent; color: var(--muted); padding: 10px 14px; white-space: nowrap; }
.tab.on { color: var(--ink); border-bottom-color: var(--accent); }
.tab:hover { color: var(--ink); }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 99px; background: var(--warn); color: #fff; font-size: 12px; text-align: center; }
@media (max-width: 480px) { .tab { padding: 10px 8px; font-size: 13px; } .tabs { gap: 0; } }
.flash.warn { color: var(--warn); }
.login-form { display: grid; gap: 12px; text-align: left; margin-top: 8px; }
.field { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.field input { font-size: 16px; }
button.link { border: 0; background: transparent; color: var(--accent); text-decoration: underline; padding: 4px; }

.warn-select { border-color: var(--warn); color: var(--warn); }

.rot-list { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
a { color: var(--accent); }
.md { max-width: 760px; overflow-wrap: anywhere; }
.md h2 { font-size: 20px; margin: 0 0 12px; } .md h3 { font-size: 17px; margin: 24px 0 8px; } .md h4, .md h5 { font-size: 15px; margin: 18px 0 6px; }
.md p, .md ul, .md ol, .md pre, .md blockquote, .md .table-scroll { margin: 0 0 12px; }
.md li { margin: 3px 0; }
.md code { font: 13px ui-monospace, Menlo, monospace; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.md pre { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; overflow-x: auto; }
.md pre code { border: 0; padding: 0; background: none; }
.md blockquote { border-left: 3px solid var(--line); padding-left: 12px; color: var(--muted); }
.md td, .md th { vertical-align: top; }
.wod-search { margin-bottom: 14px; }
.wod-search input { width: 100%; }
.wod-hits { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.wod-hits li { display: flex; align-items: flex-start; gap: 4px; }
.wod-pick { flex: 1; text-align: left; display: grid; gap: 2px; padding: 6px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.wod-pick:hover { border-color: var(--accent); }
.wod-desc { font-size: 13px; font-weight: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.wod-browse { display: grid; gap: 8px; margin-top: 12px; }
.wod-card { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface); }
.wod-text { white-space: pre-wrap; margin-top: 6px; font-size: 14px; }
.escala { display: grid; gap: 4px; min-width: 170px; }
.escala .f { font-size: 12px; }
.members td select { min-width: 112px; }

/* Marca */
h1.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.01em; }
.login h1.brand { justify-content: center; flex-direction: column; gap: 6px; font-size: 26px; }
.brand-mark img { width: 40px; height: 40px; display: block; }
.login .brand-mark img { width: 96px; height: 96px; }
.brand-mark .logo-dark { display: none; }
:root[data-theme="dark"] .brand-mark .logo-light { display: none; }
:root[data-theme="dark"] .brand-mark .logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-mark .logo-light { display: none; }
  :root:not([data-theme="light"]) .brand-mark .logo-dark { display: block; }
}

/* Integrações (TotalPass, Gympass) em Configurações: recolhíveis, com a situação sempre à vista. */
details.integration { border-top: 1px solid var(--line, #e5e5e5); }
details.integration > summary { display: flex; align-items: center; gap: 10px; padding: 14px 0; cursor: pointer; list-style: none; }
details.integration > summary::-webkit-details-marker { display: none; }
details.integration > summary::before { content: "▸"; color: var(--muted, #888); transition: transform .15s; }
details.integration[open] > summary::before { transform: rotate(90deg); }
details.integration .integration-title { font-weight: 700; font-size: 1.05rem; }
details.integration .integration-body { padding: 0 0 16px 20px; }

/* Origem do aluno na lista de check-ins: plano da box, Gympass, TotalPass. */
.pill.src-own { color: #2563eb; } .pill.src-wellhub { color: #c2410c; } .pill.src-totalpass { color: #15803d; }
:root[data-theme="dark"] .pill.src-own { color: #93c5fd; } :root[data-theme="dark"] .pill.src-wellhub { color: #fdba74; } :root[data-theme="dark"] .pill.src-totalpass { color: #86efac; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pill.src-own { color: #93c5fd; } :root:not([data-theme="light"]) .pill.src-wellhub { color: #fdba74; }
  :root:not([data-theme="light"]) .pill.src-totalpass { color: #86efac; }
}

/* Aulas: faixa de dias (passado e futuro), como no app. */
.day-strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: thin; }
.day-strip .day { flex: 0 0 56px; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 0 6px;
  border-radius: 12px; background: var(--bg); font-weight: 500; }
.day-strip .day .wd, .day-strip .day .mo { font-size: 11px; color: var(--muted); }
.day-strip .day .wd { font-weight: 700; }
.day-strip .day .dn { font-size: 20px; font-weight: 700; line-height: 1.2; }
.day-strip .day.past .dn { color: var(--muted); }
.day-strip .day.today { border-color: var(--accent); }
.day-strip .day.on { background: var(--accent); border-color: var(--accent); }
.day-strip .day.on span { color: var(--accent-ink); }
.day-strip .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin-top: 3px; }
.day-strip .day.on .dot { background: var(--accent-ink); }
.day-strip .dot.none { visibility: hidden; }

/* Membros sem rolagem lateral: em tela estreita, cada membro vira um cartão. */
table.members select { min-width: 0; padding: 5px 6px; font-size: 13px; }
table.members { table-layout: fixed; }
@media (max-width: 760px) {
  table.members thead { display: none; }
  table.members, table.members tbody, table.members tr, table.members td { display: block; width: 100%; }
  table.members tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; padding: 10px 0; border-top: 1px solid var(--line); }
  table.members td { border: 0; padding: 0; }
  table.members td.name { grid-column: 1 / -1; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
  table.members td.act { display: none; }
}
@media (min-width: 761px) { table.members td.name .act-inline, table.members .checkins-label { display: none; } }
@media (max-width: 760px) { table.members td.checkins { text-align: left; } }
table.members td.checkins strong { font-size: 16px; }
table.members tr.editing td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
a.button { display: inline-block; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 4px 10px;
  font-size: 13px; font-weight: 600; color: inherit; text-decoration: none; }
a.button.whatsapp { color: #128c4b; border-color: currentColor; }
:root[data-theme="dark"] a.button.whatsapp { color: #4ade80; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) a.button.whatsapp { color: #4ade80; } }

/* Aulas: treino do dia aberto ali mesmo. */
.day-workout { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-bottom: 12px; background: var(--bg); }
.day-workout input, .day-workout select, .day-workout textarea { background: var(--surface); }

/* Treinos: prévia do treino como o aluno vê no app. */
.wod-preview { margin-bottom: 12px; }
.wod-preview-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.wod-preview-card { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; max-width: 420px; }
.wod-preview-title { font-size: 22px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.wod-preview-play { font-size: 18px; color: var(--accent); border: 2px solid currentColor; border-radius: 50%; width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 36px; padding-left: 3px; }
.wod-preview-desc { white-space: pre-wrap; margin-top: 10px; overflow-wrap: anywhere; }
.wod-preview-link { color: var(--accent); font-weight: 600; margin-top: 10px; }
.wod-preview-card { max-width: none; }
@media (min-width: 900px) { .day-workout { display: grid; grid-template-columns: 7fr 5fr; gap: 24px; align-items: start; } }

/* Modal de confirmação. */
dialog.modal { border: 1px solid var(--line); border-radius: 14px; padding: 20px; max-width: min(440px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink); box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
dialog.modal::backdrop { background: rgba(0, 0, 0, .45); }
dialog.modal h2 { margin: 0 0 8px; }
dialog.modal p { margin: 0 0 16px; color: var(--muted); }
button.danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; }
:root[data-theme="dark"] button.danger-solid { color: #121212; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) button.danger-solid { color: #121212; } }
.wod-preview-heading { font-size: 20px; font-weight: 800; margin-bottom: 10px; }
.wod-preview-stack { display: flex; flex-direction: column; gap: 12px; }
.wod-preview-card.editing { border: 2px solid var(--accent); }
.wod-preview-tag { font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.wod-order { display: flex; flex-direction: column; gap: 4px; }
.wod-order button { padding: 1px 8px; line-height: 1.2; }
@media (min-width: 900px) { .s4 { grid-column: span 4; } }
h2.titled { display: flex; align-items: center; gap: 8px; }
.info { position: relative; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid currentColor; font: italic 700 11px/1 Georgia, serif; color: var(--muted, #777); cursor: help; flex: none; }
.info:hover, .info:focus-visible { color: var(--accent, #c81e1e); outline: none; }
.info::after { content: attr(data-tip); position: absolute; left: -8px; top: calc(100% + 8px);
  width: max-content; max-width: min(280px, 75vw); padding: 8px 10px; border-radius: 8px; background: #222; color: #fff;
  font: 400 13px/1.4 system-ui, sans-serif; font-style: normal; text-align: left; white-space: normal; z-index: 20;
  box-shadow: 0 4px 16px rgba(0,0,0,.2); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .12s; }
.info:hover::after, .info:focus-visible::after { opacity: 1; visibility: visible; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.kpi { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.kpi-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi-value { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.kpi-delta { font-size: 13px; font-weight: 700; color: var(--muted); }
.kpi-delta.up { color: var(--good); } .kpi-delta.down { color: var(--bad); }
.kpi-foot { font-size: 12px; color: var(--muted); }
.fillbar { display: flex; align-items: center; gap: 10px; }
.fillbar-track { flex: 1; height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; min-width: 80px; }
.fillbar-bar { height: 100%; border-radius: 999px; background: var(--brand); opacity: .75; }
.fillbar-bar.full { opacity: 1; } .fillbar-bar.low { background: var(--muted); opacity: .5; }

/* Tela do QR do check-in (recepção: tablet ou TV) */
.qr-screen { min-height: 90vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; }
.qr-screen h1 { margin: 0; font-size: clamp(24px, 4vw, 44px); }
.qr-actions { position: fixed; top: 12px; left: 12px; }
.qr-img { width: min(70vh, 86vw); height: auto; background: #fff; border-radius: 16px; padding: 12px; }
.qr-hint { font-size: clamp(18px, 2.6vw, 30px); margin: 8px 0 0; }
@media print { .qr-actions { display: none; } .qr-screen { min-height: auto; } }
/* Cobrança: Pix para reenviar ao aluno */
.pix-box { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.pix-box img { background: #fff; border-radius: 8px; padding: 6px; }
.pix-code { display: block; margin-top: 6px; font-size: 12px; word-break: break-all; padding: 8px; border-radius: 8px; background: var(--soft, rgba(127,127,127,.08)); }
.kpi-value.bad { color: var(--bad); }
.check { display: flex; gap: 8px; align-items: flex-start; } .check input { width: auto; margin-top: 3px; flex: none; }

/* CRM: ficha do aluno e interessados. */
@media (min-width: 900px) { .s8 { grid-column: span 8; } }
.profile h3 { font-size: 14px; margin: 18px 0 8px; }
.profile-grid { display: grid; gap: 8px 32px; }
@media (min-width: 900px) { .profile-grid { grid-template-columns: 5fr 7fr; } }
/* Gráfico de presenças por semana (ficha). Uma série: sem legenda; valores no eixo e na dica. */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wchart { margin: 0; display: grid; grid-template-columns: 22px 1fr; grid-template-rows: 130px auto; column-gap: 6px; }
.wchart-y { position: relative; }
.wchart-y span { position: absolute; right: 0; transform: translateY(50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.wchart-plot { position: relative; border-bottom: 1px solid var(--muted); }
.wchart-grid { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.wchart-avg { position: absolute; left: 0; right: 0; border-top: 1.5px dashed var(--muted); z-index: 1; pointer-events: none; }
.wchart-avg span { position: absolute; right: 0; bottom: 2px; font-size: 11px; color: var(--muted); background: var(--surface); padding: 0 4px; border-radius: 4px; }
.wchart-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--muted); }
.wchart-cols { position: absolute; inset: 0; display: flex; gap: 2px; }
.wchart-col { position: relative; flex: 1; display: flex; align-items: flex-end; justify-content: center; outline: none; border-radius: 4px; }
.wchart-col:hover, .wchart-col:focus-visible { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.wchart-col:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.wchart-bar { width: 70%; max-width: 28px; background: var(--brand); opacity: .55; border-radius: 4px 4px 0 0; }
.wchart-bar.now { opacity: 1; }
.wchart-tip { display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 2; white-space: nowrap;
  background: var(--ink); color: var(--surface); font-size: 12px; padding: 6px 8px; border-radius: 8px; flex-direction: column; gap: 1px; pointer-events: none; }
.wchart-col:first-child .wchart-tip { left: 0; transform: none; }
.wchart-col:last-child .wchart-tip { left: auto; right: 0; transform: none; }
.wchart-col:hover .wchart-tip, .wchart-col:focus-visible .wchart-tip { display: flex; }
.wchart-x { grid-column: 2; display: flex; gap: 2px; padding-top: 4px; }
.wchart-x span { flex: 1; text-align: center; font-size: 11px; color: var(--muted); white-space: nowrap; }
dialog.modal textarea { min-height: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 13px; font-weight: 600; }
.tag button { border: 0; background: transparent; padding: 0 6px; font-size: 15px; line-height: 1; color: var(--muted); cursor: pointer; }
input.tag-input { width: 130px; padding: 4px 8px; font-size: 13px; border-radius: 999px; }
ul.notes { list-style: none; padding: 0; margin: 8px 0 0; }
ul.notes li { border-top: 1px solid var(--line); padding: 8px 0; }
.note-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.note-meta { font-size: 12px; margin-top: 2px; display: flex; align-items: center; }
td.name button.link { padding: 0; font-weight: inherit; text-align: left; }
/* App da box (Configurações): três colunas em tela larga, uma no celular. */
.app-config { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.app-config h3 { font-size: 15px; margin: 0 0 8px; }
/* Tabela que cabe na largura, sem rolagem lateral: títulos quebram linha e os números ficam compactos. */
table.fit { table-layout: auto; }
table.fit th { white-space: normal; }
table.fit td:first-child { overflow-wrap: break-word; }
@media (max-width: 480px) { table.fit th, table.fit td { padding: 7px 4px; } table.fit th { letter-spacing: 0; } }
