:root {
  color-scheme: light;
  --bm-idle: #dfe2e8;
  --bm-body: #eef0f3;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f0f1f4;
  --border: #e2e4e9;
  --text: #191919;
  --text-2: #666666;
  --accent: #257de0;
  --accent-ink: #ffffff;
  --grid: #e9eaee;
  --s1: #257de0; --s2: #f47230; --s3: #00b894; --s4: #f2a600;
  --s5: #ee7fac; --s6: #008a17; --s7: #6a4ce2; --s8: #ec4647;
  --good: #0aac23; --warning: #fbb315; --serious: #f18a59; --critical: #dc3c3d;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111111; --surface: #191919; --surface-2: #222222; --border: #2e2e2e;
    --text: #efefef; --text-2: #9c9c9c; --accent: #338ced; --grid: #2a2a2a;
    --s1: #338ced; --s2: #e76624; --s3: #00a888; --s4: #d28e05;
    --s5: #e24d8b; --s6: #0aac23; --s7: #9887ef; --s8: #eb6263;
    --bm-idle: #33363c; --bm-body: #26282c;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bm-idle: #33363c; --bm-body: #26282c;
  --bg: #111111; --surface: #191919; --surface-2: #222222; --border: #2e2e2e;
  --text: #efefef; --text-2: #9c9c9c; --accent: #338ced; --grid: #2a2a2a;
  --s1: #338ced; --s2: #e76624; --s3: #00a888; --s4: #d28e05;
  --s5: #e24d8b; --s6: #0aac23; --s7: #9887ef; --s8: #eb6263;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 1.5rem; margin: 0 0 4px; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
h3 { font-size: 1rem; margin: 16px 0 8px; }
.muted { color: var(--text-2); }
.small { font-size: .85rem; }

.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; gap: 16px; align-items: center;
  padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.brand { font-weight: 700; white-space: nowrap; }
#nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
#nav a { color: var(--text-2); padding: 6px 8px; border-radius: 8px; font-size: .9rem; white-space: nowrap; }
#nav a.active, #nav a:hover { color: var(--text); background: var(--surface-2); }
.top-actions { display: flex; gap: 6px; }

main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; min-width: 0; }
.card + .card { margin-top: 0; }
.stack > * + * { margin-top: 16px; }

.stat .label { color: var(--text-2); font-size: .82rem; }
.stat .value { font-size: 1.7rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--text-2); font-size: .82rem; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--surface-2); color: var(--text); }
.badge .dot { width: 8px; height: 8px; border-radius: 50%; }
.st-verde .dot { background: var(--good); }
.st-amarelo .dot { background: var(--warning); }
.st-vermelho .dot { background: var(--critical); }
.st-sem_dados .dot { background: var(--text-2); }

.score-ring { display: flex; align-items: center; gap: 16px; }
.score-ring .num { font-size: 3rem; font-weight: 800; font-variant-numeric: tabular-nums; }

.btn {
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  padding: 7px 14px; border-radius: 9px; cursor: pointer; font: inherit; font-size: .9rem; font-weight: 600;
}
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn.small { padding: 4px 10px; font-size: .82rem; }
.btn.danger { background: transparent; color: var(--critical); border-color: var(--critical); }
.btn:disabled { opacity: .55; cursor: progress; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 9px; width: 100%;
}
textarea { min-height: 70px; resize: vertical; }
label { display: block; font-size: .82rem; color: var(--text-2); margin-bottom: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }

table { width: 100%; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-2); font-weight: 600; font-size: .8rem; }
tr.click { cursor: pointer; }
tr.click:hover { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }

.report { line-height: 1.6; }
.report h2 { font-size: 1.05rem; margin: 18px 0 6px; }
.report h3 { font-size: .98rem; }
.report table { margin: 8px 0; }
.report ul { padding-left: 20px; }

.chart-box { position: relative; height: 240px; }
.chart-box.tall { height: 300px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--text-2); margin-bottom: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

.flags { margin: 8px 0 0; padding-left: 18px; }
.flags li { margin: 2px 0; }

