/* «Отрывной календарь»: день — листок с крупной датой, воскресенье красным.
   Палитра своя (бумага и чернила); светлая или тёмная — по теме Telegram (data-theme на <html>).
   Цвет типа записи приходит с сервера в --c; значки типа красятся классом .cat. */
:root {
  --wall: #E3E5E9;
  --paper: #FBFBF8;
  --paper-back: #E4E4DE;
  --paper-back-2: #F3F3EF;
  --ink: #1E1F22;
  --muted: #5E6067;
  --red: #C62828;
  --rule: #E8E8E3;
  --rule-strong: #D6D6D0;
  --under-1: #F2F2EE;
  --under-2: #EAEAE6;
  --marker: #FFE58A;
  --marker-ink: #1E1F22;
  --on-ink: #FBFBF8;
  --shadow: 0 1px 1px rgba(30, 31, 34, 0.06), 0 10px 28px rgba(30, 31, 34, 0.12);
  --dim: rgba(17, 18, 21, 0.45);
  --display: "Sofia Sans Extra Condensed", "Roboto Condensed", "Arial Narrow", sans-serif-condensed, sans-serif;
  --body: "Sofia Sans", Roboto, -apple-system, "Segoe UI", system-ui, sans-serif;
  --safe-bottom: max(env(safe-area-inset-bottom), var(--tg-safe-area-inset-bottom, 0px));
  --bar-height: 80px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --wall: #111215;
  --paper: #1D1E22;
  --paper-back: #2A2B30;
  --paper-back-2: #232428;
  --ink: #ECEBE7;
  --muted: #A3A4AA;
  --red: #FF6B5E;
  --rule: #2A2B30;
  --rule-strong: #35363C;
  --under-1: #19191D;
  --under-2: #151619;
  --marker: #5B4A12;
  --marker-ink: #FFF3C4;
  --on-ink: #1D1E22;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  --dim: rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--wall);
  color: var(--ink);
  font: 16px/1.4 var(--body);
  -webkit-tap-highlight-color: transparent;
}
body.sheet-open { overflow: hidden; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.icon { display: block; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.cat { color: var(--c); }
:root[data-theme="dark"] .cat { color: color-mix(in srgb, var(--c) 72%, #fff); }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 16px calc(var(--bar-height) + 40px + var(--safe-bottom));
}

/* ---------- Верхняя панель ---------- */

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; margin: 0 -8px; padding: 0;
  background: var(--wall);
}
.topbar-tools { display: flex; margin-left: auto; }
.icon-btn {
  width: 44px; height: 44px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border: 0; padding: 0; background: none; color: var(--ink); border-radius: 22px;
}
.icon-btn.muted { color: var(--muted); }
.icon-btn[aria-pressed="true"] { position: relative; }
.icon-btn[aria-pressed="true"]::after {
  content: ""; position: absolute; top: 9px; right: 9px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--red);
}
.today-btn {
  height: 36px; margin-left: 8px; padding: 0 14px;
  border: 1.5px solid var(--ink); border-radius: 18px; background: none;
  font-family: var(--display); font-size: 19px; font-weight: 700;
}

/* ---------- Нижняя панель ---------- */

.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; align-items: center; gap: 8px;
  max-width: 520px; margin: 0 auto;
  height: calc(var(--bar-height) + var(--safe-bottom));
  padding: 0 16px var(--safe-bottom) 8px;
  background: var(--wall);
}
.tabs { flex: 1; min-width: 0; display: flex; justify-content: space-between; max-width: 300px; }
.tab {
  height: 56px; padding: 0 6px; border: 0; background: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-family: var(--display); font-size: 21px; line-height: 24px; font-weight: 600; color: var(--muted);
}
.tab::after { content: ""; width: 100%; height: 3px; border-radius: 2px; background: transparent; }
.tab[aria-current="page"] { color: var(--ink); font-weight: 800; }
.tab[aria-current="page"]::after { background: var(--ink); }
.fab {
  width: 58px; height: 58px; flex: none; margin-left: auto;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: var(--ink); color: var(--on-ink);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
}
.fab .icon { stroke-width: 2.4; }

