/* ───────────────────────── Fedor: оформление ─────────────────────────
   Светлая и тёмная темы: «авто» следует за телефоном, а выбор в «Ещё» переопределяет его через data-theme. */

:root {
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #eff1f8;
  --border: #e2e5f0;
  --text: #14172f;
  --muted: #5d6483;
  --accent: #4f46e5;
  --accent-strong: #4338ca;
  --accent-soft: #ecebfd;
  --on-accent: #ffffff;
  --ok: #097a4c;
  --ok-bg: #e3f6ec;
  --warn: #b45309;
  --warn-bg: #fff4dc;
  --warn-border: #f0d49a;
  --danger: #d92d20;
  --danger-bg: #fdeceb;
  --shadow: 0 1px 2px rgba(20, 23, 47, .05), 0 6px 20px rgba(20, 23, 47, .05);
  --shadow-fab: 0 10px 26px rgba(79, 70, 229, .38);
  --radius: 20px;
  --radius-s: 14px;
  --sidebar-w: 248px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0c0d1b;
  --surface: #15172e;
  --surface-2: #1d2043;
  --border: #292d56;
  --text: #eef0ff;
  --muted: #9aa0c6;
  --accent: #8e90ff;
  --accent-strong: #a9aaff;
  --accent-soft: #25285a;
  --on-accent: #0c0d1b;
  --ok: #5fd39a;
  --ok-bg: #11301f;
  --warn: #ffb25b;
  --warn-bg: #2b2411;
  --warn-border: #5a4a1d;
  --danger: #ff8a80;
  --danger-bg: #3a1b20;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .28);
  --shadow-fab: 0 10px 26px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0d1b;
    --surface: #15172e;
    --surface-2: #1d2043;
    --border: #292d56;
    --text: #eef0ff;
    --muted: #9aa0c6;
    --accent: #8e90ff;
    --accent-strong: #a9aaff;
    --accent-soft: #25285a;
    --on-accent: #0c0d1b;
    --ok: #5fd39a;
    --ok-bg: #11301f;
    --warn: #ffb25b;
    --warn-bg: #2b2411;
    --warn-border: #5a4a1d;
    --danger: #ff8a80;
    --danger-bg: #3a1b20;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .28);
    --shadow-fab: 0 10px 26px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; font-size: .9em; }
a { color: var(--accent); }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); }
.center { text-align: center; }
.stack > * + * { margin-top: 14px; }
.link { color: var(--accent); }

/* ── каркас ── */
.shell { min-height: 100vh; min-height: 100dvh; }
.main-col { min-width: 0; }

/* шапка как в iPhone: прилипает только тонкая строка «назад» + кнопки; крупный заголовок уезжает со страницей,
   а когда он скрылся под строкой — в ней проступает маленький заголовок (класс title-gone ставит app.js) */
.appbar { padding: 0 18px 10px; }
.appbar-bar {
  position: sticky; top: 0; z-index: 20; padding: env(safe-area-inset-top) 18px 0;
  border-bottom: 1px solid transparent; transition: background-color .2s, border-color .2s;
}
.appbar-bar-inner { max-width: 760px; margin: 0 auto; min-height: var(--bar-h, 50px); display: flex; align-items: center; gap: 8px; }
.appbar-bar .back-link { flex: none; margin: 0 0 0 -10px; }
.appbar-mini { flex: 1; min-width: 0; text-align: center; font-weight: 700; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transition: opacity .18s; }
.appbar-actions { flex: none; display: flex; gap: 4px; align-items: center; margin-right: -8px; }
.scrolled .appbar-bar { background: color-mix(in srgb, var(--bg) 86%, transparent); border-bottom-color: var(--border);
  backdrop-filter: blur(18px) saturate(170%); -webkit-backdrop-filter: blur(18px) saturate(170%); }
.title-gone .appbar-mini { opacity: 1; }
.appbar-bar.is-empty { margin-bottom: calc(-1 * var(--bar-h, 50px)); pointer-events: none; }   /* пустая строка лежит поверх отступа и места не занимает */
.appbar-inner { max-width: 760px; margin: 0 auto; }
.is-empty + .appbar .appbar-inner { padding-top: 14px; }
.appbar h1 { font-size: 1.75rem; line-height: 1.15; letter-spacing: -.025em; font-weight: 750; overflow-wrap: break-word; }
.appbar-sub { color: var(--muted); font-size: .92rem; margin-top: 2px; }
@media (prefers-reduced-motion: reduce) { .appbar-bar, .appbar-mini { transition: none; } }

.page { max-width: 760px; margin: 0 auto; padding: 6px 18px calc(var(--nav-top) + 48px); }
.card-title { display: flex; align-items: center; }

.mark { display: block; width: 34px; height: 34px; border-radius: 11px; object-fit: cover; background: var(--accent-soft); }
.brand-name { font-weight: 750; letter-spacing: .01em; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .nav-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; font-size: 1.15rem; }
  .page { padding-bottom: 120px; }
  :root { --bar-h: 58px; }
  .is-empty + .appbar .appbar-inner { padding-top: 26px; }
}

/* ── кнопки ── */
.btn {
  font: inherit; font-weight: 650; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 18px; border-radius: var(--radius-s);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-danger { color: var(--danger); }
.btn-small { min-height: 38px; padding: 6px 14px; font-size: .9rem; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 44px; min-height: 44px; padding: 0; border-radius: 14px; }
.btn-chip { min-height: 36px; padding: 5px 13px; font-size: .88rem; border-radius: 999px; background: var(--surface-2); border-color: transparent; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 2px; }


/* ── карточки и списки ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.card-alert { background: var(--warn-bg); border-color: var(--warn-border); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 6px; }
.card-title { font-size: 1.02rem; font-weight: 700; }
.pad { padding: 18px; }
.section-label { font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 22px 4px 8px; }
.count { color: var(--muted); font-weight: 600; font-size: .9rem; margin-left: 6px; }
.empty { padding: 26px 20px; text-align: center; color: var(--muted); }
.empty .i { width: 34px; height: 34px; margin-bottom: 8px; color: var(--accent); }
.empty em { color: var(--text); font-style: normal; font-weight: 600; }
.chip { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; max-width: 100%; background: var(--surface-2); border-radius: 999px; padding: 2px 10px; font-size: .78rem; font-weight: 600; color: var(--muted); }
.chip .i { width: 14px; height: 14px; }

.list { list-style: none; margin: 0; padding: 0; }
.rem { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--border); }
.rem-actions .btn-icon { width: 40px; min-height: 40px; border-radius: 12px; }
@media (min-width: 500px) { .rem { grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; padding: 14px 16px; } .rem-actions .btn-icon { width: 44px; min-height: 44px; } }
.card-head + .list .rem:first-child, .section-card > .list > .rem:first-child { border-top: 0; }
.rem-time { text-align: center; }
.rem-time b { display: block; font-size: 1.12rem; letter-spacing: -.01em; }
.rem-time span { display: block; font-size: .72rem; color: var(--muted); font-weight: 600; margin-top: 1px; }
.rem-title { font-weight: 650; overflow-wrap: anywhere; }
.rem-meta { color: var(--muted); font-size: .84rem; margin-top: 3px; display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.rem-actions { display: flex; gap: 6px; }
.late { color: var(--warn); font-weight: 650; }
.rem-done .rem-title { font-weight: 500; color: var(--muted); }
.rem-fired { padding: 14px 18px; border-top: 1px solid var(--warn-border); }
.rem-fired:first-of-type { border-top: 0; }
.rem-fired .rem-title { font-size: 1.02rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* ── сообщения ── */
.flash { padding: 12px 16px; border-radius: var(--radius-s); margin: 4px 0 16px; font-weight: 600; font-size: .95rem; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--danger-bg); color: var(--danger); }
.notice { background: var(--warn-bg); border: 1px solid var(--warn-border); padding: 12px 14px; border-radius: var(--radius-s); font-size: .92rem; margin-bottom: 14px; }
.hint { color: var(--muted); font-size: .82rem; }
.ok-text { color: var(--ok); font-weight: 650; }
.warn-text { color: var(--warn); font-weight: 650; }

