:root {
  --bg: #0b0f12; --panel: #11171c; --panel2: #161e24; --panel3: #1c252c; --line: #233039; --line2: #2d3b45;
  --text: #e9eff3; --muted: #8b9ba7; --dim: #5f6f7b;
  --teal: #2ec4c9; --teal-d: #1e8f93; --orange: #f07a2e; --red: #ef5b5b; --green: #3fca7f; --yellow: #f2c94c;
  --run: #2ec4c9; --bike: #f07a2e; --swim: #4d8df7; --strength: #a879f0; --crossfit: #e8505b; --hyrox: #d4e04a; --other: #8b9ba7; --race: #f2c94c; --note: #6b7a86;
  --radius: 10px; --shadow: 0 8px 30px rgba(0,0,0,.35);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-h: 'Montserrat', var(--font);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-h); margin: 0 0 .6em; letter-spacing: .01em; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; } h4 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.boot { display: grid; place-items: center; height: 100vh; } .boot img { width: 160px; opacity: .8; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { display: block; padding: 4px 6px 16px; }
.side .brand img { width: 100%; max-width: 190px; display: block; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.nav a:hover { background: var(--panel2); color: var(--text); text-decoration: none; }
.nav a.on { background: rgba(46,196,201,.12); color: var(--teal); }
.nav .sep { height: 1px; background: var(--line); margin: 10px 4px; }
.nav .label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); padding: 8px 10px 2px; }
.side .me { margin-top: auto; padding: 10px; border-top: 1px solid var(--line); font-size: 13px; }
.side .me .role { color: var(--dim); font-size: 12px; }
.main { padding: 22px 28px 60px; min-width: 0; }
.topbar { display: none; }
.page-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-head .grow { flex: 1; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--teal); border-bottom-color: var(--teal); }

/* ---------- Componentes ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 14px; }
.grid > .card + .card, .grid > .kpi + .kpi { margin-top: 0; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0,1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text); padding: 7px 13px; border-radius: 8px; font: 500 13px var(--font); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--teal-d); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #052224; font-weight: 600; }
.btn.primary:hover { background: #45d3d8; }
.btn.danger { color: var(--red); } .btn.danger:hover { border-color: var(--red); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); } .btn.ghost:hover { color: var(--text); background: var(--panel2); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
input, select, textarea { width: 100%; background: var(--bg); border: 1px solid var(--line2); color: var(--text); border-radius: 8px; padding: 8px 10px; font: 14px var(--font); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(46,196,201,.15); }
input[type=checkbox] { width: auto; accent-color: var(--teal); }
textarea { min-height: 110px; font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 13px; resize: vertical; }
.field { margin-bottom: 12px; }
.fields { display: grid; gap: 0 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-size: 13px; margin: 0 12px 0 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); font-weight: 600; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--panel2); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 500; background: var(--panel3); color: var(--muted); }
.pill.ok { background: rgba(63,202,127,.14); color: var(--green); }
.pill.warn { background: rgba(242,201,76,.14); color: var(--yellow); }
.pill.bad { background: rgba(239,91,91,.14); color: var(--red); }
.pill.info { background: rgba(46,196,201,.14); color: var(--teal); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.empty { text-align: center; padding: 40px 10px; color: var(--muted); }
.notice { padding: 10px 12px; border-radius: 8px; background: rgba(46,196,201,.08); border: 1px solid rgba(46,196,201,.25); color: var(--text); font-size: 13px; }
.notice.warn { background: rgba(242,201,76,.08); border-color: rgba(242,201,76,.3); }
code, .mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12.5px; }
pre.desc { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin: 0; font-size: 12.5px; max-height: 300px; overflow: auto; }

/* KPIs */
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .k { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
.kpi .v { font: 700 28px var(--font-h); margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12px; color: var(--muted); }
.c-ctl { color: var(--teal); } .c-atl { color: #b78cf7; } .c-tsb { color: var(--orange); }
.form-fresh { color: var(--green); } .form-optimal { color: var(--teal); } .form-grey { color: var(--muted); } .form-risk { color: var(--red); } .form-transition { color: var(--yellow); }

/* Dashboard treinador */
.ath-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.ath { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; cursor: pointer; transition: border-color .15s; }
.ath:hover { border-color: var(--teal-d); }
.ath .top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--teal), var(--teal-d)); color: #052224; display: grid; place-items: center; font: 700 13px var(--font-h); flex: none; }
.ath .name { font-weight: 600; }
.ath .mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 8px 0; }
.ath .mini div { background: var(--panel2); border-radius: 8px; padding: 6px 8px; }
.ath .mini b { display: block; font: 700 17px var(--font-h); }
.ath .mini span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.ath .line { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; margin-top: 4px; }