/* ---------- Стопка листков ---------- */

.pad { position: relative; margin: 8px 0 22px; }
.pad::before, .pad::after { content: ""; position: absolute; border-radius: 4px; z-index: 0; }
.pad::before { inset: 14px 12px -14px; background: var(--under-2); box-shadow: var(--shadow); }
.pad::after { inset: 7px 6px -7px; background: var(--under-1); }

.leaf {
  position: relative; z-index: 1;
  min-height: 420px; padding-bottom: 18px;
  border-radius: 4px; background: var(--paper); color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.03);
  touch-action: pan-y;
  transform-origin: 50% 120%;
}
/* Загнутый уголок — подсказка, что листок можно оторвать */
.leaf.curled { padding-bottom: 34px; clip-path: polygon(0 0, 100% 0, 100% calc(100% - 32px), calc(100% - 32px) 100%, 0 100%); }
.curl {
  position: absolute; right: 0; bottom: 0; z-index: 2; width: 32px; height: 32px;
  clip-path: polygon(0 0, 100% 0, 0 100%);
  background: linear-gradient(135deg, var(--paper-back-2) 0%, var(--paper-back) 70%);
  pointer-events: none;
}

.perf {
  height: 7px; margin: 10px 16px 0;
  background: radial-gradient(circle at 3.5px 3.5px, var(--wall) 3.4px, transparent 3.9px) 0 0 / 14px 7px repeat-x;
}

.leaf-top {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 12px 20px 0; font-family: var(--display);
}
.leaf-month { font-size: 28px; line-height: 30px; font-weight: 700; }
.leaf-year { font-size: 24px; line-height: 30px; font-weight: 600; color: var(--muted); }

.leaf-num {
  margin: 8px 0 0; text-align: center;
  font-family: var(--display); font-weight: 900; font-size: clamp(150px, 57vw, 224px); line-height: 0.79;
  letter-spacing: -0.03em;
}
.leaf-weekday-row { display: flex; align-items: center; justify-content: space-between; padding: 2px 8px 0; }
.leaf-weekday { font-family: var(--display); font-size: 30px; line-height: 34px; font-weight: 700; }
.leaf.is-red .leaf-num, .leaf.is-red .leaf-weekday { color: var(--red); }

.leaf-status {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin: 10px 20px 0; padding: 12px 0 10px; border-top: 2px solid var(--ink);
  font-size: 15px; line-height: 20px;
}
.leaf-status span { color: var(--muted); }
.leaf-status strong { font-weight: 600; text-align: right; }

.leaf-note { margin: 0; padding: 12px 20px 0; border-top: 1px solid var(--rule-strong); color: var(--muted); font-size: 15px; }
.leaf-empty { margin: 0; padding: 22px 20px 8px; border-top: 1px solid var(--rule-strong); }
.leaf-empty b { display: block; font-family: var(--display); font-size: 26px; line-height: 30px; font-weight: 800; }
.leaf-empty span { color: var(--muted); font-size: 15px; }
.link-btn {
  min-height: 44px; padding: 0 2px; border: 0; background: none;
  color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px;
}

/* Листок отрывается вбок; следующий поднимается из стопки */
.leaf.dragging { transition: none; }
.leaf.snap { transition: transform 0.2s ease; }
.leaf.fly-left { transition: transform 0.24s cubic-bezier(0.4, 0, 0.7, 0.2), opacity 0.24s; transform: translateX(-120%) rotate(-14deg); opacity: 0; }
.leaf.fly-right { transition: transform 0.24s cubic-bezier(0.4, 0, 0.7, 0.2), opacity 0.24s; transform: translateX(120%) rotate(14deg); opacity: 0; }
.leaf.rise { animation: leaf-rise 0.26s ease-out; }
@keyframes leaf-rise { from { transform: translateY(12px) scale(0.97); opacity: 0.5; } to { transform: none; opacity: 1; } }

/* ---------- Записи ---------- */

