/*
 * styles.css — Estilos do FitTrack.
 * Mobile-first (iPhone). Temas claro/escuro por variáveis CSS em
 * :root[data-theme]. Respeita a área segura (notch e barra inferior).
 */

:root {
  --bg: #ffffff;
  --bg-2: #f5f6f8;
  --card: #ffffff;
  --card-2: #f7f8fa;
  --line: #e7e9ee;
  --text: #111318;
  --text-2: #5d6370;
  --text-3: #8b919c;
  --accent: #0f9f6e;
  --accent-soft: #e3f6ee;
  --accent-text: #ffffff;
  --warn: #b7791f;
  --warn-soft: #fdf3e1;
  --danger: #d23c3c;
  --danger-soft: #fdeaea;
  --c1: #0f9f6e; --c2: #3b6fd8; --c3: #c2780a; --c4: #8a4fd1; --c5: #d23c6e;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --radius: 16px;
  --radius-sm: 10px;
  --nav-h: 62px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0b0b0d;
  --bg-2: #141418;
  --card: #17171c;
  --card-2: #1e1e24;
  --line: #2a2a31;
  --text: #f2f3f5;
  --text-2: #a7abb5;
  --text-3: #767b86;
  --accent: #34d399;
  --accent-soft: #123a2c;
  --accent-text: #06261b;
  --warn: #f0b354;
  --warn-soft: #3a2c12;
  --danger: #f07171;
  --danger-soft: #3a1717;
  --c1: #34d399; --c2: #6f9cff; --c3: #f0b354; --c4: #b98cf5; --c5: #f17aa3;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg-2);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
body.sheet-open { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
p { margin: .35rem 0; }
ul, ol { margin: .3rem 0; padding-left: 1.2rem; }
a { color: var(--accent); }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ----------------------------- Estrutura ----------------------------- */

#app { min-height: 100vh; min-height: 100dvh; }
.boot { display: grid; place-items: center; align-content: center; min-height: 100vh; gap: .5rem; color: var(--text-2); }
.boot-logo { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.4rem; color: var(--text); }
.logo-dot { width: 14px; height: 14px; border-radius: 5px; background: var(--accent); display: inline-block; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: calc(var(--safe-top) + 6px) calc(14px + var(--safe-right)) 6px calc(14px + var(--safe-left));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; }
.save-status { font-size: .78rem; color: var(--text-3); margin-left: auto; min-height: 1em; }
.save-status.saved { color: var(--accent); }
.save-status.error { color: var(--danger); font-weight: 600; }

.main {
  max-width: 760px; margin: 0 auto;
  padding: 14px calc(14px + var(--safe-right)) calc(var(--nav-h) + var(--safe-bottom) + 28px) calc(14px + var(--safe-left));
  display: flex; flex-direction: column; gap: 14px;
}

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding: 4px calc(4px + var(--safe-right)) var(--safe-bottom) calc(4px + var(--safe-left));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--line);
}
.nav-brand, .nav-config, .nav-secondary { display: none !important; }
.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 0; background: none; color: var(--text-3); font-size: .7rem; font-weight: 500; border-radius: 12px;
  min-height: 48px;
}
.nav-item.active { color: var(--accent); }
.nav-item .icon { display: grid; }

@media (min-width: 900px) {
  .topbar { display: none; }
  .nav {
    top: 0; bottom: 0; right: auto; width: 232px; height: auto;
    display: flex; flex-direction: column; gap: 4px; padding: 22px 14px;
    border-top: 0; border-right: 1px solid var(--line); background: var(--bg);
  }
  .nav-brand { display: flex !important; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.2rem; padding: 0 10px 18px; }
  .nav-item { flex-direction: row; justify-content: flex-start; gap: 12px; font-size: .95rem; padding: 10px 12px; min-height: 44px; }
  .nav-item.active { background: var(--accent-soft); }
  .nav-config { display: flex !important; margin-top: auto; }
  .nav-secondary { display: flex !important; }
  .nav-more { display: none !important; }
  .main { margin-left: 232px; margin-right: auto; padding: 28px 32px 48px; max-width: 820px; }
  body { background: var(--bg-2); }
}

/* ----------------------------- Componentes ----------------------------- */

