/* estrutura.css — onde cada coisa fica. Texto em rem: um número (html font-size) controla o app todo. */
* { box-sizing: border-box; }
html { font-size: 17.6px; }
body { margin: 0; line-height: 1.45; min-height: 100vh; }
button, input, select { font: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.2; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0; }

.layout { display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 1.1rem .8rem; display: flex; flex-direction: column; gap: 1.2rem; }
.brand { display: flex; align-items: center; gap: .6rem; padding: .2rem .5rem; }
.brand-name { font-size: 1.1rem; }
.nav { display: flex; flex-direction: column; gap: .2rem; }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .55rem .7rem; text-decoration: none; font-size: .95rem; }
.nav .group { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; padding: .8rem .7rem .2rem; opacity: .6; }
.tag-soon { font-size: .62rem; padding: .05rem .4rem; white-space: nowrap; }
.sidebar .spacer { flex: 1; }
.sign { font-size: .5rem; padding: 0 .6rem; }

.main { min-width: 0; padding: 1.6rem 2rem 4rem; max-width: 74rem; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.page-head .sub { margin-top: .3rem; font-size: .9rem; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.card { padding: 1.1rem 1.2rem; }
.card h2 { margin-bottom: .7rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: 1rem; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; }

.btn { padding: .5rem .9rem; font-size: .9rem; }
.btn.sm { padding: .3rem .6rem; font-size: .8rem; }
.tabs { display: flex; gap: .4rem; border-bottom: 1px solid var(--va-line); margin-bottom: 1.1rem; flex-wrap: wrap; }
.tabs button { padding: .6rem .9rem; border: 0; font-size: .95rem; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .8rem; }
.kpi { padding: .8rem 1rem; }
.kpi .k { font-size: .62rem; }
.kpi .v { font-size: 1.3rem; font-weight: 600; margin-top: .15rem; }
.kpi .s { font-size: .75rem; margin-top: .1rem; }

form.f { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .8rem 1rem; align-items: end; }
label.fld { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; }
label.fld .lab { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
label.fld input, label.fld select { padding: .5rem .65rem; width: 100%; font-size: .95rem; }
label.fld .hint { font-size: .72rem; }
.f .full { grid-column: 1 / -1; }

.race { display: flex; flex-direction: column; gap: .7rem; cursor: pointer; }
.race .top { display: flex; align-items: center; gap: .6rem; }
.race .name { font-weight: 600; font-size: 1.05rem; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.prio { font-size: .75rem; font-weight: 700; padding: .1rem .5rem; }
.badge-ex { font-size: .62rem; padding: .05rem .4rem; }
.race .meta { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .85rem; }
.race .meta b { font-weight: 600; }
.race .acts { display: flex; gap: .5rem; justify-content: flex-end; }

.tbl { width: 100%; border-collapse: collapse; font-size: .85rem; }
.tbl th { text-align: left; font-weight: 500; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; padding: .45rem .6rem; white-space: nowrap; }
.tbl td { padding: .55rem .6rem; vertical-align: top; }
.tbl .r { text-align: right; }
.tbl-wrap { overflow-x: auto; }
.pill { display: inline-block; font-size: .7rem; padding: .05rem .5rem; white-space: nowrap; }

.warn, .err, .info { padding: .7rem .9rem; font-size: .85rem; }

.chart-wrap { position: relative; }
.chart { width: 100%; height: auto; display: block; touch-action: pan-y; }
.chart .line { stroke-width: 1.5; }
.chart .axis, .chart .grid, .chart .stop-line, .chart .cursor { stroke-width: 1; }
.chart .stop-line { stroke-dasharray: 3 4; }
.chart .stop circle { stroke-width: 2; }
.chart .stop text { font-size: 9px; text-anchor: middle; dominant-baseline: central; }
.chart text { font-size: 11px; }
.tip { position: absolute; pointer-events: none; padding: .35rem .6rem; font-size: .75rem; white-space: nowrap; display: none; z-index: 5; }
.legend { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .75rem; margin-top: .6rem; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.sw { width: .8rem; height: .8rem; display: inline-block; }

.empty { text-align: center; padding: 2.4rem 1rem; }
.empty h2 { margin-bottom: .4rem; }
.empty p { max-width: 34rem; margin: 0 auto 1rem; }

.conn { display: flex; flex-direction: column; gap: .7rem; }
.conn .head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.conn ul { margin: 0; padding-left: 1.1rem; font-size: .85rem; }
.conn li { margin: .15rem 0; }

details { font-size: .9rem; }
details summary { cursor: pointer; padding: .3rem 0; }

.toast { position: fixed; right: 1rem; bottom: 1rem; padding: .7rem 1rem; font-size: .85rem; z-index: 50; max-width: 24rem; }
.hide { display: none !important; }

@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: .7rem; gap: .5rem; border-right: 0; border-bottom: 1px solid var(--va-line); }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav .group, .sidebar .spacer, .sign { display: none; }
  .main { padding: 1.1rem 1rem 3rem; }
}

/* Hoje / Treinos */
.hoje-score { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
.score { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 7rem; height: 7rem; border-radius: 50%; border: 3px solid var(--va-line2); }
.score .num { font-size: 2.4rem; font-weight: 700; line-height: 1; }
.score .muted { font-size: .7rem; }
.wk-t { font-weight: 600; }
.why { margin: .4rem 0 0; padding-left: 1.1rem; }
.why li { margin: .15rem 0; }
.sugg { padding: .8rem 1rem; }
.sugg .k { font-size: .62rem; text-transform: uppercase; letter-spacing: .08em; }
.chart .hrv-line { stroke-width: 1.5; }
.sw.band-sw { width: .8rem; height: .8rem; display: inline-block; }
.row > label.fld { flex: 1 1 9rem; width: auto; }

.steps { margin: .3rem 0 0; padding-left: 1.2rem; font-size: .85rem; }
.steps li { margin: .25rem 0; }

.bar { height: .55rem; border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 999px; }
.race-wk td { font-weight: 600; }

.fb-k { font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; margin-bottom: .2rem; }
.tbl input[data-ef] { width: 100%; min-width: 7rem; padding: .3rem .5rem; font-size: .85rem; }