.entries { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule-strong); }
.entry { display: flex; align-items: center; min-height: 56px; padding: 0 12px 0 20px; border-top: 1px solid var(--rule); }
.entry:first-child { border-top: 0; }
.entry-time {
  width: 56px; flex: none;
  font: 600 22px/24px var(--display); font-variant-numeric: tabular-nums;
}
.entry-time.allday { font: 400 12px/16px var(--body); color: var(--muted); white-space: nowrap; }
.check {
  width: 44px; height: 52px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border: 0; padding: 0; background: none;
}
.check-box {
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--ink); border-radius: 5px; color: var(--on-ink);
}
.check-box .icon { stroke-width: 2.8; opacity: 0; }
.entry-main {
  flex: 1; min-width: 0; min-height: 52px;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0 6px 6px; border: 0; background: none; text-align: left;
}
.entry-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.entry-title { font-size: 17px; line-height: 22px; font-weight: 500; overflow-wrap: anywhere; }
.entry-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; margin-top: 2px;
  font-size: 14px; line-height: 18px; color: var(--muted);
}
.entry-meta > span { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.entry-meta .soon { color: var(--ink); font-weight: 600; }
.entry.done .entry-time, .entry.done .entry-title { color: var(--muted); }
.entry.done .entry-title { text-decoration: line-through; }
.entry.done .check-box { background: var(--ink); }
.entry.done .check-box .icon { opacity: 1; }
.entry.flash .entry-title { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 40% { background: var(--marker); box-shadow: 0 0 0 3px var(--marker); } 100% { background: transparent; box-shadow: none; } }

/* Компактный вид — в неделе */
.entries.compact .entry { min-height: 48px; padding-left: 16px; }
.entries.compact .entry-time { width: 50px; font-size: 19px; }
.entries.compact .entry-time.allday { font-size: 12px; line-height: 16px; }
.entries.compact .check { height: 46px; }
.entries.compact .entry-main { min-height: 46px; }
.entries.compact .entry-title { font-size: 16px; }

/* ---------- Неделя ---------- */

.sheet-top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 8px 0 20px; font-family: var(--display);
}
.sheet-top h2 { margin: 0; font-size: 34px; line-height: 38px; font-weight: 800; }
.sheet-top .nav { display: flex; }
.wday { border-top: 2px solid var(--ink); margin: 12px 0 0; }
.wday + .wday { margin-top: 0; border-top: 1px solid var(--rule-strong); }
.wday:first-of-type { margin: 12px 0 0; }
.wday-head {
  width: 100%; min-height: 48px; display: flex; align-items: baseline; gap: 10px;
  padding: 8px 20px 4px; border: 0; background: none; text-align: left; font-family: var(--display);
}
.wday-num { font-size: 30px; line-height: 32px; font-weight: 900; min-width: 36px; }
.wday-name { font-size: 21px; line-height: 24px; font-weight: 700; }
.wday-note { margin-left: auto; font-family: var(--body); font-size: 14px; color: var(--muted); }
.wday.is-sunday .wday-num, .wday.is-sunday .wday-name { color: var(--red); }
.wday.is-today .wday-note { color: var(--ink); font-weight: 600; }
.wday .entries { border-top: 0; }
.wday-empty { margin: 0; padding: 0 20px 12px 66px; color: var(--muted); font-size: 15px; }

/* ---------- Месяц ---------- */

