/* Планировщик звонков.
   Раскладка: слева узкая колонка разделов (на телефоне — нижняя панель),
   в центре одна колонка «стопки» дел и звонков, справа выезжает карточка
   обещания. Время звонка везде пишется как счётчик плёнки: моноширинно. */
:root {
  --bg: #f2f5f5;
  --surface: #ffffff;
  --surface-2: #e9eeee;
  --surface-3: #dfe6e6;
  --line: #d9e1e1;
  --text: #132022;
  --text-2: #4a5a5c;
  --text-3: #7d8b8d;
  --accent: #0b7480;
  --accent-ink: #ffffff;
  --accent-soft: #d6eeef;
  --late: #c6402f;
  --late-soft: #fbe5e1;
  --soon: #a86a0a;
  --soon-soft: #fbefd6;
  --ok: #2e8a55;
  --ok-soft: #dcf1e3;
  --shadow: 0 1px 2px rgba(16, 36, 38, .06), 0 6px 20px rgba(16, 36, 38, .06);
  --shadow-lg: 0 18px 50px rgba(10, 30, 32, .18);
  --scrim: rgba(12, 22, 24, .38);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-rounded, "SF Pro Rounded", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 14px;
  --r-sm: 9px;
  --rail: 248px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1415; --surface: #161c1d; --surface-2: #1d2526; --surface-3: #263031; --line: #283234;
    --text: #e6eded; --text-2: #a3b1b2; --text-3: #6e7e80;
    --accent: #45c2c9; --accent-ink: #062224; --accent-soft: #123b3e;
    --late: #ff7a68; --late-soft: #3a1c18; --soon: #f0b44c; --soon-soft: #362a14; --ok: #5fcf8d; --ok-soft: #15301f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, .5);
    --scrim: rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1415; --surface: #161c1d; --surface-2: #1d2526; --surface-3: #263031; --line: #283234;
  --text: #e6eded; --text-2: #a3b1b2; --text-3: #6e7e80;
  --accent: #45c2c9; --accent-ink: #062224; --accent-soft: #123b3e;
  --late: #ff7a68; --late-soft: #3a1c18; --soon: #f0b44c; --soon-soft: #362a14; --ok: #5fcf8d; --ok-soft: #15301f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .5);
  --scrim: rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text); font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.num, .tc, time { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ загрузка --- */
.boot { min-height: 100%; display: grid; place-items: center; }
.boot-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--accent); opacity: .85; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.88); opacity: .5; } }

/* ------------------------------------------------------------- каркас --- */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100%; }
.rail {
  position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 4px;
  padding: 20px 14px calc(16px + env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px));
  border-right: 1px solid var(--line); background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 16px; text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; color: var(--accent-ink); flex: none; }
.brand-name { font: 600 16px/1.1 var(--font-display); letter-spacing: -.01em; }
.brand-sub { font-size: 11.5px; color: var(--text-3); }
.search-btn {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; margin-bottom: 10px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); color: var(--text-3); text-align: left;
}
.search-btn kbd { margin-left: auto; font: 11px var(--font-mono); padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line); background: var(--surface); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--r-sm);
  text-decoration: none; color: var(--text-2); font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--text); }
