/* Мой малыш — дизайн-система мини-приложения.
   Цвета фона, текста и кнопок берутся из темы Telegram; смысловые цвета категорий — свои. */
:root {
  --bg: var(--tg-theme-secondary-bg-color, #f2f2f7);
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #ffffff));
  --text: var(--tg-theme-text-color, #111114);
  --hint: var(--tg-theme-hint-color, #8a8a93);
  --sub: var(--tg-theme-subtitle-text-color, var(--hint));
  --accent: var(--tg-theme-button-color, #3478f6);
  --on-accent: var(--tg-theme-button-text-color, #ffffff);
  --link: var(--tg-theme-link-color, var(--accent));
  --danger: var(--tg-theme-destructive-text-color, #e5484d);
  --line: rgba(128, 128, 140, .18);
  --fill: rgba(128, 128, 140, .10);
  --fill2: rgba(128, 128, 140, .16);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .05);

  --sleep: #7b6cf0; --sleep-s: rgba(123, 108, 240, .14);
  --feed: #ee8f33; --feed-s: rgba(238, 143, 51, .15);
  --dia: #1aa89a; --dia-s: rgba(26, 168, 154, .15);
  --act: #3b8bf0; --act-s: rgba(59, 139, 240, .14);
  --hl: #e5546c; --hl-s: rgba(229, 84, 108, .14);
  --n: #8e8e99; --n-s: rgba(142, 142, 153, .16);

  --f-xs: 12px; --f-s: 13px; --f-m: 15px; --f-l: 17px; --f-xl: 20px; --f-xxl: 28px;
  --r-s: 10px; --r-m: 14px; --r-l: 20px;
  --tab-h: 64px;
  --safe-b: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light dark;
}
html[data-theme="dark"] {
  --bg: var(--tg-theme-secondary-bg-color, #0f0f12);
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #1c1c21));
  --text: var(--tg-theme-text-color, #f2f2f5);
  --hint: var(--tg-theme-hint-color, #8d8d96);
  --line: rgba(255, 255, 255, .09);
  --fill: rgba(255, 255, 255, .06);
  --fill2: rgba(255, 255, 255, .10);
  --shadow: none;
  --sleep: #9a8cff; --sleep-s: rgba(154, 140, 255, .16);
  --feed: #f4a35a; --feed-s: rgba(244, 163, 90, .15);
  --dia: #3cc7b6; --dia-s: rgba(60, 199, 182, .15);
  --act: #5ea2ff; --act-s: rgba(94, 162, 255, .15);
  --hl: #ff7088; --hl-s: rgba(255, 112, 136, .15);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 400 var(--f-m)/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.num, .tm { font-variant-numeric: tabular-nums; }
.ic { display: inline-flex; width: 1em; height: 1em; flex: none; }
.ic svg { width: 100%; height: 100%; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- каркас ---------- */
#app { padding: 12px 16px calc(var(--tab-h) + var(--safe-b) + 28px); max-width: 640px; margin: 0 auto; }
#app.no-tabs { padding-bottom: calc(var(--safe-b) + 96px); }
#app.is-loading { opacity: .55; transition: opacity .15s; pointer-events: none; }
.page-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 2px 14px; }
.page-h h1 { font-size: var(--f-xxl); line-height: 1.15; margin: 0; font-weight: 700; letter-spacing: -.02em; }
.page-h .sub { color: var(--hint); font-size: var(--f-s); margin-top: 2px; }
.sec-h { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 4px 8px; }
.sec-h b { font-size: var(--f-l); font-weight: 650; }
.sec-h span, .sec-h button { color: var(--hint); font-size: var(--f-s); }
.sec-h button { color: var(--link); }
.stack > * + * { margin-top: 10px; }
.cols { display: block; }

.card { background: var(--card); border-radius: var(--r-l); box-shadow: var(--shadow); padding: 16px; }
.card.flat { padding: 0; overflow: hidden; }
.muted { color: var(--hint); }
.small { font-size: var(--f-s); }
.xs { font-size: var(--f-xs); }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px;
  border-radius: var(--r-m); background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: var(--f-m);
  transition: transform .12s var(--ease), opacity .12s; user-select: none;
}
.btn:active { transform: scale(.97); }
.btn[disabled], .btn.busy { opacity: .55; pointer-events: none; }
.btn.block { width: 100%; }
.btn.soft { background: var(--fill2); color: var(--text); }
.btn.ghost { background: transparent; color: var(--link); }
.btn.danger { background: transparent; color: var(--danger); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: var(--f-s); border-radius: 11px; }
.btn .ic { font-size: 18px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 0; }
.link { color: var(--link); font-size: var(--f-s); font-weight: 500; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; color: var(--hint); }
.icon-btn:active { background: var(--fill); }
.icon-btn .ic { font-size: 22px; }

/* ---------- иконки категорий ---------- */
.bubble { width: 36px; height: 36px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; flex: none; font-size: 19px; }
.bubble.lg { width: 48px; height: 48px; border-radius: 15px; font-size: 24px; }
.c-sleep { color: var(--sleep); background: var(--sleep-s); }
.c-feed { color: var(--feed); background: var(--feed-s); }
.c-dia { color: var(--dia); background: var(--dia-s); }
.c-act { color: var(--act); background: var(--act-s); }
.c-hl { color: var(--hl); background: var(--hl-s); }
.c-n { color: var(--n); background: var(--n-s); }

/* ---------- статус ---------- */
.hero { position: relative; overflow: hidden; }
.hero.sleeping { background: linear-gradient(135deg, var(--sleep-s), transparent 70%), var(--card); }
.hero-top { display: flex; align-items: center; gap: 14px; }
.hero-title { font-size: var(--f-xl); font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.hero-sub { color: var(--hint); font-size: var(--f-s); margin-top: 2px; }
.hero-actions { display: flex; gap: 8px; margin-top: 14px; }
.hero-actions .btn:first-child { flex: 1; }
.hero.sleeping .btn.primary { background: var(--sleep); color: #fff; }
.lasts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.last { background: var(--card); border-radius: var(--r-m); padding: 12px 14px; box-shadow: var(--shadow); min-width: 0; text-align: left; }
.last b { display: block; font-size: var(--f-m); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.last span { color: var(--hint); font-size: var(--f-xs); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.last .k { display: flex; align-items: center; gap: 6px; font-size: var(--f-xs); font-weight: 600; margin-bottom: 4px; }
.live { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.live .t { flex: 1; min-width: 0; }
.live .t b { display: block; font-weight: 650; }
.live .t span { color: var(--hint); font-size: var(--f-s); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; margin-right: 6px; animation: pulse 1.6s infinite; vertical-align: middle; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* ---------- быстрые действия ---------- */
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.qa {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 10px; min-height: 92px;
  padding: 12px; border-radius: var(--r-m); background: var(--card); box-shadow: var(--shadow); text-align: left;
  transition: transform .12s var(--ease);
}
.qa:active { transform: scale(.96); }
.qa b { font-size: var(--f-m); font-weight: 650; line-height: 1.2; }
.qa small { display: block; color: var(--hint); font-size: var(--f-xs); margin-top: 2px; }
.qa.hint-next { box-shadow: inset 0 0 0 2px var(--feed); }
.qa.busy { opacity: .5; pointer-events: none; }

/* ---------- ввод текстом ---------- */
.composer { display: flex; align-items: flex-end; gap: 8px; background: var(--card); border-radius: var(--r-l); padding: 8px 8px 8px 16px; box-shadow: var(--shadow); }
.composer textarea {
  flex: 1; border: 0; outline: 0; background: transparent; resize: none; min-height: 24px; max-height: 120px; padding: 9px 0;
  font-size: var(--f-m); line-height: 1.35;
}
.composer textarea::placeholder { color: var(--hint); }
.composer .send { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: var(--on-accent); display: inline-flex; align-items: center; justify-content: center; font-size: 20px; flex: none; }
.composer .send[disabled] { opacity: .35; }
.composer .mic { width: 40px; height: 40px; border-radius: 12px; background: var(--fill2); display: inline-flex; align-items: center; justify-content: center; font-size: 20px; flex: none; }
.composer .mic.rec { background: var(--hl); color: #fff; animation: pulse 1.2s infinite; }
.examples { display: flex; gap: 6px; overflow-x: auto; padding: 8px 2px 2px; scrollbar-width: none; }
.examples::-webkit-scrollbar { display: none; }
.examples button { white-space: nowrap; font-size: var(--f-s); color: var(--hint); background: var(--fill); padding: 6px 10px; border-radius: 999px; }

.result { margin-top: 10px; animation: rise .25s var(--ease); }
.result q { display: block; color: var(--hint); font-size: var(--f-s); font-style: italic; margin-bottom: 8px; quotes: "«" "»"; }
.result .head { font-weight: 650; margin-bottom: 4px; }
.result .note { font-size: var(--f-s); color: var(--hint); margin-top: 6px; }
.choice { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.choice p { margin: 0 0 8px; font-size: var(--f-s); font-weight: 600; }
.choice .btn-row .btn { flex: 0 1 auto; }

/* ---------- итоги дня ---------- */
.summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--card); border-radius: var(--r-m); padding: 12px 14px; box-shadow: var(--shadow); text-align: left; }
.stat .k { display: flex; align-items: center; gap: 6px; font-size: var(--f-xs); font-weight: 600; }
.stat b { display: block; font-size: var(--f-xl); font-weight: 700; margin-top: 6px; letter-spacing: -.01em; }
.stat b u { text-decoration: none; font-size: var(--f-s); font-weight: 600; color: var(--hint); margin: 0 1px; }
.stat span { display: block; color: var(--hint); font-size: var(--f-xs); margin-top: 2px; }

/* ---------- лента ---------- */
.feed { background: var(--card); border-radius: var(--r-l); box-shadow: var(--shadow); padding: 4px 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; min-height: 56px; width: 100%; text-align: left; position: relative; }
.row:active { background: var(--fill); }
.row + .row::before { content: ""; position: absolute; top: 0; left: 104px; right: 14px; border-top: 1px solid var(--line); }
.row .tm { width: 46px; flex: none; font-size: var(--f-s); color: var(--hint); font-weight: 500; text-align: right; }
.row .tm i { font-style: normal; font-size: var(--f-xs); }
.row .tx { flex: 1; min-width: 0; }
.row .tx b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .tx span { display: block; color: var(--hint); font-size: var(--f-s); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .val { color: var(--hint); font-size: var(--f-s); font-weight: 500; white-space: nowrap; }
.row.ongoing .val { color: var(--sleep); }
.gap { display: flex; align-items: center; gap: 10px; padding: 2px 14px 2px 72px; color: var(--hint); font-size: var(--f-xs); }
.gap::after { content: ""; flex: 1; border-top: 1px dashed var(--line); }
.empty { text-align: center; color: var(--hint); padding: 28px 16px; font-size: var(--f-m); }
.empty .ic { font-size: 40px; display: block; margin: 0 auto 10px; opacity: .5; }

/* ---------- списки настроек ---------- */
.list { background: var(--card); border-radius: var(--r-l); box-shadow: var(--shadow); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 52px; width: 100%; text-align: left; position: relative; }
.item + .item::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 1px solid var(--line); }
.item:active { background: var(--fill); }
.item .tx { flex: 1; min-width: 0; }
.item .tx b { display: block; font-weight: 500; }
.item .tx span { display: block; font-size: var(--f-s); color: var(--hint); }
.item .chev { color: var(--hint); font-size: 18px; }
.item .val { color: var(--hint); font-size: var(--f-m); }
.switch { width: 50px; height: 30px; border-radius: 15px; background: var(--fill2); position: relative; flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s var(--ease); }
.switch.on { background: #34c759; }
.switch.on::after { transform: translateX(20px); }
.foot { color: var(--hint); font-size: var(--f-s); margin: 8px 16px 0; }

/* ---------- формы ---------- */
.field { margin-top: 16px; }
.card > .field:first-child { margin-top: 0; }
.field > label, .lab { display: block; font-size: var(--f-s); color: var(--hint); font-weight: 500; margin: 0 4px 8px; }
.inp {
  width: 100%; min-height: 48px; border-radius: var(--r-m); border: 0; background: var(--fill); padding: 12px 14px; outline: none;
  font-size: var(--f-l);
}
.inp:focus { box-shadow: inset 0 0 0 2px var(--accent); }
textarea.inp { min-height: 96px; resize: vertical; font-size: var(--f-m); }
.seg { display: flex; background: var(--fill); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; min-height: 40px; border-radius: 9px; font-size: var(--f-m); font-weight: 500; color: var(--text); padding: 0 8px; }
.seg button.on { background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); font-weight: 650; }
html[data-theme="dark"] .seg button.on { background: var(--fill2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 38px; padding: 0 14px; border-radius: 999px; background: var(--fill); font-size: var(--f-m); font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: var(--accent); color: var(--on-accent); }
.big-num { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 6px 0 12px; }
.big-num output { font-size: 44px; font-weight: 700; letter-spacing: -.02em; min-width: 140px; text-align: center; }
.big-num output small { font-size: var(--f-l); color: var(--hint); font-weight: 600; margin-left: 4px; }
.big-num button { width: 52px; height: 52px; border-radius: 50%; background: var(--fill2); font-size: 22px; display: inline-flex; align-items: center; justify-content: center; }
.when { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.when b { font-weight: 600; }
.warn { background: var(--hl-s); color: var(--hl); border-radius: var(--r-m); padding: 10px 12px; font-size: var(--f-s); margin-top: 12px; }
.hint { color: var(--hint); font-size: var(--f-s); margin: 8px 4px 0; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; cursor: pointer; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check .box { width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--line); flex: none; display: inline-flex; align-items: center; justify-content: center; color: transparent; transition: .15s; margin-top: 1px; }
.check input:checked + .box { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.check input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }
.check span { font-size: var(--f-m); }
.opt { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: var(--r-m); background: var(--card); box-shadow: var(--shadow); width: 100%; text-align: left; border: 2px solid transparent; }
.opt + .opt { margin-top: 10px; }
.opt.on { border-color: var(--accent); }
.opt b { display: block; font-size: var(--f-l); font-weight: 650; }
.opt span { display: block; color: var(--hint); font-size: var(--f-s); margin-top: 2px; }

/* ---------- лист (bottom sheet) ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .38); z-index: 40; opacity: 0; transition: opacity .2s; }
.scrim.on { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--bg); border-radius: 22px 22px 0 0;
  max-height: 92vh; overflow-y: auto; padding: 8px 16px calc(var(--safe-b) + 16px); transform: translateY(100%);
  transition: transform .28s var(--ease); max-width: 640px; margin: 0 auto; overscroll-behavior: contain;
}
.sheet.on { transform: none; }
.sheet .grab { width: 38px; height: 5px; border-radius: 3px; background: var(--fill2); margin: 2px auto 10px; }
.sheet-h { display: flex; align-items: center; gap: 12px; margin: 4px 0 6px; }
.sheet-h h2 { flex: 1; margin: 0; font-size: var(--f-xl); font-weight: 700; }
.sheet-foot { position: sticky; bottom: calc(-1 * (var(--safe-b) + 16px)); background: var(--bg); padding: 12px 0 calc(var(--safe-b) + 4px); margin-top: 16px; display: flex; gap: 8px; }
.sheet-foot .btn { flex: 1; }
.kinds { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 6px; margin-top: 8px; }
.kind { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 2px; border-radius: var(--r-m); font-size: var(--f-xs); font-weight: 500; text-align: center; }
.kind:active { background: var(--fill); }

/* ---------- таб-бар ---------- */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; }
.tabbar {
  display: flex; align-items: center; justify-content: space-around; height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border-top: 1px solid var(--line);
}
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 500; color: var(--hint); padding: 8px 0; }
.tabbar button .ic { font-size: 24px; }
.tabbar button.on { color: var(--accent); }
.tabbar .fab { flex: none; width: 52px; height: 52px; border-radius: 18px; background: var(--accent); color: var(--on-accent); margin: 0 6px; padding: 0; justify-content: center; box-shadow: 0 6px 16px rgba(0, 0, 0, .18); }
.tabbar .fab .ic { font-size: 28px; }

/* ---------- календарь ---------- */
.cal-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-h b { font-size: var(--f-l); font-weight: 650; }
.cal-wd, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-wd span { text-align: center; font-size: var(--f-xs); color: var(--hint); padding: 4px 0; }
.cal-grid button { aspect-ratio: 1 / 1; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: var(--f-m); font-weight: 500; position: relative; }
.cal-grid button:disabled { color: var(--hint); opacity: .45; }
.cal-grid button.has::after { content: ""; position: absolute; bottom: 6px; width: 5px; height: 5px; border-radius: 50%; background: var(--sleep); opacity: var(--o, 1); }
.cal-grid button.today { color: var(--accent); font-weight: 700; }
.cal-grid button.sel { background: var(--accent); color: var(--on-accent); }
.cal-grid button.sel::after { background: var(--on-accent); }
.day-nav { display: flex; align-items: center; gap: 8px; margin: 18px 2px 10px; }
.day-nav h2 { flex: 1; margin: 0; font-size: var(--f-xl); font-weight: 700; }

/* ---------- отчёты ---------- */
.rep-nav { display: flex; align-items: center; justify-content: space-between; margin: 12px 0; }
.rep-nav b { font-weight: 600; }
.rcard .rh { display: flex; align-items: center; gap: 10px; }
.rcard .rh span { font-weight: 650; font-size: var(--f-l); }
.rcard .big { display: flex; align-items: baseline; gap: 8px; margin: 12px 0 2px; }
.rcard .big b { font-size: var(--f-xxl); font-weight: 700; letter-spacing: -.02em; }
.rcard .big span { color: var(--hint); font-size: var(--f-s); }
.rcard .say { font-size: var(--f-s); color: var(--hint); }
.rcard .say.up { color: var(--dia); }
.chart { display: grid; gap: 4px; align-items: end; height: 120px; margin-top: 14px; }
.bar { display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; height: 100%; position: relative; border-radius: 6px; }
.bar:active { background: var(--fill); }
.bar .seg-a, .bar .seg-b { border-radius: 4px; min-height: 0; }
.bar .seg-b { margin-top: 2px; }
.bar.partial .seg-a, .bar.partial .seg-b { opacity: .45; }
.bar small { position: absolute; bottom: -20px; left: 0; right: 0; text-align: center; font-size: 11px; color: var(--hint); }
.bar.partial small { color: var(--accent); font-weight: 600; }
.chart-wrap { padding-bottom: 22px; }
.legend { display: flex; gap: 14px; margin-top: 10px; font-size: var(--f-xs); color: var(--hint); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- профиль ---------- */
.baby { display: flex; align-items: center; gap: 14px; }
.avatar { width: 56px; height: 56px; border-radius: 18px; background: var(--sleep-s); color: var(--sleep); display: inline-flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; flex: none; }
.baby .who { flex: 1; min-width: 0; }
.baby .who b { font-size: var(--f-xl); font-weight: 700; display: block; color: var(--text); }
.baby .who span { color: var(--hint); font-size: var(--f-s); display: block; }

/* ---------- онбординг ---------- */
.ob { padding-top: 12px; }
.ob h1 { font-size: var(--f-xxl); font-weight: 700; letter-spacing: -.02em; margin: 12px 0 8px; line-height: 1.15; }
.ob p.lead { color: var(--hint); margin: 0 0 18px; }
.steps { display: flex; gap: 6px; }
.steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--fill2); }
.steps i.on { background: var(--accent); }
.docs a { display: block; color: var(--link); padding: 6px 0; text-decoration: none; font-size: var(--f-m); }

/* ---------- уведомления ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 14px); transform: translate(-50%, 20px); z-index: 60;
  background: #1f1f24; color: #fff; border-radius: 14px; padding: 10px 10px 10px 16px; display: flex; align-items: center; gap: 12px;
  font-size: var(--f-m); opacity: 0; pointer-events: none; transition: .22s var(--ease); max-width: calc(100vw - 32px); box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
#toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast button { color: #8ab4ff; font-weight: 600; padding: 6px 8px; white-space: nowrap; }
#toast.no-tabs { bottom: calc(var(--safe-b) + 20px); }
#net {
  position: fixed; left: 50%; top: calc(var(--tg-content-safe-area-inset-top, 0px) + 10px); transform: translateX(-50%); z-index: 70;
  background: #1f1f24; color: #fff; border-radius: 999px; padding: 7px 14px; font-size: var(--f-s); white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .22); max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis;
}
#net[hidden] { display: none; }
.loading { display: flex; justify-content: center; padding: 60px 0; }
.spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--fill2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.btn .spin { width: 18px; height: 18px; border-width: 2px; border-color: rgba(255, 255, 255, .35); border-top-color: currentColor; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.err { background: var(--hl-s); color: var(--hl); padding: 14px 16px; border-radius: var(--r-m); }
.skeleton { background: linear-gradient(90deg, var(--fill), var(--fill2), var(--fill)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--r-l); }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- широкий экран ---------- */
@media (min-width: 900px) {
  #app { max-width: 1120px; padding: 20px 28px 40px; }
  #app.no-tabs { padding-bottom: 40px; }
  #tabs { position: sticky; top: 0; bottom: auto; }
  .tabbar { height: 60px; padding: 0 calc((100vw - 1120px) / 2 + 28px); justify-content: flex-start; gap: 6px; border-top: 0; border-bottom: 1px solid var(--line); }
  .tabbar button { flex: none; flex-direction: row; gap: 8px; font-size: var(--f-m); padding: 8px 14px; border-radius: 12px; }
  .tabbar button.on { background: var(--fill); }
  .tabbar .fab { margin-left: auto; order: 9; width: auto; height: 40px; border-radius: 12px; padding: 0 16px; font-size: var(--f-m); font-weight: 600; box-shadow: none; }
  .tabbar .fab .ic { font-size: 20px; }
  .tabbar .fab::after { content: "Запись"; }
  .page-h .icon-btn[data-act="add"] { display: none; }
  .cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 24px; align-items: start; }
  .cols > .side { position: sticky; top: 80px; }
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: 520px; border-radius: 22px; transform: translate(-50%, -46%) scale(.98); opacity: 0; max-height: 86vh;
    padding-bottom: 16px; transition: transform .22s var(--ease), opacity .22s; pointer-events: none; }
  .sheet.on { transform: translate(-50%, -50%); opacity: 1; pointer-events: auto; }
  .sheet .grab { display: none; }
  .sheet-foot { bottom: -16px; padding-bottom: 4px; }
  #toast { bottom: 24px; }
  .rgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .rgrid > .card + .card { margin-top: 0; }
  .quick { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 360px) {
  .quick { grid-template-columns: repeat(2, 1fr); }
  .kinds { grid-template-columns: repeat(3, 1fr); }
  .page-h h1 { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