/* ── формы ── */
.field { display: block; }
.field > span { display: block; font-size: .84rem; color: var(--muted); margin-bottom: 5px; font-weight: 650; }
.field input, .field select, .field textarea, .input {
  font: inherit; width: 100%; min-width: 0; max-width: 100%; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-s); padding: 12px 14px; min-height: 48px; display: block;
  -webkit-appearance: none; appearance: none;
}
.field select {
  padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 22px) 54%, calc(100% - 16px) 54%; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat;
}
.field textarea, textarea.input { resize: vertical; line-height: 1.45; }
.field input[type="datetime-local"] { min-width: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; color: var(--muted); }
.check input { margin-top: 3px; width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
.pickers { display: flex; gap: 10px; flex-wrap: wrap; }
.picker { cursor: pointer; }
.form-actions { display: flex; gap: 10px; }
.form-actions .btn-primary { flex: 1; }
.search { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.search-box { position: relative; flex: 1; }
.search-box .i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 20px; height: 20px; }
.search-box input { padding-left: 44px; }

/* ── выезжающее окошко (добавить напоминание, запись) ── */
dialog.sheet {
  border: 0; padding: 0; width: 100%; max-width: 560px; background: var(--surface); color: var(--text);
  border-radius: 26px 26px 0 0; margin: auto 0 0; margin-inline: auto; max-height: 92vh; max-height: 92dvh; overflow: auto;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, .25);
}
dialog.sheet::backdrop { background: rgba(8, 9, 24, .55); backdrop-filter: blur(3px); }
.sheet-grab { width: 42px; height: 5px; border-radius: 3px; background: var(--border); margin: 10px auto 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px 4px; }
.sheet-head h2 { font-size: 1.25rem; letter-spacing: -.015em; }
.sheet-body { padding: 8px 20px calc(22px + env(safe-area-inset-bottom)); }
.sheet-body > * + * { margin-top: 14px; }
.sheet-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 700px) { dialog.sheet { margin: auto; border-radius: 26px; } .sheet-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.more-toggle { display: flex; align-items: center; gap: 8px; color: var(--accent); font-weight: 650; font-size: .92rem; background: none; border: 0; padding: 4px 0; cursor: pointer; font-family: inherit; }
.more-toggle .i { width: 16px; height: 16px; transition: transform .15s; }
.more-toggle[aria-expanded="true"] .i { transform: rotate(90deg); }

/* ── память ── */
.mem-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.mem { display: grid; gap: 5px; padding: 15px 17px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: inherit; text-decoration: none; }
.mem:hover { border-color: var(--accent); }
.mem-title { font-weight: 700; overflow-wrap: anywhere; }
.mem-snippet { color: var(--muted); font-size: .92rem; overflow-wrap: anywhere; }
.mem-meta { color: var(--muted); font-size: .82rem; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mem-docs { display: flex; flex-wrap: wrap; gap: 6px; }
.mem-thumbs { display: flex; gap: 6px; margin-bottom: 6px; }
.mem-thumbs img { width: 84px; height: 84px; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); }
.item-h1 { font-size: 1.35rem; margin: 0 0 6px; overflow-wrap: anywhere; letter-spacing: -.015em; }
.note-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 14px 0; line-height: 1.6; }
.photo { display: block; margin: 12px 0; }
.photo img { width: 100%; height: auto; border-radius: 14px; border: 1px solid var(--border); display: block; }
.doc-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.ref { color: var(--accent); font-weight: 700; text-decoration: none; }
.answer .section-label { margin-top: 18px; }

/* ── настройки ── */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 14px; padding: 15px 18px; border-top: 1px solid var(--border); color: inherit; text-decoration: none; background: none; width: 100%; font: inherit; text-align: left; border-left: 0; border-right: 0; border-bottom: 0; cursor: pointer; }
.rows > li:first-child .row, .card > .row:first-child { border-top: 0; }
.row:hover { background: var(--surface-2); }
.row-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.row-text { flex: 1; min-width: 0; }
.row-title { font-weight: 650; }
.row-sub { color: var(--muted); font-size: .84rem; }
.row > .i:last-child { color: var(--muted); width: 18px; height: 18px; }
/* устройства с уведомлениями (как «Активные сеансы» Telegram): строка + кнопки под текстом, на одной линии с ним */
.dev + .dev { border-top: 1px solid var(--border); }
.dev .row { border-top: 0; padding-bottom: 8px; cursor: default; align-items: flex-start; }
.dev .row:hover { background: none; }
.dev-this { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft);
  color: var(--accent); font-size: .72rem; font-weight: 700; vertical-align: 2px; }
.dev-meta { font-size: .78rem; }
.dev-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px 14px 70px; }
.dev-actions form, .row-test { margin: 0; }
.dev-del { color: var(--danger); }
@media (max-width: 480px) { .dev-actions { padding-left: 18px; } }   /* на телефоне обе кнопки в одну строку */
@media (max-width: 359px) { .dev-actions { gap: 4px; padding-left: 12px; padding-right: 12px; } .dev-actions .btn { padding-left: 11px; padding-right: 11px; } }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: var(--surface-2); padding: 5px; border-radius: 16px; }
.seg { border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 650; font-size: .9rem; padding: 10px 6px; border-radius: 12px; cursor: pointer; display: grid; justify-items: center; gap: 4px; }
.seg[aria-pressed="true"] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
.meter { height: 9px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin: 10px 0 6px; }
.meter > i { display: block; height: 100%; border-radius: 6px; background: var(--accent); }
.meter.warn > i { background: var(--warn); }
.meter.bad > i { background: var(--danger); }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.stat { background: var(--surface-2); border-radius: var(--radius-s); padding: 12px 14px; }
.stat b { display: block; font-size: 1.15rem; letter-spacing: -.01em; }
.stat span { color: var(--muted); font-size: .8rem; }
.push-body { padding: 4px 18px 16px; }
.push-body p { margin: 4px 0 10px; }
.pad > .hint, .push-body .hint { margin-top: 10px; }
.push-ok { color: var(--ok); font-weight: 650; }
.push-warn { color: var(--warn); font-weight: 650; }

