/* =============================================================================
   Мнемо — дизайн-система «Ночная библиотека»  ·  mnemo.css  v1.0
   Подключается ПОСЛЕ встроенного <style> в index.html и переопределяет его.
   Разметку не требует менять; то, что без разметки не сделать (иконки, сова),
   описано в docs/design/markup-changes.md.

   Порядок: 0 шрифты · 1 токены (светлая) · 2 тёмная тема · 3 база · 4 оболочка
   (сайдбар, шапка) · 5 примитивы (кнопки, поля, чипы, теги, бейджи) · 6 карточки
   · 7 страницы · 8 оверлеи (модалка, тосты, уведомления, палитра, баннер)
   · 9 мобильная ширина · 10 моушн и доступность
   ============================================================================= */

@import url("https://fonts.googleapis.com/css2?family=Onest:wght@400..700&family=JetBrains+Mono:wght@400;500&display=swap");

/* ---------------------------------------------------------------- 1. Токены */
:root {
  /* шрифты */
  --font: "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* нейтрали: тёплая «бумага», не холодный серый */
  --bg: #F7F6F3;          /* фон страницы */
  --side: #F0EEE9;        /* сайдбар — на тон темнее страницы, как в macOS */
  --card: #FFFFFF;        /* карточки, поповеры */
  --raised: #FFFFFF;      /* активный пункт навигации, сегмент */
  --sunken: #F3F2EE;      /* вложенные плашки, поля в карточках, скелетоны */
  --hover: rgba(24, 23, 28, .045);
  --press: rgba(24, 23, 28, .08);
  --fg: #18171C;          /* основной текст, 17.4:1 на --bg */
  --fg-2: #46444D;        /* вторичный текст, 9.4:1 */
  --muted: #706D78;       /* подписи, 4.9:1 на --bg, 5.2:1 на --card */
  --faint: #A3A0AA;       /* плейсхолдеры, разделители-точки (не для текста-смысла) */
  --line: #E7E4DE;        /* хайрлайны */
  --line-strong: #D6D2CA; /* рамки полей, ховер карточек */

  /* единственный акцент — «чернила совы» */
  --accent: #4B42D6;       /* текст-ссылки, иконки, кольцо фокуса */
  --accent-solid: #4B42D6; /* заливка кнопок (белый текст 7.6:1) */
  --accent-hover: #4038C4;
  --accent-press: #362FAE;
  --accent-fg: #FFFFFF;
  --accent-soft: #EEEDFC;  /* выделение выбранного, мягкие плашки */
  --accent-line: #CBC7F6;
  --accent-ink: #3A32B5;   /* текст на --accent-soft, 7.9:1 */

  /* семантика */
  --ok: #1A7F55;   --ok-soft: #E4F3EB;
  --warn: #A86400; --warn-soft: #FBF0DB;
  --bad: #C53A3A;  --bad-soft: #FBE8E6;

  /* сущности памяти — приглушены до одного уровня насыщенности */
  --space: #6A4BCF; --project: #1A7F55; --person: #B0541C; --org: #0E7490;

  /* откуда пришло (ReminderOut.origin) */
  --o-exchange: #2F6FE4; --o-ktalk: #7A4FE0; --o-google: #2E9A55; --o-ical: #0F8C82;
  --o-meeting: #C77A12;  --o-telegram: #1E8FD0; --o-note: #9A7316; --o-voice: #CF3D82;
  --o-document: #66707F; --o-mail: #4B42D6; --o-manual: #8A8792;

  /* маскот */
  --owl-body: #5B4FDB; --owl-belly: #EFECFF; --owl-ink: #1B1A2E; --owl-eye: #FFFFFF; --owl-beak: #F2A93B;

  /* геометрия: шаг 4 */
  --r-xs: 6px; --r-sm: 8px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px; --r-full: 999px;
  --ctl-sm: 28px; --ctl: 36px; --ctl-lg: 44px;

  /* глубина: хайрлайн + мягкая тень, никакой «грязи» */
  --shadow-xs: 0 1px 1px rgba(24, 23, 28, .04);
  --shadow: 0 1px 2px rgba(24, 23, 28, .05), 0 1px 1px rgba(24, 23, 28, .02);
  --shadow-md: 0 6px 16px -6px rgba(24, 23, 28, .12), 0 2px 4px -2px rgba(24, 23, 28, .06);
  --shadow-lg: 0 18px 40px -12px rgba(24, 23, 28, .22), 0 4px 10px -4px rgba(24, 23, 28, .08);
  --shadow-xl: 0 32px 80px -20px rgba(24, 23, 28, .35), 0 8px 24px -8px rgba(24, 23, 28, .12);
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
  --scrim: rgba(18, 17, 26, .38);
  --glass: color-mix(in srgb, var(--bg) 78%, transparent);

  /* моушн */
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-in: cubic-bezier(.55, 0, 1, .45);
  --ease-spring: cubic-bezier(.34, 1.4, .64, 1);
  --d-1: 120ms; --d-2: 180ms; --d-3: 260ms; --d-4: 420ms;

  /* служебные картинки (меняются в тёмной теме) */
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23706D78' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  --chev-right-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E");

  color-scheme: light;
}