.nav a[aria-current="page"] svg { color: var(--accent); }
.nav .count { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--text-3); font-variant-numeric: tabular-nums; }
.nav .count.alert { color: #fff; background: var(--late); border-radius: 999px; padding: 0 7px; line-height: 19px; }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 10px 8px 0; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-3); }
.rail-foot .row { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; border: 0;
  background: transparent; color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.link-btn { border: 0; background: none; padding: 0; color: var(--text-2); text-decoration: underline; text-underline-offset: 3px; }

.main { min-width: 0; padding-block: 28px 64px; padding-left: max(32px, env(safe-area-inset-left, 0px)); padding-right: max(32px, env(safe-area-inset-right, 0px)); }
.page { max-width: 880px; margin: 0 auto; display: flex; flex-direction: column; gap: 26px; }

.topbar, .tabbar { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .main { padding-block: 8px calc(96px + env(safe-area-inset-bottom, 0px)); padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
  body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--bg); }
  .topbar {
    display: flex; align-items: center; gap: 6px; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
    padding: 10px var(--gutter-r) 10px var(--gutter-l); margin: 0 calc(-1 * var(--gutter-r)) 0 calc(-1 * var(--gutter-l));
    background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  }
  .topbar .brand { padding: 0; }
  .topbar .spacer { flex: 1; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    padding: 6px var(--gutter-r) calc(6px + env(safe-area-inset-bottom, 0px)) var(--gutter-l);
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; font-size: 10.5px; font-weight: 500; color: var(--text-3); text-decoration: none; position: relative; }
  .tabbar a[aria-current="page"] { color: var(--accent); }
  .tabbar .dot { position: absolute; top: 1px; left: calc(50% + 8px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--late); color: #fff; font-size: 10px; line-height: 16px; text-align: center; font-weight: 700; }
  .page { gap: 22px; }
}

/* ------------------------------------------------------------ заголовки --- */
.head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.head .grow { flex: 1; min-width: 0; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
h1 { margin: 2px 0 0; font: 700 30px/1.15 var(--font-display); letter-spacing: -.02em; text-wrap: balance; }
h2 { margin: 0; font: 650 17px/1.3 var(--font-display); letter-spacing: -.005em; display: flex; align-items: center; gap: 8px; }
h2 .n { font: 600 13px var(--font); color: var(--text-3); font-variant-numeric: tabular-nums; }
.lede { margin: 6px 0 0; color: var(--text-2); max-width: 62ch; }
.section { display: flex; flex-direction: column; gap: 10px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
@media (max-width: 860px) { h1 { font-size: 25px; } }

/* --------------------------------------------------------- плашки дня --- */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tile {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--surface); text-decoration: none; color: var(--text-2); font-size: 13px;
}
.tile b { font: 700 26px/1.1 var(--font-display); color: var(--text); font-variant-numeric: tabular-nums; }
.tile.late b { color: var(--late); }
.tile.soon b { color: var(--soon); }
.tile:hover { border-color: var(--text-3); }
@media (max-width: 560px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ------------------------------------------------------- переключатели --- */
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: none; border: 0; background: transparent; padding: 6px 12px; border-radius: 9px; font-size: 13.5px; font-weight: 550; color: var(--text-2); white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg .n { margin-left: 5px; color: var(--text-3); font-variant-numeric: tabular-nums; font-weight: 500; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn { border: 1px solid var(--line); background: var(--surface); padding: 4px 11px; border-radius: 999px; font-size: 13px; color: var(--text-2); }
.chip-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ----------------------------------------------------------- обещания --- */
.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.group-label { padding: 10px 16px 6px; font-size: 12px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); background: var(--surface); }
.group-label.late { color: var(--late); }
.group-label.soon { color: var(--soon); }
.item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start;
  padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface); cursor: pointer; transition: background .15s;
}
.group-label + .item, .list > .item:first-child { border-top: 0; }
.item:hover { background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
.check {
  width: 22px; height: 22px; margin-top: 1px; border-radius: 50%; border: 2px solid var(--text-3); background: transparent;
  display: grid; place-items: center; color: transparent; padding: 0; transition: all .18s;
}
.check:hover { border-color: var(--ok); color: var(--ok); }
.item.done .check { background: var(--ok); border-color: var(--ok); color: #fff; }
.item.done .what { text-decoration: line-through; text-decoration-color: var(--text-3); color: var(--text-3); }
.item.dropped .what { color: var(--text-3); }
.item.leaving { animation: leave .45s ease forwards; }
@keyframes leave { 60% { opacity: .5; } to { opacity: 0; transform: translateX(14px); } }
.what { font-weight: 520; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 3px; font-size: 12.5px; color: var(--text-3); }
.meta .who { color: var(--text-2); font-weight: 550; }
.meta .src { display: inline-flex; gap: 5px; align-items: center; min-width: 0; }
.due { align-self: center; white-space: nowrap; font-size: 12.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-variant-numeric: tabular-nums; }
.due.late { background: var(--late-soft); color: var(--late); }
.due.today { background: var(--soon-soft); color: var(--soon); }
.due.none { background: transparent; color: var(--text-3); font-weight: 500; }
.kind-tag { font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); }
.kind-tag.assigned { background: var(--soon-soft); color: var(--soon); }
.more-row { padding: 10px 16px; border-top: 1px solid var(--line); background: var(--surface); }
@media (max-width: 560px) {
  .item { grid-template-columns: auto minmax(0, 1fr); padding: 12px 14px; }
  .item .due { grid-column: 2; justify-self: start; margin-top: -4px; }
}

/* тайм-код как счётчик плёнки */
.tc {
  display: inline-flex; align-items: center; font: 600 11.5px/1 var(--font-mono); padding: 3px 6px; border-radius: 6px;
  background: var(--surface-2); color: var(--text-2); text-decoration: none; border: 0; vertical-align: 1px;
}
a.tc:hover, button.tc:hover { background: var(--accent-soft); color: var(--accent); }

/* ------------------------------------------------------------- звонки --- */
.calls { display: flex; flex-direction: column; gap: 10px; }
.call-card {
  display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; padding: 14px 16px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: inherit; transition: border-color .15s, transform .15s;
}
.call-card:hover { border-color: var(--text-3); }
.call-date { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.call-date .d { font: 700 20px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.call-date .m { font-size: 12px; color: var(--text-3); text-transform: lowercase; }
.call-date .t { font: 600 12px var(--font-mono); color: var(--text-2); margin-top: 4px; }
.call-title { font: 620 16px/1.3 var(--font-display); letter-spacing: -.005em; overflow-wrap: anywhere; }
.call-gist { margin-top: 4px; color: var(--text-2); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.call-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-variant-numeric: tabular-nums; }
.tag.accent { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tag.muted { color: var(--text-3); }
.week-label { margin: 10px 0 2px; font-size: 12px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }

.back { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--text-2); text-decoration: none; margin-bottom: 4px; }
.back:hover { color: var(--text); }
.call-hero { display: flex; flex-direction: column; gap: 10px; }
.call-hero .facts { display: flex; flex-wrap: wrap; gap: 8px; color: var(--text-2); font-size: 14px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; border: 0; background: none; padding: 10px 12px; font-weight: 560; color: var(--text-3); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }

.protocol { display: grid; gap: 14px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.panel h3 { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.bul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 9px; }
.bul li { position: relative; padding-left: 18px; overflow-wrap: anywhere; }
.bul li::before { content: ""; position: absolute; left: 3px; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.bul li.lead { font-weight: 560; }
.bul li.lead::before { background: var(--accent); width: 8px; height: 8px; left: 2px; top: .55em; }
.bul.decisions li::before { content: ""; width: 10px; height: 6px; border-radius: 0; background: none; border-left: 2px solid var(--ok); border-bottom: 2px solid var(--ok); transform: rotate(-45deg); top: .45em; left: 1px; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.todo-person { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.todo-person .who-line { display: flex; align-items: center; gap: 8px; font-weight: 620; }
.avatar { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center; font: 700 12px var(--font-display); color: #fff; }
.avatar.lg { width: 44px; height: 44px; font-size: 16px; }
.todo-person ul { margin: 0; padding: 0 0 0 36px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text-2); }
.note { font-size: 13px; color: var(--text-3); }

.md { display: flex; flex-direction: column; gap: 10px; overflow-wrap: anywhere; }
.md h3 { margin: 14px 0 0; font: 650 16px var(--font-display); }
.md h4 { margin: 10px 0 0; font-size: 14px; }
.md p { margin: 0; max-width: 72ch; }
.md ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 5px; }
.md ul ul { margin-top: 5px; }
.md blockquote { margin: 0; padding: 4px 12px; border-left: 3px solid var(--line); color: var(--text-2); }
.md .tbl { overflow-x: auto; }
.md table { border-collapse: collapse; font-size: 13.5px; }
.md td, .md th { border: 1px solid var(--line); padding: 5px 8px; text-align: left; vertical-align: top; }
.md code { font-family: var(--font-mono); font-size: .9em; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }
.md .ck { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 4px; border: 1.5px solid var(--text-3); margin-right: 6px; vertical-align: -2px; font-size: 10px; }
.md .ck.on { background: var(--ok); border-color: var(--ok); color: #fff; }

.transcript { display: flex; flex-direction: column; }
.tr-tools { display: flex; gap: 10px; align-items: center; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg); padding: 8px 0; }
.tr-line { display: grid; grid-template-columns: 60px minmax(0, 1fr); gap: 12px; padding: 8px 10px; border-radius: 10px; scroll-margin-top: 120px; }
.tr-line .spk { font-weight: 620; font-size: 13px; }
.tr-line .txt { overflow-wrap: anywhere; }
.tr-line.me .spk { color: var(--accent); }
.tr-line.flash { animation: flash 2.2s ease; }
@keyframes flash { 0%, 40% { background: var(--accent-soft); } to { background: transparent; } }
.ann { color: var(--text-3); font-size: .86em; }
mark { background: var(--soon-soft); color: inherit; border-radius: 3px; padding: 0 1px; }
.tr-note { font-size: 13px; color: var(--text-3); padding: 0 10px 10px; max-width: 72ch; }

/* ----------------------------------------------------------- календарь --- */
.cal-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-head .grow { flex: 1; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--line); gap: 1px; }
.cal .dow { background: var(--surface); padding: 8px 10px; font-size: 11.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.day {
  background: var(--surface); min-height: 104px; padding: 6px 7px; display: flex; flex-direction: column; gap: 3px; text-align: left;
  border: 0; border-radius: 0; color: inherit; min-width: 0;
}
.day.other { background: color-mix(in srgb, var(--surface) 55%, var(--bg)); color: var(--text-3); }
.day .dn { font: 600 13px var(--font-display); font-variant-numeric: tabular-nums; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.day.today .dn { background: var(--accent); color: var(--accent-ink); }
.day.sel { box-shadow: inset 0 0 0 2px var(--accent); }
.pill { font-size: 11.5px; line-height: 1.3; padding: 1px 6px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--accent-soft); color: var(--accent); }
.pill.p { background: var(--surface-2); color: var(--text-2); }
.pill.p.late { background: var(--late-soft); color: var(--late); }
.pill.p.done { text-decoration: line-through; color: var(--text-3); }
.pill.more { background: none; color: var(--text-3); padding-left: 2px; }
.dots { display: none; gap: 3px; flex-wrap: wrap; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.dots i.p { background: var(--text-3); }
.dots i.late { background: var(--late); }
@media (max-width: 640px) {
  .day { min-height: 54px; align-items: center; padding: 6px 2px; }
  .day .pill { display: none; }
  .day .dots { display: flex; justify-content: center; }
  .cal .dow { padding: 6px 0; text-align: center; font-size: 10.5px; }
}
.agenda { display: flex; flex-direction: column; gap: 10px; }

/* --------------------------------------------------------------- люди --- */
.person-card { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: inherit; min-width: 0; }
.person-card:hover { border-color: var(--text-3); }
.person-card .nm { font: 620 15.5px var(--font-display); }
.person-card .sub { font-size: 12.5px; color: var(--text-3); }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) { .two-col { grid-template-columns: minmax(0, 1fr); } }

/* ----------------------------------------------------------- пустота --- */
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 36px 20px; color: var(--text-3); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); }
.empty svg { color: var(--ok); }
.empty b { color: var(--text-2); font-weight: 600; }

/* -------------------------------------------------------- шторка дела --- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100%); z-index: 41; background: var(--surface); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: slide .22s cubic-bezier(.2, .8, .2, 1);
  padding: calc(16px + env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) 20px;
  overflow-y: auto; gap: 16px;
}
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
@media (max-width: 640px) {
  .drawer {
    top: auto; left: 0; width: 100%; max-height: 88vh; border-radius: 18px 18px 0 0; animation: rise .24s cubic-bezier(.2, .8, .2, 1);
    padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: max(18px, env(safe-area-inset-right, 0px));
  }
  @keyframes rise { from { transform: translateY(40px); opacity: 0; } }
}
.drawer-head { display: flex; align-items: center; gap: 8px; }
.drawer-head .grow { flex: 1; }
.drawer h2 { font-size: 20px; line-height: 1.3; }
.facts-list { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 14px; font-size: 14px; margin: 0; }
.facts-list dt { color: var(--text-3); }
.facts-list dd { margin: 0; overflow-wrap: anywhere; }
.quote { margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); font-size: 14.5px; color: var(--text-2); }
.quote::before { content: "«"; } .quote::after { content: "»"; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 14px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface); font-weight: 580; font-size: 14px; text-decoration: none; color: var(--text);
}
.btn:hover { border-color: var(--text-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { border-color: transparent; background: var(--surface-2); }
.btn.danger { color: var(--late); }
.date-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.date-row input[type="date"] { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
details.more summary { cursor: pointer; color: var(--text-3); font-size: 13px; }
details.more p { font-size: 13px; color: var(--text-2); margin: 8px 0 0; }

/* -------------------------------------------------------------- поиск --- */
.palette-wrap { position: fixed; inset: 0; z-index: 50; display: flex; justify-content: center; align-items: flex-start; padding: calc(10vh + env(safe-area-inset-top, 0px)) var(--gutter-r) 20px var(--gutter-l); }
.palette { width: min(680px, 100%); max-height: 76vh; display: flex; flex-direction: column; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; border: 1px solid var(--line); position: relative; z-index: 51; animation: pop .16s ease; }
@keyframes pop { from { transform: scale(.98); opacity: 0; } }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.palette-input input { flex: 1; border: 0; outline: none; background: transparent; font-size: 17px; min-width: 0; }
.palette-results { overflow-y: auto; padding: 6px; }
.res-group { padding: 10px 10px 4px; font-size: 11.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.res { display: block; padding: 9px 10px; border-radius: 10px; text-decoration: none; color: inherit; }
.res:hover, .res.active { background: var(--surface-2); }
.res .t { font-weight: 560; }
.res .s { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.res .c { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ------------------------------------------------------------- прочее --- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 16px; border-radius: 12px; background: var(--text); color: var(--bg);
  box-shadow: var(--shadow-lg); font-size: 14px; max-width: calc(100% - 32px);
}
.toast button { border: 0; background: transparent; color: var(--accent-soft); font-weight: 650; padding: 4px 6px; }
@media (max-width: 860px) { .toast { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); } }

.settings { display: flex; flex-direction: column; gap: 14px; }
.copy-row { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.copy-row input { flex: 1 1 260px; min-width: 0; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font: 12.5px var(--font-mono); }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; color: var(--text-2); font-size: 14px; }

/* ---------------------------------------------------------------- вход --- */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px var(--gutter-r) 24px var(--gutter-l); }
.login-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 16px; padding: 28px; background: var(--surface); border-radius: 20px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.login-card .brand { padding: 0; }
.login-card h1 { font-size: 24px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); }
.field input { padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font-size: 16px; color: var(--text); }
.err { color: var(--late); font-size: 13.5px; min-height: 1.2em; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ------------------------------------------- без встроенных стилей (CSP) --- */
.minw0 { min-width: 0; }
.flush { margin: 0; }
.spaced { margin-top: 12px; }
.tr-input { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); }
.av-0 { background: #2f7d6d; } .av-1 { background: #3d6bb3; } .av-2 { background: #9a5a2c; } .av-3 { background: #7b4fa6; }
.av-4 { background: #a2455a; } .av-5 { background: #4f7f2e; } .av-6 { background: #2b7f99; } .av-7 { background: #8a6d1f; }
.meta .src { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; max-width: 100%; }
details.stale > summary { cursor: pointer; list-style: none; padding: 11px 14px; border-radius: var(--r); border: 1px dashed var(--line); color: var(--text-2); font-size: 14px; background: var(--surface); }
details.stale > summary::-webkit-details-marker { display: none; }
details.stale > summary::before { content: "▸"; display: inline-block; margin-right: 8px; color: var(--text-3); transition: transform .15s; }
details.stale[open] > summary::before { transform: rotate(90deg); }
details.stale[open] > summary { margin-bottom: 10px; }
.drawer:focus { outline: none; }