.qr { background: #fff; width: 232px; max-width: 100%; padding: 8px; border-radius: 14px; margin: 10px 0; }
.qr svg { display: block; width: 100%; height: auto; }
.secret { display: inline-block; font-size: 1.05rem; letter-spacing: .06em; padding: 6px 10px; word-break: break-all; }
.codes { list-style: none; margin: 12px 0 18px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.codes li code { display: block; text-align: center; font-size: 1.05rem; padding: 9px; }

.meter > i.w0 { width: 0%; }
.meter > i.w1 { width: 1%; }
.meter > i.w2 { width: 2%; }
.meter > i.w3 { width: 3%; }
.meter > i.w4 { width: 4%; }
.meter > i.w5 { width: 5%; }
.meter > i.w6 { width: 6%; }
.meter > i.w7 { width: 7%; }
.meter > i.w8 { width: 8%; }
.meter > i.w9 { width: 9%; }
.meter > i.w10 { width: 10%; }
.meter > i.w11 { width: 11%; }
.meter > i.w12 { width: 12%; }
.meter > i.w13 { width: 13%; }
.meter > i.w14 { width: 14%; }
.meter > i.w15 { width: 15%; }
.meter > i.w16 { width: 16%; }
.meter > i.w17 { width: 17%; }
.meter > i.w18 { width: 18%; }
.meter > i.w19 { width: 19%; }
.meter > i.w20 { width: 20%; }
.meter > i.w21 { width: 21%; }
.meter > i.w22 { width: 22%; }
.meter > i.w23 { width: 23%; }
.meter > i.w24 { width: 24%; }
.meter > i.w25 { width: 25%; }
.meter > i.w26 { width: 26%; }
.meter > i.w27 { width: 27%; }
.meter > i.w28 { width: 28%; }
.meter > i.w29 { width: 29%; }
.meter > i.w30 { width: 30%; }
.meter > i.w31 { width: 31%; }
.meter > i.w32 { width: 32%; }
.meter > i.w33 { width: 33%; }
.meter > i.w34 { width: 34%; }
.meter > i.w35 { width: 35%; }
.meter > i.w36 { width: 36%; }
.meter > i.w37 { width: 37%; }
.meter > i.w38 { width: 38%; }
.meter > i.w39 { width: 39%; }
.meter > i.w40 { width: 40%; }
.meter > i.w41 { width: 41%; }
.meter > i.w42 { width: 42%; }
.meter > i.w43 { width: 43%; }
.meter > i.w44 { width: 44%; }
.meter > i.w45 { width: 45%; }
.meter > i.w46 { width: 46%; }
.meter > i.w47 { width: 47%; }
.meter > i.w48 { width: 48%; }
.meter > i.w49 { width: 49%; }
.meter > i.w50 { width: 50%; }
.meter > i.w51 { width: 51%; }
.meter > i.w52 { width: 52%; }
.meter > i.w53 { width: 53%; }
.meter > i.w54 { width: 54%; }
.meter > i.w55 { width: 55%; }
.meter > i.w56 { width: 56%; }
.meter > i.w57 { width: 57%; }
.meter > i.w58 { width: 58%; }
.meter > i.w59 { width: 59%; }
.meter > i.w60 { width: 60%; }
.meter > i.w61 { width: 61%; }
.meter > i.w62 { width: 62%; }
.meter > i.w63 { width: 63%; }
.meter > i.w64 { width: 64%; }
.meter > i.w65 { width: 65%; }
.meter > i.w66 { width: 66%; }
.meter > i.w67 { width: 67%; }
.meter > i.w68 { width: 68%; }
.meter > i.w69 { width: 69%; }
.meter > i.w70 { width: 70%; }
.meter > i.w71 { width: 71%; }
.meter > i.w72 { width: 72%; }
.meter > i.w73 { width: 73%; }
.meter > i.w74 { width: 74%; }
.meter > i.w75 { width: 75%; }
.meter > i.w76 { width: 76%; }
.meter > i.w77 { width: 77%; }
.meter > i.w78 { width: 78%; }
.meter > i.w79 { width: 79%; }
.meter > i.w80 { width: 80%; }
.meter > i.w81 { width: 81%; }
.meter > i.w82 { width: 82%; }
.meter > i.w83 { width: 83%; }
.meter > i.w84 { width: 84%; }
.meter > i.w85 { width: 85%; }
.meter > i.w86 { width: 86%; }
.meter > i.w87 { width: 87%; }
.meter > i.w88 { width: 88%; }
.meter > i.w89 { width: 89%; }
.meter > i.w90 { width: 90%; }
.meter > i.w91 { width: 91%; }
.meter > i.w92 { width: 92%; }
.meter > i.w93 { width: 93%; }
.meter > i.w94 { width: 94%; }
.meter > i.w95 { width: 95%; }
.meter > i.w96 { width: 96%; }
.meter > i.w97 { width: 97%; }
.meter > i.w98 { width: 98%; }
.meter > i.w99 { width: 99%; }
.meter > i.w100 { width: 100%; }
.spaced { margin-top: 18px; }
.foot { margin: 8px 0 20px; }
.small { font-size: .85rem; font-weight: 500; margin-left: 8px; }
.search .field { margin: 0; }
details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary .card-title::before { content: "▸"; display: inline-block; margin-right: 8px; color: var(--muted); transition: transform .15s; }
details.card[open] > summary .card-title::before { transform: rotate(90deg); }
details.card > .list, details.card > form { border-top: 1px solid var(--border); }
.history-tools { display: flex; justify-content: flex-end; padding: 4px 10px; }
.exact > summary.more-toggle { list-style: none; cursor: pointer; }

/* ── чат ── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.chatbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.select-field { flex: 1; min-width: 180px; }
.select-field select { min-height: 44px; padding-top: 8px; padding-bottom: 8px; font-weight: 650; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 650; font-size: .92rem; position: relative; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { width: 48px; height: 29px; border-radius: 15px; background: var(--border); position: relative; transition: background .15s; flex: none; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 23px; height: 23px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.switch input:checked + .switch-ui { background: var(--accent); }
.switch input:checked + .switch-ui::after { transform: translateX(19px); }
.switch input:focus-visible + .switch-ui { outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 2px; }
.chat-hint { margin: 2px 4px 14px; }
.chat-log { display: flex; flex-direction: column; gap: 14px; padding-bottom: 130px; }
.chat-empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.chat-empty .avatar-big { display: block; width: 88px; height: 88px; margin: 0 auto 14px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent), var(--shadow); }
.avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--border); }
.msg { display: flex; flex-direction: column; max-width: 92%; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg.assistant { align-self: flex-start; display: grid; grid-template-columns: 30px minmax(0, 1fr); column-gap: 10px; justify-items: start; }
.msg.assistant > * { grid-column: 2; }
.msg.assistant > .avatar { grid-column: 1; grid-row: 1; margin-top: 4px; }
.bubble { padding: 11px 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); overflow-wrap: anywhere; line-height: 1.5; box-shadow: var(--shadow); }
.msg.user .bubble { background: var(--accent); color: var(--on-accent); border-color: transparent; border-bottom-right-radius: 7px; white-space: pre-wrap; }
.msg.assistant .bubble { border-bottom-left-radius: 7px; }
.bubble p { margin: 0 0 .6em; } .bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: .3em 0 .6em; padding-left: 1.3em; }
.bubble pre { background: var(--surface-2); padding: 10px 12px; border-radius: 12px; overflow: auto; font-size: .85rem; margin: .5em 0; }
.bubble pre code { background: none; padding: 0; }
.bubble.error { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }
.bubble.error .actions { margin-top: 10px; }
.msg-meta { font-size: .74rem; color: var(--muted); margin: 4px 8px 0; }
.src-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 4px 0; }
.src-row .chip { text-decoration: none; }
.src-row .chip-strong { background: var(--accent-soft); color: var(--accent); }
.chip-meaning { background: var(--accent-soft); color: var(--accent); }
.typing .bubble { display: flex; gap: 5px; padding: 15px 18px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite ease-in-out; }
.dot:nth-child(2) { animation-delay: .2s; } .dot:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: scale(.85); } 40% { opacity: 1; transform: scale(1); } }
.composer2 {
  position: fixed; left: 0; right: 0; z-index: 26; bottom: calc(var(--nav-top));
  padding: 10px 14px; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--border);
}
.composer2-inner { max-width: 760px; margin: 0 auto; display: flex; gap: 10px; align-items: flex-end; }
.composer2 textarea {
  flex: 1; min-width: 0; resize: none; max-height: 140px; font: inherit; line-height: 1.4; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 23px; padding: 12px 18px; min-height: 48px; display: block;
}
.send { width: 48px; height: 48px; flex: none; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; cursor: pointer; }
.send:active { transform: scale(.94); }
.page-chat .page { padding-bottom: calc(var(--nav-top) + 40px); }
.chat-history .hist-row { display: flex; align-items: center; gap: 8px; padding: 10px 4px; border-top: 1px solid var(--border); }
.chat-history .hist-row .row-text { text-decoration: none; color: inherit; }
@media (min-width: 900px) { .composer2 { left: var(--sidebar-w); bottom: 0; padding: 16px 28px 22px; } }

/* ── вход ── */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 22px; }
.login-card { width: 100%; max-width: 390px; background: var(--surface); border: 1px solid var(--border); border-radius: 26px; box-shadow: var(--shadow); padding: 30px 24px; }
.brand-big { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; font-size: 1.6rem; }
.brand-big .mark { width: 96px; height: 96px; border-radius: 50%; box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent), var(--shadow); }
.login-card .muted { margin: 8px 0 22px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ── лимиты и экономия ── */
.preset-row > form { display: contents; }
.preset-hints { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 4px; font-size: .84rem; color: var(--muted); }
.preset-hints li.on { color: var(--text); }
.plain-list { margin: 6px 0 0; padding-left: 1.2em; font-weight: 500; }
.switch-block { display: flex; align-items: flex-start; gap: 12px; }
.switch-block .switch-text { flex: 1; }
.prog-row { margin: 12px 0 0; }
.balance-box { margin-top: 12px; display: grid; gap: 4px; font-size: .92rem; }
.balance-box p { margin: 0; }
.field .hint { display: block; margin: 6px 0 0; }
.sticky-actions { position: sticky; bottom: calc(var(--nav-top) + 12px); z-index: 5; padding: 10px 0 4px; background: linear-gradient(to top, var(--bg) 70%, transparent); }
.sticky-actions .btn { width: 100%; box-shadow: var(--shadow); }
@media (min-width: 900px) { .sticky-actions { position: static; background: none; padding: 0; } .sticky-actions .btn { width: auto; } }
#depth-field { min-width: 150px; flex: 1 1 150px; }

/* ── «Выбрать» и «Отменить» ── */
.flash { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.flash-undo { margin: 0; flex: none; }
.flash-undo .btn { background: transparent; border-color: currentColor; color: inherit; }
.sel-box { display: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--muted); flex: none; place-items: center; transition: background .12s, border-color .12s; }
.sel-box::after { content: ""; width: 11px; height: 6px; border-left: 2.5px solid #fff; border-bottom: 2.5px solid #fff; transform: rotate(-45deg) translate(1px, -1px); opacity: 0; }
.selecting .sel-box { display: grid; }
.selecting .sel-row { cursor: pointer; user-select: none; -webkit-user-select: none; }
.sel-row.selected { background: var(--accent-soft); }
.sel-row.selected .sel-box { background: var(--accent); border-color: var(--accent); }
.sel-row.selected .sel-box::after { opacity: 1; }
.selecting .rem { grid-template-columns: 28px 54px minmax(0, 1fr) auto; }
@media (min-width: 500px) { .selecting .rem { grid-template-columns: 28px 64px minmax(0, 1fr) auto; } }
.selecting .rem-actions { opacity: .35; pointer-events: none; }
.mem-list > li.sel-row { display: flex; align-items: center; gap: 12px; border-radius: var(--radius); }
.mem-list > li.sel-row > .mem { flex: 1; min-width: 0; }
.row-link { display: flex; align-items: center; gap: 12px; padding: 14px 16px; color: inherit; text-decoration: none; min-width: 0; flex: 1; }
.sel-row.item { display: flex; align-items: center; gap: 12px; padding: 0 16px; border-top: 1px solid var(--border); }
.sel-row.item .row-link { padding-left: 0; padding-right: 0; }
.rows > li:first-child .sel-row.item, .item-list > li:first-child.sel-row { border-top: 0; }
.item-list { list-style: none; margin: 0; padding: 0; }
.item-title { font-weight: 650; overflow-wrap: anywhere; }
.item-sub { color: var(--muted); font-size: .86rem; margin-top: 2px; overflow-wrap: anywhere; }
.pin-mark { color: var(--accent); width: 15px; height: 15px; vertical-align: -2px; }
.msg-actions { display: flex; gap: 4px; margin: 2px 0 0 4px; }
.msg-actions .btn { min-height: 32px; padding: 3px 10px; font-size: .8rem; border-radius: 10px; background: transparent; color: var(--muted); border-color: transparent; }
.msg-actions .btn:hover { background: var(--surface-2); color: var(--text); }
.msg-actions .i { width: 15px; height: 15px; }
.banner { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: var(--radius-s); background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: .9rem; margin-bottom: 10px; }
.banner .i { width: 18px; height: 18px; flex: none; }
.warn-note { color: var(--warn); font-weight: 600; }
.model-pick { width: 100%; justify-content: space-between; text-align: left; }
.pick-list { display: grid; gap: 8px; margin-top: 6px; }
.pick-list .btn { justify-content: flex-start; text-align: left; min-height: 48px; }
.pick-list .btn small { display: block; color: var(--muted); font-weight: 500; }
.danger-zone { margin-top: 22px; }
.provider-row { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--border); }
.provider-row:first-child { border-top: 0; }
.provider-row .row-text { flex: 1; min-width: 0; }
.provider-row form { margin: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; }
.section-head .btn { text-transform: none; letter-spacing: 0; }
.item-action { margin: 0; flex: none; }
.selecting .item-action { display: none; }
.pad-text { padding: 14px 18px 4px; margin: 0; }
.page-ai .field select { max-width: 100%; }
.item-title, .item-sub { display: block; }
.item-sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mem-list > li.sel-row.selected { background: none; }
.mem-list > li.sel-row.selected > .mem { border-color: var(--accent); background: var(--accent-soft); }
.mem-list > li.sel-row .sel-box { margin-left: 2px; }

/* ── панель выбора: на телефоне занимает место нижней панели, как панель инструментов в iOS ── */
.selbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border); box-shadow: 0 -6px 24px rgba(0, 0, 0, .14); }
.selbar[hidden] { display: none; }
.selbar-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; }
.selbar .count { font-weight: 700; }
.selbar-actions { display: flex; gap: 6px; margin-top: 4px; }
.selbar-actions .btn { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 3px; min-height: 54px; padding: 6px 4px; font-size: .76rem; line-height: 1.15; border-radius: 14px; white-space: normal; text-align: center; }
.selbar-actions .btn .i { width: 22px; height: 22px; }
.selbar .btn:disabled { opacity: .4; }
@media (max-width: 899px) { .is-selecting .nav { display: none; } }
@media (min-width: 900px) { .selbar { left: var(--sidebar-w); } .selbar-actions .btn { flex-direction: row; min-height: 44px; font-size: .9rem; } }
.selbar-top, .selbar-actions { max-width: 724px; margin-left: auto; margin-right: auto; }
.is-selecting .page { padding-bottom: calc(190px + env(safe-area-inset-bottom)); }