/* ------------------------------------------------------------ 2. Тёмная тема
   Два пути: системная (если пользователь не выбрал «светлую») и явная. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E0E11; --side: #121216; --card: #17171B; --raised: #212127; --sunken: #121215;
    --hover: rgba(255, 255, 255, .05); --press: rgba(255, 255, 255, .09);
    --fg: #EDECF1; --fg-2: #C6C4CE; --muted: #9693A0; --faint: #64616D;
    --line: #26262C; --line-strong: #36363E;
    --accent: #A39DFF; --accent-solid: #6259EE; --accent-hover: #7068F5; --accent-press: #554CDC; --accent-fg: #FFFFFF;
    --accent-soft: #23213D; --accent-line: #3D3A72; --accent-ink: #C3BFFF;
    --ok: #4CC38A; --ok-soft: rgba(76, 195, 138, .13);
    --warn: #E9A93E; --warn-soft: rgba(233, 169, 62, .13);
    --bad: #F27272; --bad-soft: rgba(242, 114, 114, .13);
    --space: #A792F5; --project: #4CC38A; --person: #EE9A5E; --org: #45BCD6;
    --o-exchange: #5B93F5; --o-ktalk: #A083F5; --o-google: #4CC38A; --o-ical: #3CC2B5;
    --o-meeting: #E9A93E; --o-telegram: #4AB3EC; --o-note: #D4AE4C; --o-voice: #EE6FA8;
    --o-document: #9AA3B2; --o-mail: #8E87FF; --o-manual: #8D8A96;
    --owl-body: #7D74FF; --owl-belly: #2A2747; --owl-ink: #121120; --owl-eye: #F4F3FA; --owl-beak: #F2B04B;
    --shadow-xs: 0 1px 1px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 8px 20px -6px rgba(0, 0, 0, .55);
    --shadow-lg: 0 20px 48px -12px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .05);
    --shadow-xl: 0 36px 90px -20px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .06);
    --scrim: rgba(0, 0, 0, .6);
    --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239693A0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E0E11; --side: #121216; --card: #17171B; --raised: #212127; --sunken: #121215;
  --hover: rgba(255, 255, 255, .05); --press: rgba(255, 255, 255, .09);
  --fg: #EDECF1; --fg-2: #C6C4CE; --muted: #9693A0; --faint: #64616D;
  --line: #26262C; --line-strong: #36363E;
  --accent: #A39DFF; --accent-solid: #6259EE; --accent-hover: #7068F5; --accent-press: #554CDC; --accent-fg: #FFFFFF;
  --accent-soft: #23213D; --accent-line: #3D3A72; --accent-ink: #C3BFFF;
  --ok: #4CC38A; --ok-soft: rgba(76, 195, 138, .13);
  --warn: #E9A93E; --warn-soft: rgba(233, 169, 62, .13);
  --bad: #F27272; --bad-soft: rgba(242, 114, 114, .13);
  --space: #A792F5; --project: #4CC38A; --person: #EE9A5E; --org: #45BCD6;
  --o-exchange: #5B93F5; --o-ktalk: #A083F5; --o-google: #4CC38A; --o-ical: #3CC2B5;
  --o-meeting: #E9A93E; --o-telegram: #4AB3EC; --o-note: #D4AE4C; --o-voice: #EE6FA8;
  --o-document: #9AA3B2; --o-mail: #8E87FF; --o-manual: #8D8A96;
  --owl-body: #7D74FF; --owl-belly: #2A2747; --owl-ink: #121120; --owl-eye: #F4F3FA; --owl-beak: #F2B04B;
  --shadow-xs: 0 1px 1px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 8px 20px -6px rgba(0, 0, 0, .55);
  --shadow-lg: 0 20px 48px -12px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .05);
  --shadow-xl: 0 36px 90px -20px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .06);
  --scrim: rgba(0, 0, 0, .6);
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239693A0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  color-scheme: dark;
}

/* -------------------------------------------------------------------- 3. База */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-rendering: optimizeLegibility; }
body {
  font: 400 14.5px/1.55 var(--font);
  font-feature-settings: "cv11", "ss01";
  letter-spacing: -.003em;
  background: var(--bg); color: var(--fg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
button, input, select, textarea { font-family: inherit; letter-spacing: inherit; }
b, strong { font-weight: 600; }
::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }
a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
code, kbd, pre, .kbd { font-family: var(--mono); }
.muted { color: var(--muted); font-size: 13px; }
.warn { color: var(--warn); }
.error, .bad, .rec, .overdue { color: var(--bad); }
.good { color: var(--ok); }
/* длинные ссылки и токены не должны распирать вёрстку */
.card, .toast, .brief, .modal .box { overflow-wrap: break-word; }
.card a, .task .meta, .fact, .q li, .md, .brief, .line .grow { overflow-wrap: anywhere; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* иконки из спрайта (см. markup-changes.md → icon()) */
svg.i { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: -3.5px;
     fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.i.sm { width: 15px; height: 15px; vertical-align: -2.5px; }
.i.lg { width: 22px; height: 22px; }
.i.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* иконки в контексте */
.card h2 > .i:first-child { color: var(--muted); }
.chip .i, .opt .i, .edit .i, button.ghost .i, button.primary .i, a.primary .i { width: 16px; height: 16px; vertical-align: -3px; }
.edit .i { width: 17px; height: 17px; }
.iconBtn .i { width: 18px; height: 18px; }
.task > div:first-child .i { width: 18px; height: 18px; vertical-align: -3px; }
.task .meta .i, .line .sub .i, .nitem .nw .i { width: 13px; height: 13px; vertical-align: -2px; }
.kicon .i { color: var(--muted); }
.nitem .ni .i, .toast .tt .ti .i { width: 16px; height: 16px; }
.addBtn .i { width: 18px; height: 18px; stroke-width: 2.2; }
.addTabs .i { width: 16px; height: 16px; }
.side .foot .i { width: 14px; height: 14px; }
.brief h4 .i { width: 13px; height: 13px; vertical-align: -2px; }
.empty svg.owl, .hero svg.owl { flex: none; }
.chatMsgs .bubble svg.owl { width: 22px; height: 22px; vertical-align: -6px; margin-right: 6px; }

/* скроллбары — тонкие, как в macOS */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* раскрывашки: свой шеврон вместо треугольника браузера */
details > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
  margin: 0; border-radius: var(--r-sm); }
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
  content: ""; flex: none; width: 14px; height: 14px; align-self: center;
  background: currentColor; opacity: .55;
  -webkit-mask: var(--chev-right-mask) center / contain no-repeat; mask: var(--chev-right-mask) center / contain no-repeat;
  transition: transform var(--d-2) var(--ease-out);
}
details[open] > summary::before { transform: rotate(90deg); }
details[open] > summary { margin-bottom: 10px; }

/* ---------------------------------------------------------- 4. Оболочка */
.app { grid-template-columns: 248px minmax(0, 1fr); }

.side {
  background: var(--side); border-right: 1px solid var(--line);
  padding: 14px 12px 12px; gap: 1px;
}
.brand { gap: 10px; padding: 4px 8px 14px; border-radius: var(--r-md); }
.brand svg { width: 34px; height: 34px; transition: transform var(--d-3) var(--ease-spring); }
.brand:hover svg { transform: rotate(-6deg) scale(1.04); }
.brand b { font-size: 16px; font-weight: 650; letter-spacing: -.015em; line-height: 1.15; }
.brand small { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; line-height: 1.3; }

.addBtn {
  height: var(--ctl); margin: 2px 0 14px; padding: 0 14px; gap: 8px;
  font-size: 14px; font-weight: 600; letter-spacing: -.005em;
  border-radius: var(--r-md); background: var(--accent-solid); color: var(--accent-fg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 1px 2px color-mix(in srgb, var(--accent-solid) 40%, transparent),
              0 4px 12px -4px color-mix(in srgb, var(--accent-solid) 45%, transparent);
  transition: background var(--d-1), transform var(--d-1), box-shadow var(--d-2);
}
.addBtn:hover { filter: none; background: var(--accent-hover); }
.addBtn:active { background: var(--accent-press); transform: translateY(1px); }

.side .grp {
  font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--faint); margin: 16px 10px 6px;
}
.side [data-tab] {
  position: relative; height: 34px; padding: 0 10px; gap: 10px;
  border-radius: var(--r-sm); color: var(--fg-2); font-size: 14px; font-weight: 500;
  transition: background var(--d-1), color var(--d-1);
}
.side [data-tab] .ic { width: 20px; display: inline-flex; justify-content: center; font-size: 15px; color: var(--muted); }
/* пока в .ic эмодзи — приглушаем их до монохрома; с иконками фильтр не нужен */
.side [data-tab] .ic:not(:has(svg)) { filter: grayscale(1) contrast(.9); opacity: .72; }
.side [data-tab]:hover { background: var(--hover); color: var(--fg); }
.side [data-tab]:active { background: var(--press); }
.side [data-tab].active {
  background: var(--raised); color: var(--fg); font-weight: 600;
  box-shadow: 0 0 0 1px var(--line), var(--shadow-xs);
}
.side [data-tab].active .ic { color: var(--accent); }
.side [data-tab].active .ic:not(:has(svg)) { filter: none; opacity: 1; }
.side [data-tab] .badge { background: var(--press); color: var(--fg-2); }
.side [data-tab] #tasksBadge, .side [data-tab] #inboxBadge { background: var(--accent-solid); color: var(--accent-fg); }
.side #srcBadge { background: var(--bad); color: #fff; }

.side .foot { gap: 2px; padding: 12px 4px 0; border-top: 1px solid var(--line); margin-top: auto; font-size: 12px; }
.side .foot a { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border-radius: var(--r-xs); color: var(--muted); }
.side .foot a:hover { background: var(--hover); color: var(--fg); text-decoration: none; }

main { max-width: 1120px; padding: 28px 40px 96px; }

.pagehead { align-items: center; margin-bottom: 22px; gap: 16px; min-height: 44px; }
.pagehead h1 { font-size: 28px; line-height: 34px; font-weight: 650; letter-spacing: -.025em; }
.pagehead p { margin-top: 4px; font-size: 14px; line-height: 20px; color: var(--muted); max-width: 62ch; }

.topbar { gap: 8px; }
.iconBtn {
  width: var(--ctl); height: var(--ctl); border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--card); color: var(--fg-2);
  box-shadow: var(--shadow-xs); font-size: 16px;
  transition: background var(--d-1), border-color var(--d-1), color var(--d-1);
}
.iconBtn:hover { border-color: var(--line-strong); background: var(--card); color: var(--fg); }
.iconBtn:active { background: var(--sunken); }
.iconBtn .badge { top: -5px; right: -5px; box-shadow: 0 0 0 2px var(--bg); background: var(--bad); color: #fff; }
.iconBtn.dnd { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.searchBtn { width: 260px; justify-content: flex-start; padding: 0 8px 0 12px; gap: 8px; font-size: 13.5px; color: var(--muted); }
.searchBtn .kbd { margin-left: auto; }
.kbd {
  font-size: 11px; line-height: 18px; padding: 0 6px; min-width: 20px; text-align: center;
  color: var(--muted); background: var(--sunken); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px;
}

/* -------------------------------------------------------- 5. Примитивы */
/* кнопки: primary / secondary(.ghost) / tertiary(.opt) / icon(.edit) / danger */
button.primary, a.primary, button.ghost, .opt, a.opt {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  white-space: nowrap; text-decoration: none; cursor: pointer; user-select: none;
  transition: background var(--d-1), border-color var(--d-1), color var(--d-1), box-shadow var(--d-2), transform var(--d-1);
}
button.primary, a.primary {
  height: var(--ctl); padding: 0 16px; border: 0; border-radius: var(--r-md);
  font-size: 14px; font-weight: 600;
  background: var(--accent-solid); color: var(--accent-fg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 1px 2px color-mix(in srgb, var(--accent-solid) 35%, transparent);
}
button.primary:hover, a.primary:hover { background: var(--accent-hover); text-decoration: none; }
button.primary:active, a.primary:active { background: var(--accent-press); transform: translateY(1px); }

button.ghost {
  height: var(--ctl); padding: 0 14px; border-radius: var(--r-md);
  font-size: 14px; font-weight: 500;
  background: var(--card); color: var(--fg); border: 1px solid var(--line-strong); box-shadow: var(--shadow-xs);
}
button.ghost:hover { background: var(--sunken); }
button.ghost:active { background: var(--press); transform: translateY(1px); }

.opt, a.opt {
  height: 30px; padding: 0 12px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 500;
  background: var(--card); color: var(--fg-2); border: 1px solid var(--line);
}
.opt:hover, a.opt:hover { background: var(--sunken); border-color: var(--line-strong); color: var(--fg); text-decoration: none; }
.opt:active { background: var(--press); }
.opt.top { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-line); }
.opt.top:hover { background: color-mix(in srgb, var(--accent) 16%, var(--card)); }
.opt .pct { color: inherit; opacity: .6; font-variant-numeric: tabular-nums; }
select.opt { padding-right: 28px; }

.edit {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-width: 28px; height: 28px; padding: 0 6px; border-radius: var(--r-sm);
  font-size: 13px; color: var(--muted); background: none; border: 0;
  transition: background var(--d-1), color var(--d-1);
}
.edit:hover { background: var(--hover); color: var(--fg); }
.edit[data-del]:hover, .edit[data-disc]:hover, .edit[data-forget]:hover { color: var(--bad); background: var(--bad-soft); }

.danger, button.primary.danger { background: var(--bad) !important; color: #fff; box-shadow: none; }
.danger:hover { filter: brightness(1.06); }

button:disabled, .opt:disabled { opacity: .45; cursor: progress; box-shadow: none; transform: none; }

/* поля */
input[type=text], input[type=password], input[type=date], input[type=time], input[type=datetime-local],
input[type=email], input[type=search], input[type=number], select, textarea {
  font-size: 14px; color: var(--fg);
  background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--d-1), box-shadow var(--d-2), background var(--d-1);
}
input[type=text], input[type=password], input[type=date], input[type=time], input[type=datetime-local],
input[type=email], input[type=search], input[type=number], select { height: var(--ctl); padding: 0 12px; }
textarea { padding: 10px 12px; line-height: 1.55; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--fg) 22%, var(--line-strong)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  padding-right: 32px; background-image: var(--chev); background-repeat: no-repeat; background-position: right 10px center;
}
input[type=time], input[type=date], input[type=datetime-local] { font-variant-numeric: tabular-nums; }

/* чекбокс: собственная отрисовка, нативная семантика */
input[type=checkbox] {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 18px; height: 18px; margin: 0 6px 0 0; vertical-align: -4px; cursor: pointer;
  border: 1.5px solid var(--line-strong); border-radius: 5px; background: var(--card);
  transition: background var(--d-1), border-color var(--d-1), box-shadow var(--d-2);
}
input[type=checkbox]:hover { border-color: var(--muted); }
input[type=checkbox]:checked { background: var(--accent-solid) var(--check) center / 12px no-repeat; border-color: var(--accent-solid); }
input[type=checkbox]:focus-visible { outline: none; box-shadow: var(--ring); }

/* в .toggle чекбокс — это переключатель (iOS-тумблер) */
.toggle > input[type=checkbox] {
  width: 38px; height: 22px; margin: 1px 0 0; border: 0; border-radius: var(--r-full);
  background: var(--line-strong); position: relative; order: 2;
  transition: background var(--d-2) var(--ease-out);
}
.toggle > input[type=checkbox]::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25), 0 0 0 .5px rgba(0, 0, 0, .04);
  transition: transform var(--d-3) var(--ease-spring);
}
.toggle > input[type=checkbox]:checked { background: var(--accent-solid); background-image: none; }
.toggle > input[type=checkbox]:checked::after { transform: translateX(16px); }
.toggle > input[type=checkbox]:hover { filter: brightness(.97); }

/* чипы — навигационные/быстрые действия */
.chip {
  height: 30px; padding: 0 12px; gap: 6px; border-radius: var(--r-full);
  font-size: 13px; font-weight: 500; color: var(--fg-2);
  background: var(--card); border: 1px solid var(--line);
  transition: background var(--d-1), border-color var(--d-1), color var(--d-1);
}
.chip:hover { border-color: var(--line-strong); background: var(--sunken); color: var(--fg); text-decoration: none; }
.chip:active { background: var(--press); }
.chip b { font-weight: 650; color: var(--fg); font-variant-numeric: tabular-nums; }
.chip.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.chip.bad { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.chip.warn b, .chip.bad b { color: inherit; }

/* теги сущностей — мягкая заливка вместо обводки */
.tag {
  display: inline-block; box-sizing: border-box; height: 22px; padding: 0 8px; margin: 2px 4px 2px 0;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;  /* a long name never spills over neighbours */
  border-radius: var(--r-xs); font-size: 12px; font-weight: 500; line-height: 20px; vertical-align: middle;
  border: 1px solid transparent; background: color-mix(in srgb, currentColor 10%, transparent);
  transition: background var(--d-1);
}
.tag:hover { background: color-mix(in srgb, currentColor 17%, transparent); }
.tag.space.inferred { border: 1px dashed color-mix(in srgb, currentColor 45%, transparent); }
.tag.space.predicted, .tag.space.assigned { border: 1px dotted color-mix(in srgb, currentColor 55%, transparent); background: transparent; }
.tag.space.review { background: var(--warn-soft); color: var(--warn); }
.tag.unlabeled { color: var(--muted); background: transparent; border: 1px dashed var(--line-strong); }

/* бейджи — счётчики */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px; border-radius: var(--r-full);
  font-size: 11px; font-weight: 650; line-height: 1; font-variant-numeric: tabular-nums;
  background: var(--accent-solid); color: var(--accent-fg);
}