.page-title { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.card.inset { background: var(--card-2); box-shadow: none; }
.card-kicker { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 600; }
.card-title { font-size: 1.1rem; font-weight: 650; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap { flex-wrap: wrap; }
.gap { gap: 8px; }
.muted { color: var(--text-2); }
.small { font-size: .86rem; }
.hint { font-size: .84rem; color: var(--text-2); }
.hint.warn, .warn-text { color: var(--warn); }
.note { font-size: .88rem; background: var(--card-2); border-radius: var(--radius-sm); padding: 8px 10px; color: var(--text-2); white-space: pre-wrap; }
.pad { padding: 12px; }
.center { align-self: center; }
.center-text { text-align: center; }
.big-num { font-size: 1.25rem; }
.subhead { font-size: .8rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; }
.section { display: flex; flex-direction: column; gap: 10px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section-title h3 { font-size: 1.05rem; font-weight: 650; }
.icon { display: inline-grid; place-items: center; vertical-align: middle; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 600; font-size: .95rem; text-decoration: none; white-space: nowrap;
  transition: transform .08s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; }
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn.secondary { background: var(--card-2); color: var(--text); border-color: var(--line); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger-ghost { background: transparent; color: var(--danger); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .86rem; border-radius: 10px; }
.btn.block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-row.small-gap { gap: 6px; }
.btn-row.tight { gap: 2px; flex-wrap: nowrap; }
.file-btn { position: relative; cursor: pointer; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  border: 0; background: transparent; color: var(--text-2);
}
.icon-btn:active { background: var(--card-2); }
.icon-btn:disabled { opacity: .3; }
.icon-btn.danger { color: var(--danger); }
.icon-btn.fav { color: var(--warn); }

.badge {
  display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: .74rem; font-weight: 600;
  background: var(--card-2); color: var(--text-2); white-space: nowrap; border: 1px solid var(--line);
}
.badge.ok { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.muted { background: var(--card-2); color: var(--text-2); }

.segmented {
  display: flex; background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px;
  overflow-x: auto; scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.seg { flex: 1; border: 0; background: transparent; padding: 8px 10px; border-radius: 9px; font-weight: 600; font-size: .88rem; color: var(--text-2); white-space: nowrap; min-height: 36px; }
.seg.active { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
:root[data-theme="dark"] .seg.active { background: #2b2b33; }
.segmented.big .seg { min-height: 42px; font-size: .95rem; }
.segmented.small .seg { font-size: .8rem; padding: 6px 8px; }

.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); padding: 6px 12px; border-radius: 999px; font-size: .84rem; font-weight: 500; color: var(--text-2); min-height: 34px; }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }

.progress { height: 6px; background: var(--card-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.progress-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s ease; }
.progress.over .progress-fill { background: var(--warn); }

.empty { text-align: center; padding: 22px 14px; color: var(--text-2); background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--warn-soft); color: var(--text); border-radius: var(--radius); padding: 12px 14px; font-size: .9rem; }
.error-card { border-color: var(--danger); }

/* ------------------------------ Formulários ------------------------------ */

.form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-label { font-size: .8rem; font-weight: 600; color: var(--text-2); }
.field-hint { font-size: .78rem; color: var(--text-3); }
.input {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--card); color: var(--text);
  font-size: 16px; /* 16px evita zoom automático no iPhone */
  -webkit-appearance: none; appearance: none;
}
select.input { background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
textarea.input { min-height: 80px; resize: vertical; }
.input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 0; border-color: var(--accent); }
.input.num { text-align: center; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.row4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.row5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.row5 .input { padding: 8px 4px; }
@media (min-width: 600px) { .row4 { grid-template-columns: repeat(4, 1fr); } }
.check { display: flex; align-items: center; gap: 8px; font-size: .92rem; min-height: 36px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.check.inline { display: inline-flex; }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; }
.date-hidden { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; }

/* ------------------------------ Listas ------------------------------ */

.list { display: flex; flex-direction: column; }
.list.card { padding: 0; overflow: hidden; }
.list-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 12px 14px;
  background: transparent; border: 0; border-bottom: 1px solid var(--line); color: var(--text);
}
.list-item:last-child { border-bottom: 0; }
.card.list-item { border: 1px solid var(--line); }
.li-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.li-main.as-btn { background: none; border: 0; text-align: left; padding: 0; }
.li-title { font-weight: 600; font-size: .95rem; }
.li-sub { font-size: .8rem; color: var(--text-2); }
.list-item .icon { color: var(--text-3); }

/* --------------------------------- Hoje --------------------------------- */

.date-bar { display: flex; align-items: center; justify-content: space-between; }
.date-center { position: relative; display: flex; flex-direction: column; align-items: center; cursor: pointer; padding: 2px 14px; }
.date-week { font-size: .82rem; color: var(--text-2); font-weight: 600; }
.date-main { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }

.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 600px) { .kpi-grid { grid-template-columns: repeat(4, 1fr); } }
.kpi-card { display: flex; flex-direction: column; gap: 6px; padding: 12px; }
.kpi-label { font-size: .76rem; color: var(--text-2); font-weight: 600; }
.kpi-value { font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; }
.kpi-value.sm { font-size: 1.05rem; }
.kpi-value small { font-size: .78rem; color: var(--text-3); font-weight: 500; }
.kpi-foot { font-size: .74rem; color: var(--text-3); }
.mini-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.mini-kpis div { display: flex; flex-direction: column; background: var(--card-2); border-radius: var(--radius-sm); padding: 8px 10px; }
.mini-kpis strong { font-size: 1.1rem; }
.mini-kpis span { font-size: .74rem; color: var(--text-2); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-bottom: 12px; }
.kpi { display: flex; flex-direction: column; background: var(--card-2); border-radius: var(--radius-sm); padding: 10px; }
.kpi .kpi-value { font-size: 1.05rem; }

.plan-list { padding-left: 1.3rem; display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.plan-list li { padding-left: 2px; }
.plan-list li > span:first-child { display: block; font-weight: 550; }
.plan-list li > span.muted { font-size: .84rem; }
.plan-list.compact { gap: 2px; font-size: .9rem; }
.plan-list.compact li { display: list-item; }
.plan-list.compact li > span { display: inline; }
.plan-list.compact li > span.muted::before { content: " · "; }

.insights { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.insights li { padding: 8px 10px 8px 30px; border-radius: var(--radius-sm); background: var(--card-2); position: relative; font-size: .92rem; }
.insights li::before { content: "•"; position: absolute; left: 12px; color: var(--text-3); font-weight: 700; }
.insights li.up::before { content: "↑"; color: var(--accent); }
.insights li.pr::before { content: "★"; color: var(--warn); }

/* ------------------------------- Sessão ------------------------------- */

.session-head { display: flex; flex-direction: column; gap: 10px; }
.clock { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--accent); font-size: .92rem; }
.ex-card { padding: 0; overflow: hidden; }
.ex-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 14px; background: transparent; border: 0; text-align: left; }
.ex-head-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ex-name { font-weight: 650; font-size: 1rem; }
.ex-meta { font-size: .8rem; color: var(--text-2); }
.ex-head-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.count { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-2); font-size: .95rem; }
.count.full { color: var(--accent); }
.ex-body { display: none; padding: 0 14px 14px; flex-direction: column; gap: 10px; }
.ex-card.open .ex-body { display: flex; }
.prev-line { font-size: .82rem; color: var(--text-2); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 0; }

.sets { display: flex; flex-direction: column; gap: 6px; }
.set-row { display: grid; grid-template-columns: 34px minmax(62px, 1.25fr) 1fr 1fr 0.75fr 44px; gap: 6px; align-items: center; }
.sets.cardio .set-row { grid-template-columns: 34px minmax(62px, 1.25fr) 1fr 1fr 44px; }
.set-header { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); font-weight: 600; text-align: center; }
.set-header span:nth-child(2) { text-align: left; }
.set-row .input { min-height: 42px; padding: 6px 4px; border-radius: 10px; }
.set-row .prev { font-size: .78rem; color: var(--text-2); line-height: 1.2; display: flex; flex-direction: column; gap: 2px; }
.delta { font-size: .68rem; font-weight: 700; color: var(--text-3); }
.delta.up { color: var(--accent); }
.set-n { height: 34px; width: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--card-2); font-weight: 700; font-size: .85rem; color: var(--text-2); }
.set-n.warm { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.check-btn { height: 42px; width: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--text-3); display: grid; place-items: center; }
.check-btn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.set-row.done .input { background: var(--accent-soft); border-color: transparent; }
.ex-actions { border-top: 1px solid var(--line); padding-top: 10px; }