.plan-day { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--surface-2); }
.week { border-left: 3px solid var(--accent); padding-left: 12px; margin: 14px 0; }
.session-pill { display: grid; grid-template-columns: 46px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.session-pill:last-child { border: 0; }
.wd { font-weight: 700; text-transform: uppercase; color: var(--text-2); font-size: .8rem; }

.chat { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow-y: auto; padding: 4px; }
.msg { padding: 10px 14px; border-radius: 12px; max-width: 85%; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); }
.msg.assistant { align-self: flex-start; background: var(--surface-2); }
.coach-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.coach-tabs .btn.ghost.on { border-color: var(--accent); color: var(--accent); }

.set-row { display: grid; grid-template-columns: 1fr 70px 80px 70px 34px; gap: 6px; align-items: center; margin: 4px 0; }
.set-row input { padding: 5px 7px; }
.ex-block { border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin: 8px 0; }

.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast { position: fixed; bottom: 20px; right: 20px; max-width: 420px; background: var(--text); color: var(--surface); padding: 12px 16px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.25); z-index: 100; }
.toast.hidden { display: none; }
.empty { text-align: center; padding: 28px; color: var(--text-2); }

@media (max-width: 640px) {
  .topbar { padding: 8px 16px; gap: 8px; }
  .brand { flex: 1; }
  #nav { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  #nav a { white-space: nowrap; }
  main { padding: 16px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .set-row { grid-template-columns: 1fr 56px 64px 56px 30px; }
}

/* veredito do treino da assessoria */
.verdict { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border-radius: 999px; font-weight: 700; background: var(--surface-2); }
.verdict .dot { width: 10px; height: 10px; border-radius: 50%; }
.v-manter .dot { background: var(--good); }
.v-ajustar .dot { background: var(--warning); }
.v-substituir .dot { background: var(--serious); }
.v-descansar .dot { background: var(--critical); }
.verdict-card { border-left: 4px solid var(--border); }
.verdict-card.v-manter { border-left-color: var(--good); }
.verdict-card.v-ajustar { border-left-color: var(--warning); }
.verdict-card.v-substituir { border-left-color: var(--serious); }
.verdict-card.v-descansar { border-left-color: var(--critical); }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compare > div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.compare dt { font-size: .78rem; color: var(--text-2); margin-top: 6px; }
.compare dd { margin: 0; }
.drop { border: 2px dashed var(--border); border-radius: 12px; padding: 14px; text-align: center; color: var(--text-2); cursor: pointer; }
.drop.has { border-color: var(--accent); color: var(--text); }
@media (max-width: 640px) { .compare { grid-template-columns: 1fr; } }

/* chat flutuante */
#chatw { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.chatw-fab { border-radius: 999px; padding: 10px 16px; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.chatw-panel { width: min(420px, calc(100vw - 32px)); height: min(560px, calc(100vh - 120px)); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 12px 32px rgba(0,0,0,.22); order: -1; }
.chatw-panel.hidden { display: none; }
.chatw-panel .chat { flex: 1; max-height: none; }
.chatw-panel .msg { max-width: 92%; font-size: .9rem; }

/* janela (modal) e prévia do treino no relógio */
#modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { position: relative; background: var(--surface); color: var(--text); border-radius: 16px; padding: 18px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: 0 16px 40px rgba(0,0,0,.3); }
.modal-x { position: absolute; top: 12px; right: 12px; }
.watch-steps { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.watch-block { display: flex; gap: 10px; align-items: stretch; background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.watch-rep { font-weight: 800; color: var(--accent); min-width: 34px; display: flex; align-items: center; border-right: 2px solid var(--accent); padding-right: 8px; }
.watch-step { padding: 2px 0; font-variant-numeric: tabular-nums; }

#nav-settings.on, #nav-profile.on, #nav-body.on { border-color: var(--accent); }

/* mapa do corpo */
.bodymap { max-width: 100%; height: auto; display: block; }
.bodymap .bm-body { fill: var(--bm-body); }
.bodymap .bm-r { stroke: var(--surface); stroke-width: 1.2; }
.bodymap .bm-label { fill: var(--text-2); font-size: 12px; }

/* musculação: bloco, exercícios e ficha */
.ex-media { border-radius: 10px; overflow: hidden; background: var(--surface-2); display: block; object-fit: cover; }
.ex-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ex-media.sm { width: 64px; height: 48px; flex: none; }
.ex-media.md { width: 128px; height: 96px; flex: none; }
.ex-media.lg { width: 100%; aspect-ratio: 4 / 3; }
.empty-media { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--text-2); font-size: .75rem; padding: 4px; }
.ex-modal-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 14px; margin: 12px 0; align-items: start; }
.swap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 8px; }
.swap-item { border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 4px; cursor: pointer; color: var(--text); font: inherit; font-size: .75rem; text-align: left; }
.swap-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; display: block; }
.block-grid td, .block-grid th { text-align: center; }
.block-grid td:first-child, .block-grid th:first-child { text-align: left; }
.block-grid .cur { background: var(--surface-2); }
.cell-done { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; align-items: center; justify-content: center; background: var(--good); color: #fff; font-weight: 800; }
.ex-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.ex-row { display: flex; gap: 10px; align-items: center; text-align: left; background: var(--surface-2); border: 1px solid transparent; border-radius: 12px; padding: 6px; cursor: pointer; color: var(--text); font: inherit; width: 100%; }
.ex-row:hover { border-color: var(--border); }
.ex-row-txt { min-width: 0; }
.ficha-head { position: sticky; top: 58px; z-index: 5; margin-bottom: 12px; }
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress > div { height: 100%; background: var(--good); transition: width .3s; }
.ex-card-top { display: flex; gap: 12px; align-items: flex-start; }
.ex-media-btn { border: 0; padding: 0; background: none; cursor: pointer; border-radius: 10px; }
.ex-mini { margin-top: 6px; }
.ex-mini .bodymap { width: 120px; }
.cues { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 8px 0 4px; font-size: .85rem; }
.set-head, .set-line { display: grid; grid-template-columns: 44px 1fr 64px 76px 56px; gap: 6px; align-items: center; }
.set-head { margin-top: 10px; }
.set-line { padding: 6px 0; border-top: 1px solid var(--border); }
.set-line input { padding: 8px 6px; text-align: center; font-size: 1rem; }
.set-check { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface); color: #fff; font-size: 1.2rem; font-weight: 800; cursor: pointer; }
.set-line.done .set-check { background: var(--good); border-color: var(--good); }
.set-line.done input { background: transparent; }
.set-n { font-weight: 700; }
#restbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; z-index: 150; width: min(460px, calc(100vw - 32px)); background: var(--text); color: var(--surface); border-radius: 16px; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
#restbar.go { background: var(--good); color: #fff; }
#restbar .btn.ghost { color: inherit; border-color: currentColor; }
.rest-num { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
@media (max-width: 640px) {
  .ex-modal-grid { grid-template-columns: 1fr; }
  .ex-media.md { width: 104px; height: 78px; }
  .set-head, .set-line { grid-template-columns: 44px 1fr 56px 68px 50px; }
  .topbar { position: static; }
  .ficha-head { top: 0; padding: 10px 14px; }
  .ficha-head h1 { font-size: 1.15rem; }
  .set-n .small { display: block; font-size: .7rem; }
}
body:has(#restbar) #chatw { display: none; }
body:has(.ficha-head) #chatw .chatw-fab { display: none; }

/* água e proteína */
.meter-track { position: relative; height: 12px; background: var(--surface-2); border-radius: 99px; margin: 6px 0 4px; overflow: visible; }
.meter-fill { height: 100%; border-radius: 99px; transition: width .3s; }
.meter-mark { position: absolute; top: -3px; width: 2px; height: 18px; background: var(--text-2); border-radius: 2px; }
.quick { margin-top: 12px; }
.quick .row { gap: 6px; }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; margin-top: 8px; }
.preset { display: flex; gap: 4px; align-items: stretch; }
.preset-add { flex: 1; text-align: left; display: flex; flex-direction: column; gap: 2px; background: var(--surface-2); border: 1px solid transparent; border-radius: 10px; padding: 8px 10px; cursor: pointer; color: var(--text); font: inherit; }
.preset-add:hover { border-color: var(--border); }

.plan-list { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.plan-item { display: grid; grid-template-columns: 52px 1fr 36px; gap: 8px; align-items: center; background: var(--surface-2); border-radius: 10px; padding: 6px 8px; font-size: .9rem; }
.plan-time { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-2); }

/* triathlon */
.tri-session { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.tri-dl { display: grid; grid-template-columns: 110px 1fr; gap: 2px 10px; margin: 6px 0; font-size: .88rem; }
.tri-dl dt { color: var(--text-2); }
.tri-dl dd { margin: 0; }
.swim-card h2 { font-size: 1.4rem; }
.swim-row { display: grid; grid-template-columns: 130px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 1.15rem; }
.swim-k { font-weight: 700; color: var(--text-2); }
@media print {
  body * { visibility: hidden; }
  #modal, #modal * { visibility: visible; }
  #modal { position: absolute; inset: 0; background: #fff; display: block; padding: 0; }
  .modal-box { box-shadow: none; width: 100%; max-height: none; color: #000; background: #fff; }
  .modal-x, .no-print { display: none !important; }
}
@media (max-width: 640px) { .tri-dl, .swim-row { grid-template-columns: 1fr; } }

.env { display: inline-block; font-size: .75rem; font-weight: 700; padding: 1px 8px; border-radius: 99px; margin-top: 2px; }
.env-in { background: var(--surface); border: 1px solid var(--s7); color: var(--text); }
.env-out { background: var(--surface); border: 1px solid var(--s6); color: var(--text); }
.tip-indoor { background: var(--surface); border-radius: 8px; padding: 6px 8px; margin: 6px 0; }

/* login */
body.logged-out .topbar #nav, body.logged-out .top-actions, body.logged-out #chatw { display: none !important; }
.login-wrap { min-height: 70vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: min(400px, 100%); }
.secret-key { font-family: ui-monospace, monospace; font-size: 1.1rem; letter-spacing: .08em; background: var(--surface-2); padding: 8px 10px; border-radius: 8px; margin: 6px 0; word-break: break-all; }

/* composição corporal */
.modal-box.wide { width: min(820px, 100%); }
.unreadable input, td.unreadable input { border-color: var(--warning); background: var(--surface); }
.unreadable label { color: var(--text); }
.seg-table input { min-width: 70px; padding: 6px; }

@media (max-width: 1360px) and (min-width: 641px) { .brand-name { display: none; } }

/* =====================================================================
   VISUAL DE APP NO CELULAR (estilo iOS) — só em telas estreitas
   ===================================================================== */
#tabbar, #mnav, #ptr { display: none; }
.ic { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

@media (max-width: 760px) {
  :root { --bg: #f2f2f7; --tab-h: 50px; --nav-h: 44px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px); }
  :root:not([data-theme="light"]) { }
  body { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif; -webkit-tap-highlight-color: transparent;
         padding-bottom: calc(var(--tab-h) + var(--safe-b) + 16px); overscroll-behavior-y: none; }
  .topbar, #chatw { display: none !important; }
  main { padding: 8px 16px 24px; }
  .card { border: 0; border-radius: 14px; }
  .btn { min-height: 40px; border-radius: 12px; }
  .btn.small { min-height: 34px; }
  a, button, .list-row, .app-tile { touch-action: manipulation; }
  .btn:active, .app-tile:active, .list-row:active, .hub-icon:active, .pill:active, .ex-row:active, .card a:active { transform: scale(.97); opacity: .85; transition: transform .08s; }

  /* barra superior: voltar + título pequeno que aparece ao rolar */
  #mnav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; position: sticky; top: 0; z-index: 40;
          height: calc(var(--nav-h) + var(--safe-t)); padding: var(--safe-t) 8px 0;
          background: color-mix(in srgb, var(--bg) 82%, transparent); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
          border-bottom: .5px solid transparent; transition: border-color .2s; }
  body.scrolled #mnav { border-bottom-color: var(--border); }
  .mnav-title { font-weight: 600; font-size: 1.0625rem; opacity: 0; transition: opacity .2s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55vw; }
  body.scrolled .mnav-title, body:not(.is-root) .mnav-title { opacity: 1; }
  .mnav-back { justify-self: start; display: flex; align-items: center; gap: 0; background: none; border: 0; color: var(--accent); font: inherit; font-size: 1.0625rem; padding: 8px 4px; cursor: pointer; }
  .mnav-back .ic { width: 26px; height: 26px; stroke-width: 2.4; }
  body.is-root .mnav-back { visibility: hidden; }
  .mnav-actions { justify-self: end; }
  .mnav-btn { background: none; border: 0; color: var(--accent); padding: 8px; cursor: pointer; }

  /* barra de abas */
  #tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
            height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
            background: color-mix(in srgb, var(--surface) 85%, transparent); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
            border-top: .5px solid var(--border); }
  #tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--text-2); font-size: .66rem; font-weight: 500; }
  #tabbar a .ic { width: 26px; height: 26px; }
  #tabbar a.active { color: var(--accent); }
  #tabbar a.active .ic { stroke-width: 2.2; }
  body.logged-out #tabbar, body.logged-out #mnav { display: none; }

  /* títulos grandes */
  .large-title { margin: 4px 0 14px; }
  .large-title h1, .page-head h1 { font-size: 2.125rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
  .page-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .page-head > .row, .page-head > .btn, .page-head > a.btn, .page-head > label.btn { width: 100%; justify-content: center; }
  .section-title { font-size: 1.25rem; font-weight: 700; margin: 22px 0 10px; }
  h2 { font-size: 1.125rem; }

  /* transições entre telas */
  #view.anim-in[data-anim="push"] { animation: ios-push .32s cubic-bezier(.2, .8, .2, 1); }
  #view.anim-in[data-anim="pop"] { animation: ios-pop .32s cubic-bezier(.2, .8, .2, 1); }
  #view.anim-in[data-anim="fade"] { animation: ios-fade .22s ease-out; }

  /* Hoje */
  .today-hero { display: flex; align-items: center; gap: 14px; color: var(--text); }
  .today-hero-txt { flex: 1; min-width: 0; }
  .today-hero-txt p { margin: 6px 0; font-size: .92rem; }
  .mini-stats { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .8rem; color: var(--text-2); }
  .mini-stats span { display: inline-flex; align-items: center; gap: 3px; }
  .mini-stats .ic { width: 14px; height: 14px; }
  .hint { font-size: .82rem; color: var(--text-2); margin: 10px 4px 0; }
  .ring { position: relative; display: flex; flex-direction: column; align-items: center; flex: none; }
  .ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 10; }
  .ring-fg { fill: none; stroke-width: 10; stroke-linecap: round; transition: stroke-dasharray .6s ease; }
  .ring-val { position: absolute; top: 0; height: calc(100% - 18px); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .85rem; line-height: 1.05; text-align: center; padding: 0 8px; font-variant-numeric: tabular-nums; }
  .ring-label { font-size: .75rem; color: var(--text-2); margin-top: 2px; }
  .rings-row { display: flex; justify-content: space-around; color: var(--text); }
  .quick-row { display: flex; gap: 8px; overflow-x: auto; margin-top: 12px; padding-bottom: 2px; scrollbar-width: none; }
  .pill { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; border: 0; border-radius: 999px; padding: 9px 14px; background: var(--surface-2); color: var(--text); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; }
  .pill .ic { width: 16px; height: 16px; color: var(--accent); }
  .verdict-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; background: var(--text-2); }
  .verdict-dot.v-manter { background: var(--good); } .verdict-dot.v-ajustar { background: var(--warning); }
  .verdict-dot.v-substituir, .verdict-dot.v-trocar { background: var(--serious); } .verdict-dot.v-descansar { background: var(--critical); }

  /* ícones de app, blocos e listas agrupadas */
  .app-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; color: #fff; flex: none; position: relative; }
  .app-icon .ic { stroke: #fff; width: 24px; height: 24px; }
  .app-icon.sm { width: 30px; height: 30px; border-radius: 7px; }
  .app-icon.sm .ic { width: 18px; height: 18px; }
  .app-icon.lg { width: 62px; height: 62px; border-radius: 15px; box-shadow: 0 2px 6px rgba(0,0,0,.12); }
  .app-icon.lg .ic { width: 32px; height: 32px; }
  .tile-list { display: flex; flex-direction: column; gap: 10px; }
  .app-tile { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 14px; padding: 12px 14px; color: var(--text); }
  .app-tile-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .app-tile-txt b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .app-tile-txt span { font-size: .82rem; color: var(--text-2); }
  .chev { width: 18px; height: 18px; color: var(--text-2); opacity: .6; stroke-width: 2.2; }
  .list-card { background: var(--surface); border-radius: 14px; overflow: hidden; margin-bottom: 18px; }
  .list-row { display: flex; align-items: center; gap: 12px; width: 100%; background: none; border: 0; padding: 11px 14px; color: var(--text); font: inherit; text-align: left; cursor: pointer; position: relative; }
  .list-row + .list-row::before { content: ""; position: absolute; top: 0; left: 56px; right: 0; border-top: .5px solid var(--border); }
  .list-row-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .list-row-txt b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .list-row-txt span { font-size: .8rem; color: var(--text-2); }
  .list-row.danger b { color: var(--critical); }
  .app-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px 8px; background: var(--surface); border-radius: 18px; padding: 18px 8px; }
  .hub-icon { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text); font-size: .8rem; font-weight: 500; text-align: center; }
  .hub-badge { position: absolute; top: -6px; right: -10px; background: var(--critical); color: #fff; font-size: .62rem; font-weight: 700; padding: 1px 6px; border-radius: 99px; white-space: nowrap; max-width: 70px; overflow: hidden; text-overflow: ellipsis; }

  /* controles segmentados no lugar das abas de botões */
  .coach-tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 2px; background: var(--surface-2); padding: 2px; border-radius: 10px; scrollbar-width: none; }
  .coach-tabs .btn.ghost { flex: 1 0 auto; min-height: 32px; border: 0; border-radius: 8px; background: transparent; font-size: .82rem; padding: 6px 10px; }
  .coach-tabs .btn.ghost.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

  /* janelas viram "bottom sheets" */
  #modal { align-items: flex-end; padding: 0; }
  .modal-box, .modal-box.wide { width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; padding: 22px 16px calc(16px + var(--safe-b)); animation: sheet-up .3s cubic-bezier(.2, .8, .2, 1); }
  .modal-box::before { content: ""; position: absolute; top: 7px; left: 50%; transform: translateX(-50%); width: 38px; height: 5px; border-radius: 3px; background: var(--border); }

  /* ficha, descanso e chat acima da barra de abas */
  .ficha-head { top: calc(var(--nav-h) + var(--safe-t)); }
  #restbar { bottom: calc(var(--tab-h) + var(--safe-b) + 10px); }
  .chat { max-height: calc(100vh - 330px); }
  .toast { bottom: calc(var(--tab-h) + var(--safe-b) + 12px); right: 16px; left: 16px; max-width: none; }

  /* puxar para atualizar */
  #ptr { display: flex; position: fixed; top: calc(var(--nav-h) + var(--safe-t) + 6px); left: 50%; transform: translate(-50%, 0); z-index: 45; opacity: 0;
         width: 34px; height: 34px; border-radius: 50%; background: var(--surface); box-shadow: 0 2px 8px rgba(0,0,0,.15); align-items: center; justify-content: center; color: var(--accent); }
  #ptr.spin .ic { animation: spin .8s linear infinite; }
  #ptr .ic { width: 20px; height: 20px; }
}

@media (max-width: 760px) {
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) { --bg: #000; --surface: #1c1c1e; --surface-2: #2c2c2e; --border: #38383a; }
  }
  :root[data-theme="dark"] { --bg: #000; --surface: #1c1c1e; --surface-2: #2c2c2e; --border: #38383a; }
}

@keyframes ios-push { from { transform: translateX(28px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ios-pop { from { transform: translateX(-28px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ios-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  #view.anim-in, .modal-box, .ring-fg { animation: none !important; transition: none !important; }
}