/* источник происхождения — мягкая пилюля цвета источника */
.src {
  display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 5px;
  font-size: 11px; font-weight: 600; letter-spacing: .01em; vertical-align: 1px;
  color: var(--o, var(--o-manual)); background: color-mix(in srgb, var(--o, var(--o-manual)) 13%, transparent);
}
.conf { font-size: 11px; padding: 1px 7px; border-radius: var(--r-full); border: 0; background: var(--sunken); color: var(--muted); }
.conf.высокая { color: var(--ok); background: var(--ok-soft); border: 0; }

/* -------------------------------------------------------- 6. Карточки */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.card h2 {
  font-size: 15px; line-height: 22px; font-weight: 600; letter-spacing: -.01em;
  margin: 0 0 12px; gap: 8px; color: var(--fg);
}
.card h2 .more {
  font-size: 13px; font-weight: 500; color: var(--muted);
  padding: 2px 6px; margin-right: -6px; border-radius: var(--r-xs);
}
.card h2 .more:hover { color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.grid2 { gap: 16px; }
.grid2[style*="margin-bottom"] { margin-bottom: 16px !important; }
.stack { gap: 16px; }
.cols { gap: 16px; }
.row { gap: 8px; margin-top: 12px; }

/* строки списков */
.line { gap: 12px; padding: 10px 0; font-size: 14px; align-items: center; }
.line .sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.line .tick {
  width: 20px; height: 20px; border: 1.5px solid var(--line-strong); color: transparent; font-size: 11px;
  transition: border-color var(--d-1), background var(--d-1), color var(--d-1), transform var(--d-2) var(--ease-spring);
}
.line .tick:hover { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.line .tick:active { transform: scale(.88); }
.recent .line { margin: 0 -10px; padding: 10px; border-radius: var(--r-md); border-top-color: transparent; }
.recent .line + .line { box-shadow: 0 -1px 0 var(--line); }
.recent .line:hover { background: var(--hover); box-shadow: none; }
.recent .line:hover + .line { box-shadow: none; }
.recent .line:hover .grow > div:first-child { color: var(--fg); }
.kicon { width: 20px; color: var(--muted); }

/* пустые состояния */
.empty { gap: 16px; padding: 12px 0; font-size: 14px; color: var(--muted); line-height: 1.5; }
.empty > svg { width: 52px; height: 52px; opacity: 1; }
.empty b { color: var(--fg); font-weight: 600; }
.card.allDone .empty, .chatHello .empty { padding: 20px 4px; }

/* скелетон */
.skel { background: linear-gradient(90deg, var(--sunken) 25%, color-mix(in srgb, var(--fg) 6%, var(--sunken)) 50%, var(--sunken) 75%);
        background-size: 200% 100%; border-radius: var(--r-xs); height: 12px; margin: 10px 0; }

/* таблицы */
table.rep, .dtable { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; margin: 8px 0 16px; }
table.rep th, .dtable th {
  font-size: 12px; font-weight: 500; color: var(--muted); text-align: left; white-space: nowrap;
  padding: 8px 10px; border-bottom: 1px solid var(--line); background: transparent;
}
table.rep td, .dtable td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.rep tr:last-child td, .dtable tr:last-child td { border-bottom: 0; }
table.rep tbody tr:hover td, .dtable tr:hover td { background: var(--hover); }
table.rep td.num, .dtable td.num, table.rep th.num { text-align: right; font-variant-numeric: tabular-nums; }
.dtable td input[type=checkbox] { margin: 0; }

/* KPI-плитки */
.dstats, .tiles { gap: 10px; }
.stat {
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; background: var(--sunken);
  display: flex; flex-direction: column; gap: 2px;
}
.tiles .stat { background: var(--sunken); }
.stat > .muted:first-child { font-size: 12.5px !important; font-weight: 500; color: var(--muted); }
.stat > b { font-size: 24px !important; line-height: 30px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat > .muted:last-child:not(:first-child) { font-size: 12px !important; }

/* -------------------------------------------------------- 7. Страницы */

/* Сегодня: приветствие */
.hero {
  gap: 20px; padding: 24px 24px 20px; align-items: flex-start; position: relative; overflow: hidden;
  background:
    radial-gradient(90% 140% at 0% 0%, color-mix(in srgb, var(--accent) 9%, transparent) 0%, transparent 60%),
    var(--card);
}
.hero > svg { width: 64px; height: 64px; margin-top: 2px; filter: drop-shadow(0 6px 12px color-mix(in srgb, var(--owl-body) 25%, transparent)); }
.hero h2 { font-size: 24px; line-height: 30px; font-weight: 650; letter-spacing: -.022em; }
.hero .sum { color: var(--muted); font-size: 14px; margin-top: 4px; }
.hero .askline { margin-top: 16px; gap: 8px; }
.hero .askline input { height: var(--ctl-lg); padding: 0 16px; font-size: 15px; border-radius: 12px; background: var(--card); }
.hero .askline button.primary { height: var(--ctl-lg); padding: 0 18px; border-radius: 12px; }
.quick { gap: 8px; margin-top: 12px; }

.setup { gap: 10px; }
.step { border: 1px dashed var(--line-strong); border-radius: var(--r-md); padding: 12px 14px; background: var(--sunken);
        transition: border-color var(--d-1), background var(--d-1); }
.step:hover { border-color: var(--accent); background: var(--accent-soft); }
.step b { font-weight: 600; font-size: 14px; }
.step.done { opacity: .6; border-style: solid; background: transparent; }

/* ближайшая встреча */
.meet .when { font-size: 13px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.meet .ttl { font-size: 18px; line-height: 24px; font-weight: 650; letter-spacing: -.015em; margin: 4px 0 6px; }
.meet .hl { margin-top: 10px; padding: 10px 12px; border-radius: var(--r-md); background: var(--sunken); font-size: 13.5px; color: var(--fg-2); }

/* «Разобрать»: вопросы и предложения */
.q h3 { font-size: 16px; line-height: 23px; font-weight: 600; letter-spacing: -.01em; margin: 0 0 6px; }
.q h3 .muted { display: block; font-size: 13px; font-weight: 400; margin-top: 2px; letter-spacing: 0; }
.q ul { margin: 10px 0 4px; padding-left: 0; list-style: none; color: var(--fg-2); font-size: 13.5px; }
.q ul li { position: relative; padding: 3px 0 3px 16px; }
.q ul li::before { content: ""; position: absolute; left: 3px; top: 12px; width: 5px; height: 5px; border-radius: 50%; background: var(--faint); }
.q > .row { padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--line); }
.q > .row input[type=text] { max-width: 220px; }
.proposal {
  border-left: 1px solid var(--line);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 5%, var(--card)) 0, var(--card) 120px);
}
.ecard { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; background: var(--sunken); font-size: 13px; }
.pair { gap: 12px; margin: 12px 0; }
.fact { padding: 12px 0; line-height: 1.5; }
.fact > div { margin-top: 4px; }
.fact.hl, .fact.sel { margin: 0 -10px; padding: 12px 10px; border-radius: var(--r-md); background: var(--accent-soft); }
.stats { font-size: 13px; color: var(--muted); }

/* Дела */
.task { gap: 12px; padding: 14px 0 14px 14px; align-items: flex-start; }
.task.has-origin { box-shadow: inset 2px 0 0 var(--o, transparent); padding-left: 14px; }
.task > div:first-child { width: 20px; text-align: center; color: var(--muted); line-height: 22px; }
.task .body > div:first-child { font-size: 14.5px; font-weight: 500; line-height: 22px; }
.task .meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.task .acts { gap: 6px; align-items: center; }
@media (hover: hover) {
  .task .acts .edit, .task .acts select[data-snooze] { opacity: .5; transition: opacity var(--d-1); }
  .task:hover .acts .edit, .task:hover .acts select[data-snooze], .task .acts :focus-visible { opacity: 1; }
}
.imp {
  height: 26px; padding: 0 24px 0 10px; font-size: 12px; font-weight: 600; border-radius: var(--r-full);
  border: 0; box-shadow: none; background-position: right 6px center; background-size: 14px;
  background-color: color-mix(in srgb, currentColor 11%, transparent);
}
.imp-low { color: var(--muted); } .imp-normal { color: var(--accent); }
.imp-high { color: var(--warn); } .imp-critical { color: var(--bad); }
.group-title { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.brief { font-size: 13.5px; margin-top: 10px; padding: 14px 16px; border-radius: var(--r-md); background: var(--sunken); border: 1px solid var(--line); color: var(--fg-2); }
.brief h4 { margin: 14px 0 4px; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.brief ul { padding-left: 18px; } .brief li { margin: 2px 0; }

/* Календарь — сетка как в Apple Calendar */
.cal { gap: 4px; margin-top: 16px; }
.cal .dow { font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); padding: 0 0 4px; }
.cal .day {
  min-height: 104px; padding: 6px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--card);
  transition: border-color var(--d-1), background var(--d-1);
}
.cal .day:hover { border-color: var(--line-strong); background: var(--sunken); }
.cal .day.other { opacity: .42; background: transparent; }
.cal .day.today { border-color: var(--line); }
.cal .day.sel { outline: 0; border-color: var(--accent); box-shadow: var(--ring); }
.cal .num { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 4px;
            font-size: 12.5px; font-weight: 500; color: var(--fg-2); font-variant-numeric: tabular-nums; border-radius: var(--r-full); }
.cal .today .num { background: var(--accent-solid); color: var(--accent-fg); font-weight: 650; }
.cal .item { font-size: 11.5px; line-height: 18px; padding: 0 6px; margin-top: 3px; border-radius: 4px; border-left-width: 2px; color: var(--fg-2); }
.cal .more { font-size: 11px; color: var(--muted); padding-left: 6px; }
.legend { gap: 6px; margin: 12px 0 0; }

/* Ассистент */
.chat { grid-template-columns: 260px minmax(0, 1fr); gap: 16px; }
.chatList { padding: 10px; max-height: calc(100vh - 160px); }
.chatList #chatNew { height: var(--ctl); margin-bottom: 6px; }
.chatList .ci { padding: 8px 10px; margin-top: 2px; border-radius: var(--r-sm); font-size: 13.5px; font-weight: 500; color: var(--fg-2);
                transition: background var(--d-1); }
.chatList .ci small { font-size: 11.5px; font-weight: 400; color: var(--muted); margin-top: 1px; }
.chatList .ci:hover { background: var(--hover); }
.chatList .ci.sel { background: var(--accent-soft); color: var(--accent-ink); }
.chatMain { min-height: calc(100vh - 200px); padding: 0; overflow: hidden; }
.chatMain .chatHead { padding: 14px 20px; border-bottom: 1px solid var(--line); }
.chatMain .chatHead b { font-size: 15px; font-weight: 600; }
.chatMsgs { padding: 20px 24px; max-height: calc(100vh - 300px); }
.msg { margin: 16px 0; max-width: 88%; }
.msg .bubble { padding: 10px 14px; border-radius: 18px; line-height: 1.6; }
.msg.user .bubble { background: var(--accent-soft); color: var(--fg); border-bottom-right-radius: 6px; }
.msg.assistant { max-width: 100%; }
.msg.assistant .bubble { background: none; border: 0; padding: 2px 0; font-size: 14.5px; }
.msg .att { font-size: 12px; }
.chatFiles { padding: 0 20px; }
.chatFiles .fchip { font-size: 12px; height: 26px; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; border-radius: var(--r-full); background: var(--sunken); border: 1px solid var(--line); }
.chatInput {
  margin: 0 16px 16px; padding: 6px 6px 6px 8px; gap: 6px; align-items: flex-end;
  border: 1px solid var(--line-strong); border-radius: 16px; background: var(--card); box-shadow: var(--shadow-md);
  transition: border-color var(--d-1), box-shadow var(--d-2);
}
.chatInput:focus-within { border-color: var(--accent); box-shadow: var(--ring), var(--shadow-md); }
.chatInput textarea { border: 0; box-shadow: none; background: transparent; resize: none; min-height: 40px; padding: 9px 4px; font-size: 14.5px; }
.chatInput textarea:focus { box-shadow: none; }
.chatInput .attach { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0;
                     border-radius: var(--r-md); color: var(--muted); font-size: 16px; border: 0; }
.chatInput .attach:hover { background: var(--hover); color: var(--fg); }
.chatInput button.primary { height: 36px; border-radius: var(--r-md); }
.chatHello { padding: 24px 4px; }
.chatHello .chip { height: auto; min-height: 32px; padding: 6px 14px; white-space: normal; text-align: left; }
.cite { font-size: 10.5px; font-weight: 600; color: var(--accent-ink); background: var(--accent-soft); border-radius: 4px; padding: 0 4px; margin: 0 1px; }
.cite:hover { text-decoration: none; background: color-mix(in srgb, var(--accent) 22%, var(--card)); }
.cite.chip { height: 22px; padding: 0 8px; border: 0; border-radius: var(--r-full); font-size: 12px; }
.srclink { color: var(--accent); font-size: 12.5px; }
.rate .edit { min-width: 26px; height: 26px; }

/* Ассистент: даты, время, реплики */
.daysep { display: flex; align-items: center; gap: 12px; margin: 22px 0 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.daysep::before, .daysep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.daysep span { padding: 2px 10px; border: 1px solid var(--line); border-radius: var(--r-full); background: var(--card); }
.chatMsgs > .daysep:first-child { margin-top: 0; }
.mtime { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.msg.user { display: flex; flex-direction: column; align-items: flex-end; margin-left: auto; margin-top: 26px; }
.msg.user .mtime { margin: 3px 6px 0 0; }
.msg.user .att { align-self: flex-end; }
.msg.assistant .who { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--fg-2); margin-bottom: 2px; }
.msg.assistant .who svg.owl { width: 20px; height: 20px; flex: none; }
.msg.assistant .who .mtime { font-weight: 400; }
.msg.assistant .who .mtime::before { content: "·"; margin-right: 6px; color: var(--faint); }
.msg.assistant .bubble.md { padding-left: 26px; }
.msg.assistant > .action, .msg.assistant > details, .msg.assistant > .muted, .msg.assistant > .mfoot { margin-left: 26px; }
.msg.assistant .mfoot { margin: 4px 0 2px 26px; gap: 8px; }
.msg.assistant > .card.action { margin: 8px 0 6px 26px; }
.typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: typing 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
.opts.ctxasks { margin-left: 0; }

/* список разговоров: закреплённая лента + группы по дате */
.chatList .ci { display: flex; flex-direction: column; cursor: pointer; }
.chatList .ci .cit { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chatList .ci:focus-visible { outline: none; box-shadow: var(--ring); }
.chatList .ci.feed { flex-direction: row; align-items: center; gap: 10px; margin: 4px 0 6px; padding: 10px; border: 1px solid var(--line); background: var(--sunken); }
.chatList .ci.feed .grow { display: flex; flex-direction: column; min-width: 0; }
.chatList .ci.feed:hover { border-color: var(--line-strong); }
.chatList .ci.feed.sel { background: var(--accent-soft); border-color: var(--accent-line); }
.chatList .ci .badge { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-full); background: var(--accent-solid);
  color: var(--accent-fg); font-size: 11.5px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.cigrp { margin: 12px 10px 2px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.fkicon { width: 30px; height: 30px; flex: none; border-radius: var(--r-sm); display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); }
.fcard.digest .fkicon, .ctxcard .fkicon.digest { background: var(--sunken); color: var(--fg-2); }
.chatHeadIcon { display: inline-flex; color: var(--accent); margin-right: -4px; }
.chatHeadIcon[hidden] { display: none; }
.chatHead { gap: 10px; }
.chatHead #chatTitle { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chatMain.feedMode #chatTitle { cursor: default; }

/* «Сводки и итоги»: лента записей-документов, только чтение */
.chatMain.feedMode .chatMsgs { background: var(--bg); max-height: calc(100vh - 290px); }
.fcard { margin: 10px 0 14px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--card); box-shadow: var(--shadow-xs); }
.fcard.fresh { border-color: var(--accent-line); box-shadow: inset 3px 0 0 var(--accent-solid); }
.fhead { display: flex; gap: 12px; align-items: flex-start; }
.fkind { font-size: 12px; color: var(--muted); font-weight: 500; }
.ftitle { margin: 1px 0 0; font-size: 16px; font-weight: 650; letter-spacing: -.01em; line-height: 1.35; overflow-wrap: anywhere; }
.fhead .sub { font-size: 12px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.newtag { margin-left: 4px; padding: 1px 7px; border-radius: var(--r-full); background: var(--accent-soft); color: var(--accent-ink); font-size: 11px; font-weight: 600; }
.fhl { margin: 10px 0 0 42px; font-size: 14.5px; line-height: 1.55; color: var(--fg); }
.fbody { margin: 8px 0 0 42px; }
.fbody > summary { list-style: none; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 500; }
.fbody > summary::-webkit-details-marker { display: none; }
.fbody .when-open, .fbody[open] .when-closed { display: none; }
.fbody[open] .when-open { display: inline; }
.fbody > .md { margin-top: 6px; padding-top: 4px; font-size: 14px; }
.fbody > .md > :first-child { margin-top: 0; }
.factions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0 42px; }
.factions button.sm { height: 32px; padding: 0 12px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.factions .copied { color: var(--ok); }
.ftalk { margin: 12px 0 0 42px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 13px; }
.ftalk > summary { cursor: pointer; color: var(--muted); }
.feedFoot { display: flex; align-items: center; gap: 10px; margin: 0 16px 16px; padding: 10px 14px; border: 1px dashed var(--line-strong);
  border-radius: 14px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.feedFoot[hidden] { display: none; }
.feedFoot > .i { flex: none; color: var(--fg-2); }
.feedFoot .more { white-space: nowrap; }
.ctxcard { margin: 4px 0 8px; padding: 12px 14px; border: 1px solid var(--line); border-left: 3px solid var(--accent-solid); border-radius: var(--r-md); background: var(--sunken); }
.ctxcard .fhl { margin: 4px 0 0; font-size: 13.5px; color: var(--fg-2); }
.ctxcard .fbody { margin-left: 38px; }
.chatInput[hidden], .chatFiles[hidden] { display: none; }
@media (max-width: 860px) {
  .chat { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .chatList { max-height: 232px; overflow: auto; }
  .chatMain { min-height: 0; }
  .chatList .ci:not(.feed) small { display: none; }
  .fcard { padding: 14px; }
  .fhl, .fbody, .factions, .ftalk { margin-left: 0; }
  .factions button.sm { flex: 1 1 0; justify-content: center; white-space: nowrap; }
  .factions button.primary.sm { flex-basis: 100%; }
  .msg.assistant .bubble.md { padding-left: 0; }
  .msg.assistant > .action, .msg.assistant > details, .msg.assistant > .muted, .msg.assistant > .mfoot, .msg.assistant > .card.action { margin-left: 0; }
  .feedFoot { margin: 0 8px 8px; flex-wrap: wrap; }
  .chatMain.feedMode .chatMsgs { max-height: none; }
}
@media (prefers-reduced-motion: reduce) { .typing i { animation: none; opacity: .6; } }

/* Markdown */
.md { line-height: 1.65; }
.md p { margin: .55em 0; }
.md h1, .md h2, .md h3 { font-size: 15.5px; font-weight: 650; letter-spacing: -.01em; margin: 1em 0 .35em; }
.md ul, .md ol { padding-left: 1.3em; } .md li { margin: .2em 0; }
.md li::marker { color: var(--faint); }
.md code { font-size: 12.5px; padding: 1px 5px; border-radius: 5px; background: var(--sunken); border: 1px solid var(--line); }
.md pre { background: var(--sunken); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; }
.md pre code { padding: 0; border: 0; background: none; }
.md blockquote { border-left: 2px solid var(--accent-line); padding-left: 12px; color: var(--fg-2); }
.md table { border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.md th { background: var(--sunken); font-weight: 600; font-size: 12.5px; }
.md th, .md td { border: 0; border-bottom: 1px solid var(--line); padding: 6px 10px; }
.md a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); }

/* Память */
.mem { grid-template-columns: 264px minmax(0, 1fr); gap: 16px; }
.memTree { padding: 12px; top: 16px; }
.memTree > input[type=text] { margin-bottom: 10px !important; background: var(--sunken); box-shadow: none; border-color: transparent; }
.memTree > input[type=text]:focus { background: var(--card); border-color: var(--accent); }
.memTree .navlink { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; border-radius: var(--r-sm);
                    font-size: 13.5px; font-weight: 500; color: var(--fg-2); }
.memTree .navlink:hover { background: var(--hover); color: var(--fg); text-decoration: none; }
.memTree .navlink.sel { background: var(--accent-soft); color: var(--accent-ink); }
.memTree .row b { font-size: 11px !important; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.tree { margin: 6px 0 0; }
.tree:empty { display: none; }
.tree .tree { margin-top: 1px; padding-left: 12px; margin-left: 11px; border-left: 1px solid var(--line); }
.tree li { margin: 1px 0; }
.memTree .tree .tag.space { height: 28px; padding: 0 8px; margin: 0; font-size: 13.5px; font-weight: 400; color: var(--fg-2);
                            background: none; border: 0; border-radius: var(--r-sm); }
.memTree .tree .tag.space:hover { background: var(--hover); color: var(--fg); }
.memTree .tree .tag.space.sel { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.memTree .tree .muted { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.crumbs { font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); } .crumbs a:hover { color: var(--accent); }
[data-space-card] { transition: border-color var(--d-1), box-shadow var(--d-2), transform var(--d-2) var(--ease-out); }
[data-space-card]:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.profile h4 { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 18px 0 6px; }
.ev { color: var(--accent); }

/* Источники */
.sectitle, .setblock > h3 {
  font-size: 12px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin: 28px 0 10px;
}
.sectitle span { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--faint); }
.catalog { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile {
  padding: 16px; gap: 6px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow);
  transition: border-color var(--d-1), box-shadow var(--d-2), transform var(--d-2) var(--ease-out);
}
.tile:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.tile.on { border-color: var(--accent); box-shadow: var(--ring); }
.tile .ti {
  width: 40px; height: 40px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--accent); background: var(--accent-soft); margin-bottom: 6px;
}
.tile .ti .i { width: 20px; height: 20px; }
.tile b { font-size: 14.5px; font-weight: 600; }
.tile .muted { font-size: 12.5px; line-height: 1.45; }
.tile .st { font-size: 12.5px; font-weight: 500; color: var(--ok); margin-top: 4px; }
.tile .st.bad { color: var(--bad); }
.drop { border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg); background: var(--sunken); padding: 32px 20px; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.upload { padding: 12px 16px; }
.upload .ok { color: var(--ok); }
.upbar { height: 4px; border-radius: var(--r-full); background: var(--sunken); }
.upbar > div { background: var(--accent-solid); border-radius: inherit; }
.live-dot { width: 8px; height: 8px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.live-dot.off { box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 22%, transparent); }

/* Настройки */
.setnav {
  gap: 4px; margin: -8px -4px 8px; padding: 10px 4px; top: 0;
  background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
}
.setnav .chip { background: transparent; border-color: transparent; color: var(--muted); }
.setnav .chip:hover { background: var(--hover); color: var(--fg); }
.setblock { scroll-margin-top: 72px; }
/* баннер встречи тоже липкий — навигация настроек встаёт под него */
main:has(#banner .bn) .setnav { top: 84px; }
main:has(#banner .bn) .setblock { scroll-margin-top: 150px; }
.setblock > h3:first-child { margin-top: 20px; }
.toggle { gap: 14px; padding: 14px 0; align-items: flex-start; border-top: 1px solid var(--line); }
.card > .toggle:first-child, .card > h2 + .muted + .dtable + .toggle { border-top: 0; padding-top: 4px; }
.toggle b { font-size: 14.5px; font-weight: 600; }
.toggle .muted { display: block; font-size: 13px; line-height: 1.5; margin-top: 2px; }
.toggle > span[style*="font-size"] { width: 22px; text-align: center; color: var(--muted); }

/* ---------------------------------------------- 8. Оверлеи и «живые» элементы */

/* модалка */
.modal { background: var(--scrim); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); padding: 24px;
         animation: fadeIn var(--d-2) var(--ease-out); }
.modal .box {
  border-radius: var(--r-xl); padding: 24px; border: 1px solid var(--line); box-shadow: var(--shadow-xl);
  animation: modalIn var(--d-3) var(--ease-out);
}
.modal .box > .row:first-child { top: -24px; padding: 12px 0; margin-top: -12px !important; }
.modal .box > .row:first-child > b { font-size: 18px !important; font-weight: 650; letter-spacing: -.015em; }
.modal pre { font-family: var(--font); background: var(--sunken); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; }

/* сегментированный контрол вкладок «Добавить» */
.addTabs { display: inline-flex; gap: 2px; padding: 3px; margin: 14px 0 16px; border-radius: 11px; background: var(--sunken); border: 1px solid var(--line); }
.addTabs button { height: 32px; padding: 0 14px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted);
                  font-size: 13.5px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px;
                  transition: background var(--d-1), color var(--d-1), box-shadow var(--d-2); }
.addTabs button:hover { color: var(--fg); }
.addTabs button.on { background: var(--raised); color: var(--fg); font-weight: 600; border: 0;
                     box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 1px var(--line); }

/* тосты */
#toasts { right: 20px; bottom: 20px; gap: 10px; z-index: 70; max-width: min(400px, calc(100vw - 32px)); }
.toast {
  border: 1px solid var(--line); border-left: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 14px 36px 14px 14px; background: var(--card); box-shadow: var(--shadow-lg); font-size: 14px;
}
.toast .tt { gap: 12px; }
.toast .tt .ti {
  width: 28px; height: 28px; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; line-height: 1; color: var(--accent); background: var(--accent-soft);
}
.toast.success .tt .ti { color: var(--ok); background: var(--ok-soft); }
.toast.warn .tt .ti, .toast.high .tt .ti { color: var(--warn); background: var(--warn-soft); }
.toast.error .tt .ti, .toast.critical .tt .ti { color: var(--bad); background: var(--bad-soft); }
.toast .tt b { font-size: 14px; font-weight: 600; line-height: 20px; }
.toast .tt .tb { font-size: 13px; line-height: 1.45; color: var(--muted); margin-top: 1px; }
.toast .tx { top: 8px; right: 8px; width: 26px; height: 26px; border-radius: var(--r-sm); display: inline-flex; align-items: center; justify-content: center; }
.toast .tx:hover { background: var(--hover); color: var(--fg); }
.toast .row { margin-top: 10px; padding-left: 40px; }
.toast .bar { height: 2px; opacity: .6; background: var(--accent-solid); }
.toast.success, .toast.error, .toast.warn, .toast.critical, .toast.high { border-left-color: var(--line); }
.toast.link:hover { border-color: var(--line-strong); }

/* панель уведомлений */
#notifPanel {
  top: 76px; right: 40px; width: min(400px, calc(100vw - 24px));
  border-radius: 16px; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow-xl);
  animation: popIn var(--d-2) var(--ease-out); transform-origin: top right;
}
#notifPanel header { padding: 14px 14px 10px 18px; gap: 4px; }
#notifPanel header b { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
#notifPanel header .chip { height: 28px; padding: 0 10px; border: 0; background: transparent; color: var(--muted); }
#notifPanel header .chip:hover { background: var(--hover); color: var(--fg); }
#notifPanel .tabs { gap: 2px; padding: 10px 14px 4px; }
#notifPanel .tabs .chip { height: 28px; border: 0; background: transparent; color: var(--muted); }
#notifPanel .tabs .chip.on, #notifPanel .tabs .chip.active, #notifPanel .tabs .chip[aria-pressed="true"] { background: var(--press); color: var(--fg); }
#notifPanel .list { padding: 4px 8px 10px; }
#notifPanel footer { padding: 10px 18px; font-size: 12.5px; }
.ngroup { font-size: 11px; font-weight: 600; letter-spacing: .07em; color: var(--faint); margin: 12px 10px 4px; }
.nitem { gap: 12px; padding: 10px; border-radius: var(--r-md); transition: background var(--d-1); }
.nitem:hover { background: var(--hover); }
.nitem .ni { width: 32px; height: 32px; font-size: 14px; color: var(--accent); background: var(--accent-soft); }
.nitem.error .ni { color: var(--bad); background: var(--bad-soft); }
.nitem.success .ni { color: var(--ok); background: var(--ok-soft); }
.nitem.warn .ni { color: var(--warn); background: var(--warn-soft); }
.nitem .nt { font-size: 13.5px; font-weight: 600; line-height: 19px; padding-right: 14px; }
.nitem.read .nt { font-weight: 450; color: var(--fg-2); }
.nitem .nb { font-size: 12.5px; line-height: 1.45; margin-top: 1px; }
.nitem .nw { font-size: 11.5px; color: var(--faint); margin-top: 3px; font-variant-numeric: tabular-nums; }
.nitem:not(.read)::after { top: 16px; right: 12px; width: 7px; height: 7px; background: var(--accent-solid); }
.dndMenu { padding: 10px 16px; gap: 6px; background: var(--sunken); }

/* палитра команд ⌘K */
#palette { background: var(--scrim); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); padding-top: 14vh;
           animation: fadeIn var(--d-1) var(--ease-out); }
#palette .pbox { width: min(640px, calc(100vw - 24px)); border-radius: 16px; border: 1px solid var(--line); background: var(--card);
                 box-shadow: var(--shadow-xl); animation: popIn var(--d-2) var(--ease-out); }
