:root {
  --bg: #F6F4FB;
  --card: #FFFFFF;
  --text: #24264A;
  --muted: #6E7096;
  --line: #E4E1F0;
  --brand: #4A4FA3;
  --brand-ink: #FFFFFF;
  --moon: #F2C866;
  --sleep: #5B63C9;
  --sleep-soft: #E6E7FA;
  --feed: #D9708A;
  --feed-soft: #FBE6EC;
  --settle: #8C6BC8;
  --settle-soft: #EFE7FB;
  --diaper: #3E9C8A;
  --diaper-soft: #DFF3EE;
  --growth: #C98A2E;
  --danger: #C4453A;
  --radius: 18px;
  --shadow: 0 2px 10px rgba(40, 36, 90, 0.07);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14152B;
    --card: #1E2040;
    --text: #ECEBFA;
    --muted: #A2A3C8;
    --line: #2F3160;
    --brand: #8A8FF0;
    --brand-ink: #14152B;
    --sleep: #8E95F2;
    --sleep-soft: #2A2D5E;
    --feed: #F19AB0;
    --feed-soft: #43263A;
    --settle: #B79AF0;
    --settle-soft: #34295A;
    --diaper: #6FD0BD;
    --diaper-soft: #1E3E3B;
    --growth: #E8B35F;
    --danger: #F07A6E;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) 0 calc(76px + env(safe-area-inset-bottom));
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }

#app { max-width: 560px; margin: 0 auto; padding: 12px 16px 24px; }

.top { display: flex; align-items: center; gap: 12px; padding: 6px 0 14px; }
.top img { width: 40px; height: 40px; border-radius: 11px; }
.top .who { flex: 1; min-width: 0; }
.top h1 { font-size: 20px; margin: 0; line-height: 1.2; }
.top .sub { color: var(--muted); font-size: 14px; }
.icon-btn { border: 0; background: var(--card); width: 42px; height: 42px; border-radius: 12px; box-shadow: var(--shadow); font-size: 20px; cursor: pointer; }