.month-top { display: flex; align-items: flex-end; justify-content: space-between; padding: 10px 8px 0 20px; }
.month-title { display: flex; align-items: baseline; gap: 10px; margin: 0; font-family: var(--display); }
.month-title b { font-size: 58px; line-height: 56px; font-weight: 900; letter-spacing: -0.01em; }
.month-title span { font-size: 28px; line-height: 30px; font-weight: 600; color: var(--muted); }
.month-grid { margin: 14px 12px 0; padding-top: 10px; border-top: 2px solid var(--ink); }
.month-heads, .month-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.month-heads span {
  text-align: center; font-family: var(--display); font-size: 17px; line-height: 20px; font-weight: 700; color: var(--muted);
}
.month-heads span:last-child { color: var(--red); }
.mday {
  height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 0; padding: 0; background: none;
}
.mday-num {
  width: 42px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 50%;
  font-family: var(--display); font-size: 27px; font-weight: 700;
}
.mday.is-sunday .mday-num { color: var(--red); }
.mday.is-other { opacity: 0.55; }
.mday.is-other .mday-num { color: var(--muted); }
.mday.is-today .mday-num { box-shadow: inset 0 0 0 2px var(--red); }
.mday.is-selected:not(.is-today) .mday-num { box-shadow: inset 0 0 0 2px var(--ink); }
.dots { display: flex; gap: 3px; height: 5px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.dots i.past { color: var(--muted); }

.soon-title { margin: 0; padding: 16px 20px 8px; font-family: var(--display); font-size: 24px; line-height: 26px; font-weight: 800; }
.soon { list-style: none; margin: 0; padding: 0; }
.soon-item {
  width: 100%; min-height: 48px; display: flex; align-items: center; gap: 10px;
  padding: 0 20px; border: 0; border-top: 1px solid var(--rule); background: none; text-align: left;
}
.soon-day { width: 52px; flex: none; font-family: var(--display); font-size: 19px; font-weight: 600; color: var(--muted); }
.soon-day.is-today { font-size: 17px; color: var(--ink); }
.soon-time { width: 62px; flex: none; font-family: var(--display); font-size: 19px; font-weight: 600; }
.soon-time.allday { font-size: 15px; }
.soon-title-text { flex: 1; min-width: 0; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.soon-empty { margin: 0; padding: 0 20px 12px; color: var(--muted); }

/* ---------- Итоги ---------- */

.period { display: flex; gap: 2px; margin: 0 12px 0 auto; }
.period button {
  height: 40px; padding: 0 12px; border: 0; border-radius: 20px; background: none;
  font-family: var(--display); font-size: 19px; font-weight: 700; color: var(--muted);
}
.period button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.stats-range {
  display: flex; align-items: center; justify-content: space-between;
  margin: 10px 8px 0; font-family: var(--display); font-size: 22px; font-weight: 700;
}
.stats-big { display: flex; align-items: baseline; gap: 10px; margin: 8px 20px 0; font-family: var(--display); }
.stats-big b { font-size: 120px; line-height: 0.85; font-weight: 900; letter-spacing: -0.03em; }
.stats-big span { font-size: 34px; font-weight: 700; color: var(--muted); }
.stats-cap { margin: 8px 20px 0; color: var(--muted); }
.stats-bar { height: 10px; margin: 12px 20px 0; border-radius: 5px; background: var(--rule-strong); overflow: hidden; }
.stats-bar i { display: block; height: 100%; background: var(--ink); }
.stats-title { margin: 22px 20px 6px; font-family: var(--display); font-size: 24px; line-height: 26px; font-weight: 800; }
.overdue { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule-strong); }
.overdue li { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 6px 12px 6px 20px; border-top: 1px solid var(--rule); }
.overdue li:first-child { border-top: 0; }
.overdue-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.overdue-text b { font-weight: 600; overflow-wrap: anywhere; }
.overdue-text span { color: var(--red); font-size: 14px; }
.types { list-style: none; margin: 0; padding: 0 20px; }
.types li { display: grid; grid-template-columns: 20px 86px 1fr 52px; align-items: center; gap: 10px; min-height: 36px; font-size: 15px; }
.types .bar { height: 8px; display: flex; }
.types .bar-total { height: 8px; border-radius: 4px; background: var(--rule-strong); overflow: hidden; display: flex; }
.types .bar-done { background: var(--c); }
:root[data-theme="dark"] .types .bar-done { background: color-mix(in srgb, var(--c) 72%, #fff); }
.types .num { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 14px; }
.stats-note { margin: 16px 20px 0; color: var(--muted); }

/* ---------- Шторка ---------- */

.sheet-layer { position: fixed; inset: 0; z-index: 10; }
.sheet-backdrop { position: absolute; inset: 0; background: var(--dim); opacity: 0; transition: opacity 0.2s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-width: 520px; max-height: calc(100% - 24px); margin: 0 auto;
  display: flex; flex-direction: column;
  border-radius: 6px 6px 0 0; background: var(--paper); color: var(--ink);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.25);
  transform: translateY(100%); transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet-layer.open .sheet-backdrop { opacity: 1; }
.sheet-layer.open .sheet { transform: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 8px 0 20px; }
.sheet-title { margin: 0; font-family: var(--display); font-size: 32px; line-height: 36px; font-weight: 800; overflow-wrap: anywhere; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px 20px calc(20px + var(--safe-bottom)); }

/* ---------- Форма записи ---------- */

.smart { position: relative; display: block; margin-top: 10px; padding-bottom: 10px; border-bottom: 2px solid var(--ink); }
.smart-mirror, .smart-input {
  display: block; width: 100%; margin: 0; padding: 0; border: 0;
  font: 500 20px/30px var(--body); letter-spacing: normal;
  white-space: pre-wrap; overflow-wrap: break-word; word-break: normal;
}
.smart-mirror { min-height: 30px; color: var(--ink); }
.smart-input {
  position: absolute; top: 0; left: 0; height: calc(100% - 10px);
  resize: none; overflow: hidden; background: transparent; color: transparent; caret-color: var(--ink); outline: none;
}
.smart-input::placeholder { color: var(--muted); }
.smart.plain .smart-input { color: var(--ink); }
mark { background: var(--marker); color: var(--marker-ink); border-radius: 2px; box-shadow: 0 0 0 2px var(--marker); }
.form-hint { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 18px; }

.stub { display: flex; gap: 14px; margin-top: 16px; }
.stub-leaf {
  width: 92px; flex: none; padding: 8px 0 10px; border-radius: 3px; background: var(--paper-back-2);
  display: flex; flex-direction: column; align-items: center; font-family: var(--display);
}
.stub-month { font-size: 15px; line-height: 16px; font-weight: 700; color: var(--muted); }
.stub-num { font-size: 64px; line-height: 58px; font-weight: 900; letter-spacing: -0.03em; }
.stub-wd { font-size: 18px; line-height: 20px; font-weight: 700; }
.stub-leaf.is-red .stub-num, .stub-leaf.is-red .stub-wd { color: var(--red); }
.stub-list { flex: 1; min-width: 0; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; justify-content: center; }
.stub-list li { display: flex; align-items: center; gap: 10px; min-height: 36px; border-top: 1px solid var(--rule); font-size: 15px; color: var(--muted); }
.stub-list li:first-child { border-top: 0; }
.stub-list .t { width: 50px; flex: none; font-family: var(--display); font-size: 20px; font-weight: 600; }
.stub-list .t.allday { font-family: var(--body); font-size: 12px; font-weight: 400; white-space: nowrap; }
.stub-list .x { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.stub-list li.new { color: var(--ink); font-weight: 600; }
.stub-list li.more { color: var(--muted); font-size: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip {
  position: relative; height: 44px; display: inline-flex; align-items: center; gap: 6px;
  padding: 0 14px; border: 1.5px solid var(--ink); border-radius: 22px; background: none;
  font-size: 15px; font-weight: 500; white-space: nowrap;
}
.chip .icon { width: 17px; height: 17px; }
.chip[aria-pressed="true"], .chip.on { background: var(--ink); color: var(--on-ink); }
.chip-native {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0;
  cursor: pointer; appearance: none; -webkit-appearance: none; font-size: 16px;
}
.chip-group { display: inline-flex; align-items: center; }
.chip-group .chip { border-radius: 22px 0 0 22px; }
.chip-clear {
  width: 40px; height: 44px; display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--ink); border-left: 0; border-radius: 0 22px 22px 0; background: none; padding: 0;
}
.chip-clear .icon { width: 16px; height: 16px; }
.note-input {
  display: block; width: 100%; min-height: 84px; margin-top: 12px; padding: 10px 12px;
  border: 1.5px solid var(--rule-strong); border-radius: 10px; background: transparent; resize: vertical; font-size: 16px;
}
.primary-btn {
  width: 100%; min-height: 54px; margin-top: 20px; padding: 0 16px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; background: var(--ink); color: var(--on-ink);
  font-family: var(--display); font-size: 24px; font-weight: 800;
}
.primary-btn:disabled { opacity: 0.4; cursor: default; }
.ghost-btn {
  min-height: 48px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px solid var(--ink); border-radius: 12px; background: none; font-size: 16px; font-weight: 500;
}
.ghost-btn.danger { color: var(--red); border-color: var(--red); }

/* ---------- Карточка записи ---------- */

.card-cat { display: flex; align-items: center; gap: 8px; margin: 4px 0 0; font-weight: 600; }
.facts { list-style: none; margin: 14px 0 0; padding: 0; border-top: 1px solid var(--rule-strong); }
.facts li { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--rule); line-height: 22px; }
.facts li:first-child { border-top: 0; }
.facts .icon { margin-top: 1px; color: var(--muted); }
.facts .note { white-space: pre-wrap; overflow-wrap: anywhere; }
.actions { margin-top: 12px; border-top: 1px solid var(--rule-strong); }
.action {
  width: 100%; min-height: 54px; display: flex; align-items: center; gap: 14px;
  padding: 8px 0; border: 0; border-bottom: 1px solid var(--rule); background: none; text-align: left; font-size: 16px;
}
.action > span { display: flex; flex-direction: column; }
.action small { color: var(--muted); font-size: 13px; line-height: 17px; }
.action.danger { color: var(--red); }
.primary-btn .icon { stroke-width: 2.4; }

/* ---------- Поиск, фильтр, настройки ---------- */

.search-input {
  display: block; width: 100%; margin-top: 10px; padding: 0 0 8px;
  border: 0; border-bottom: 2px solid var(--ink); border-radius: 0; background: transparent;
  font: 500 20px/30px var(--body); outline: none;
}
.search-input::-webkit-search-cancel-button { display: none; }
.results { list-style: none; margin: 12px 0 0; padding: 0; }
.result {
  width: 100%; min-height: 56px; display: flex; align-items: center; gap: 12px;
  padding: 6px 0; border: 0; border-top: 1px solid var(--rule); background: none; text-align: left;
}
.result-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.result-text b { font-weight: 500; overflow-wrap: anywhere; }
.result-text span { font-size: 14px; color: var(--muted); }
.results-empty { padding: 12px 0; color: var(--muted); }
.filter-chips .chip[aria-pressed="false"] { border-color: var(--rule-strong); color: var(--muted); }
.filter-chips .chip[aria-pressed="false"] .icon { opacity: 0.6; }
.filter-chips .chip[aria-pressed="true"] { background: none; color: var(--ink); border-color: var(--ink); }
.row-actions { display: flex; gap: 8px; margin-top: 18px; }
.row-actions > * { flex: 1; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--rule); }
.setting:first-child { border-top: 0; }
.setting small { display: block; color: var(--muted); font-size: 14px; line-height: 18px; }
.setting input[type="checkbox"] { width: 24px; height: 24px; accent-color: var(--ink); flex: none; }
.setting input[type="time"] {
  height: 44px; padding: 0 10px; border: 1.5px solid var(--rule-strong); border-radius: 10px; background: transparent;
}
.setting-note { margin: 10px 0 0; color: var(--muted); font-size: 14px; }

/* ---------- Сообщение ---------- */

.toast {
  position: fixed; left: 12px; right: 12px; z-index: 8;
  bottom: calc(var(--bar-height) + 8px + var(--safe-bottom));
  max-width: 496px; margin: 0 auto; min-height: 52px;
  display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 16px;
  border-radius: 12px; background: var(--ink); color: var(--on-ink);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  opacity: 0; transform: translateY(8px); transition: opacity 0.18s, transform 0.18s;
}
.toast.show { opacity: 1; transform: none; }
.toast.error { background: var(--red); color: #fff; }
.toast-text { flex: 1; font-size: 15px; line-height: 20px; }
.toast-action {
  min-height: 44px; padding: 0 12px; border: 0; border-radius: 8px; background: none;
  color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .leaf.rise, .entry.flash .entry-title { animation: none; }
  .leaf.fly-left, .leaf.fly-right, .leaf.snap, .sheet, .sheet-backdrop, .toast { transition: none; }
}