#palette input { height: 56px; padding: 0 20px; font-size: 17px; border: 0; border-bottom: 1px solid var(--line);
                 border-radius: 0; box-shadow: none; background: transparent; }
#palette input:focus { box-shadow: none; border-color: var(--line); }
#palette .plist { padding: 8px; max-height: min(420px, 55vh); }
#palette .pg { font-size: 11px; font-weight: 600; letter-spacing: .07em; color: var(--faint); margin: 10px 12px 4px; }
#palette .pi { height: 40px; padding: 0 12px; gap: 12px; border-radius: var(--r-md); font-size: 14px; color: var(--fg-2); }
#palette .pi.sel { background: var(--press); color: var(--fg); }
#palette .pi .i { color: var(--muted); } #palette .pi.sel .i { color: var(--accent); }
#palette .pi .pk { font-size: 12px; color: var(--faint); }

/* баннер ближайшей встречи — «Live Activity», чернильная плашка */
#banner { top: 12px; margin: -8px 0 16px; }
#banner .bn {
  min-height: 52px; padding: 8px 8px 8px 16px; gap: 12px; border-radius: 16px;
  background: #1B1A22; color: #F4F3F8; border: 1px solid rgba(255, 255, 255, .06);
  box-shadow: 0 12px 32px -12px rgba(18, 17, 26, .5), 0 2px 6px -2px rgba(18, 17, 26, .2);
  animation: popIn var(--d-3) var(--ease-spring);
}
:root[data-theme="dark"] #banner .bn:not(.live) { background: #24232D; border-color: rgba(255, 255, 255, .08); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #banner .bn:not(.live) { background: #24232D; border-color: rgba(255, 255, 255, .08); } }
#banner .bn .grow { font-size: 14px; font-weight: 600; }
#banner .bn small { font-size: 12.5px; font-weight: 400; color: rgba(244, 243, 248, .65); opacity: 1; }
#banner .bn button, #banner .bn a {
  height: 34px; padding: 0 14px; display: inline-flex; align-items: center; gap: 6px;
  border-radius: 10px; font-size: 13px; font-weight: 600;
  border: 0; background: rgba(255, 255, 255, .1); color: #fff;
}
#banner .bn button:hover, #banner .bn a:hover { background: rgba(255, 255, 255, .18); text-decoration: none; }
#banner .bn a[href^="http"] { background: #fff; color: #1B1A22; }
#banner .bn a[href^="http"]:hover { background: #ECEBF3; }
#banner .bn .x { width: 34px; padding: 0; justify-content: center; background: none; color: rgba(255, 255, 255, .6); }
#banner .bn.live { background: linear-gradient(0deg, rgba(0, 0, 0, .08), rgba(0, 0, 0, .08)), #D23C3C; border-color: transparent; }
.pulse-dot { width: 8px; height: 8px; background: #FF6B5E; box-shadow: 0 0 0 0 rgba(255, 107, 94, .6); animation: ring 1.6s infinite; }
#banner .bn.live .pulse-dot { background: #fff; }

/* ------------------------------------------------- 9. Мобильная ширина */
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: sticky; top: 0; z-index: 30; height: 56px; padding: 0 8px; gap: 2px;
    background: color-mix(in srgb, var(--side) 82%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px);
    border-right: 0; border-bottom: 1px solid var(--line);
    scrollbar-width: none;
  }
  .side::-webkit-scrollbar { display: none; }
  .brand { padding: 0 6px 0 2px; }
  .brand small, .brand b { display: none; }
  .brand svg { width: 30px; height: 30px; }
  .addBtn { width: 36px; height: 36px; padding: 0; margin: 0 6px 0 0; flex: none; border-radius: var(--r-md); font-size: 18px; }
  .side [data-tab] { width: 40px; height: 40px; padding: 0; justify-content: center; flex: none; }
  .side [data-tab] .ic { width: auto; font-size: 18px; }
  .side [data-tab] .ic .i { width: 20px; height: 20px; }
  .side [data-tab].active { box-shadow: none; background: var(--accent-soft); }
  .side [data-tab] .badge { position: absolute; top: 3px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; margin: 0;
                            font-size: 10px; box-shadow: 0 0 0 2px var(--side); }
  main { padding: 16px 16px 96px; }
  .pagehead { margin-bottom: 14px; min-height: 0; }
  .pagehead h1 { font-size: 24px; line-height: 30px; }
  .searchBtn { width: var(--ctl); padding: 0; justify-content: center; }
  .searchBtn .kbd { display: none; }
  .card { padding: 16px; border-radius: var(--r-lg); margin-bottom: 12px; }
  .grid2 { gap: 12px; }
  .hero { padding: 18px 16px; }
  .hero h2 { font-size: 21px; line-height: 27px; }
  .hero .askline { flex-direction: column; }
  .hero .askline button.primary { width: 100%; }
  .task { flex-wrap: wrap; }
  .task .acts { width: 100%; padding-left: 32px; }
  .task .acts .edit, .task .acts select[data-snooze] { opacity: 1; }
  .cal { gap: 2px; }
  .cal .day { min-height: 52px; padding: 3px; border-radius: var(--r-sm); }
  .cal .dow { font-size: 10.5px; letter-spacing: .02em; }
  .chatMsgs { padding: 14px; max-height: none; }
  .chatInput { margin: 0 8px 8px; }
  .searchBtn span:not(.kbd) { display: none; }
  #notifPanel { top: 64px; right: 12px; left: 12px; width: auto; }
  #banner { top: 64px; margin: 0 0 12px; }
  #banner .bn { flex-wrap: wrap; padding: 10px 10px 10px 14px; row-gap: 10px; }
  #banner .bn .grow { flex: 1 1 calc(100% - 60px); }
  #banner .bn small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  #banner .bn button:not(.x), #banner .bn a { flex: 1 1 auto; justify-content: center; }
  #banner .bn .x { position: absolute; top: 6px; right: 6px; }
  #banner .bn { position: relative; padding-right: 44px; }
  #toasts { left: 12px; right: 12px; bottom: 12px; max-width: none; }
  /* модалка становится нижним листом */
  .modal { align-items: flex-end; padding: 0; }
  .modal .box { border-radius: 20px 20px 0 0; max-height: 92vh; padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
                animation: sheetIn var(--d-3) var(--ease-out); border-bottom: 0; }
  .modal .box::before { content: ""; display: block; width: 36px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: -8px auto 10px; }
  .modal .box > .row:first-child { top: -20px; }
  .addTabs { display: flex; } .addTabs button { flex: 1; justify-content: center; }
  #palette { padding-top: 8vh; }
}
@media (max-width: 600px) {
  .pair { grid-template-columns: 1fr; }
  .q > .row input[type=text] { max-width: none; flex: 1 1 100%; }
  .q > .row select { flex: 1 1 100%; }
}

