/* Дашборд как в Garmin Connect: карточки, крупные цифры, кольца. Цвета — из Telegram themeParams (app.js кладёт их в
   переменные --tg-*); значения ниже — запасные для светлой темы. */
:root {
  --tg-bg: #f2f2f7; --tg-text: #111; --tg-hint: #6d6d72; --tg-link: #2481cc;
  --tg-btn: #2481cc; --tg-btn-text: #fff; --tg-card: #fff; --tg-accent: #2481cc; --tg-destructive: #e53935;
  --good: #2e9e5b; --warn: #e0a100;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--tg-bg); color: var(--tg-text);
  font: 16px/1.35 -apple-system, "Segoe UI", Roboto, sans-serif; }
.gate { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px;
  text-align: center; font-size: 18px; color: var(--tg-hint); }
.gate p { margin: 0; }
.view { padding: 12px 12px calc(84px + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--tg-card);
  border-top: 1px solid rgba(128,128,128,.25); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.tabs button { flex: 1; border: 0; background: none; color: var(--tg-hint); padding: 14px 2px; font-size: 12px;
  font-weight: 600; }
.tabs button.on { color: var(--tg-accent); box-shadow: inset 0 3px 0 var(--tg-accent); }
h1 { font-size: 22px; margin: 4px 4px 10px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--tg-hint); margin: 18px 4px 6px; }
.card { background: var(--tg-card); border-radius: 16px; padding: 14px; margin: 0 0 10px; }
.card h3 { margin: 0 0 8px; font-size: 14px; color: var(--tg-hint); font-weight: 600; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0;
  border-top: 1px solid rgba(128,128,128,.18); }
.row:first-of-type { border-top: 0; }
.row.tap { cursor: pointer; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--tg-hint); font-size: 13px; }
.big { font-size: 34px; font-weight: 700; line-height: 1.1; }
.mid { font-size: 20px; font-weight: 700; }
.rings { display: flex; gap: 8px; justify-content: space-around; }
.ring { text-align: center; flex: 1; }
.ring svg { width: 100%; max-width: 150px; height: auto; }
.ring .track { stroke: rgba(128,128,128,.22); }
.ring .bar { stroke: var(--tg-accent); transition: stroke-dashoffset .4s; }
.ring.over .bar { stroke: var(--warn); }
.ring .num { font-size: 26px; font-weight: 700; fill: var(--tg-text); }
.ring .unit { font-size: 11px; fill: var(--tg-hint); }
.ring .cap { font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.tile { background: rgba(128,128,128,.1); border-radius: 12px; padding: 10px; }
.tile b { display: block; font-size: 22px; }
.chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px;
  background: rgba(128,128,128,.18); color: var(--tg-hint); vertical-align: middle; }
.chip.warn { background: var(--warn); color: #000; }
.chip.good { background: var(--good); color: #fff; }
.chip.bad { background: var(--tg-destructive); color: #fff; }
.bar-h { height: 6px; border-radius: 3px; background: rgba(128,128,128,.22); overflow: hidden; margin-top: 4px; }
.bar-h i { display: block; height: 100%; background: var(--tg-accent); }
.nav { display: flex; align-items: center; justify-content: space-between; margin: 0 0 10px; }
.nav b { font-size: 17px; }
.seg { display: flex; background: rgba(128,128,128,.18); border-radius: 10px; padding: 2px; margin: 0 0 10px; }
.seg button { flex: 1; border: 0; background: none; color: var(--tg-text); padding: 7px; border-radius: 8px;
  font-weight: 600; }
.seg button.on { background: var(--tg-card); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
button.btn, .btn { border: 0; border-radius: 10px; background: var(--tg-btn); color: var(--tg-btn-text);
  padding: 10px 14px; font-weight: 600; font-size: 15px; }
button.btn.ghost { background: rgba(128,128,128,.18); color: var(--tg-text); }
button.btn.danger { background: var(--tg-destructive); color: #fff; }
button.btn.small { padding: 6px 10px; font-size: 13px; }
button.icon { border: 0; background: none; color: var(--tg-accent); font-size: 22px; padding: 4px 10px; }
button.icon:disabled { color: var(--tg-hint); opacity: .4; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.chart { width: 100%; height: auto; display: block; }
.chart .axis { stroke: rgba(128,128,128,.35); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--tg-accent); stroke-width: 2; stroke-linejoin: round; }
.chart .line2 { fill: none; stroke: var(--good); stroke-width: 2.5; }
.chart .line2.dashed { stroke-dasharray: 5 4; }
.chart .dot { fill: var(--tg-accent); }
.chart text { fill: var(--tg-hint); font-size: 10px; }
.empty { text-align: center; color: var(--tg-hint); padding: 18px 8px; }
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 10; display: flex; align-items: flex-end;
  justify-content: center; }
.sheet[hidden], .toast[hidden], #app[hidden] { display: none; }
.sheet .panel { background: var(--tg-card); width: 100%; max-width: 640px; border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); max-height: 90vh; overflow: auto; }
.sheet h3 { margin: 0 0 10px; font-size: 18px; }
label.field { display: block; margin: 0 0 10px; font-size: 13px; color: var(--tg-hint); }
input, select { width: 100%; margin-top: 3px; padding: 10px; font-size: 16px; color: var(--tg-text);
  background: rgba(128,128,128,.12); border: 1px solid rgba(128,128,128,.3); border-radius: 10px; }
input[type=checkbox] { width: auto; }
.set-input { max-width: 170px; margin: 0; }
.toast { position: fixed; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 20;
  background: #222; color: #fff; padding: 12px 14px; border-radius: 12px; display: flex; gap: 10px;
  align-items: center; justify-content: space-between; }
.toast.err { background: var(--tg-destructive); }
.toast button { border: 0; background: rgba(255,255,255,.25); color: #fff; padding: 6px 10px; border-radius: 8px;
  font-weight: 700; }
details.card summary { cursor: pointer; font-weight: 700; }
.gate[hidden] { display: none; }
/* календарь дней: месяц сеткой; цвет дня — доступная энергия, точки — тренировки, «еда» — есть записи еды */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .wd { text-align: center; font-size: 11px; color: var(--tg-hint); font-weight: 600; padding: 2px 0; }
.cal button { border: 1px solid rgba(128,128,128,.25); border-radius: 10px; background: none; color: var(--tg-text);
  min-height: 52px; padding: 3px 1px; display: flex; flex-direction: column; align-items: center; gap: 1px;
  font-size: 15px; font-weight: 600; }
.cal button .m { font-size: 9px; letter-spacing: 1px; color: var(--tg-accent); min-height: 11px; }
.cal button .f { font-size: 9px; color: var(--tg-hint); font-weight: 600; min-height: 11px; }
.cal .ea-ok { background: rgba(46,158,91,.28); border-color: var(--good); }
.cal .ea-low { background: rgba(229,57,53,.25); border-color: var(--tg-destructive); }
.cal .ea-pending, .cal .ea-psmf { background: rgba(128,128,128,.12); }
.cal .nodata, .cal .future { opacity: .45; }
.cal .today { box-shadow: inset 0 0 0 2px var(--tg-accent); }
.cal button:disabled { opacity: .25; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 10px; font-size: 12px; color: var(--tg-hint); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 4px;
  border: 1px solid rgba(128,128,128,.4); }
.legend i.ok { background: rgba(46,158,91,.5); } .legend i.low { background: rgba(229,57,53,.5); }
.small { font-size: 12px; }