.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card h2 { font-size: 15px; margin: 0 0 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.status { display: flex; align-items: center; gap: 14px; }
.status .big { font-size: 26px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.status .emoji { font-size: 38px; }
.next { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--sleep-soft); font-size: 15px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

.act {
  border: 0; border-radius: 16px; padding: 16px 10px; min-height: 76px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-weight: 600; font-size: 15px; text-align: center;
}
.act .e { font-size: 26px; line-height: 1; }
.act:active { transform: scale(.97); }
.act.sleep { background: var(--sleep-soft); color: var(--sleep); }
.act.sleep.on { background: var(--sleep); color: #fff; }
.act.settle { background: var(--settle-soft); color: var(--settle); }
.act.settle.on { background: var(--settle); color: #fff; }
.act.feed { background: var(--feed-soft); color: var(--feed); }
.act.feed.on { background: var(--feed); color: #fff; }
.act.diaper { background: var(--diaper-soft); color: var(--diaper); min-height: 68px; }
.act .t { font-variant-numeric: tabular-nums; font-size: 20px; }
.wide { grid-column: 1 / -1; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--bg); border-radius: 999px; padding: 6px 12px; font-size: 14px; }
.chip b { font-variant-numeric: tabular-nums; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.list li:last-child { border-bottom: 0; }
.list .dot { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; font-size: 18px; }
.list .main { flex: 1; min-width: 0; }
.list .time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; white-space: nowrap; }
.dot.sleep { background: var(--sleep-soft); } .dot.feed { background: var(--feed-soft); }
.dot.settle { background: var(--settle-soft); } .dot.diaper { background: var(--diaper-soft); }
.dot.growth { background: var(--bg); }
.day-h { margin: 18px 4px 6px; font-weight: 700; display: flex; justify-content: space-between; align-items: baseline; }

.btn { border: 0; border-radius: 12px; padding: 12px 16px; background: var(--brand); color: var(--brand-ink); font-weight: 600; cursor: pointer; }
.btn.ghost { background: var(--bg); color: var(--text); }
.btn.danger { background: transparent; color: var(--danger); }
.btn.block { width: 100%; }
.fab { position: fixed; right: max(16px, calc(50% - 264px)); bottom: calc(88px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 18px; font-size: 28px; box-shadow: 0 6px 18px rgba(40, 36, 90, .25); }

label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea { width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1; border: 1px solid var(--line); background: var(--bg); padding: 10px 6px; border-radius: 12px; cursor: pointer; min-width: 70px; }
.seg button.sel { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.err { color: var(--danger); font-size: 14px; min-height: 20px; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center;
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 5;
}
.tabs button { flex: 1; max-width: 140px; border: 0; background: none; padding: 8px 0 10px; font-size: 12px; color: var(--muted); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tabs button span { font-size: 22px; filter: grayscale(1); opacity: .6; }
.tabs button.sel { color: var(--brand); font-weight: 600; }
.tabs button.sel span { filter: none; opacity: 1; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + env(safe-area-inset-bottom));
  background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 14px; z-index: 20;
  display: flex; gap: 14px; align-items: center; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.toast button { background: none; border: 0; color: var(--moon); font-weight: 700; cursor: pointer; }

dialog { border: 0; border-radius: 22px; padding: 0; width: min(520px, calc(100% - 24px)); background: var(--card); color: var(--text); }
dialog::backdrop { background: rgba(10, 10, 30, .45); }
/* Докато има отворен прозорец, страницата отзад не се превърта (на телефона „избягваше“ нагоре). */
html:has(dialog[open]), html:has(dialog[open]) body { overflow: hidden; }
dialog { overscroll-behavior: contain; }
dialog .in { padding: 18px; }
dialog h3 { margin: 0 0 14px; }
dialog .row { display: flex; gap: 10px; }
dialog .row > * { flex: 1; }

.tl { list-style: none; margin: 0; padding: 0; position: relative; }
.tl li { display: flex; gap: 12px; padding: 10px 0; align-items: center; }
.tl .tm { width: 92px; flex: none; font-variant-numeric: tabular-nums; font-weight: 600; }
.tl .lb { flex: 1; }
.tl li.pred .tm, .tl li.pred .lb { color: var(--muted); }
.tl li.pred .lb::after { content: " · прогноза"; font-size: 12px; }
.tl li.nextup { background: var(--sleep-soft); border-radius: 12px; padding: 10px; margin: 0 -10px; }
.tl li.nextup .tm, .tl li.nextup .lb { color: var(--text); }
.tl .ic { width: 28px; text-align: center; }

.ins { padding: 12px 0; border-bottom: 1px solid var(--line); }
.ins:last-child { border-bottom: 0; }
.ev { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-bottom: 4px; }
.ev-strong { background: #DDF2E4; color: #1E7A43; }
.ev-obs { background: #E2ECFB; color: #2F5FA8; }
.ev-heur { background: #FCEFD6; color: #9A6510; }
.ev-personal { background: var(--settle-soft); color: var(--settle); }
@media (prefers-color-scheme: dark) {
  .ev-strong { background: #1D3B2A; color: #8FDCAE; }
  .ev-obs { background: #1D2D4A; color: #9EC0F4; }
  .ev-heur { background: #3D3019; color: #F1C77A; }
}
.src { font-size: 13px; color: var(--muted); }
details summary { cursor: pointer; font-weight: 600; }
.sources li { margin-bottom: 12px; }

.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart .grid { stroke: var(--line); }
.chart .ln { fill: none; stroke-width: 2.5; }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14px; }
.table td, .table th { padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: right; }
.table td:first-child, .table th:first-child { text-align: left; }

/* Профил горе и избор на дете */
.who-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.caret { font-size: 14px; color: var(--muted); }
.av { border-radius: 50%; object-fit: cover; flex: none; display: inline-grid; place-items: center; background: var(--card); box-shadow: var(--shadow); }
.kids li.cur { background: var(--bg); border-radius: 12px; padding-left: 8px; padding-right: 8px; }
.photo-row { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }

/* Снимки */
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.th { position: relative; }
.th img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; display: block; cursor: zoom-in; }
.th button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--danger); color: #fff; font-size: 14px; line-height: 1; cursor: pointer; }
.lbl { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.lightbox { width: auto; max-width: 96vw; background: #000; padding: 8px; text-align: center; }
.lightbox img { max-width: 100%; max-height: 80vh; display: block; margin: 0 auto 8px; border-radius: 10px; }
textarea { resize: vertical; }

/* Здраве */
.act.note { background: var(--settle-soft); color: var(--settle); min-height: 60px; flex-direction: row; gap: 10px; }
.dot.note, .dot.appointment, .dot.pweight, .dot.contraction { background: var(--settle-soft); }

/* Филтри в дневника */
.filters { margin-bottom: 4px; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
.filters .chip { border: 1px solid var(--line); cursor: pointer; white-space: nowrap; background: var(--card); }
.filters .chip.sel { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* Бременност */
.preg-hero { text-align: center; }
.preg-hero .wk { font-size: 20px; }
.preg-hero .wk b { font-size: 48px; line-height: 1.1; }
.preg-hero .wk span { color: var(--muted); }
.progress { height: 10px; background: var(--bg); border-radius: 999px; overflow: hidden; margin: 12px 0 8px; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--feed), var(--settle)); border-radius: 999px; }
.alert { margin-top: 10px; padding: 12px; border-radius: 12px; background: var(--feed-soft); color: var(--text); font-weight: 600; }
.card.warn { border: 2px solid var(--feed-soft); }
.card.warn p { margin: 0 0 8px; }
.born-btn { margin: 6px 0 20px; padding: 16px; font-size: 17px; }

/* Вход, поверителност, код за възстановяване */
.privacy-note { margin-top: 18px; font-size: 13px; color: var(--muted); background: var(--card); border-radius: 14px; padding: 12px; text-align: left; line-height: 1.45; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 12px; font-size: 14px; text-align: left; cursor: pointer; }
.check input { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.rcode { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 17px; font-weight: 700; letter-spacing: .04em; background: var(--bg); border: 2px dashed var(--brand); border-radius: 12px; padding: 12px; margin: 12px 0; text-align: center; word-break: break-all; user-select: all; }
.google-wrap { margin-top: 20px; }
.gbtn { display: flex; justify-content: center; min-height: 44px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 16px 0 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
img.broken { opacity: .3; }

/* Модули */
.mod-row { display: flex; align-items: center; gap: 12px; width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 14px; padding: 12px; margin-bottom: 8px; cursor: pointer; text-align: left; }
.mod-row .mi { font-size: 24px; }
.mod-row .mt { flex: 1; display: flex; flex-direction: column; }
.mod-row .sw { width: 44px; height: 26px; border-radius: 999px; background: var(--line); position: relative; flex: none; transition: background .15s; }
.mod-row .sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.mod-row.on .sw { background: var(--brand); }
.mod-row.on .sw::after { left: 21px; }

/* Админ */
.admin-list li { cursor: default; align-items: flex-start; }
.admin-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.admin-actions .btn { padding: 8px 10px; font-size: 13px; }
.warn-chip { background: var(--feed-soft); color: var(--danger); }

/* Забравен бутон за сън */
.late-link { display: block; margin: 8px auto 0; font-size: 14px; }
.big-time { font-size: 32px; font-weight: 700; text-align: center; margin: 4px 0; font-variant-numeric: tabular-nums; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* Само гледане (баба/дядо) */
body.readonly [data-act="albumAdd"], body.readonly [data-act="addGrowth"], body.readonly [data-first="custom"], body.readonly .fab { display: none !important; }
body.readonly .first, body.readonly .cdc-item, body.readonly .tooth { pointer-events: none; }
.share-kids { margin: 10px 0; }

/* Бебефон */
.monitor { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0; background: #000; color: #fff; overflow: hidden; }
.monitor::backdrop { background: #000; }
.mon-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.mon-video.bright { filter: brightness(1.8) contrast(1.15); }
/* Завъртане: при 90°/270° размерите се разменят, за да се вписва целият кадър */
.mon-video.r90, .mon-video.r270 { inset: auto; top: 50%; left: 50%; width: 100dvh; height: 100vw; }
.mon-video.r90 { transform: translate(-50%, -50%) rotate(90deg); }
.mon-video.r180 { transform: rotate(180deg); }
.mon-video.r270 { transform: translate(-50%, -50%) rotate(270deg); }
.mon-row .btn.ghost { padding: 10px 12px; }
.mon-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 14px 20px; background: linear-gradient(rgba(0,0,0,.65), transparent); }
.mon-status { flex: 1; font-weight: 600; }
.mon-alert { position: absolute; top: 30%; left: 50%; transform: translateX(-50%); background: #d9573f; color: #fff; font-size: 30px; font-weight: 800; padding: 16px 28px; border-radius: 20px; animation: pulse 1s ease-in-out infinite; box-shadow: 0 8px 30px rgba(217, 87, 63, .5); }
@keyframes pulse { 50% { transform: translateX(-50%) scale(1.08); } }
.mon-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 14px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.7)); }
.mon-meter { height: 8px; background: rgba(255,255,255,.2); border-radius: 999px; overflow: hidden; margin-bottom: 12px; }
.mon-meter span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #6FD0BD, #F2C866, #d9573f); transition: width .1s; }
.mon-row { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }
.mon-row .btn.ghost { background: rgba(255,255,255,.15); color: #fff; }
.mon-row select { width: auto; background: rgba(255,255,255,.15); color: #fff; border: 0; margin-left: 6px; }
.mon-dim { position: absolute; inset: 0; background: #000; color: #333; display: grid; place-items: center; font-size: 14px; }

/* Нощен режим: много тъмно и червеникаво, за да не разсънва при нощно хранене */
:root[data-night] {
  --bg: #0b0606; --card: #150b0a; --text: #ff9b7d; --muted: #a8594b; --line: #2a1512;
  --brand: #d9573f; --brand-ink: #0b0606; --moon: #ff9b7d;
  --sleep: #d9573f; --sleep-soft: #2a110d; --feed: #e0704f; --feed-soft: #2d130e;
  --settle: #c4573f; --settle-soft: #24100c; --diaper: #c86a4a; --diaper-soft: #26120d;
  --growth: #d98b4f; --danger: #ff6b4a; --shadow: none; color-scheme: dark;
}
:root[data-night] img { filter: brightness(.7) sepia(.3); }
:root[data-night] .ev { background: #2a110d !important; color: #ff9b7d !important; }

/* Растеж: процентили */
.chart .band { fill: none; stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; opacity: .7; }
.chart .band.mid { stroke-dasharray: none; opacity: .5; }
.chart .band-l { font-size: 9px; fill: var(--muted); }
.pct { margin: 6px 0 0; }
.card-why { background: var(--card); border-radius: var(--radius); padding: 10px 16px; margin: -6px 0 14px; }

/* Първи неща */
.firsts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.first { border: 1px dashed var(--line); background: var(--bg); border-radius: 14px; padding: 10px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; min-width: 0; }
.first .fi { font-size: 24px; filter: grayscale(1); opacity: .5; }
.first .ft { font-size: 12px; font-weight: 600; text-align: center; line-height: 1.2; }
.first .fd { font-size: 11px; color: var(--muted); }
.first.done { border: 1px solid transparent; background: var(--settle-soft); }
.first.done .fi { filter: none; opacity: 1; }

/* Чеклист CDC */
.cdc-cat { margin: 14px 0 6px; font-size: 14px; color: var(--muted); }
.cdc-item { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; background: none; border: 0; padding: 7px 0; cursor: pointer; font-size: 15px; }
.cdc-item .cb { width: 22px; height: 22px; flex: none; border-radius: 6px; border: 2px solid var(--line); display: grid; place-items: center; font-weight: 700; color: var(--brand-ink); }
.cdc-item.done .cb { background: var(--diaper); border-color: var(--diaper); }
.cdc-item.done span:last-child { color: var(--muted); }

/* Зъбки */
.mouth { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 6px 0; }
.jaw { display: flex; gap: 4px; }
.jaw.up { align-items: flex-end; }
.tooth { width: 22px; height: 28px; border: 2px solid var(--line); background: var(--bg); cursor: pointer; padding: 0; }
.jaw.up .tooth { border-radius: 4px 4px 10px 10px; }
.jaw.down .tooth { border-radius: 10px 10px 4px 4px; }
.tooth.molar { width: 28px; }
.tooth.soon { border-color: var(--growth); background: rgba(201, 138, 46, .15); }
.tooth.done { background: #fff; border-color: var(--muted); }

/* Ваксини */
.vax summary { cursor: pointer; font-weight: 600; margin-bottom: 6px; }
.vx-done .dot { background: var(--diaper-soft); color: var(--diaper); }
.vx-due .dot { background: var(--feed-soft); }
.vx-overdue .dot { background: var(--feed-soft); }
.vx-overdue .main { color: var(--danger); }

/* Графики */
.trends summary { cursor: pointer; }
.trends h4 { margin: 14px 0 4px; }

/* Отчет за педиатъра */
.report { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; border-radius: 0; background: #fff; color: #111; }
.rep { max-width: 760px; margin: 0 auto; padding: 18px; font-size: 15px; }
.rep h1 { margin: 0 0 4px; } .rep h2 { font-size: 17px; margin: 22px 0 6px; border-bottom: 1px solid #ddd; padding-bottom: 4px; }
.rep .muted { color: #666; } .rep .table td { border-color: #eee; }
.rep-actions { display: flex; gap: 8px; justify-content: flex-end; position: sticky; top: 0; background: #fff; padding: 6px 0; }
@media print {
  body > *:not(#report) { display: none !important; }
  .report { position: static; display: block; height: auto; }
  .rep-actions { display: none; }
  .rep .th img { width: 90px; height: 90px; }
}

/* Албум */
.album-month .am-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.album-month h2 { margin: 0; text-transform: none; font-size: 17px; color: var(--text); letter-spacing: 0; }
.album-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.ag-item { border: 0; padding: 0; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--bg); cursor: pointer; }
.ag-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pe-img { width: 100%; max-height: 50vh; object-fit: contain; border-radius: 12px; margin-bottom: 12px; background: #000; }
.month-card { text-align: center; background: linear-gradient(135deg, var(--feed-soft), var(--settle-soft)); }
.month-card .mc-emoji { font-size: 44px; line-height: 1; }
.month-card h3 { margin: 8px 0 4px; font-size: 20px; }

/* Слайдшоу на цял екран */
.slideshow { width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0; background: #000; color: #fff; overflow: hidden; }
.slideshow::backdrop { background: #000; }
.ss-stage { position: absolute; inset: 0; }
.ss-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity 1s ease; }
.ss-img.on { opacity: 1; }
.ss-img.kb { animation: kenburns 6s ease-out forwards; }
@keyframes kenburns { from { transform: scale(1); } to { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .ss-img.kb { animation: none; } .ss-img { transition: none; } }
.ss-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 14px 24px; background: linear-gradient(rgba(0,0,0,.6), transparent); }
.ss-title { font-weight: 700; flex: 1; }
.ss-count { opacity: .8; font-variant-numeric: tabular-nums; font-size: 14px; }
.ss-cap { position: absolute; left: 0; right: 0; bottom: calc(76px + env(safe-area-inset-bottom)); text-align: center; padding: 24px 16px 8px; background: linear-gradient(transparent, rgba(0,0,0,.6)); font-size: 15px; }
.ss-cap span { opacity: .8; font-size: 13px; }
.ss-ctrl { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 18px; padding: 12px 0 calc(14px + env(safe-area-inset-bottom)); }
.ss-btn { width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255,255,255,.18); color: #fff; font-size: 20px; cursor: pointer; }
.tabs button { font-size: 11px; }

/* Обяснения под съветите („Какво значи?“) */
.explained li { margin-bottom: 8px; }
details.why { margin: 4px 0 2px; }
details.why summary { font-weight: 500; font-size: 14px; color: var(--brand); list-style: none; cursor: pointer; }
details.why summary::-webkit-details-marker { display: none; }
details.why summary::before { content: 'ℹ️ '; }
details.why[open] { background: var(--bg); border-radius: 12px; padding: 8px 12px; }
details.why p { font-size: 14px; margin: 6px 0; }

/* Захранване */
.atiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.atile { border: 1px solid var(--line); background: var(--bg); border-radius: 14px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; text-align: center; min-width: 0; }
.atile .ai { font-size: 24px; }
.atile .an { font-weight: 600; font-size: 13px; line-height: 1.2; }
.atile .as { font-size: 11px; color: var(--muted); line-height: 1.2; }
.atile.ok { background: var(--diaper-soft); border-color: transparent; }
.atile.ok .as { color: var(--diaper); }
.atile.reaction { background: var(--feed-soft); border-color: var(--danger); }
.atile.reaction .as { color: var(--danger); font-weight: 600; }
.atile.pending { border-style: dashed; border-color: var(--settle); }
.atile.keep { box-shadow: inset 0 0 0 2px var(--growth); }
.seg.wrap button { flex: 0 1 auto; }
.seg.multi button { font-size: 14px; }
.fu-card { border: 2px solid var(--settle); }
.danger-t { color: var(--danger); }
.dot.food { background: var(--diaper-soft); }
.dot.food.mild, .dot.food.severe { background: var(--feed-soft); }
.emergency h3 { color: var(--danger); }

/* Часове за лекарства (часовници) */
.time-list { display: grid; gap: 8px; }
.time-item { display: flex; align-items: center; gap: 8px; }
.time-item .tnum { width: 22px; color: var(--muted); font-weight: 600; text-align: right; }
.time-item input[type="time"] { flex: 1; font-size: 20px; font-weight: 600; padding: 10px 12px; font-variant-numeric: tabular-nums; }
.t-rm { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--danger); font-size: 22px; cursor: pointer; flex: none; }
.presets button.sel { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* Лечение */
.push-card.on { border: 1px solid var(--diaper); }
.push-card.quiet { background: transparent; box-shadow: none; border: 1px dashed var(--line); }
.dose-card.is-due { border: 2px solid var(--feed); }
.dose-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; }
.ill-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.ill-head h3 { margin: 0 0 2px; font-size: 18px; }
.med { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.med-head { display: flex; gap: 10px; cursor: pointer; }
.med-ic { font-size: 20px; }
.slots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.slot { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 8px 12px; font-variant-numeric: tabular-nums; cursor: pointer; font-weight: 600; }
.slot.given { background: var(--diaper-soft); color: var(--diaper); border-color: transparent; }
.slot.skipped { opacity: .6; text-decoration: line-through; }
.slot.missed { background: var(--feed-soft); color: var(--danger); border-color: var(--danger); }
.slot.due { background: var(--feed); color: #fff; border-color: transparent; }
.prn { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.presets button { min-width: 0; font-size: 13px; }
dialog h4 { margin: 14px 0 4px; }
.tabs button { min-width: 0; }

.auth { max-width: 380px; margin: 8vh auto 0; text-align: center; }
.auth img { width: 96px; height: 96px; border-radius: 26px; }
.auth h1 { margin: 12px 0 4px; font-size: 30px; }
.auth form { text-align: left; margin-top: 22px; }
.linkbtn { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 10px; }

/* Език: бутон горе и на екрана за вход; линк-бутоните изглеждат като другите бутони */
.lang-btn { font-size: 14px; font-weight: 700; color: var(--text); }
.auth { position: relative; }
.auth-lang { position: absolute; top: -6vh; right: 0; font-weight: 600; }
.auth-lang .linkbtn[disabled] { color: var(--text); text-decoration: none; opacity: .5; cursor: default; }
a.btn { display: block; box-sizing: border-box; text-align: center; text-decoration: none; font: inherit; font-weight: 600; }

/* Админ: отчет за ползването */
.adm-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 12px; }
.adm-tile { background: var(--bg); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.adm-tile b { font-size: 22px; line-height: 1.1; color: var(--brand); }
.adm-tile span { font-size: 13px; font-weight: 600; }
.adm-tile small { font-size: 11px; color: var(--muted); }
.adm-chart { display: flex; align-items: flex-end; gap: 2px; height: 70px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.adm-bar { flex: 1; height: 100%; position: relative; display: flex; align-items: flex-end; }
.adm-bar i { position: absolute; bottom: 0; left: 0; right: 0; background: var(--sleep-soft); border-radius: 3px 3px 0 0; }
.adm-bar i.rec { left: 25%; right: 25%; background: var(--brand); }
.adm-bar em { position: absolute; top: -2px; left: 50%; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--feed); }
.adm-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--sleep-soft); vertical-align: middle; }
.adm-key.rec { background: var(--brand); }
.adm-key.new { background: var(--feed); border-radius: 50%; }
@media (max-width: 380px) { .adm-tiles { grid-template-columns: repeat(2, 1fr); } }