.rest-bar {
  position: fixed; left: 12px; right: 12px; z-index: 40;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 10px);
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 16px;
  background: var(--text); color: var(--bg); box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.rest-bar .btn.secondary { background: color-mix(in srgb, var(--bg) 16%, transparent); color: var(--bg); border-color: transparent; }
.rest-bar.done { background: var(--accent); color: var(--accent-text); justify-content: space-between; }
.rest-time { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.05rem; }
.rest-label { flex: 1; font-size: .8rem; opacity: .75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 900px) { .rest-bar { left: auto; right: 24px; width: 380px; bottom: 24px; } }

.sum-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.sum-line > span:first-child { font-weight: 600; flex: 1 1 100%; }
.hist-row { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; font-size: .9rem; }

/* ------------------------------ Refeições ------------------------------ */

.meal-card h4 { font-size: 1rem; font-weight: 650; }
.meal-card.planned { border-style: dashed; }
.meal-card.pending { border-style: dashed; background: var(--card-2); box-shadow: none; }
.meal-card.skipped { opacity: .7; }
.items { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 4px; }
.items li { display: flex; justify-content: space-between; gap: 10px; font-size: .9rem; }
.items.editable li { display: block; }
.item-btn { display: flex; justify-content: space-between; gap: 10px; width: 100%; background: var(--card-2); border: 0; border-radius: 10px; padding: 9px 10px; text-align: left; font-size: .9rem; }
.item-btn span:first-child { font-weight: 550; }
.item-btn span:last-child { text-align: right; flex: none; }
.preview { font-weight: 600; background: var(--accent-soft); color: var(--text); padding: 10px 12px; border-radius: var(--radius-sm); }
.ing-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.qty-wrap { display: flex; align-items: center; gap: 4px; width: 110px; }
.qty-wrap .input { padding: 8px 4px; }