/* Calendário */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-head .title { font: 600 17px var(--font-h); min-width: 170px; text-align: center; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)) 150px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--line); gap: 1px; }
.cal .dow { background: var(--panel2); padding: 7px 8px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.day { background: var(--panel); min-height: 128px; padding: 6px; position: relative; display: flex; flex-direction: column; gap: 4px; cursor: pointer; }
.day:hover { background: #131b21; }
.day.other { background: #0e1317; } .day.other .dnum { color: var(--dim); }
.day.today { box-shadow: inset 0 0 0 2px var(--teal); }
.day.unavail { background-image: repeating-linear-gradient(135deg, rgba(239,91,91,.07) 0 8px, transparent 8px 16px); }
.day.limited { background-image: repeating-linear-gradient(135deg, rgba(242,201,76,.06) 0 8px, transparent 8px 16px); }
.day.drop { background: rgba(46,196,201,.12); }
.dnum { font-size: 12px; font-weight: 600; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.dnum .av { font-size: 10px; font-weight: 600; padding: 1px 5px; border-radius: 4px; }
.dnum .av.no { background: rgba(239,91,91,.18); color: var(--red); }
.dnum .av.lim { background: rgba(242,201,76,.18); color: var(--yellow); }
.dnum .av.cap { color: var(--dim); font-weight: 500; }
select[name=preferred_time] { min-width: 96px; }
.item { border-radius: 6px; padding: 4px 6px 4px 8px; font-size: 12px; line-height: 1.3; background: var(--panel3); border-left: 3px solid var(--other); overflow: hidden; }
.item .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .m { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item.plan { background: transparent; border: 1px dashed var(--line2); border-left: 3px solid var(--other); }
.item.plan.done { opacity: .55; }
.item.act { background: var(--panel3); }
.item[draggable=true] { cursor: grab; }
.item.sync-error .t::after { content: ' ⚠'; color: var(--red); }
.s-run { border-left-color: var(--run) !important; } .s-bike { border-left-color: var(--bike) !important; } .s-swim { border-left-color: var(--swim) !important; }
.s-strength { border-left-color: var(--strength) !important; } .s-crossfit { border-left-color: var(--crossfit) !important; } .s-hyrox { border-left-color: var(--hyrox) !important; } .s-race { border-left-color: var(--race) !important; background: rgba(242,201,76,.08) !important; } .s-note { border-left-color: var(--note) !important; }
.wk { background: var(--panel2); padding: 8px; font-size: 12px; display: flex; flex-direction: column; gap: 4px; }
.wk .r { display: flex; justify-content: space-between; color: var(--muted); }
.wk .r b { color: var(--text); font-weight: 600; }
.wk .bar { height: 5px; background: var(--line); border-radius: 3px; overflow: hidden; }
.wk .bar i { display: block; height: 100%; background: var(--teal); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.agenda { display: none; }
.agenda .aday { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin-bottom: 8px; }
.agenda .aday.today { border-color: var(--teal); }
.agenda .aday h3 { font-size: 13px; display: flex; justify-content: space-between; }

/* Zonas */
.ztable td:first-child { width: 58px; }
.zchip { display: inline-block; min-width: 38px; text-align: center; padding: 2px 6px; border-radius: 5px; font-weight: 700; font-size: 12px; color: #071114; }
.zsec { margin-bottom: 18px; }

/* Modal */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 50; padding: 16px; backdrop-filter: blur(2px); }
.modal { background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; width: min(640px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--shadow); }
.modal.wide { width: min(860px, 100%); }
.modal .mh { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 1; }
.modal .mh h2 { margin: 0; flex: 1; }
.modal .mb { padding: 16px 18px; }
.modal .mf { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; position: sticky; bottom: 0; background: var(--panel); }
#toast-root { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast { background: var(--panel3); border: 1px solid var(--line2); border-left: 3px solid var(--teal); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: 380px; font-size: 13px; }
.toast.err { border-left-color: var(--red); }

/* Login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 80% -10%, rgba(46,196,201,.12), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(240,122,46,.10), transparent 60%), var(--bg); }
.auth .box { width: min(400px, 100%); }
.auth .logo { width: 100%; max-width: 340px; display: block; margin: 0 auto 22px; }
.auth .card { padding: 22px; }
.auth .tag { text-align: center; color: var(--muted); letter-spacing: .3em; font-size: 11px; margin: -10px 0 22px; text-transform: uppercase; }
.err-msg { color: var(--red); font-size: 13px; min-height: 18px; margin-bottom: 8px; }

.chart-box { position: relative; height: 340px; }
.chart-box.sm { height: 220px; }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
  .cal { grid-template-columns: repeat(7, minmax(0,1fr)); }
  .cal .wk, .cal .dow.wkh { display: none; }
  .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 30% 0 0; z-index: 40; transform: translateX(-105%); transition: transform .2s; height: 100vh; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
  .topbar img { height: 30px; }
  .main { padding: 16px 16px 60px; }
  .g2, .g3 { grid-template-columns: 1fr; } .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .kpi .v { font-size: 24px; }
  .cal { display: none; } .agenda { display: block; }
  .chart-box { height: 260px; }
  th, td { padding: 7px 6px; }
  .hide-m { display: none; }
}

/* ---------- Explicações ---------- */
details.why { margin-top: 6px; font-size: 12px; color: var(--muted); }
details.why summary { cursor: pointer; color: var(--teal); list-style: none; display: inline-block; }
details.why summary::-webkit-details-marker { display: none; }
details.why summary::before { content: 'ⓘ '; }
details.why p { margin: 6px 0 0; color: var(--text); line-height: 1.45; }
details.explain > summary { cursor: pointer; list-style: none; }
details.explain > summary::-webkit-details-marker { display: none; }
details.explain > summary::before { content: '▸ '; color: var(--teal); }
details.explain[open] > summary::before { content: '▾ '; }
.explain-body { margin-top: 10px; line-height: 1.55; max-width: 860px; }
.explain-body p, .explain-body ul { margin: 0 0 10px; }
.explain-body li { margin-bottom: 4px; }
.reading p { margin: 0 0 8px; line-height: 1.55; max-width: 860px; }
.formscale { margin: 4px 0 14px; max-width: 860px; }
.formscale .bar { position: relative; display: flex; height: 10px; border-radius: 99px; overflow: hidden; opacity: .9; }
.formscale .bar i { position: absolute; top: -4px; width: 4px; height: 18px; margin-left: -2px; background: var(--text); border-radius: 2px; box-shadow: 0 0 0 2px var(--bg); }
.formscale .bar { overflow: visible; }
.formscale .bar span:first-child { border-radius: 99px 0 0 99px; } .formscale .bar span:last-child { border-radius: 0 99px 99px 0; }
.formscale .lbl { display: flex; font-size: 11px; color: var(--muted); margin-top: 6px; }
.formscale .lbl span { text-align: center; }
@media (max-width: 640px) { .formscale .lbl { font-size: 9.5px; } }

.grid > .kpi { align-self: start; }

/* ---------- v0.2: construtor de treinos ---------- */
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line2); border-radius: 9px; padding: 3px; gap: 2px; margin: 4px 0 12px; flex-wrap: wrap; }
.seg button { background: transparent; border: 0; color: var(--muted); padding: 6px 12px; border-radius: 7px; font: 500 13px var(--font); cursor: pointer; }
.seg button.on { background: var(--panel3); color: var(--teal); }
svg.blocks { display: block; width: 100%; height: 90px; color: var(--muted); }
svg.blocks.mini { height: 14px; margin-top: 4px; border-radius: 2px; background: rgba(255,255,255,.03); }
.bld-chart { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 8px 4px; }
.bld-tot { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 8px 2px 10px; }
.bld-tot b { color: var(--text); }
.bld-list { display: flex; flex-direction: column; gap: 6px; }
.st { display: flex; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.st.nested { background: var(--panel); }
.st-bar { width: 5px; flex: none; }
.st-main { flex: 1; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.st.ro .st-main { flex-direction: row; display: block; font-size: 13px; }
.st-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.st-row select, .st-row input { width: auto; padding: 5px 8px; font-size: 13px; }
.st-row .kind { min-width: 128px; font-weight: 600; }
.st-row .dur { display: inline-flex; align-items: center; gap: 4px; }
.st-row .dur input { width: 82px; }
.st-row .cue { flex: 1; min-width: 140px; }
.st-row .u, .st-row .lbl, .st-row .dash { font-size: 12px; color: var(--dim); }
.st-row .lbl { min-width: 32px; text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px; }
.tg { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tg input:not([type=checkbox]) { width: 70px; }
.tg.none select { color: var(--dim); }
.rmp { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); margin: 0 0 0 4px; }
.acts { display: inline-flex; gap: 2px; margin-left: auto; }
.ib { background: transparent; border: 1px solid transparent; color: var(--muted); border-radius: 6px; width: 28px; height: 28px; cursor: pointer; font-size: 14px; }
.ib:hover { background: var(--panel3); color: var(--text); border-color: var(--line2); }
.ib.del:hover { color: var(--red); }
.rep { border: 1px dashed var(--line2); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 6px; background: rgba(46,196,201,.03); }
.rep-h { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; }
.rep-h input { width: 64px; padding: 5px 8px; }
.bld-add { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.bld-help { margin-top: 10px; font-size: 13px; color: var(--muted); }
.bld-help summary { cursor: pointer; color: var(--teal); }
.bld-help p { margin: 6px 0; line-height: 1.5; }
.item svg.blocks.mini { pointer-events: none; }

/* ---------- v0.2: nutrição ---------- */
.kv { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 13px; margin: 6px 0; }
.kv span { color: var(--muted); }
table.tgt { margin-top: 10px; }
table.tgt td, table.tgt th { padding: 6px 8px; }
table.tgt input { padding: 5px 8px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.dt { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--panel3); }
.dt-rest { color: var(--muted); } .dt-easy { color: #4d8df7; } .dt-moderate { color: var(--teal); } .dt-long { color: var(--orange); } .dt-race { color: var(--yellow); }
select.dtsel { width: auto; padding: 3px 8px; font-size: 12px; font-weight: 600; border-radius: 99px; }
.nweek { display: flex; flex-direction: column; gap: 8px; }
.nday { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--panel2); }
.nday.today { border-color: var(--teal-d); }
.nd-h { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.macros { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; margin-top: 4px; color: var(--muted); }
.macros b { color: var(--text); }
.nday details summary { cursor: pointer; color: var(--teal); margin-top: 4px; }
.meal { font-size: 12.5px; margin-top: 4px; }
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-top: 4px; }
.mcard { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--panel2); }
.mcard h4 { margin-bottom: 6px; }
.mcard ul { margin: 0; padding-left: 18px; font-size: 13px; }
.medit { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 6px; }
.medit .mname { font-weight: 600; max-width: 260px; }
.mrow { display: grid; grid-template-columns: 1fr 90px 72px 30px; gap: 6px; }
.mrow input, .mrow select, .medit input { padding: 6px 8px; }
.medit .mnote { flex: 1; }
.sm-sel { width: auto; padding: 5px 8px; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chips button { border: 1px solid var(--line2); background: var(--panel2); color: var(--muted); border-radius: 99px; padding: 5px 12px; font: 500 12.5px var(--font); cursor: pointer; }
.chips button.on { border-color: var(--teal); color: var(--teal); background: rgba(46,196,201,.1); }
.plist { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 12px; }
.pit { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-bottom: 1px solid var(--line); cursor: pointer; margin: 0; color: var(--text); font-size: 13px; }
.pit:last-child { border-bottom: 0; }
.pit.on { background: rgba(46,196,201,.08); }
.pit input { width: auto; margin-top: 3px; }
.shop-cat { margin-bottom: 10px; }
.shop-cat h4 { margin: 8px 0 4px; }
.shop-it { display: flex; align-items: baseline; gap: 8px; padding: 5px 2px; border-bottom: 1px solid var(--line); margin: 0; font-size: 13.5px; color: var(--text); cursor: pointer; }
.shop-it input { width: auto; }
.shop-it .nm { flex: 1; }
.shop-it .q { text-align: right; font-size: 12.5px; }
.shop-it.done .nm, .shop-it.done .q { text-decoration: line-through; color: var(--dim); }

/* ---------- v0.2: equipamento ---------- */
.ggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.gcard { display: flex; gap: 12px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.gcard.ret { opacity: .6; }
.gi { font-size: 26px; line-height: 1; }
.gb { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.gkm { margin-top: 4px; font-size: 14px; }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; background: var(--teal); }
.bar.warn i { background: var(--yellow); } .bar.bad i { background: var(--red); }

@media (max-width: 640px) {
  .st-row .kind { flex: 1 1 130px; min-width: 130px; }
  .st-row .dur input { width: 70px; }
  .modal .mf { flex-wrap: wrap; }
  .modal .mf .spacer { display: none; }
  .st-row .cue { min-width: 100%; order: 5; }
  .acts { margin-left: 0; }
  .tg input:not([type=checkbox]) { width: 62px; }
  .mrow { grid-template-columns: 1fr 70px 60px 30px; }
  .ggrid { grid-template-columns: 1fr; }
}
@media print {
  body.print-shop * { visibility: hidden; }
  body.print-shop .shop, body.print-shop .shop * { visibility: visible; color: #000 !important; }
  body.print-shop .shop { position: absolute; left: 0; top: 0; width: 100%; border: 0; background: #fff; }
  body.print-shop .shop button { display: none; }
}
.modal.wide { width: min(980px, 100%); }

/* ---------- v0.3: cumprimento, corpo, documentos ---------- */
.seg a { display: inline-block; color: var(--muted); padding: 6px 12px; border-radius: 7px; font: 500 13px var(--font); }
.seg a.on { background: var(--panel3); color: var(--teal); }
.seg a:hover { text-decoration: none; color: var(--text); }
.kpi .v.ok, b.ok { color: var(--green); } .kpi .v.warn, b.warn { color: var(--yellow); } .kpi .v.bad, b.bad { color: var(--red); }
.kpi .v small { font-size: 14px; color: var(--muted); font-weight: 600; margin-left: 2px; }
.cbar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; gap: 2px; margin: 6px 0 10px; }
.clegend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.clegend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.cpill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); white-space: nowrap; }
.ctab td { vertical-align: top; }
.cbadge { float: right; margin-left: 4px; font-size: 10.5px; font-weight: 700; color: var(--c); background: color-mix(in srgb, var(--c) 18%, transparent); border-radius: 99px; padding: 0 5px; line-height: 16px; }
.dlt { font-size: 12px; color: var(--muted); font-weight: 600; } .dlt.good { color: var(--green); } .dlt.bad { color: var(--red); }
.hint { padding: 5px 0 5px 12px; border-left: 3px solid var(--line2); margin-bottom: 6px; font-size: 13.5px; }
.hint.ok { border-color: var(--green); } .hint.warn { border-color: var(--yellow); } .hint.bad { border-color: var(--red); }
table.bct td { padding: 6px 12px; } table.bct tr.gh td { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); font-weight: 600; padding-top: 12px; background: var(--panel2); }
.segmap { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.segmap .sg { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.segmap .sg span { font-size: 11.5px; color: var(--muted); } .segmap .sg em { font-style: normal; font-size: 12.5px; color: var(--teal); }
details.bcg { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-top: 8px; }
details.bcg summary { cursor: pointer; font-weight: 600; color: var(--teal); }
details.bcg[open] summary { margin-bottom: 8px; }
table.segin { width: auto; } table.segin td, table.segin th { padding: 4px 6px; } table.segin input { width: 88px; padding: 5px 8px; }
.doc { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.doc:first-of-type { border-top: 0; }
.doc-main { flex: 1; min-width: 200px; }
.doc-side { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.notice.warn { background: rgba(242,201,76,.08); border-color: rgba(242,201,76,.3); }
@media (max-width: 640px) { .segmap { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; } .segmap .sg { padding: 6px; } table.segin input { width: 64px; } }

/* ---------- v0.3: fundos com fotografias ---------- */
body.has-bg::before { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgba(11,15,18,.80), rgba(11,15,18,.93) 45%, rgba(11,15,18,.96)), var(--page-bg) center / cover no-repeat; }
body.has-bg .main .card, body.has-bg .main .kpi, body.has-bg .main .ath, body.has-bg .main .cal, body.has-bg .main .aday { background: rgba(17,23,28,.95); }
.page-head.hero { position: relative; min-height: 132px; padding: 22px; border-radius: 14px; border: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(11,15,18,.94) 0%, rgba(11,15,18,.70) 45%, rgba(11,15,18,.15) 100%), var(--hero) center 40% / cover no-repeat; align-content: flex-end; }
.page-head.hero h1 { font-size: 26px; text-shadow: 0 2px 12px rgba(0,0,0,.5); }
.auth.photo { background: linear-gradient(180deg, rgba(11,15,18,.45), rgba(11,15,18,.88)), var(--hero) center / cover no-repeat; }
.auth.photo .card { background: rgba(17,23,28,.88); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.auth.photo .tag { color: #dfe7ec; text-shadow: 0 1px 8px rgba(0,0,0,.6); }
.bgthumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.bgt { position: relative; width: 132px; height: 80px; border-radius: 8px; background: var(--panel2) center / cover; border: 1px solid var(--line); }
.bgt span { position: absolute; left: 6px; bottom: 4px; font-size: 10.5px; background: rgba(0,0,0,.6); padding: 0 5px; border-radius: 4px; }
.bgt .ib { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,.6); }
.bgt.add { display: grid; place-items: center; color: var(--teal); cursor: pointer; border-style: dashed; margin: 0; font-size: 13px; }
@media (max-width: 640px) { .page-head.hero { min-height: 110px; padding: 16px; } .page-head.hero h1 { font-size: 21px; } }

/* ---------- v0.4: onboarding, provas, marcas ---------- */
.steps { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; }
.steps button { display: inline-flex; align-items: center; gap: 6px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); border-radius: 99px; padding: 5px 12px 5px 6px; font: 500 12.5px var(--font); cursor: pointer; }
.steps button i { font-style: normal; width: 20px; height: 20px; border-radius: 50%; background: var(--panel3); display: grid; place-items: center; font-size: 11px; }
.steps button.on { border-color: var(--teal); color: var(--teal); } .steps button.on i { background: var(--teal); color: #052224; }
.shoe-row { display: grid; grid-template-columns: 1.6fr 1fr 1.4fr 80px 30px; gap: 6px; margin-bottom: 6px; }
.shoe-row select, .shoe-row input { padding: 6px 8px; }
.mini-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; background: var(--panel2); flex-wrap: wrap; }
ul.ckl { list-style: none; padding: 0; margin: 4px 0; } ul.ckl li { padding: 4px 0; color: var(--muted); } ul.ckl li.ok { color: var(--text); } ul.ckl li.ok::first-letter { color: var(--green); }
.kvl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; font-size: 13px; }
.kvl > div { display: flex; flex-direction: column; } .kvl span { color: var(--dim); font-size: 11.5px; } .kvl .full { grid-column: 1 / -1; }
.prio { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 6px; font-size: 11.5px; font-weight: 800; color: #0b0f12; background: var(--c); }
.prios { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.prio-opt { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; cursor: pointer; margin: 0; color: var(--text); font-size: 13px; }
.prio-opt input { width: auto; margin-top: 3px; } .prio-opt span { display: flex; flex-direction: column; gap: 2px; } .prio-opt small { color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.prio-opt:has(input:checked) { border-color: var(--teal); background: rgba(46,196,201,.07); }
.races { display: flex; flex-direction: column; gap: 8px; }
.race { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 10px; padding: 10px 12px; background: var(--panel2); cursor: pointer; }
.race .rd { display: flex; flex-direction: column; align-items: center; min-width: 46px; } .race .rd b { font: 700 22px var(--font-h); line-height: 1; } .race .rd span { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.race .rb { flex: 1; min-width: 0; } .race .rt { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.race .rc { display: flex; flex-direction: column; align-items: flex-end; white-space: nowrap; }
.catlist { max-height: 560px; overflow: auto; margin: 8px 0; border: 1px solid var(--line); border-radius: 8px; }
.crow { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.crow:last-child { border-bottom: 0; } .crow.mine { background: rgba(63,202,127,.06); }
.crow .cdate { font-size: 12px; color: var(--teal); font-weight: 600; min-width: 42px; } .crow .cname { flex: 1; min-width: 0; font-size: 13.5px; }
.item.plan.s-race { border-style: solid; }
@media (max-width: 640px) {
  .shoe-row { grid-template-columns: 1fr 1fr; } .shoe-row [data-k="role"] { grid-column: 1 / -1; }
  .prios { grid-template-columns: 1fr; } .kvl { grid-template-columns: 1fr; }
}

/* v0.5 — escolha de modalidades */
.sp-pick { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 6px 0; }
.sp-pick .chk { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; white-space: nowrap; cursor: pointer; }
.sp-pick .chk input { width: auto; margin: 0; }

/* v0.6 — convites / ficha preenchida pelo atleta */
.auth .box.wide { width: min(980px, 100%); }
.inv-page { place-items: start center; padding-top: 40px; }
.inv-intro { margin-bottom: 14px; }
.inv-intro ul { margin: 8px 0 0; padding-left: 18px; }
.inv-form { position: static; max-width: none; width: 100%; max-height: none; margin: 0; box-shadow: none; }
.inv-form .mb { max-height: none; overflow: visible; }
.auth.photo .inv-form { background: rgba(17,23,28,.92); backdrop-filter: blur(6px); }
.consent { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; line-height: 1.45; }
.consent input { width: auto; margin-top: 3px; flex: none; }
.inv-t td { vertical-align: middle; } .inv-t td.right { text-align: right; white-space: nowrap; }
.row.wrap { flex-wrap: wrap; }
@media (max-width: 700px) {
  .inv-page { padding: 16px 10px; } .inv-t td.right { white-space: normal; }
  .page-head #inv-ath { order: 9; }
}