/* ------------------------------------------- 10. Моушн и доступность */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
button:focus-visible, a:focus-visible, [data-tab]:focus-visible, .chip:focus-visible, .tile:focus-visible,
.opt:focus-visible, .edit:focus-visible { outline: none; box-shadow: var(--ring); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }

main > section.active { animation: pageIn var(--d-3) var(--ease-out); }
.feed .line { animation: pageIn var(--d-3) var(--ease-out); }

@keyframes pageIn  { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn   { from { opacity: 0; transform: scale(.97) translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes modalIn { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes sheetIn { from { transform: translateY(100%); } to { transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes slideOut { to { opacity: 0; transform: translateX(24px) scale(.98); height: 0; padding: 0; margin: 0; } }
@keyframes ring    { 0% { box-shadow: 0 0 0 0 rgba(255, 107, 94, .55); } 80%, 100% { box-shadow: 0 0 0 8px rgba(255, 107, 94, 0); } }
@keyframes flash   { 0% { background: var(--accent-soft); } 100% { background: transparent; } }
.toast { animation: slideIn var(--d-3) var(--ease-spring); }
.toast.out { animation: slideOut var(--d-2) var(--ease-in) forwards; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (forced-colors: active) {
  .card, .tile, .toast, .modal .box, #notifPanel, #palette .pbox { border: 1px solid CanvasText; }
  .side [data-tab].active { outline: 2px solid Highlight; }
  .toggle > input[type=checkbox] { appearance: auto; width: auto; height: auto; }
}

/* ---------------------------------------------------------- merge search */
.mergePanel { margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); overflow: hidden; }
.mergeSearch { display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--line); color: var(--muted); }
.mergeSearch input { border: 0 !important; box-shadow: none !important; background: transparent !important; padding: 12px 0 !important; font-size: 15px; }
.mergeSearch input:focus { outline: none; }
.mergeList { max-height: 360px; overflow: auto; padding: 4px 6px 8px; }
.mcand { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 10px; cursor: pointer; }
.mcand:hover, .mcand.sel { background: var(--hover, rgba(0,0,0,.04)); }
.mcand.sel { box-shadow: inset 0 0 0 1px var(--accent); }
.mcand.dim { opacity: .55; }
.mcand .grow { flex: 1; min-width: 0; }
.mcand .sub, .mside .sub { font-size: 12.5px; color: var(--muted); }
.mav { width: 34px; height: 34px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center;
       font-size: 12.5px; font-weight: 600; color: var(--accent); background: var(--accent-soft, rgba(75,66,214,.1)); }
.mname { font-weight: 600; font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mname mark { background: color-mix(in srgb, var(--accent) 18%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.mbadge { font-size: 11px; font-weight: 500; padding: 1px 7px; border-radius: 999px; background: var(--sunken, rgba(0,0,0,.05)); color: var(--muted); }
.mbadge.strong { background: color-mix(in srgb, var(--ok, #1f8a5b) 14%, transparent); color: var(--ok, #1f8a5b); }
.mmeta { text-align: right; font-size: 12px; color: var(--muted); flex: none; min-width: 64px; }
.mmeta b { color: var(--fg); font-size: 14px; }
.mcompare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; }
.mside { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--sunken, var(--bg)); }
.mside ul { margin: 4px 0 0; padding-left: 18px; font-size: 13px; }
#mergeCompare > .muted, #mergeCompare > .row { padding: 0 12px; }
#mergeCompare > .row { padding-bottom: 12px; }
@media (max-width: 860px) { .mcompare { grid-template-columns: 1fr; } }
.mergeSearch .kbd { white-space: nowrap; flex: none; }
.mcand .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------- meeting panel («Итоги встречи») */
body.noscroll { overflow: hidden; }
#meetScrim { position: fixed; inset: 0; background: var(--scrim); z-index: 45; animation: fadeUp .15s var(--ease-out); }
#meetDrawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(600px, 100vw); z-index: 46; background: var(--card);
  border-left: 1px solid var(--line); box-shadow: var(--shadow-xl); display: flex; flex-direction: column;
  animation: drawerIn .26s var(--ease-out); }
@keyframes drawerIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.mdHead { display: flex; gap: 12px; align-items: flex-start; padding: 22px 24px 10px; }
.mdHead .grow { flex: 1; min-width: 0; }
.mdHead h2 { font-size: 22px; letter-spacing: -.02em; margin: 2px 0 8px; line-height: 1.2; }
.mdWhen { font-size: 13px; color: var(--muted); text-transform: capitalize; }
.mdMeta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); }
.mdTabs { display: flex; gap: 2px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.mdTabs button { font: inherit; font-size: 13.5px; border: 0; background: none; color: var(--muted); padding: 10px 10px 11px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.mdTabs button:hover { color: var(--fg); }
.mdTabs button.on { color: var(--fg); border-bottom-color: var(--accent); font-weight: 600; }
.mdBody { flex: 1; overflow: auto; padding: 18px 24px 24px; }
.mdFoot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 24px 18px; border-top: 1px solid var(--line); background: var(--card); }
.mdFoot .edit { margin-left: auto; }
.mhead { font-size: 17px; line-height: 1.45; font-weight: 600; letter-spacing: -.01em; padding: 14px 16px; border-radius: var(--r-lg);
  background: var(--accent-soft); color: var(--fg); margin-bottom: 18px; }
.msec { margin: 0 0 18px; }
.msec h4 { display: flex; align-items: center; gap: 7px; margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.msec ul { margin: 0; padding-left: 20px; } .msec li { margin: 4px 0; line-height: 1.5; }
.msec li::marker { color: var(--faint); }
.mdue { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--accent); background: var(--accent-soft);
  border-radius: var(--r-full); padding: 0 8px; margin-left: 4px; white-space: nowrap; }
.mmood { color: var(--muted); font-style: italic; font-size: 13.5px; margin: 4px 0 18px; }
.mpill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; border-radius: var(--r-full);
  padding: 2px 9px; background: var(--sunken); color: var(--muted); white-space: nowrap; }
.mpill.ok { background: var(--ok-soft); color: var(--ok); }
.mpill.warn { background: var(--warn-soft); color: var(--warn); }
.mpill.live { background: var(--bad-soft); color: var(--bad); }
/* home: today's meetings */
.mrow { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.mcard { font: inherit; text-align: left; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; padding: 12px 14px;
  border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--card); color: var(--fg); cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s var(--ease-out); }
.mcard:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.mcard.ready { border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.mcard .mtime { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mcard .mtitle { font-weight: 600; font-size: 14.5px; line-height: 1.3; }
.mcard .mhl { font-size: 13px; color: var(--fg-2); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 860px) {
  #meetDrawer { top: 8vh; width: 100vw; border-left: 0; border-radius: var(--r-xl) var(--r-xl) 0 0; animation: sheetIn .26s var(--ease-out); }
  @keyframes sheetIn { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
  .mdHead, .mdBody, .mdFoot { padding-left: 16px; padding-right: 16px; }
}

/* Icons and the owl never take the click: the button / link around them gets it (handlers
   read data-* from event.target). */
svg.i, svg.i *, svg.owl, svg.owl * { pointer-events: none; }

/* reminder toast */
.toast.rem .tt b { font-size: 14.5px; }
.toast.rem .rhl { font-size: 13px; color: var(--fg-2); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden; }
.toast.rem .row { flex-wrap: wrap; gap: 6px; }
.toast.rem .dismiss { color: var(--muted); }
.toast.rem .dismiss:hover { color: var(--bad); border-color: var(--bad); }
.nitem .nx { position: absolute; right: 6px; bottom: 6px; display: none; gap: 4px; }
.nitem:hover .nx { display: flex; }
.nitem .nx button { font: inherit; font-size: 11.5px; border: 1px solid var(--line); background: var(--card); color: var(--muted);
  border-radius: var(--r-full); padding: 1px 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 3px; }
.nitem .nx button:hover { color: var(--bad); border-color: var(--bad); }
.spamBtn { color: var(--muted) !important; }
.spamBtn:hover { color: var(--bad) !important; border-color: var(--bad) !important; }

/* meetings at the same time (app/conflicts.py) */

/* source + date under an example fact («Разобрать») */
.exsrc { margin-top: 2px; font-size: 12px; color: var(--muted); }
.srcref { cursor: pointer; display: inline-flex; align-items: center; gap: 4px; border-bottom: 1px dotted currentColor; }
.srcref:hover { color: var(--accent); }

/* where a task belongs («Дела»): click to change */
.spacechip { display: inline-flex; align-items: center; gap: 3px; padding: 0 7px; border-radius: 999px;
  background: var(--accent-soft, rgba(99,102,241,.12)); color: var(--accent); font-size: 12px; cursor: pointer; }
.spacechip.guess { background: transparent; border: 1px dashed var(--accent); }
.spacechip.none { background: transparent; border: 1px dashed var(--border, #ccc); color: var(--muted); }
.spacechip:hover { filter: brightness(1.1); }

/* ---- meetings that overlap (app/conflicts.py): red outline + ⚠, never a fill ---- */
.task.clash { box-shadow: inset 0 0 0 1.5px var(--bad); background: var(--bad-soft); border-radius: var(--r-md, 10px); }
.task .meta.clash { color: var(--bad); font-weight: 500; }
.cal .item.clash, .item.clash { box-shadow: inset 0 0 0 1.5px var(--bad); background: var(--bad-soft) !important; color: var(--bad); }
.day.hasclash { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bad) 45%, transparent); }
.day .num .clashdot { float: right; display: inline-flex; align-items: center; gap: 2px; padding: 0 5px;
  border-radius: 999px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 600; line-height: 16px; }
.day .num .clashdot svg { width: 11px; height: 11px; }
.clashbanner { margin: 8px 0; padding: 8px 12px; border-radius: var(--r-md, 10px); background: var(--bad-soft);
  border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); color: var(--bad); font-size: 13px; }
.clashbanner > div + div { margin-top: 3px; }
.clashbanner .sub { color: var(--muted); font-size: 12px; }
#homeNext.card.clash { border-color: var(--bad) !important; box-shadow: 0 0 0 1px var(--bad), 0 6px 20px -8px color-mix(in srgb, var(--bad) 45%, transparent) !important; }
.clashline { margin: 6px 0; color: var(--bad); font-weight: 500; font-size: 13px; }
.line.clash .kicon, .line.clash .kicon svg { color: var(--bad) !important; }
.clashtag { display: inline-flex; align-items: center; gap: 3px; color: var(--bad); font-size: 12px; font-weight: 500; }
.mcard.clash { border-color: var(--bad) !important; box-shadow: 0 0 0 1px var(--bad); }

/* rows that open a source («Новое в памяти», «Источники») */
[data-source] { cursor: pointer; }
.recent .line .kicon.go { color: var(--muted); }
.recent .line:hover .kicon.go { color: var(--accent); }

/* «Сводки и итоги» on the home page: a card per digest / meeting summary of the day */
.dfeed { display: flex; flex-direction: column; gap: 6px; }
.dcard { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--r-md, 10px); cursor: pointer; transition: background .15s, border-color .15s; }
.dcard:hover { background: var(--hover); border-color: var(--line-strong); }
.dcard .kicon { color: var(--accent); margin-top: 1px; }
.dcard.digest .kicon { color: var(--muted); }
.dcard .dtitle { font-weight: 600; font-size: 14px; }
.dcard .dhl { font-size: 13px; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dcard .sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.dcard .dcopy { opacity: .55; flex: none; }
.dcard:hover .dcopy, .dcopy.copied { opacity: 1; }
.dcopy.copied, #mdCopy.copied { color: var(--ok); }

/* importance on the home page («Дела на сегодня»): automatic unless picked by hand */
.impchip { display: inline-flex; align-items: center; gap: 2px; padding: 0 7px; border-radius: 999px; font-size: 11.5px;
  font-weight: 600; line-height: 18px; cursor: pointer; border: 1px dashed currentColor; }
.impchip.manual { border-style: solid; }
.impchip.imp-critical { background: var(--bad-soft); }
.impchip.imp-high { background: color-mix(in srgb, var(--warn) 12%, transparent); }
.impchip svg { width: 11px; height: 11px; }

/* «Откуда задача» */
.ttl-link { cursor: pointer; }
.ttl-link:hover { color: var(--accent); text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.ctxfacts { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.ctxfacts svg { color: var(--muted); }
.ctxh { margin: 16px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.ctxbox { padding: 8px 12px; border-radius: var(--r-md, 10px); background: var(--hover); font-size: 13.5px; }
.ctxsrc { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.ctxquote { margin: 8px 0; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--accent-soft, rgba(99,102,241,.08));
  border-radius: 0 var(--r-md, 10px) var(--r-md, 10px) 0; font-size: 13.5px; display: flex; flex-direction: column; gap: 4px; }
.ctxquote .due { font-weight: 600; }

/* home: urgent things only (conflicts, a broken source, a stuck job); absent when all is well */
.alertstrip { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.alertstrip .chip { height: auto; min-height: 32px; padding: 6px 12px; white-space: normal; }
#homeSum a { color: var(--accent); }

#homeMeetings > .dcard { margin-bottom: 10px; cursor: pointer; }
.mbare { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font-size: 13px; }
.mbare .chip { font: inherit; font-size: 12.5px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; background: transparent;
  color: var(--muted); cursor: pointer; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mbare .chip:hover { color: var(--fg); border-color: var(--line-strong); background: var(--hover); }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.group-title .gnext { margin-left: 10px; font-size: 12.5px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.group-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
#homeWaiting .wrows { display: flex; flex-direction: column; }
#homeWaiting .sub b { color: var(--fg-2); font-weight: 600; }

/* «Цели» (app/goals.py): observations with their evidence, the user's answer */
#goals .ghead { margin: 12px 6px 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); cursor: default; }
#goals details > summary.ghead { cursor: pointer; }
#goals .gcount { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: var(--r-full); background: var(--accent-soft);
  color: var(--accent-ink); font-size: 11.5px; text-align: center; margin-left: 4px; }
#goalView > .card, #goalView > details.card { margin-bottom: 12px; }
.gChips { display: flex; flex-wrap: wrap; gap: 6px; }
.gChips .chip { cursor: default; height: auto; padding: 2px 10px; font-size: 12.5px; }
.gChips .chip.ok { border-color: var(--ok); color: var(--ok); }
.gRec { border-left: 3px solid var(--accent-line); }
.gRec.lvl-high { border-left-color: var(--warn); }
.gRec.lvl-low, .gRec.lvl-silent, .gRec.done { border-left-color: var(--line); }
.gRec.done { opacity: .8; }
.gRecHead { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; color: var(--fg-2); font-weight: 600; }
.gRecHead .muted { font-weight: 400; }
.gObs { margin-top: 6px; font-size: 15px; color: var(--fg); }
.gWhy { margin-top: 4px; font-size: 13px; color: var(--muted); }
.gBasis { margin-top: 8px; font-size: 13px; }
.gBasis summary { cursor: pointer; color: var(--accent); }
.gBasis ul { margin: 6px 0 0; padding-left: 18px; color: var(--fg-2); }
.gSug { margin-top: 8px; padding: 6px 10px; border-radius: var(--r-md); background: var(--sunken); font-size: 13.5px; }
.gActs { margin-top: 10px; align-items: center; }
.gFine { font-size: 11.5px; margin-top: 6px; }
.gPickList { max-height: 280px; overflow: auto; }
.gForm label { display: inline-flex; gap: 6px; align-items: center; }
.gsSpheres { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; max-width: 460px; }
.gsRow { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13.5px; }
.gsRow select { min-width: 190px; }
.gScanLine { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; font-size: 13.5px; color: var(--fg-2); }
.gScanLine > svg { color: var(--ok); flex: none; }
.gScan.t-warn .gScanLine > svg { color: var(--warn); }
.gScan.t-bad .gScanLine > svg { color: var(--bad); }
.gScanLine span { flex: 1 1 260px; min-width: 0; }

/* ------------------------------------------------ relations («Связи» on entity pages) */
#relBox h4 { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 16px 0 4px; }
.relowner { margin-top: 6px; font-size: 13.5px; }
.rel { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main act" "meta act" "more more";
  column-gap: 10px; padding: 7px 8px; margin: 0 -8px; border-radius: var(--r-xs, 8px); }
.rel:hover { background: var(--sunken); }
.rel .rmain { grid-area: main; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; min-width: 0; }
.rel .rtext { color: var(--fg-2); font-size: 13.5px; }
.rel .rmeta { grid-area: meta; font-size: 12px; color: var(--muted); }
.rel .ract { grid-area: act; display: flex; align-items: center; gap: 2px; opacity: .55; transition: opacity var(--d-1, .12s); }
.rel:hover .ract, .rel:focus-within .ract { opacity: 1; }
.rel .rmore { grid-area: more; margin-top: 6px; padding: 8px 10px; border-left: 2px solid var(--line-strong); }
.rel .rmore .fact { font-size: 13px; }
.rel.tier-possible .rmain { opacity: .72; }
.rel.rejected .rmain { text-decoration: line-through; opacity: .6; }
.tier { font-size: 11px; padding: 1px 7px; border-radius: var(--r-full, 999px); background: var(--sunken); color: var(--muted); }
.tier.user { background: var(--ok-soft); color: var(--ok); }
.tier.stated { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.tier.possible { background: transparent; border: 1px dashed var(--line-strong); }
button.rlink { border: 0; background: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
button.rlink:hover { text-decoration: underline; }
.relhidden { margin-top: 12px; }
.relhidden summary { cursor: pointer; }
.relmention { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; line-height: 2; }
.relform { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; margin: 8px 0; }
.relform label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); min-width: 140px; }
.relform label.grow { flex: 1; min-width: 220px; }
.relform input, .relform select { font-size: 13.5px; }
.relpick { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 6px; }
.relpick .tag { cursor: pointer; }
.relpick .tag.sel { box-shadow: inset 0 0 0 1.5px currentColor; }
#relAdd { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--sunken); }
@media (max-width: 640px) { .rel { grid-template-columns: 1fr; grid-template-areas: "main" "meta" "act" "more"; } .rel .ract { opacity: 1; } }

/* «Удалить из памяти» on an entity page */
.delPanel { margin-top: 10px; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--bad) 40%, var(--line)); border-radius: 12px; background: var(--card); display: flex; flex-direction: column; gap: 8px; }
.delPanel .delMode { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.delPanel .delMode:has(input:checked) { border-color: var(--bad); background: var(--bad-soft); }
.delPanel .delMode input, .delPanel .delForget input { margin-top: 3px; }
.delPanel .delForget { display: flex; gap: 8px; align-items: flex-start; }
.delPanel .delPlan { font-size: 13.5px; }
.delPanel .delPlan ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); }
.delPanel .row { margin: 0; }

/* «Дела»: Список | Доска (app/board.py) */
.seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--r-md); background: var(--sunken); border: 1px solid var(--line); }
.seg button { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--fg-2); font: inherit; font-size: 13.5px; cursor: pointer; box-shadow: none; }
.seg button[aria-selected="true"] { background: var(--raised); color: var(--fg); box-shadow: var(--shadow); }
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.board { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding: 2px 2px 14px; scroll-snap-type: x proximity; }
.bcol { flex: 0 0 290px; display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: var(--r-lg); background: var(--sunken); border: 1px solid var(--line); max-height: calc(100vh - 200px); scroll-snap-align: start; }
.bcol[data-role="done"] { background: color-mix(in srgb, var(--ok) 6%, var(--sunken)); }
.bcol.bnew { flex-basis: 230px; background: transparent; border-style: dashed; }
.bcol.bnew input { width: 100%; }
.bhead { display: flex; align-items: center; gap: 6px; min-height: 28px; }
.bgrip { display: inline-flex; color: var(--faint); cursor: grab; }
.bgrip:hover { color: var(--muted); }
.btitle { font-size: 14px; }
.bcount { margin-right: auto; color: var(--muted); font-size: 12.5px; }
.bhint { margin: -2px 0 2px; color: var(--muted); font-size: 12px; }
.bcards { display: flex; flex-direction: column; gap: 8px; min-height: 56px; padding: 2px; overflow-y: auto; }
.bempty { padding: 14px 8px; border: 1px dashed var(--line-strong); border-radius: var(--r-md); color: var(--muted); font-size: 12.5px; text-align: center; }
.bcards:has(.bcard) .bempty { display: none; }
.bcard { position: relative; padding: 9px 10px 8px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--card); box-shadow: var(--shadow-xs); cursor: grab; }
.bcard.has-origin { box-shadow: inset 3px 0 0 var(--o, transparent), var(--shadow-xs); }
.bcard:hover { border-color: var(--line-strong); }
.bcard:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.bcard.done .bttl { color: var(--muted); text-decoration: line-through; }
.bcard.saving { opacity: .55; }
.bcard.gone { opacity: 0; transition: opacity .25s; }
.btop { display: flex; gap: 6px; align-items: flex-start; }
.bttl { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.bkind { margin-top: 1px; color: var(--muted); }
.bcheck { opacity: .55; }
.bcard:hover .bcheck, .bcheck:focus-visible { opacity: 1; color: var(--ok); }
.bmeta { display: flex; flex-wrap: wrap; gap: 3px 10px; margin-top: 5px; color: var(--muted); font-size: 12px; }
.bmeta .i, .blast .i, .bacts .i { width: 12px; height: 12px; vertical-align: -2px; }
.bmeta .overdue { color: var(--bad); font-weight: 500; }
.blast { margin-top: 6px; padding: 4px 7px; border-radius: var(--r-sm); background: var(--sunken); color: var(--fg-2); font-size: 12px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.blast .i { color: var(--muted); }
.bacts { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.bacts .opt { padding: 2px 8px; font-size: 12px; }
.bmove { opacity: 0; }
.bcard:hover .bmove, .bcard:focus-within .bmove, .bmove:focus-visible { opacity: 1; }
@media (hover: none) { .bmove, .bcheck { opacity: 1; } }
.badd { align-self: stretch; padding: 6px 4px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.badd:hover { background: var(--hover); color: var(--fg); }
.baddform textarea { width: 100%; resize: vertical; }
.bolder { align-self: center; font-size: 12px; }
.bghost { opacity: .35; }
.bchosen { box-shadow: var(--shadow-md); }
.bdrag { transform: rotate(1.5deg); }
.brename { flex: 1; min-width: 0; font: inherit; font-size: 14px; font-weight: 600; }
.bjump { display: none; }
@media (max-width: 640px) {
  .bjump { display: flex; gap: 6px; margin-bottom: 8px; overflow-x: auto; }
  .bcol { flex-basis: 86vw; max-height: none; }
  .bcol.bnew { flex-basis: 60vw; }
}
.bpop { position: absolute; z-index: 60; display: flex; flex-direction: column; min-width: 200px; max-width: 290px; padding: 6px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--card); box-shadow: var(--shadow-lg); }
.bpop button[role="menuitem"] { display: flex; gap: 6px; align-items: center; padding: 7px 9px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--fg); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; }
.bpop button[role="menuitem"]:hover:not([disabled]), .bpop button[role="menuitem"]:focus-visible { background: var(--hover); }
.bpop button[disabled] { color: var(--muted); cursor: default; }
.bpoph { padding: 4px 9px; color: var(--muted); font-size: 12px; }
.stagechip, .cmtchip { display: inline-flex; align-items: center; gap: 3px; padding: 0 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 11.5px; cursor: pointer; }
.cmtchip { background: var(--sunken); color: var(--fg-2); }
.stagechip .i, .cmtchip .i { width: 12px; height: 12px; }
/* the task window: stage, thread, comments; «Откуда задача» below */
.twbar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 10px 0 4px; font-size: 13.5px; }
.twbar .overdue { color: var(--bad); }
.twstage { display: inline-flex; align-items: center; gap: 4px; }
.twline { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 10px; }
.twev { color: var(--fg-2); font-size: 12.5px; }
.twev .i { width: 13px; height: 13px; vertical-align: -2px; color: var(--muted); }
.twc { padding: 8px 10px; border-radius: var(--r-md); background: var(--sunken); }
.twcm { display: flex; gap: 8px; align-items: center; font-size: 12px; }
.twca { display: inline-flex; gap: 2px; margin-left: auto; opacity: 0; }
.twc:hover .twca, .twc:focus-within .twca { opacity: 1; }
@media (hover: none) { .twca { opacity: 1; } }
.twct { margin-top: 4px; font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.twct textarea, .twform textarea { width: 100%; resize: vertical; }
.ctxmore { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.ctxmore > summary { cursor: pointer; font-size: 14px; font-weight: 600; }
.btop .edit { flex: none; width: 24px; min-width: 24px; height: 24px; padding: 0; }
.twform textarea { min-height: 0; height: auto; }
#tasks select { max-width: 100%; }

/* The chat with tools: what the assistant looked at and did (app/agent.py) */
.msg .steps { margin: 2px 0 6px; font-size: 12.5px; }
.msg .steps > summary { cursor: pointer; }
.msg .steps.live { margin: 0 0 8px; padding: 6px 8px; border-radius: var(--r-md); background: var(--sunken); }
.msg .astep { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; padding: 2px 0; color: var(--fg-2); }
.msg .astep .abar { flex: 0 0 72px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; align-self: center; }
.msg .astep .abar > i { display: block; height: 100%; background: var(--accent); transition: width .4s ease; }
.msg .astep .anote { flex-basis: 100%; padding-left: 19px; font-size: 12px; }
.msg .mtime .warn { color: var(--warn); }
.chatList .ci small .live { color: var(--accent); display: inline-flex; gap: 4px; align-items: center; }
.chatList .ci small .live .i { width: 11px; height: 11px; }
#chatMsgs .interrupted { margin: 4px 0 10px 44px; font-size: 12.5px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.msg .astep .i { width: 13px; height: 13px; flex: none; transform: translateY(2px); color: var(--muted); }
.msg .astep.done .i { color: var(--ok); }
.msg .astep.error .i { color: var(--warn); }
.msg .stepnote { padding: 2px 0 4px; color: var(--muted); font-style: italic; }

/* ---- «Коуч» (app/coach.py) ---- */
.coachWrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; align-items: start; }
.coachMain { display: flex; flex-direction: column; min-height: 70vh; }
.coachBar { display: flex; align-items: center; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.coachMsgs { flex: 1; overflow-y: auto; max-height: 62vh; padding: 4px 2px; }
.coachMsgs .msg.assistant .who svg.i { color: var(--warn); }
.coachMsgs .msg.care .bubble { border-left: 3px solid var(--accent); padding-left: 12px; }
.coachInput { display: flex; gap: 8px; align-items: flex-end; border-top: 1px solid var(--line); padding-top: 10px; }
.coachInput textarea { flex: 1; resize: vertical; min-height: 44px; }
.coachFound { background: var(--warn-soft); border-radius: var(--r-md); padding: 8px 10px; margin: 6px 0; font-size: 13px; }
.coachCare { background: var(--accent-soft); color: var(--accent-ink); border-radius: var(--r-md); padding: 8px 10px; margin: 8px 0; font-size: 13px; }
.coachConsent { background: var(--sunken); border-radius: var(--r-lg); padding: 14px 16px; margin: 10px 0; }
.coachConsent p { line-height: 1.55; margin: 6px 0 10px; }
.coachOp { margin: 4px 0 2px 26px; font-size: 13px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.coachOp.undone, .coachOp.dismissed { opacity: .6; text-decoration: line-through; }
.coachOp.failed { color: var(--muted); }
.coachQuick { margin: 6px 0 2px 26px; }
.coachSide .card h3 { font-size: 14px; }
.coachView { white-space: pre-wrap; font-size: 12px; background: var(--sunken); border-radius: var(--r-md); padding: 8px; max-height: 320px; overflow: auto; }
.gCoach { margin-top: 8px; font-size: 13.5px; display: grid; gap: 3px; }
.hstrip { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0 6px; }
.hday { width: 18px; height: 18px; border-radius: 4px; border: 1px solid var(--line-strong); background: var(--sunken); padding: 0; cursor: pointer; }
.hday.done { background: var(--ok); border-color: var(--ok); }
.hday.skipped { background: var(--bad-soft); border-color: var(--bad); }
.hday.today { border: 2px solid var(--accent); }
.hday.off { opacity: .35; }
@media (max-width: 900px) {
  .coachWrap { grid-template-columns: 1fr; }
  .coachMsgs { max-height: none; }
  .coachOp, .coachQuick { margin-left: 0; }
}
.coachVoice { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; margin: 8px 0; background: var(--sunken); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.cvHead { display: flex; gap: 10px; align-items: center; width: 100%; justify-content: space-between; }
.cvOrb { width: 84px; height: 84px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, var(--accent-soft), var(--accent)); opacity: .55; transition: transform .2s, opacity .2s; }
.cvOrb.hear { opacity: 1; transform: scale(1.12); }
.cvOrb.think { opacity: .8; animation: cvPulse 1.2s ease-in-out infinite; }
.cvOrb.speak { opacity: 1; animation: cvPulse .6s ease-in-out infinite; background: radial-gradient(circle at 35% 35%, var(--warn-soft), var(--warn)); }
@keyframes cvPulse { 50% { transform: scale(1.08); } }
.cvStatus { font-size: 13px; color: var(--fg-2); text-align: center; }
.cvLog { width: 100%; max-height: 180px; overflow-y: auto; font-size: 13px; display: grid; gap: 4px; }
.cvLine.me { text-align: right; color: var(--fg-2); }
.cvLine.coach { color: var(--fg); }
.cvBtns { justify-content: center; }
@media (prefers-reduced-motion: reduce) { .cvOrb { animation: none !important; transition: none; } }

/* ---- Знакомство с Мнемо (static/guide.js): spotlight, the mascot's bubble, page tips ---- */
.gVeil { position: fixed; inset: 0; z-index: 80; background: rgba(12, 11, 20, .45); }
.gSpot { position: fixed; z-index: 81; border-radius: 12px; pointer-events: none;
  box-shadow: 0 0 0 3px var(--accent), 0 0 0 9999px rgba(12, 11, 20, .45);
  transition: left .25s ease, top .25s ease, width .25s ease, height .25s ease; }
.gBubble { position: fixed; z-index: 82; width: min(360px, calc(100vw - 32px)); box-sizing: border-box;
  background: var(--card); color: var(--fg); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px 16px 12px; box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
  transition: left .25s ease, top .25s ease; }
.gBubble.center { left: 50% !important; top: 50% !important; transform: translate(-50%, -50%);
  width: min(440px, calc(100vw - 32px)); text-align: center; padding: 22px 22px 18px; }
.gBubble p { margin: 8px 0 10px; line-height: 1.5; font-size: 14.5px; }
.gBubble h2 { font-size: 19px; margin: 10px 0 4px; }
.gHead { display: flex; gap: 10px; align-items: center; padding-right: 22px; }
.gHead .gOwl { width: 44px; height: 44px; flex: none; }
.gHero .gOwl { width: 88px; height: 88px; }
.gName { font-size: 12px; color: var(--muted); }
.gTitle { font-size: 15.5px; }
.gWait { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); margin: -2px 0 8px; }
.gFoot { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.gFoot .gProg { margin-right: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.gBtns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.gBubble button.link { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 6px 4px; }
.gBubble button.link:hover { color: var(--fg); }
.gClose { position: absolute; top: 10px; right: 10px; background: none; border: 0; color: var(--muted);
  cursor: pointer; padding: 4px; border-radius: 6px; }
.gClose:hover { color: var(--fg); background: var(--raised, var(--line)); }
.gTip { display: flex; gap: 10px; align-items: flex-start; }
.gTip .gOwl { width: 34px; height: 34px; flex: none; }
.gTip ul { margin: 4px 0 0; padding-left: 16px; font-size: 13px; }
.gTip li + li { margin-top: 2px; }
.gSpot.act { box-shadow: 0 0 0 3px var(--accent), 0 0 0 9px var(--accent-soft); }
@media (max-width: 600px) {
  .gBubble:not(.center) { left: 16px !important; right: 16px; width: auto; top: auto !important; bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) { .gSpot, .gBubble { transition: none; } }