/* ── долгое нажатие на строку не должно вызывать меню телефона ── */
.sel-row, .sel-row a { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.sel-row a { -webkit-user-drag: none; }

/* ── «назад» на вложенных экранах и карточка аккаунта ── */
.back-link { display: inline-flex; align-items: center; gap: 0; margin: -6px 0 2px -10px; padding: 8px 14px 8px 6px; min-height: 44px; border-radius: 14px;
  color: var(--accent); font-weight: 650; font-size: 1.02rem; text-decoration: none; }
.back-link .i { width: 26px; height: 26px; stroke-width: 2.2; }
.back-link:active { background: var(--accent-soft); }
.account-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.account-row .row-text { flex: 1; min-width: 0; }
.account-row form { margin: 0; }
.account-row .mark { width: 46px; height: 46px; border-radius: 50%; }
.chatbar > .select-field:first-child { flex: 2 1 260px; }
.chat-note { margin: 4px 0 8px; font-weight: 600; }

/* ── файлы: загрузка кусками, хранилище, просмотр вложений ── */
progress.bar { -webkit-appearance: none; appearance: none; width: 100%; height: 8px; border: 0; border-radius: 4px; background: var(--border); overflow: hidden; display: block; }
progress.bar::-webkit-progress-bar { background: var(--border); border-radius: 4px; }
progress.bar::-webkit-progress-value { background: var(--accent); border-radius: 4px; transition: width .2s; }
progress.bar::-moz-progress-bar { background: var(--accent); border-radius: 4px; }
progress.bar.warn::-webkit-progress-value { background: var(--warn); }
progress.bar.warn::-moz-progress-bar { background: var(--warn); }
.up-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.up-list:empty { display: none; }
.up-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--surface); }
.up-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.up-state { grid-column: 1 / -1; font-size: .82rem; color: var(--muted); }
.up-row progress { grid-column: 1 / -1; }
.up-row.failed .up-state { color: var(--danger); font-weight: 600; }
.up-row.done .up-state { color: var(--ok); }
.up-actions { display: flex; gap: 6px; }
.doc { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-s); }
.doc-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.doc-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.doc-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.doc-actions form { margin: 0; }
.doc audio { width: 100%; }
.doc video { width: 100%; max-height: 60vh; border-radius: 12px; background: #000; }
.storage-meter { display: grid; gap: 8px; }
.storage-big { font-size: 1.5rem; font-weight: 750; letter-spacing: -.02em; }
.kind-row, .big-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 12px 16px; }
.kind-row + .kind-row, .big-row + .big-row { border-top: 1px solid var(--border); }
.kind-row progress { grid-column: 1 / -1; height: 6px; }
.big-row form { margin: 0; }
.big-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.big-sub { font-size: .82rem; color: var(--muted); grid-column: 1 / -1; }
.disk-row { cursor: pointer; align-items: center; }
.disk-row input[type="checkbox"] { width: 22px; height: 22px; flex: none; accent-color: var(--accent); }
.disk-row.is-added { opacity: .65; cursor: default; }
.disk-row .row-icon { color: var(--ok); }

/* ── выбор «настроения» в «Ещё → Оформление» ── */
.sub-label { font-size: .8rem; font-weight: 700; color: var(--muted); margin: 2px 2px 8px; }
.sub-label:not(:first-child) { margin-top: 18px; }
.mood-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mood-opt { font: inherit; display: grid; justify-items: center; align-content: start; gap: 3px; padding: 10px 6px 11px; border-radius: 16px; cursor: pointer;
  background: var(--surface-2); border: 2px solid transparent; color: var(--text); text-align: center; }