.day-tabs { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.day-tab { display: flex; flex-direction: column; align-items: center; padding: 8px 0; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: .85rem; }
.day-tab small { color: var(--text-3); font-weight: 500; font-size: .7rem; }
.day-tab.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.day-tab.active small { color: var(--bg); opacity: .7; }

.week-row { display: flex; flex-direction: column; gap: 8px; }
.tpl-ex { padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--card-2); box-shadow: none; }

/* ------------------------------ Calendário ------------------------------ */

.month-bar { display: flex; align-items: center; justify-content: space-between; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-wd { text-align: center; font-size: .72rem; color: var(--text-3); font-weight: 600; padding: 4px 0; }
.cal-cell { aspect-ratio: 1 / 1.05; border-radius: 12px; border: 1px solid transparent; background: var(--card-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 2px; }
.cal-cell.empty { background: transparent; }
.cal-cell.today { border-color: var(--accent); }
.cal-num { font-weight: 600; font-size: .9rem; }
.cal-cell.st-done { background: var(--accent-soft); }
.cal-marks { display: flex; gap: 3px; height: 7px; }
.cal-marks i, .legend i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.mk-train.st-done { background: var(--accent); }
.mk-train.st-progress { background: var(--warn); }
.mk-train.st-skipped { background: var(--danger); }
.mk-train.st-missing { background: transparent; border: 1.5px solid var(--text-3); }
.mk-train.st-planned { background: transparent; border: 1.5px dashed var(--text-3); }
.mk-train.st-rest { display: none !important; }
.mk-food { background: var(--c2); }
.mk-weight { background: var(--c4); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .8rem; color: var(--text-2); justify-content: center; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend .mk-train.st-missing, .legend .mk-train.st-planned { box-sizing: border-box; }

/* ------------------------------- Gráficos ------------------------------- */

.chart { margin-top: 8px; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-svg .grid { stroke: var(--line); stroke-width: 1; }
.chart-svg .axis { fill: var(--text-3); font-size: 10px; font-family: var(--font); }
.chart-svg .goal { stroke: var(--text-3); stroke-dasharray: 4 4; stroke-width: 1; }
.chart-svg .line { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .line.dashed { stroke-dasharray: 5 4; stroke-width: 1.8; }
.chart-svg .dot { stroke: var(--card); stroke-width: 1.5; cursor: pointer; }
.chart-svg .bar { cursor: pointer; }
.c1 { stroke: var(--c1); fill: var(--c1); } .chart-svg .line.c1 { fill: none; }
.c2 { stroke: var(--c2); fill: var(--c2); } .chart-svg .line.c2 { fill: none; }
.c3 { stroke: var(--c3); fill: var(--c3); } .chart-svg .line.c3 { fill: none; }
.c4 { stroke: var(--c4); fill: var(--c4); } .chart-svg .line.c4 { fill: none; }
.c5 { stroke: var(--c5); fill: var(--c5); } .chart-svg .line.c5 { fill: none; }
.chart-svg .bar { stroke: none; }
.chart-readout { font-size: .8rem; color: var(--text-2); margin-top: 4px; min-height: 1.2em; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .78rem; color: var(--text-2); margin-top: 4px; }
.lg::before { content: ""; display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle; background: currentColor; }
.lg.c1 { color: var(--c1); } .lg.c2 { color: var(--c2); } .lg.c3 { color: var(--c3); } .lg.c4 { color: var(--c4); } .lg.c5 { color: var(--c5); }
.lg { fill: none; stroke: none; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.table th, .table td { padding: 7px 6px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.table th { color: var(--text-3); font-weight: 600; font-size: .74rem; text-transform: uppercase; }
.kv { list-style: none; padding: 0; margin: 0; }
.kv li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.kv li span { color: var(--text-2); }
details summary { cursor: pointer; color: var(--accent); font-size: .9rem; margin: 8px 0; }

/* ---------------------------- Janelas (sheet) ---------------------------- */

.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.38); z-index: 50; animation: fade .18s ease; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
  max-height: calc(100dvh - var(--safe-top) - 24px); max-height: calc(100vh - var(--safe-top) - 24px);
  display: flex; flex-direction: column;
  background: var(--card); border-radius: 20px 20px 0 0;
  padding: 6px calc(16px + var(--safe-right)) calc(14px + var(--safe-bottom)) calc(16px + var(--safe-left));
  animation: up .22s cubic-bezier(.2,.8,.2,1);
  box-shadow: 0 -10px 40px rgba(0,0,0,.18);
}
@supports (height: 100dvh) { .sheet { max-height: calc(100dvh - var(--safe-top) - 24px); } }
.sheet.closing { animation: down .18s ease forwards; }
.sheet-backdrop.closing { animation: fadeout .18s ease forwards; }
.sheet-handle { width: 38px; height: 5px; border-radius: 9px; background: var(--line); margin: 4px auto 6px; flex: none; }
.sheet-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex: none; padding-bottom: 6px; }
.sheet-title { font-size: 1.12rem; font-weight: 700; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; padding-bottom: 6px; overscroll-behavior: contain; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); flex: none; }
.sheet-actions .btn { flex: 1 1 auto; }
.confirm-text { font-size: 1rem; white-space: pre-wrap; }
.picker { display: flex; flex-direction: column; gap: 10px; }
.picker .list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
@media (min-width: 700px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: min(560px, 92vw); border-radius: 20px; animation: pop .18s ease; max-height: 86vh; padding-bottom: 16px; }
  .sheet.sheet-wide { width: min(760px, 94vw); }
  .sheet.closing { animation: fadeout .15s ease forwards; }
  .sheet-handle { display: none; }
}
@keyframes up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes down { to { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeout { to { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -48%); } to { opacity: 1; transform: translate(-50%, -50%); } }

#toasts { position: fixed; left: 0; right: 0; top: calc(var(--safe-top) + 10px); z-index: 70; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; max-width: 520px; background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 12px; font-size: .9rem; font-weight: 500; opacity: 0; transform: translateY(-8px); transition: all .22s ease; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.show { opacity: 1; transform: none; }
.toast-success { background: var(--accent); color: var(--accent-text); }
.toast-error { background: var(--danger); color: #fff; }

.update-banner {
  position: fixed; left: 12px; right: 12px; z-index: 60;
  top: calc(var(--safe-top) + 58px);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--accent); box-shadow: 0 8px 24px rgba(0,0,0,.15); font-size: .9rem;
}
@media (min-width: 900px) { .update-banner { left: auto; right: 24px; top: 24px; width: 380px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============================ v1.1.0 ============================ */

.page-title.sm { font-size: 1.25rem; }
.save-status { margin-right: 2px; }
.insights li.warn::before { content: "!"; color: var(--warn); }

/* Menu "Mais" */
.more-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 4px 0 8px; }
.more-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 92px; border-radius: 16px; border: 1px solid var(--line); background: var(--card-2); font-weight: 600; font-size: .95rem; color: var(--text); }
.more-item .icon { color: var(--accent); }
.more-item.active { border-color: var(--accent); background: var(--accent-soft); }

/* Aba Eu */
.me-head { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; }
.me-head .big-btn { grid-column: 1 / -1; }
.me-avatar { width: 54px; height: 54px; border-radius: 18px; display: grid; place-items: center; font-weight: 700; font-size: 1.4rem; background: var(--accent-soft); color: var(--accent); }
.me-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.big-btn { min-height: 52px; font-size: 1.02rem; border-radius: 14px; }
.kv li small { font-weight: 400; }

/* Aba Análises */
.summary-card { display: flex; flex-direction: column; gap: 6px; }
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 6px; }
@media (max-width: 420px) { .summary-grid { grid-template-columns: repeat(2, 1fr); } }
.sum-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px; border-radius: 14px; border: 0; text-align: left; background: var(--card-2); }
.sum-tile strong { font-size: 1.6rem; line-height: 1; letter-spacing: -.02em; }
.sum-tile span { font-size: .78rem; color: var(--text-2); font-weight: 600; }
.cat-up { --cat: var(--accent); --cat-soft: var(--accent-soft); }
.cat-down { --cat: var(--danger); --cat-soft: var(--danger-soft); }
.cat-warn { --cat: var(--warn); --cat-soft: var(--warn-soft); }
.cat-flat { --cat: var(--text-2); --cat-soft: var(--card-2); }
.sum-tile.cat-up, .sum-tile.cat-down, .sum-tile.cat-warn { background: var(--cat-soft); }
.sum-tile strong { color: var(--cat); }
.cat-head h3 { display: flex; align-items: center; gap: 6px; }
.cat-head .icon { color: var(--cat); }
.count-pill { min-width: 26px; height: 24px; padding: 0 8px; border-radius: 999px; background: var(--cat-soft); color: var(--cat); font-weight: 700; font-size: .8rem; display: grid; place-items: center; }
.highlights { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 600px) { .highlights { grid-template-columns: 1fr 1fr; } }
.hl { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--text); border-left: 4px solid var(--cat); }
.hl-cat { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--cat); font-weight: 700; display: flex; align-items: center; gap: 4px; }
.ind { padding: 0; overflow: hidden; border-left: 4px solid var(--cat); }
.ind > summary { list-style: none; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; cursor: pointer; margin: 0; color: var(--text); }
.ind > summary::-webkit-details-marker { display: none; }
.ind-head { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.ind-area { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 700; }
.ind-title { font-size: .98rem; }
.ind-text { font-size: .88rem; color: var(--text-2); }
.ind-diff { flex: none; font-weight: 700; font-size: .85rem; color: var(--cat); background: var(--cat-soft); padding: 4px 8px; border-radius: 10px; white-space: nowrap; }
.ind-body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.rec { display: flex; flex-direction: column; gap: 8px; background: var(--card-2); border-radius: 12px; padding: 10px 12px; }
.rec-row span { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; color: var(--text-3); }
.rec-row p { margin: 2px 0 0; font-size: .9rem; }
.evidence ul { margin-top: 4px; }
.cross-card p { margin: 4px 0; }
.insuf { padding-left: 1.1rem; display: flex; flex-direction: column; gap: 6px; font-size: .88rem; }
.kb h4 { margin: 12px 0 4px; font-size: .95rem; }
.refs li { margin-bottom: 10px; }
.refs a { word-break: break-all; }
details.card > summary { cursor: pointer; font-weight: 600; color: var(--text); margin: 0; }