.mood-opt b { font-size: .88rem; font-weight: 700; line-height: 1.2; }
.mood-opt small { color: var(--muted); font-size: .72rem; line-height: 1.2; }
.mood-opt[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.mood-swatch { width: 100%; height: 44px; border-radius: 11px; margin-bottom: 5px; border: 1px solid rgba(128, 128, 150, .25); }
.sw-classic { background: linear-gradient(135deg, #f5f6fb 0 50%, #4f46e5 50% 100%); }
.sw-magic { background: radial-gradient(circle at 70% 30%, #f0b84e 0 7%, transparent 9%), radial-gradient(circle at 25% 70%, #ffd98a 0 4%, transparent 6%), linear-gradient(160deg, #1d2f6b, #080f2b); }
.sw-calm { background: linear-gradient(135deg, #f5f2ea 0 55%, #2c4390 55% 85%, #b7821a 85% 100%); }
.hint-magic { display: none; }
@media (max-width: 380px) { .mood-opt small { display: none; } }
.msg-actions .btn { white-space: nowrap; }

/* ── изменить напоминание: вся строка с текстом — кнопка ── */
.rem-main { display: block; width: 100%; min-width: 0; text-align: left; font: inherit; color: inherit; background: none; border: 0; border-radius: 10px;
  padding: 6px 4px; margin: -6px -4px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.rem-main:active { background: var(--surface-2); }
.rem-main .rem-title, .rem-main .rem-meta { display: block; }
.rem-main .rem-meta { display: flex; }
.edit-hint { margin: 4px 0 14px; }
.selecting .rem-main { pointer-events: none; }

/* ── «Отложить»: быстрые варианты и колёсики ── */
.snooze-text { margin: 0 0 4px; overflow-wrap: anywhere; font-weight: 600; }
.snooze-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-s); overflow: hidden; background: var(--surface-2); }
.snooze-list li + li { border-top: 1px solid var(--border); }
.snooze-opt { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 10px 16px; font: inherit; font-weight: 650;
  color: var(--text); background: transparent; border: 0; cursor: pointer; text-align: left; }
.snooze-opt:hover { background: var(--accent-soft); }
.snooze-opt:active { background: var(--accent-soft); }
.snooze-when { color: var(--muted); font-weight: 500; font-size: .88rem; white-space: nowrap; }
.wheels { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; background: var(--surface-2); border-radius: var(--radius-s); padding: 0 8px; }
.wheel { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; }
.wheel-list { height: 160px; width: 100%; overflow-y: auto; scroll-snap-type: y mandatory; padding: 60px 0; text-align: right; padding-right: 46px; box-sizing: border-box;
  scrollbar-width: none; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 32%, #000 68%, transparent); mask-image: linear-gradient(to bottom, transparent, #000 32%, #000 68%, transparent); }
.wheel-list::-webkit-scrollbar { display: none; }
.wheel-list:focus-visible { outline: 2px solid var(--accent); border-radius: 12px; }
.wheel-item { height: 40px; line-height: 40px; scroll-snap-align: center; font-size: 1.35rem; font-weight: 650; font-variant-numeric: tabular-nums; cursor: pointer; }
.wheel-unit { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .9rem; font-weight: 600; pointer-events: none; }
.wheel-mark { position: absolute; left: 6px; right: 6px; top: 50%; height: 40px; transform: translateY(-50%); border-radius: 12px; background: color-mix(in srgb, var(--accent) 14%, transparent); pointer-events: none; }
.snooze-exact { margin-top: 2px; }
.snooze-exact summary { cursor: pointer; color: var(--accent); font-weight: 650; font-size: .92rem; padding: 6px 0; }
.snooze-exact-row { display: flex; gap: 8px; margin-top: 8px; }
.snooze-exact-row .input { flex: 1; }

/* ── глобус «Искать в интернете» рядом с вводом ── */
.globe { width: 48px; height: 48px; flex: none; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border); transition: background .15s, color .15s, border-color .15s, box-shadow .2s, transform .2s; }
.globe .i { width: 24px; height: 24px; }
.globe:active { transform: scale(.94); }
.globe[aria-pressed="true"] { color: var(--on-accent); background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.globe:disabled { opacity: .4; cursor: default; }
.composer2.web-on textarea { border-color: var(--accent); }

.typing .bubble { flex-wrap: wrap; align-items: center; }
.typing-note { flex-basis: 100%; color: var(--muted); font-size: .84rem; }

.web-log { border-top: 1px solid var(--border); }
.web-log > summary { cursor: pointer; padding: 14px 18px; font-weight: 650; list-style: none; color: var(--accent); }
.web-log > summary::-webkit-details-marker { display: none; }
.web-log > summary::before { content: "▸ "; }
.web-log[open] > summary::before { content: "▾ "; }

/* ── «Дела»: карточки предложений под ответом ── */
.globe { width: 44px; height: 44px; }
.composer2-inner { gap: 8px; }
.act-cards { display: grid; gap: 8px; margin: 8px 0 0 4px; max-width: 520px; }
.act-card { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: var(--radius-s); padding: 12px 14px; }
.act-label { font-weight: 650; overflow-wrap: anywhere; }
.act-buttons { display: flex; gap: 8px; margin-top: 10px; }
.act-done { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.act-error { margin-top: 8px; color: var(--danger); font-size: .88rem; font-weight: 600; }
.msg-actions { flex-wrap: wrap; }

/* ── баланс Selectel ── */
.billing-alert { display: block; text-decoration: none; color: inherit; font-weight: 650; }
.billing-form { margin-top: 10px; }
.billing-form > summary { cursor: pointer; color: var(--accent); font-weight: 650; padding: 6px 0; list-style: none; }
.billing-form > summary::-webkit-details-marker { display: none; }
.billing-form > summary::before { content: "▸ "; }
.billing-form[open] > summary::before { content: "▾ "; }
.billing-form .stack { margin-top: 8px; }

/* ── голосовой ввод ── */
.send[hidden], .voice-toast[hidden] { display: none; }
.field.has-mic { position: relative; }
.field.has-mic > input, .field.has-mic > textarea { padding-right: 54px; }
.mic-inline { position: absolute; right: 4px; bottom: 4px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent;
  color: var(--muted); display: grid; place-items: center; cursor: pointer; transition: background .15s, color .15s; }
.mic-inline:hover { color: var(--accent); background: var(--accent-soft); }
.mic-inline .i, .search-box .mic-inline .i { position: static; transform: none; width: 22px; height: 22px; color: inherit; }
.mic-inline.is-recording, .send.mic-swap.is-recording { color: #fff; background: var(--danger); animation: mic-pulse 1.2s ease-in-out infinite; }
.mic-inline.is-busy, .send.mic-swap.is-busy { opacity: .55; cursor: default; }
@keyframes mic-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 50%, transparent); } 50% { box-shadow: 0 0 0 9px transparent; } }
.voice-toast { position: fixed; z-index: 70; left: 50%; transform: translateX(-50%); width: max-content; max-width: min(92vw, 520px);
  bottom: calc(var(--nav-top) + 84px); display: flex; align-items: center; gap: 14px;
  padding: 11px 16px; border-radius: 16px; background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow);
  font-size: .95rem; line-height: 1.35; }
.voice-toast button { flex: none; border: 0; background: transparent; color: var(--accent); font: inherit; font-weight: 650; cursor: pointer; padding: 4px 2px; }
.voice-toast.is-rec { border-color: var(--danger); }
.voice-toast.is-error { border-color: var(--danger); color: var(--danger); }
.voice-toast.in-sheet { position: static; transform: none; width: auto; max-width: none; margin: 0 0 12px; box-shadow: none; }
@media (min-width: 900px) { .voice-toast:not(.in-sheet) { bottom: 96px; left: calc(50% + var(--sidebar-w) / 2); } }
.field.has-clear > input, .field.has-clear > textarea { padding-right: 92px; }
.clear-inline { position: absolute; right: 44px; bottom: 4px; width: 36px; height: 40px; border: 0; background: transparent; color: var(--muted);
  display: grid; place-items: center; cursor: pointer; border-radius: 50%; }
.clear-inline[hidden] { display: none; }
.clear-inline .i, .search-box .clear-inline .i { position: static; transform: none; width: 18px; height: 18px; color: inherit; }
.clear-inline:hover { color: var(--text); }
.error-title { font-size: 1.5rem; margin: 14px 0 6px; letter-spacing: -.02em; }
.login-card.center { text-align: center; }
.login-card.center .stack { display: grid; gap: 10px; margin-top: 22px; }

/* ── свайп по напоминанию: вправо — «Готово» / «Пропустить», влево — «Удалить» ── */
.list > .rem.rem-swipe { display: block; padding: 0; position: relative; overflow: hidden; }
.rem-swipe .rem-fg { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 12px 14px;
  position: relative; touch-action: pan-y; transition: transform .2s ease; }
@media (min-width: 500px) { .rem-swipe .rem-fg { grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; padding: 14px 16px; } }
.selecting .rem-swipe .rem-fg { grid-template-columns: 28px 54px minmax(0, 1fr) auto; }
@media (min-width: 500px) { .selecting .rem-swipe .rem-fg { grid-template-columns: 28px 64px minmax(0, 1fr) auto; } }
.rem-swipe.swiping .rem-fg { background: var(--surface); }
.rem-fg.dragging { transition: none; }
.swipe-bg { position: absolute; inset: 0; display: none; justify-content: space-between; }
.rem-swipe.swiping .swipe-bg { display: flex; }
.swipe-bg > span { display: flex; align-items: center; gap: 8px; padding: 0 22px; color: #fff; font-weight: 650; font-size: .95rem; }
.swipe-bg .i { width: 22px; height: 22px; transition: transform .15s; }
.swipe-done { background: #0b7a4b; }
.swipe-del { background: #c0281c; margin-left: auto; }
.swipe-bg > span.armed .i { transform: scale(1.3); }
.touch-only { display: none; }
@media (pointer: coarse) { .touch-only { display: inline; } .mouse-only { display: none; } .rem-del-form { display: none; } }
.sheet-delete { padding-top: 0; }

/* ── «Сегодня»: карточка свободного дня и плашка даты в «Скоро» ── */
.day-free { display: flex; align-items: center; gap: 14px; padding: 18px 18px; }
.day-free > .i { width: 34px; height: 34px; flex: none; color: var(--accent); }
.day-free-title { margin: 0; font-weight: 700; font-size: 1.02rem; }
.day-free-sub { margin: 3px 0 0; color: var(--muted); font-size: .9rem; }
.rem-date { text-align: center; background: var(--surface-2); border-radius: 12px; padding: 5px 2px 6px; line-height: 1.1; }
.rem-date b { display: block; font-size: 1.2rem; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.rem-date span { display: block; font-size: .7rem; color: var(--muted); font-weight: 600; margin-top: 2px; white-space: nowrap; }
.rem-dated .rem-meta > span:first-child { font-variant-numeric: tabular-nums; }
.history > summary { list-style: none; cursor: pointer; }
.history > summary::-webkit-details-marker { display: none; }
.history-head { display: flex; align-items: center; gap: 10px; width: 100%; }
.history-head > .i { width: 20px; height: 20px; color: var(--muted); flex: none; }
.history-head .chev { margin-left: auto; transition: transform .15s; }
details.history[open] .history-head .chev { transform: rotate(90deg); }
details.history > summary .card-title::before { content: none; }
.history > summary.card-head { padding: 14px 18px; }

/* ── «Настройки»: короткое меню с состоянием справа ── */
.menu-card { margin-bottom: 14px; }
.account-card { margin-bottom: 18px; }
.menu-row { padding: 12px 16px; gap: 12px; }
.menu-row .row-icon { width: 34px; height: 34px; border-radius: 10px; }
.menu-row .row-icon .i { width: 19px; height: 19px; }
.menu-row .row-title { flex: 1; min-width: 0; }
.row-state { color: var(--muted); font-size: .88rem; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 48%; }
.row-state.warn-text { color: var(--warn); font-weight: 650; }
.row .chev { color: var(--muted); width: 18px; height: 18px; flex: none; }
.row-icon-off { background: var(--surface-2); color: var(--muted); }
.status-card { display: flex; align-items: center; gap: 14px; }
.status-card p { margin: 0; }
.status-card .muted { font-size: .88rem; margin-top: 2px; }
.status-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--muted); }
.status-dot.ok { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-bg); }
.big-number { margin: 0; font-size: 1.7rem; font-weight: 750; letter-spacing: -.02em; }

/* ── число в настройках: варианты кнопками + «Своё» ── */
.choice-field { border: 0; margin: 0; padding: 0; min-width: 0; }
.choice-field + .choice-field { margin-top: 22px; }
.choice-field legend { padding: 0; margin-bottom: 8px; font-weight: 650; font-size: .95rem; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice span { display: inline-block; padding: 8px 14px; border-radius: 999px; background: var(--surface-2); color: var(--text); font-weight: 600; font-size: .9rem;
  border: 1.5px solid transparent; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
.choice input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.choice input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 2px; }
.custom-row { display: none; align-items: center; gap: 10px; margin-top: 10px; }
.custom-row .input { width: 9em; flex: none; }
.custom-row .muted { font-size: .84rem; }
.choice-field:has(input[value="custom"]:checked) .custom-row { display: flex; }
.choice-field .hint { margin: 8px 0 0; }

/* ── компактный чат: модель «таблеткой», включённые режимы рядом, переключатели — в меню «+» ── */
.chatbar2 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; }
.model-chip { position: relative; display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 7px 12px 7px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); font-weight: 650; font-size: .92rem; cursor: pointer; max-width: 70vw; }
.model-chip select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 16px; }
.model-chip .model-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-chip .i { width: 16px; height: 16px; color: var(--muted); transform: rotate(90deg); flex: none; }
.model-chip:focus-within { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.mode-chips { display: contents; }
.mode-chip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; border-radius: 999px; border: 0; cursor: pointer; white-space: nowrap;
  background: var(--accent-soft); color: var(--accent); font: inherit; font-weight: 650; font-size: .85rem; }
.mode-chip .i { width: 15px; height: 15px; }
.mode-chip .x { margin-left: 2px; opacity: .7; font-size: 1rem; line-height: 1; }
.chat-hint[hidden] { display: none; }
.plus-btn { position: relative; }
.plus-btn.has-modes { color: var(--accent); border-color: var(--accent); }
.plus-btn.has-modes::after { content: ""; position: absolute; top: 4px; right: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }
.modes { display: grid; gap: 10px; }
.mode-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border-radius: var(--radius-s); background: var(--surface-2);
  border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.mode-row .row-text { flex: 1; min-width: 0; }
.mode-row:disabled { opacity: .45; cursor: default; }
.mode-row input:checked + .switch-ui, .mode-row[aria-pressed="true"] .switch-ui { background: var(--accent); }
.mode-row input:checked + .switch-ui::after, .mode-row[aria-pressed="true"] .switch-ui::after { transform: translateX(19px); }
.mode-row input:focus-visible + .switch-ui { outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 2px; }
.modes .hint { margin: 0 4px; }
.modes .field { margin-top: 4px; }

/* ── цветные значки меню «Настройки», как в iPhone: цвет по смыслу, белый значок ── */
.menu-row .row-icon[class*="ic-"] { color: #fff; }
.ic-pink { background: #d4537e; }
.ic-red { background: #e0473f; }
.ic-orange { background: #e8792c; }
.ic-violet { background: #7a6ff0; }
.ic-blue { background: #2f86e0; }
.ic-green { background: #4f9d2a; }
.ic-teal { background: #18a07a; }
.ic-gray { background: #8a8a92; }
.ic-navy { background: #2f5fb3; }
.ic-amber { background: #d08a12; }
/* «Ночной лес» и «Спокойное»: те же цвета, но приглушённые, чтобы не спорили с оформлением */
[data-mood="magic"] .menu-row .row-icon[class*="ic-"] { filter: saturate(.6) brightness(.82); box-shadow: inset 0 0 0 1px rgba(255, 217, 138, .18); }
[data-mood="calm"] .menu-row .row-icon[class*="ic-"] { filter: saturate(.55) brightness(1.04); }
/* солнце в карточке свободного дня — тёплое */
.day-free > .i { color: #e09b12; }
[data-mood="magic"] .day-free > .i { color: #ffd98a; }
.msg-actions .btn.act-web { color: var(--accent); background: var(--accent-soft); font-weight: 700; }

/* ── текст, распознанный на фото ── */
.ocr-box { margin: 8px 0 14px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--surface-2); }
.ocr-box > summary { display: flex; align-items: center; gap: 8px; padding: 10px 14px; cursor: pointer; font-weight: 650; list-style: none; }
.ocr-box > summary::-webkit-details-marker { display: none; }
.ocr-box > summary .i { width: 17px; height: 17px; color: var(--accent); }
.ocr-box > summary .muted { margin-left: auto; font-size: .78rem; font-weight: 500; }
.ocr-text { padding: 0 14px 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .92rem; line-height: 1.45; user-select: text; }
.ocr-wait { margin: 6px 0 12px; }

/* ── «Текст с фото»: выбор, кто читает ── */
.ic-cyan { background: #0f9fb5; }
.ic-indigo { background: #5856d6; }
.engine-list { display: grid; gap: 10px; }
.engine-opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-s); background: var(--surface-2);
  border: 1.5px solid transparent; cursor: pointer; }
.engine-opt input { margin-top: 4px; accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
.engine-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.engine-body { display: grid; gap: 3px; }
.engine-body small { color: var(--muted); font-size: .84rem; line-height: 1.35; }
.engine-body small.warn-text { color: var(--warn); font-weight: 650; }
.engine-sub { display: none; margin: 0 0 6px 30px; }
.engine-list:has(input[name="engine"][value="own"]:checked) .sub-own,
.engine-list:has(input[name="engine"][value="gigachat"]:checked) .sub-gigachat,
.engine-list:has(input[name="engine"][value="deepseek"]:checked) .sub-deepseek,
.engine-list:has(input[name="engine"][value="mimo"]:checked) .sub-mimo { display: block; }
.opt-group { border: 0; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; }
.opt-group legend { font-weight: 650; font-size: .92rem; margin-bottom: 6px; padding: 0; }
.mini-opt { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 12px; cursor: pointer; }
.mini-opt:has(input:checked) { background: var(--accent-soft); }
.mini-opt input { margin-top: 3px; accent-color: var(--accent); flex: none; }
.mini-opt span { display: grid; gap: 2px; }
.mini-opt small { color: var(--muted); font-size: .8rem; line-height: 1.35; }
@media (max-width: 500px) { .engine-sub { margin-left: 0; } }
.ocr-redo { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 14px 12px; font-size: .84rem; }
.ocr-plain { padding-top: 10px; }
.ocr-note { padding: 0 14px; margin: 0 0 8px; }

/* ── «Все напоминания» и «Сегодня»: группы, полоска дней, ссылки «ещё» (schedule.py) ── */
.all-row { display: flex; align-items: center; gap: 12px; padding: 14px 18px; color: inherit; text-decoration: none; font-weight: 650; }
.all-row > .i:first-child { color: var(--accent); }
.all-row .count { margin-left: auto; }
.all-row .chev, .more-row .i { width: 16px; height: 16px; color: var(--muted); transform: rotate(0deg); }
.more-row { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; padding: 12px 18px; border: 0; border-top: 1px solid var(--border);
  background: transparent; color: var(--accent); font: inherit; font-weight: 650; font-size: .92rem; text-decoration: none; cursor: pointer; }
.part-label { margin: 0; padding: 12px 18px 4px; font-size: .78rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.part-label + .list { border-top: 0; }
.section-card .list + .part-label { border-top: 1px solid var(--border); }

.day-strip { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
  margin: 4px -18px 14px; padding: 2px 18px; scroll-padding: 0 18px; }   /* до края экрана, листается до последнего дня */
.day-strip > * { flex: 0 0 46px; }
.day-strip::-webkit-scrollbar { display: none; }
.strip-day { display: grid; justify-items: center; gap: 2px; padding: 8px 0 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border);
  color: inherit; text-decoration: none; min-height: 64px; }
.strip-day small { font-size: .7rem; font-weight: 650; color: var(--muted); text-transform: uppercase; }
.strip-day b { font-size: 1.05rem; }
.strip-day.weekend small { color: var(--danger); opacity: .8; }
.strip-day.empty { opacity: .55; }
.strip-day.is-today { background: var(--accent); border-color: var(--accent); color: #fff; }
.strip-day.is-today small { color: rgba(255, 255, 255, .85); }
.strip-day .dots { display: flex; gap: 3px; height: 6px; }
.strip-day .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.strip-day.is-today .dots i { background: #fff; }

.all-tools { display: grid; gap: 10px; margin-bottom: 6px; }
.all-tools .search-box { margin: 0; }
.kind-filter .seg { padding: 8px 6px; }
.kind-filter .seg.is-on { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }

.rem-group { margin: 0; }
.rem-group > summary { list-style: none; cursor: pointer; }
.rem-group > summary::-webkit-details-marker { display: none; }
.group-head { display: flex; align-items: center; gap: 4px; margin: 20px 4px 8px; font-size: .8rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); user-select: none; }
.group-head .count { margin-left: 4px; }
.group-sub { display: inline-flex; align-items: center; gap: 3px; margin-left: 8px; font-weight: 650; letter-spacing: 0; }
.group-sub .i { width: 13px; height: 13px; }
.group-head .chev { margin-left: auto; width: 16px; height: 16px; transform: rotate(90deg); transition: transform .15s; }
.rem-group:not([open]) .group-head .chev { transform: rotate(0deg); }
.rem-group.is-waiting .group-title { color: var(--danger); }
.group-hint { margin: -4px 4px 8px; }
.page-all .edit-hint { margin-top: 18px; }

/* ── «готово» кружком (Apple Reminders): пустой круг, при нажатии заливается галочкой, строка зачёркивается и уходит ── */
.rem-check { position: relative; width: 30px; height: 30px; margin: 7px; padding: 0; border-radius: 50%; flex: none; cursor: pointer;
  display: grid; place-items: center; background: transparent; border: 2px solid color-mix(in srgb, var(--accent) 70%, var(--muted));
  color: #fff; transition: background .18s ease, border-color .18s ease, transform .12s ease; -webkit-tap-highlight-color: transparent; }
.rem-check .i { width: 17px; height: 17px; opacity: 0; transform: scale(.5); transition: opacity .15s ease, transform .18s cubic-bezier(.3, 1.6, .5, 1); }
.rem-check.is-late { border-color: var(--danger); }
.rem-check.is-repeat { border-style: dashed; }
@media (hover: hover) { .rem-check:hover .i { opacity: .55; transform: scale(.85); color: var(--accent); } }
.rem-check:active { transform: scale(.9); }
.rem-check:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }
.rem.is-completing .rem-check { background: var(--accent); border-color: var(--accent); border-style: solid; }
.rem.is-completing .rem-check .i { opacity: 1; transform: scale(1); color: #fff; }
.rem.is-completing .rem-title { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--muted); transition: color .2s; }
.rem.is-completing .rem-fg { opacity: .55; transition: opacity .25s ease .12s; }
.rem.is-leaving { overflow: hidden; transition: height .26s ease, opacity .26s ease; opacity: 0; }

/* ── «Сработало»: строка на напоминание, две кнопки ── */
.fired-title { display: flex; align-items: center; gap: 8px; }
.fired-title .i { width: 20px; height: 20px; color: var(--warn); }
.fired-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px; padding: 12px 18px 14px;
  border-top: 1px solid var(--warn-border); }
.fired-row:first-of-type { border-top: 0; }
.fired-main { min-width: 0; flex: 1 1 180px; }
.fired-main .rem-title { font-size: 1.02rem; }
.fired-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.fired-actions .btn { gap: 6px; }
.fired-actions .i { width: 17px; height: 17px; }

/* ── свободный день с котом Федором ── */
.day-free .mascot { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; flex: none;
  box-shadow: 0 0 0 3px var(--accent-soft); }

/* ── «Напоминания»: заголовки групп в стиле подписей разделов, прилипают при прокрутке, плавно раскрываются ── */
.group-head.section-label { position: sticky; top: var(--appbar-h, 0px); z-index: 5; margin: 14px -4px 8px; padding: 8px 8px;
  background: color-mix(in srgb, var(--bg) 96%, transparent); border-radius: 12px; }   /* без размытия: заголовков много, телефону легче */
.group-head .count { background: var(--surface-2); color: var(--muted); border-radius: 999px; padding: 1px 8px; font-size: .74rem;
  letter-spacing: 0; margin-left: 6px; }
/* плавно — только когда группу раскрыл сам человек (класс ставит groups.js); при загрузке страницы ничего не анимируется,
   и без прозрачности: если анимация не пойдёт (энергосбережение, вкладка в фоне), содержимое всё равно видно */
.rem-group.just-opened > section { animation: group-in .2s ease; }
@keyframes group-in { from { transform: translateY(-6px); } to { transform: none; } }
.strip-day { transition: transform .12s ease, background .15s ease; }
.strip-day:active { transform: scale(.94); }
@media (prefers-reduced-motion: reduce) {
  .rem-check, .rem-check .i, .rem.is-leaving, .rem.is-completing .rem-fg, .strip-day { transition: none; }
  .rem-group.just-opened > section { animation: none; }
}

body.page-all .appbar h1, [data-mood] body.page-all .appbar h1 { font-size: clamp(1.6rem, 7.6vw, 2.1rem); }

/* ── «Память»: строка фильтров, компактные строки с цветным значком типа (как «Файлы» и «Заметки» на iPhone) ── */
.filter-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 2px -18px 6px; padding: 2px 18px 6px; }
.filter-chips::-webkit-scrollbar { display: none; }
.fchip { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--border); color: var(--text); text-decoration: none; font-weight: 650; font-size: .9rem; white-space: nowrap; }
.fchip b { color: var(--muted); font-weight: 650; font-size: .82rem; }
.fchip.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.fchip.is-on b { color: rgba(255, 255, 255, .85); }
.fchip-tag { color: var(--muted); }
.mem-rows { list-style: none; margin: 0; padding: 0; }
.mem-rows > li { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--border); min-width: 0; }
.mem-rows > li:first-child { border-top: 0; }
.mem-rows > li > .sel-box { margin-left: 12px; }
.mem-row { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 11px 16px; color: inherit; text-decoration: none; }
.mem-row:active { background: var(--surface-2); }
.mem-badge, .mem-thumb { flex: none; width: 42px; height: 42px; border-radius: 11px; }
.mem-thumb { object-fit: cover; border: 1px solid var(--border); }
.mem-badge { display: grid; place-items: center; font-size: .7rem; font-weight: 800; letter-spacing: .02em; color: #fff; background: #8a8a92; }
.mem-badge .i { width: 20px; height: 20px; }
.b-pdf { background: #d6453d; } .b-word { background: #2f6fd6; } .b-excel { background: #1f8f4e; } .b-slides { background: #d9772b; }
.b-text { background: #6b7280; } .b-archive { background: #8b6b3d; } .b-audio { background: #b34fc9; } .b-video { background: #c9406b; }
.b-note { background: var(--accent-soft); color: var(--accent); }
.mem-body { min-width: 0; flex: 1; display: grid; gap: 2px; }
.mem-row .mem-title { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mem-line { color: var(--muted); font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }   /* как в «Заметках»: одна строка */
.mem-when { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.mem-tags { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; margin-top: 2px; }
.mem-tag { color: var(--accent); font-size: .78rem; font-weight: 600; }
.mem-tags .chip { padding: 1px 8px; font-size: .74rem; }
.selecting .mem-rows > li.selected { background: var(--accent-soft); }
.empty .mascot { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px var(--accent-soft); }
.more-mem { margin-top: 12px; }


.all-row-text { display: grid; gap: 1px; }
.all-row-text small { color: var(--muted); font-weight: 500; font-size: .8rem; }

/* «Файлы и место»: компактные строки самых больших файлов, остальное под «Показать ещё» */
.big-row { display: flex; align-items: center; gap: 10px; }
.big-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.big-name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.big-sub { color: var(--muted); font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.big-sub b { color: var(--text); font-weight: 650; }
.more-files > summary { list-style: none; }
.more-files > summary::-webkit-details-marker { display: none; }
.more-files[open] > summary { display: none; }
.more-files .big-row { border-top: 1px solid var(--border); }

/* чат: длинная подпись источника не раздвигает страницу (было: ширина 513 при экране 375) */
.msg, .msg > * { min-width: 0; }
.src-row { max-width: 100%; min-width: 0; }
.src-row .chip { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.6; }

/* ── сворачиваемые разделы настроек: текущее значение справа в заголовке (как в настройках iPhone) ── */
.group-head .group-value { margin-left: auto; min-width: 0; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-transform: none; letter-spacing: 0; font-weight: 600; font-size: .84rem; color: var(--muted); }
.group-head .group-value.warn-text { color: var(--warn); }
.group-head .group-value ~ .chev { margin-left: 6px; flex: none; }
.group-head .group-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* «Тонкая настройка» своей модели чтения фото: свёрнута, раскрывается кнопкой-строкой */
.fine-tune { margin: 4px 0 8px; }
.fine-tune > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface); font-weight: 650; font-size: .92rem; }
.fine-tune > summary::-webkit-details-marker { display: none; }
.fine-tune > summary span { display: grid; gap: 2px; min-width: 0; }
.fine-tune > summary small { color: var(--muted); font-weight: 500; font-size: .8rem; }
.fine-tune > summary .chev { margin-left: auto; width: 16px; height: 16px; flex: none; transform: rotate(0deg); transition: transform .15s; }
.fine-tune[open] > summary .chev { transform: rotate(90deg); }
.fine-tune[open] > summary { margin-bottom: 12px; }


/* ── утренняя сводка (/digest): погода крупно, план дня лентой времени, неделя ── */
.ic-yellow { background: #e9a90c; }
.dg-weather { padding: 18px; background: linear-gradient(160deg, #e8f1ff 0%, var(--surface) 70%); }
.dg-w-rain, .dg-w-storm { background: linear-gradient(160deg, #e3e9f3 0%, var(--surface) 70%); }
.dg-w-snow, .dg-w-fog { background: linear-gradient(160deg, #eef2f7 0%, var(--surface) 70%); }
.dg-w-sun { background: linear-gradient(160deg, #fff3d6 0%, var(--surface) 70%); }
:root[data-theme="dark"] .dg-weather { background: linear-gradient(160deg, #1f2a4a 0%, var(--surface) 75%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .dg-weather { background: linear-gradient(160deg, #1f2a4a 0%, var(--surface) 75%); } }
.dg-w-top { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; }
.dg-w-icon { width: 46px; height: 46px; color: var(--accent); stroke-width: 1.6; }
.dg-w-sun .dg-w-icon { color: #e9a90c; }
.dg-w-now { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.dg-temp { font-size: 2.6rem; font-weight: 750; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.dg-w-words { display: grid; font-weight: 650; min-width: 0; }
.dg-w-words small { color: var(--muted); font-weight: 500; font-size: .8rem; white-space: nowrap; }
.dg-w-city { margin: 10px 0 0; color: var(--muted); font-size: .84rem; }
.dg-w-city b { color: var(--text); font-variant-numeric: tabular-nums; }
.dg-w-parts { display: grid; grid-template-columns: repeat(auto-fit, minmax(60px, 1fr)); gap: 8px; margin-top: 14px; }
.dg-w-parts > div { display: grid; justify-items: center; gap: 2px; padding: 8px 4px; border-radius: 12px; background: var(--surface-2); text-align: center; }
.dg-w-parts span, .dg-w-parts small { color: var(--muted); font-size: .72rem; }
.dg-w-parts small { line-height: 1.2; }
.dg-w-parts b { font-size: 1.02rem; font-variant-numeric: tabular-nums; }
.dg-tip { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; padding: 10px 12px; border-radius: 12px;
  background: var(--accent-soft); color: var(--text); font-weight: 600; font-size: .92rem; }
.dg-tip .i { color: var(--accent); flex: none; }
.dg-noweather { margin: 0 4px 12px; }
.dg-timeline { list-style: none; margin: 0; padding: 8px 0; }
.dg-timeline li { display: grid; grid-template-columns: 54px 14px 1fr; align-items: start; gap: 8px; padding: 8px 18px; position: relative; }
.dg-timeline time { font-weight: 700; font-variant-numeric: tabular-nums; padding-top: 1px; }
.dg-rail { position: relative; align-self: stretch; }
.dg-rail::before { content: ""; position: absolute; left: 6px; top: -8px; bottom: -8px; width: 2px; background: var(--border); }
.dg-rail::after { content: ""; position: absolute; left: 2px; top: 6px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent); box-sizing: border-box; }
.dg-timeline li:first-child .dg-rail::before { top: 8px; }
.dg-timeline li:last-child .dg-rail::before { bottom: auto; height: 14px; }
.dg-timeline li:only-child .dg-rail::before { display: none; }
.dg-text { min-width: 0; overflow-wrap: anywhere; }
.dg-text small { display: block; color: var(--warn); font-size: .76rem; font-weight: 600; }
.dg-late time { color: var(--warn); }
.dg-late .dg-rail::after { border-color: var(--warn); background: var(--warn); }
.dg-rep { width: 14px; height: 14px; margin-left: 6px; vertical-align: -2px; color: var(--muted); }
.dg-list { list-style: none; margin: 0; padding: 4px 0 8px; }
.dg-list li { display: flex; align-items: baseline; gap: 10px; padding: 8px 18px; overflow-wrap: anywhere; min-width: 0; }
.dg-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); flex: none; transform: translateY(-2px); }
.dg-week li { display: grid; grid-template-columns: 76px 1fr; gap: 10px; }
.dg-day { color: var(--muted); font-size: .84rem; display: grid; }
.dg-day b { color: var(--text); font-variant-numeric: tabular-nums; }
.dg-hint { display: block; margin-top: 6px; }
.dg-send { margin: 18px 0 8px; }
.dg-send .hint { margin-top: 6px; }
.dg-w2 { display: flex; align-items: center; gap: 10px; margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: .9rem; }
.dg-w2 .i { width: 22px; height: 22px; color: var(--accent); flex: none; }
.dg-w2 b { margin-right: 4px; }
.dg-src { opacity: .8; }
/* курс ЦБ: строки как в «Акциях» iPhone — значок валюты, название, курс, изменение; стрелки без цвета (рост — не «хорошо») */
.dg-rates { padding: 14px 18px 12px; }
.dg-r-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.dg-r-title { margin: 0; font-size: .95rem; font-weight: 700; }
.dg-r-title span { color: var(--muted); font-weight: 500; }
.dg-r-head .dg-src { color: var(--muted); font-size: .76rem; text-align: right; }
.dg-r-list { list-style: none; margin: 6px 0 0; padding: 0; }
.dg-r-list li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 9px 0; }
.dg-r-list li + li { border-top: 1px solid var(--border); }
.dg-r-sign { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft);
  color: var(--accent); font-weight: 750; font-size: 1rem; }
.dg-r-sign.is-code { font-size: .6rem; letter-spacing: .02em; }
.dg-r-name { display: grid; min-width: 0; font-weight: 650; overflow-wrap: anywhere; }
.dg-r-name small { color: var(--muted); font-weight: 500; font-size: .74rem; }
.dg-r-val { font-size: 1.08rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dg-r-delta { min-width: 58px; text-align: right; color: var(--muted); font-size: .84rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dg-r-next { margin-top: 8px; font-size: .86rem; font-variant-numeric: tabular-nums; }
@media (max-width: 359px) {   /* iPhone SE и узкие окна: «Доллар» не должен переноситься по буквам */
  .dg-rates { padding-left: 14px; padding-right: 14px; }
  .dg-r-list li { grid-template-columns: 30px minmax(0, 1fr) auto auto; gap: 8px; }
  .dg-r-sign { width: 30px; height: 30px; }
  .dg-r-delta { min-width: 0; }
}
.dg-stale { margin: 10px 0 0; color: var(--warn); }
.dg-hint { margin-bottom: 4px; }
.dg-ai { display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: start; padding: 14px 16px; }
.dg-ai .mascot { width: 40px; height: 40px; border-radius: 12px; }
.dg-ai p { margin: 0; font-size: 1rem; line-height: 1.45; font-weight: 550; }
.dg-ai small { display: block; margin-top: 4px; color: var(--muted); font-size: .76rem; }
.dg-ai-model { margin-left: 62px; }
@media (max-width: 420px) { .dg-ai-model { margin-left: 0; } }
.dg-ai-wait p { color: var(--muted); font-weight: 500; animation: dg-pulse 1.4s ease-in-out infinite; }
.dg-ai-new p { animation: dg-in .35s ease-out; }
@keyframes dg-pulse { 50% { opacity: .45; } }
@keyframes dg-in { from { opacity: 0; transform: translateY(3px); } }
@media (prefers-reduced-motion: reduce) { .dg-ai-wait p, .dg-ai-new p { animation: none; } }


/* ── нижняя панель как в iOS 26: стеклянная капсула вкладок и круглая кнопка главного действия справа ──
   Цвет один — цвет Федора в текущем оформлении (--accent): закрытые вкладки — серый контур, открытая — залитый значок
   этого цвета на мягкой нейтральной подложке (подложка переезжает к новой вкладке — view-transition в mood.css).
   Кнопка справа есть на каждой вкладке (напоминание / запись / новый чат / поиск настроек), поэтому ширина панели не прыгает. */
:root {
  --nav-h: 62px;                                                     /* высота капсулы и круглой кнопки */
  --nav-lift: max(10px, calc(env(safe-area-inset-bottom) - 12px));   /* над полоской «Домой» iPhone, не прилипая к краю */
  --nav-top: calc(var(--nav-h) + var(--nav-lift));                   /* сколько панель занимает снизу — от этого отступают поле чата и подсказки */
  --glass: color-mix(in srgb, var(--surface) 80%, transparent);
  --glass-edge: rgba(20, 23, 47, .08);
  --glass-shadow: 0 10px 30px rgba(20, 23, 47, .14), inset 0 1px 0 rgba(255, 255, 255, .75);
  --nav-sel: rgba(20, 23, 47, .07);
  --badge: #ff3b30;
}
:root[data-theme="dark"] {
  --glass: color-mix(in srgb, var(--surface) 74%, transparent); --glass-edge: rgba(255, 255, 255, .1);
  --glass-shadow: 0 12px 34px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .06); --nav-sel: rgba(255, 255, 255, .1); --badge: #ff453a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --glass: color-mix(in srgb, var(--surface) 74%, transparent); --glass-edge: rgba(255, 255, 255, .1);
    --glass-shadow: 0 12px 34px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .06); --nav-sel: rgba(255, 255, 255, .1); --badge: #ff453a;
  }
}
.nav { position: fixed; z-index: 30; left: 12px; right: 12px; bottom: var(--nav-lift); display: flex; gap: 10px; align-items: stretch; pointer-events: none; }
.nav > * { pointer-events: auto; }   /* между капсулой и кнопкой касание проходит к странице */
.nav-brand { display: none; }
.nav-bar {
  flex: 1; min-width: 0; height: var(--nav-h); display: flex; gap: 2px; padding: 4px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--glass-shadow);
  backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
}
.nav-item {
  position: relative; isolation: isolate; flex: 1; min-width: 0; display: grid; justify-items: center; align-content: center; gap: 2px;
  padding: 4px 2px 5px; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: .68rem; font-weight: 600;
  transition: color .15s, transform .12s ease; -webkit-tap-highlight-color: transparent;
}
.nav-item:active { transform: scale(.94); }
.nav-item.active { color: var(--text); }
.nav-pill { position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--nav-sel); }
.nav-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.15; }
.nav-icon { position: relative; display: inline-grid; place-items: center; }
.tab-i { width: 25px; height: 25px; overflow: visible; }
.nav-item.active .tab-i { color: var(--accent); }
.tab-num { font: 700 9.4px/1 -apple-system, "SF Pro Rounded", "SF Pro Text", system-ui, sans-serif; letter-spacing: -.03em; }
.tab-num-on { fill: var(--on-accent); font-weight: 800; }
.nav-badge {
  position: absolute; top: -5px; left: calc(100% - 9px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  display: grid; place-items: center; background: var(--badge); color: #fff; font-size: .66rem; font-weight: 700; line-height: 1;
  box-shadow: 0 0 0 2px var(--surface); font-variant-numeric: tabular-nums;
}
.nav-act {
  position: relative; flex: none; width: var(--nav-h); height: var(--nav-h); border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent); text-decoration: none;
  box-shadow: var(--shadow-fab), inset 0 1px 0 rgba(255, 255, 255, .28); transition: transform .12s ease; -webkit-tap-highlight-color: transparent;
}
.nav-act:active { transform: scale(.93); }
.nav-act .i { width: 26px; height: 26px; stroke-width: 2.2; }
.nav-act-label { display: none; }
.tab-changed .nav-item.active .tab-i { animation: tab-pop .38s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes tab-pop { 0% { transform: scale(.82); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .nav-item, .nav-act { transition: none; } .tab-changed .nav-item.active .tab-i { animation: none; } }
@media (max-width: 899px) { .wide-only { display: none !important; } }
@media (max-width: 359px) {   /* узкие телефоны (iPhone SE первого поколения): всё чуть плотнее, «Настройки» влезают целиком */
  :root { --nav-h: 56px; }
  .nav { left: 8px; right: 8px; gap: 8px; }
  .nav-item { font-size: .6rem; padding: 3px 0 4px; }
  .tab-i { width: 22px; height: 22px; }
  .nav-act .i { width: 23px; height: 23px; }
}   /* на телефоне это делает кнопка у панели */
/* компьютер: панель — колонка слева, кнопка действия — под вкладками, с подписью */
@media (min-width: 900px) {
  :root { --nav-top: 0px; }
  .nav {
    position: sticky; top: 0; left: auto; right: auto; bottom: auto; height: 100vh; height: 100dvh; z-index: 10; pointer-events: auto;
    flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 6px; padding: 24px 16px;
    border-right: 1px solid var(--border); background: var(--surface);
  }
  .nav-bar { flex: none; height: auto; flex-direction: column; gap: 4px; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none;
    backdrop-filter: none; -webkit-backdrop-filter: none; }
  .nav-item { flex: none; display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 8px 14px; border-radius: 14px; font-size: .98rem; }
  .nav-label { overflow: visible; }
  .tab-i { width: 24px; height: 24px; }
  .nav-badge { top: -8px; left: calc(100% - 12px); min-width: 16px; height: 16px; font-size: .62rem; }
  .nav-brand { display: flex; }
  .nav-act { width: auto; height: 46px; margin-top: 14px; border-radius: 14px; display: flex; justify-content: center; gap: 8px; padding: 0 14px;
    font-weight: 650; font-size: .95rem; white-space: nowrap; box-shadow: none; }
  .nav-act .i { width: 20px; height: 20px; }
  .nav-act-label { display: inline; }
}
@media (min-width: 900px) and (hover: hover) { .nav-item:not(.active):hover { background: var(--surface-2); color: var(--text); } }

/* ── поиск по «Настройкам» (лупа у панели) ── */
dialog.sheet-find { min-height: min(78vh, 640px); }
.find-body { padding: 4px 16px 16px; }
.find-field { position: relative; display: block; margin-bottom: 10px; }
.find-field .i { position: absolute; left: 14px; top: 50%; width: 19px; height: 19px; margin-top: -9.5px; color: var(--muted); pointer-events: none; }
.find-field .input { width: 100%; padding-left: 42px; }
.find-results .row-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.find-results .row-title { overflow-wrap: anywhere; }
.find-results .row-sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.find-results > li:first-child .row { border-top: 0; }
