/* Планер — дизайн-система «Лён и графит»
   Графит (#2A2D34) — структура и текст. Маркер (#F2D16B) — то, что важно сегодня. Синие чернила (#2E4A8B) — действия.
   Рукописный шрифт — только на листе задач. */

@font-face { font-family: 'Onest'; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/vendor/fonts/onest/onest-cyrillic-wght-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Onest'; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/vendor/fonts/onest/onest-latin-wght-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Onest'; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/vendor/fonts/onest/onest-cyrillic-ext-wght-normal.woff2) format('woff2'); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: 'Caveat'; font-style: normal; font-display: swap; font-weight: 500;
  src: url(/vendor/fonts/caveat/caveat-cyrillic-500-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Caveat'; font-style: normal; font-display: swap; font-weight: 500;
  src: url(/vendor/fonts/caveat/caveat-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: 'Caveat'; font-style: normal; font-display: swap; font-weight: 700;
  src: url(/vendor/fonts/caveat/caveat-cyrillic-700-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }

:root {
  --ink: #2A2D34;
  --ink-2: #3B3F48;
  /* «Лён и графит»: льняной фон, графитовый текст, синие чернила, жёлтый маркер */
  --paper: #E9E3D8;
  --surface: #F7F3EB;
  --surface-2: #F0EBE1;
  --line: #D6CDBD;
  --line-2: #BFB4A1;
  --text: #22252A;
  --muted: #555049;
  --faint: #67615A;
  --marker: #F2D16B;
  --marker-soft: #F6E6AE;
  --pen: #2E4A8B;
  --pen-soft: #DCE2EF;
  --ok: #2B7349;   --ok-soft: #DCEBDD;
  --warn: #7A5410; --warn-soft: #F3E3BE;
  --bad: #A93526;  --bad-soft: #F3DAD3;
  --sheet: #FBF8F1;
  --sheet-line: #D5DCE8;
  --sheet-margin: #E3A79D;
  --hand: #23408F;
  --ctl: #2A2D34; --ctl-hover: #3B3F48; --code-bg: #ECE6DA; --sheet-note: #666055; --sheet-done: #66719A; --on-bad: #fff;
  --side-text: #E6E2DA; --side-muted: #A29D94; --side-hover: rgba(255,255,255,.07); --side-on: rgba(255,255,255,.11);

  --vk: #1F6FD0; --tg: #177AAD; --max: #6A3FEA; --inst: #C02A7B; --ok-net: #B8470A;

  --st-idea: #9A9285; --st-draft: #5F5A51; --st-review: #C48F12; --st-changes: #A93526;
  --st-approved: #2B7349; --st-scheduled: #2E4A8B; --st-published: #22252A; --st-flip: #fff;

  --r-s: 6px; --r-m: 10px; --r-l: 16px;
  --sh-pop: 0 12px 32px -8px rgba(40, 34, 26, .30), 0 2px 6px rgba(40, 34, 26, .10);
  --sh-lift: 0 1px 2px rgba(40, 34, 26, .07), 0 4px 14px -6px rgba(40, 34, 26, .16);
  --font: 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --hand-font: 'Caveat', 'Segoe Print', cursive;
  --side: 232px;
  color-scheme: light;
}
/* Тёмная тема: тёплый графит без синевы */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #15171B; --ink-2: #3A3E46;
    --paper: #1C1E22; --surface: #25272C; --surface-2: #2C2F35; --line: #393C43; --line-2: #4B4F57;
    --text: #EDE9E1; --muted: #BAB5AB; --faint: #A5A096;
    --marker-soft: #4C4322; --pen: #9DB2E6; --pen-soft: #2B3550;
    --ok: #7FC79A; --warn: #E2B357; --bad: #EE8A7A;
    --ok-soft: #1F3527; --warn-soft: #3D3218; --bad-soft: #42231E;
    --sheet: #EFE9DB; --ctl: #454A54; --ctl-hover: #565B66; --code-bg: #15171B; --on-bad: #1C1E22; --st-published: #D9D4CA; --st-scheduled: #9DB2E6; --st-draft: #A9A49B; --st-idea: #7E7A72; --st-flip: #1C1E22; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #15171B; --ink-2: #3A3E46;
  --paper: #1C1E22; --surface: #25272C; --surface-2: #2C2F35; --line: #393C43; --line-2: #4B4F57;
  --text: #EDE9E1; --muted: #BAB5AB; --faint: #A5A096;
  --marker-soft: #4C4322; --pen: #9DB2E6; --pen-soft: #2B3550;
  --ok: #7FC79A; --warn: #E2B357; --bad: #EE8A7A;
  --ok-soft: #1F3527; --warn-soft: #3D3218; --bad-soft: #42231E;
  --sheet: #EFE9DB; --ctl: #454A54; --ctl-hover: #565B66; --code-bg: #15171B; --on-bad: #1C1E22; --st-published: #D9D4CA; --st-scheduled: #9DB2E6; --st-draft: #A9A49B; --st-idea: #7E7A72; --st-flip: #1C1E22; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--paper); color: var(--text); font: 400 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--pen); }
:focus-visible { outline: 2px solid var(--pen); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.side :focus-visible, .toast :focus-visible { outline-color: var(--marker); }
.seg button:focus-visible, .tabs a:focus-visible, .tabs button:focus-visible { outline-offset: -2px; }
.title-input:focus-visible { outline: none; box-shadow: 0 2px 0 var(--pen); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Каркас ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; height: 100vh; }
/* Верхняя полоса единого входа с ЦУБ (одна на все системы агентства) */
.sso-bar { height: 36px; box-sizing: border-box; background: #1f2430; color: #e8eaf0; font: 13px system-ui, sans-serif; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; position: relative; z-index: 60; }
.sso-bar a { color: #e8eaf0; text-decoration: none; font-weight: 600; }
.sso-bar a:hover { text-decoration: underline; }
.sso-bar-r { display: flex; align-items: center; gap: 14px; min-width: 0; }
.sso-bar-n { opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.has-sso-bar .shell { height: calc(100vh - 36px); }
body.has-sso-bar .login { min-height: calc(100vh - 36px); }
body.print-report .sso-bar { display: none; }
.side { background: var(--ink); color: var(--side-text); display: flex; flex-direction: column; overflow-y: auto; padding: 18px 12px; gap: 2px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; font-size: 18px; color: #fff; letter-spacing: -.01em; }
/* Логотип «Постмаркер»: на светлой теме .logo-l, на тёмной .logo-d */
.brand .logo { display: block; }
.logo-d { display: none !important; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-l { display: none !important; } :root:not([data-theme="light"]) .logo-d { display: inline-block !important; } }
:root[data-theme="dark"] .logo-l { display: none !important; }
:root[data-theme="dark"] .logo-d { display: inline-block !important; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: url(/icon.svg) center / cover; flex: none; box-shadow: 0 0 0 1px rgba(255,255,255,.08); }
.nav-a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: inherit; text-decoration: none; font-size: 14.5px; position: relative; }
.nav-a:hover { background: var(--side-hover); }
.nav-a.on { background: var(--side-on); color: #fff; font-weight: 550; }
.nav-a.on::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 3px 3px 0; background: var(--marker); }
.nav-a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-a .count { margin-left: auto; background: var(--marker); color: var(--ink); font-size: 12px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 6px; }
.side-h { display: flex; align-items: center; justify-content: space-between; margin: 18px 10px 6px; font-size: 13px; color: var(--side-muted); }
.side-h button { background: none; border: 0; color: var(--side-muted); cursor: pointer; padding: 2px 6px; border-radius: 6px; font-size: 18px; line-height: 1; }
.side-h button:hover { color: #fff; background: rgba(255,255,255,.08); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.side-foot { margin-top: auto; padding-top: 16px; display: grid; gap: 2px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 8px 10px; font-size: 13.5px; color: var(--side-text); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--ink-2); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }

.main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.top { display: flex; align-items: center; gap: 12px; padding: 12px 28px; border-bottom: 1px solid var(--line); background: var(--surface); }
.top .menu-btn { display: none; }
.cmd { flex: 1; max-width: 680px; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface-2); color: var(--muted); cursor: text; text-align: left; }
.cmd:hover { border-color: var(--line-2); }
.cmd svg { width: 16px; height: 16px; flex: none; }
.cmd span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
svg[aria-hidden="true"] { width: 18px; height: 18px; flex: none; }
.cmd kbd { margin-left: auto; font: 500 12px var(--font); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 6px; color: var(--muted); background: var(--surface); }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.top-today { display: flex; align-items: baseline; gap: 16px; min-width: 0; flex-wrap: wrap; row-gap: 2px; }
.tt-date { font-size: 15px; color: var(--muted); white-space: nowrap; }
.tt-date b { color: var(--text); font-weight: 650; }
.tt-occ { font-size: 14px; color: var(--text); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46ch; }
.tt-occ:hover { text-decoration: underline; text-underline-offset: 3px; }
.tt-occ .hl { font-weight: 600; margin-right: 4px; }
.top-ic { position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; color: var(--muted); text-decoration: none; }
.top-ic:hover { background: var(--surface-2); color: var(--text); }
.top-ic.has { color: var(--text); }
.top-ic b { position: absolute; top: 1px; right: 0; min-width: 17px; height: 17px; border-radius: 9px; background: var(--bad); color: var(--on-bad); font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.top-pub { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; text-decoration: none; color: var(--text); padding: 6px 10px; border-radius: 20px; border: 1px solid var(--line); white-space: nowrap; }
.top-pub svg { width: 15px; height: 15px; }
.top-pub.muted { color: var(--muted); border-color: transparent; }
.top-pub.err { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: var(--bad-soft); }
@media (max-width: 1180px) { .hide-sm { display: none; } .tt-occ { max-width: 28ch; } }
.ai-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); padding: 6px 10px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; }
.ai-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.ai-pill.ok i { background: var(--ok); } .ai-pill.bad i { background: var(--bad); }
.content { flex: 1; overflow-y: auto; padding: 26px 28px 60px; }
.page-h { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-h h1 { margin: 0; font-size: 26px; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; }
.page-h .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.page-h .tools { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Элементы ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font-weight: 500; font-size: 14px; white-space: nowrap; text-decoration: none; color: var(--text); transition: background .12s, border-color .12s, transform .06s; }
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--marker); border-color: #CFAE45; color: #22252A; font-weight: 650; }
.btn.primary:hover { background: #EAC350; }
.btn.ink { background: var(--ctl); border-color: var(--ctl); color: #fff; }
.btn.ink:hover { background: var(--ctl-hover); border-color: var(--ctl-hover); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--bad); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon { width: 36px; padding: 0; }
.btn.sm.icon { width: 30px; }
.seg { display: inline-flex; max-width: 100%; border: 1px solid var(--line-2); border-radius: 8px; overflow-x: auto; scrollbar-width: none; background: var(--surface); }
.seg button { border: 0; background: none; padding: 0 12px; height: 34px; cursor: pointer; font-size: 13.5px; color: var(--muted); white-space: nowrap; flex: none; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--ctl); color: #fff; }

.field { display: grid; gap: 5px; margin-bottom: 14px; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 500; }
.field small { color: var(--faint); font-size: 12.5px; }
.input, .select, .textarea { width: 100%; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); padding: 8px 11px; font-size: 14.5px; min-height: 38px; }
.textarea { resize: vertical; line-height: 1.55; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--pen); box-shadow: 0 0 0 3px var(--pen-soft); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 13px; }
.spacer { flex: 1; }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 14px; }
.check input { width: 16px; height: 16px; accent-color: var(--pen); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); }
.panel-h { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 14px 18px 10px; }
.panel-h h2 { margin: 0; font-size: 16px; font-weight: 650; }
.panel-h .muted { font-size: 13px; }
.panel-b { padding: 4px 18px 16px; }
.empty { color: var(--muted); font-size: 14px; padding: 18px 0; }
.empty b { color: var(--text); font-weight: 600; }

.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 20px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.st::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--faint)); }
.net { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; color: var(--muted); font-size: 10px; font-weight: 800; flex: none; letter-spacing: -.02em; }
.net svg { width: 20px; height: 20px; display: block; }
.net.off { color: var(--muted); opacity: .75; }
/* чёрный знак Дзена на тёмной теме — белым */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .net.dzen:not(.off) svg path { fill: #f4f4f5; } }
:root[data-theme="dark"] .net.dzen:not(.off) svg path { fill: #f4f4f5; }

/* Маркерная подсветка — главный акцент */
.hl { background: linear-gradient(104deg, transparent .4em, var(--marker) .4em, var(--marker) calc(100% - .3em), transparent calc(100% - .3em)) no-repeat 0 62% / 100% 58%; padding: 0 .35em; margin: 0 -.15em; color: var(--ink); -webkit-box-decoration-break: clone; box-decoration-break: clone; }

/* В тёмной теме маркер закрывает строку целиком: графитовый текст не должен попадать на тёмный фон */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hl { background: var(--marker); border-radius: 4px; padding: 0 .3em; margin: 0 -.1em; } }
:root[data-theme="dark"] .hl { background: var(--marker); border-radius: 4px; padding: 0 .3em; margin: 0 -.1em; }

/* ---------- Сегодня ---------- */
.today { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); gap: 22px; align-items: start; }
.today-date { font-size: 34px; font-weight: 750; letter-spacing: -.03em; line-height: 1.1; margin: 0; }
.today-date .wd { display: block; font-size: 15px; font-weight: 500; letter-spacing: 0; color: var(--muted); margin-bottom: 4px; }
.occasions { display: grid; gap: 10px; margin: 18px 0 22px; }
.occ { display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); }
.occ.is-today { border-color: color-mix(in srgb, var(--marker) 80%, var(--text) 20%); background: linear-gradient(90deg, var(--marker-soft), var(--surface) 70%); }
.occ .when { width: 64px; flex: none; font-size: 13px; color: var(--muted); line-height: 1.25; }
.occ .when b { display: block; font-size: 15px; color: var(--text); }
.occ .what { flex: 1; min-width: 0; font-weight: 600; }
.occ .kind { font-size: 12px; color: var(--muted); font-weight: 500; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.today > * { min-width: 0; }
.today.tasks-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.today.ai-cols { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
.post-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.post-row:first-child { border-top: 0; }
.post-row:hover .pr-title { color: var(--pen); }
.pr-time { width: 72px; flex: none; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pr-cover { width: 40px; height: 40px; border-radius: 8px; background: var(--surface-2) center/cover; flex: none; border: 1px solid var(--line); }
.pr-main { flex: 1; min-width: 0; }
.pr-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-meta { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: center; font-size: 12.5px; color: var(--muted); }
.pr-nets { display: flex; gap: 4px; }
.day-label { font-size: 13px; font-weight: 650; color: var(--muted); margin: 14px 0 2px; }
.day-label:first-child { margin-top: 0; }

/* ---------- Рукописный лист задач ---------- */
.sheet { position: relative; background: var(--sheet); border-radius: 4px 4px 14px 4px; padding: 22px 22px 26px 58px; color: var(--hand); font-family: var(--hand-font); font-size: 25px; line-height: 36px; font-weight: 500;
  background-image: linear-gradient(to right, transparent 44px, var(--sheet-margin) 44px, var(--sheet-margin) 46px, transparent 46px), repeating-linear-gradient(to bottom, transparent 0 35px, var(--sheet-line) 35px 36px);
  background-position: 0 0, 0 22px; box-shadow: 0 1px 1px rgba(30,42,68,.08), 0 10px 24px -12px rgba(30,42,68,.35); transform: rotate(-.35deg); }
.sheet::before { content: ''; position: absolute; top: -9px; left: 50%; width: 92px; height: 22px; transform: translateX(-50%) rotate(1.5deg); background: rgba(255, 216, 74, .55); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.sheet-h { display: flex; align-items: baseline; justify-content: space-between; font-weight: 700; font-size: 30px; margin: 0 0 0 -2px; height: 36px; color: var(--ink); }
.sheet-h small { font-family: var(--font); font-size: 12.5px; font-weight: 500; color: var(--sheet-note); }
.sheet ul { list-style: none; margin: 0; padding: 0; }
.hand-task { position: relative; display: flex; align-items: flex-start; gap: 8px; min-height: 36px; cursor: pointer; user-select: none; }
.hand-task .txt { position: relative; flex: 1; word-break: break-word; }
.hand-task .proj { font-family: var(--font); font-size: 12px; color: var(--sheet-note); margin-left: 6px; font-weight: 500; vertical-align: 3px; }
.hand-task .due { font-size: 19px; color: #A93526; margin-left: 4px; }
.hand-task svg.strike { position: absolute; left: -4px; right: -4px; top: 50%; width: calc(100% + 8px); height: 22px; margin-top: -9px; pointer-events: none; overflow: visible; }
.hand-task svg.strike path { fill: none; stroke: #1C2F6E; stroke-width: 2.6; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.hand-task:not(.done) svg.strike { visibility: hidden; }
.hand-task.done .txt { color: var(--sheet-done); }
.hand-task.done svg.strike path { stroke-dashoffset: 0; }
/* Анимация «ручкой» — ключевыми кадрами, чтобы проигрывалась и когда строка переезжает вниз списка */
.hand-task.done.just svg.strike path { animation: pen-strike .5s cubic-bezier(.6,.05,.3,1) both; }
@keyframes pen-strike { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.arch-done { text-decoration: line-through; color: var(--muted); }
.arch-row .btn { flex: none; }
.hand-task .bullet { width: 18px; flex: none; color: var(--sheet-note); }
.hand-task .del { opacity: 0; font-family: var(--font); font-size: 14px; border: 0; background: none; cursor: pointer; color: var(--sheet-note); padding: 0 4px; }
.hand-task:hover .del { opacity: 1; }
.hand-input { width: 100%; border: 0; background: transparent; font: inherit; color: var(--hand); height: 36px; padding: 0; outline: none; }
.hand-input::placeholder { color: var(--sheet-note); opacity: .8; }
.hand-form { display: flex; align-items: center; gap: 8px; }
.hand-form .bullet { width: 18px; flex: none; color: var(--sheet-note); }
.hand-add { flex: none; font-family: var(--hand-font); font-size: 21px; font-weight: 700; color: var(--hand); background: rgba(242, 209, 107, .55); border: 0; border-radius: 4px 10px 4px 10px; padding: 0 12px; height: 30px; cursor: pointer; transform: rotate(-1.5deg); }
.hand-add:hover { background: rgba(242, 209, 107, .85); }
.hand-hint { font-family: var(--font); font-size: 12px; line-height: 1.4; color: var(--sheet-note); margin-top: 6px; }
.sheet .later { font-size: 21px; color: var(--sheet-note); margin-top: 8px; }
@media (prefers-reduced-motion: reduce) { .hand-task.done.just svg.strike path { animation: none; } }

/* ---------- Календарь ---------- */
.cal-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head div { padding: 8px 10px; font-size: 12.5px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); }
.cal-cell { min-height: 150px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px 6px 8px; display: flex; flex-direction: column; gap: 4px; position: relative; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.out { background: var(--surface-2); }
.cal-cell.out .cal-num { color: var(--faint); }
.cal-cell.drop { background: var(--pen-soft); }
.cal-cell.weekend .cal-num { color: var(--bad); }
.cal-top { display: flex; align-items: center; gap: 6px; min-height: 24px; }
.cal-num { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; font-size: 13.5px; font-weight: 650; font-variant-numeric: tabular-nums; padding: 1px 4px; border-radius: 6px; }
.cal-num:hover { background: var(--surface-2); text-decoration: underline; }
.day-link { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; border-radius: 4px; text-align: left; }
.day-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.week-col h3 .day-link { font-size: inherit; font-weight: inherit; }
.day-label .day-link { font-weight: 650; }
.cal-hol.mine { display: flex; align-items: flex-start; gap: 4px; width: 100%; text-align: left; font: inherit; font-size: 11.5px; line-height: 1.3; color: var(--text); cursor: pointer;
  border: 0; border-left: 3px solid var(--ec); border-radius: 4px; padding: 1px 4px 1px 5px; background: color-mix(in srgb, var(--ec) 15%, transparent); -webkit-line-clamp: unset; }
.cal-hol.mine:hover { background: color-mix(in srgb, var(--ec) 26%, transparent); }
.cal-hol.mine span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-width: 0; }
.cal-hol.mine svg { width: 12px; height: 12px; flex: none; margin-top: 1px; color: var(--ec); }
.mine-l { color: var(--text); border-left: 3px solid var(--ec); padding-left: 5px; }
.mine-l svg { width: 12px; height: 12px; vertical-align: -1px; margin-right: 3px; color: var(--ec); }
.cal-num:focus-visible, .day-link:focus-visible, .cal-hol.mine:focus-visible, .ev-col:focus-visible { outline: 2px solid var(--pen); outline-offset: 2px; }
/* окно дня */
.day-sec { margin-bottom: 16px; }
.day-sec h3 { margin: 0 0 6px; font-size: 13px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.day-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.day-ev { display: flex; align-items: flex-start; gap: 10px; padding: 8px 8px 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); }
.day-ev.mine { border-left: 4px solid var(--ec); }
.day-ev-ic { color: var(--ec, var(--muted)); flex: none; display: grid; place-items: center; width: 20px; height: 20px; }
.day-ev-ic svg { width: 17px; height: 17px; }
.day-ev-b { flex: 1; min-width: 0; }
.day-ev-n { white-space: pre-wrap; margin-top: 3px; color: var(--text); }
.day-ev-act { display: flex; gap: 2px; flex: none; }
.ev-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 520px) { .ev-grid { grid-template-columns: 1fr; } }
.ev-colors { display: flex; gap: 8px; flex-wrap: wrap; }
.ev-col { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; background: var(--ec); cursor: pointer; padding: 0; box-shadow: inset 0 0 0 2px var(--surface); }
.ev-col.auto { background: conic-gradient(from 0deg, #E5484D, #0091FF, #D9A400, #E5484D); }
.ev-col.on { border-color: var(--text); }
.cal-cell.today .cal-num { background: var(--marker); color: var(--ink); border-radius: 6px; }
.cal-wd { display: none; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.cal-add { margin-left: auto; opacity: 0; border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 18px; line-height: 1; width: 24px; height: 24px; border-radius: 6px; }
.cal-cell:hover .cal-add, .cal-add:focus-visible { opacity: 1; }
@media (hover: none) { .cal-add { opacity: 1; } }
.cal-add:hover { background: var(--surface-2); color: var(--text); }
.cal-hol { font-size: 11.5px; line-height: 1.3; color: var(--muted); padding: 0 4px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cal-hol.gov { color: var(--bad); font-weight: 600; }
.chip { display: flex; align-items: flex-start; gap: 7px; padding: 6px 7px 6px 8px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--c); font-size: 13px; line-height: 1.3; cursor: grab; min-width: 0; }
.chip:hover { border-color: var(--line-2); border-left-color: var(--c); box-shadow: var(--sh-lift); }
.chip .cv { width: 30px; height: 30px; border-radius: 6px; background: var(--surface-2) center / cover; flex: none; }
.chip .cb { flex: 1; min-width: 0; display: grid; gap: 2px; }
.chip .t { font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.chip .mt { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); min-width: 0; }
.chip .cn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip .tm { font-variant-numeric: tabular-nums; }
.chip .s { width: 8px; height: 8px; border-radius: 50%; background: var(--sc); flex: none; }
.tbl-wrap { overflow-x: auto; }
.plan-tbl td { vertical-align: top; }
.plan-tbl tr.day-start td { border-top: 2px solid var(--line-2); }
.plan-tbl tr:hover td { background: var(--surface-2); }
.plan-tbl .topic { min-width: 240px; max-width: 420px; }
.plan-tbl .clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.nowrap { white-space: nowrap; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--text); cursor: pointer; text-align: left; }
.link-btn:hover { color: var(--pen); text-decoration: underline; }
.cell-in { border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 3px 6px; font-size: 13.5px; min-height: 30px; }
.cell-in:hover { border-color: var(--line-2); background: var(--surface); }
.cell-in:focus { outline: none; border-color: var(--pen); background: var(--surface); }
.st-sel { font-weight: 600; color: color-mix(in srgb, var(--c) 55%, var(--text)); }
.th-sort { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.th-sort.on { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.chip.dragging { opacity: .4; }
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 10px 2px 0; font-size: 12.5px; color: var(--muted); }
.cal-legend .st { font-weight: 500; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.fchip { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px; border-radius: 15px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font-size: 13px; }
.fchip.off { background: transparent; border-style: dashed; color: var(--muted); }
.fchip.off .dot { opacity: .5; }
.fchip:hover { border-color: var(--faint); }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.week-col { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); min-height: 360px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.week-col.today { border-color: color-mix(in srgb, var(--marker) 80%, var(--text) 20%); box-shadow: inset 0 3px 0 var(--marker); }
.week-col h3 { margin: 0 0 4px; font-size: 13px; font-weight: 650; display: flex; justify-content: space-between; }
.list-day { margin-bottom: 18px; }

/* ---------- Оверлеи ---------- */
.scrim { position: fixed; inset: 0; background: rgba(18, 24, 38, .42); z-index: 40; animation: fade .16s ease-out; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(980px, 100vw); background: var(--surface); z-index: 41; display: flex; flex-direction: column; box-shadow: var(--sh-pop); animation: slide .22s cubic-bezier(.2,.8,.2,1); }
.drawer-h { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.drawer-h h2 { margin: 0; font-size: 17px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-b { flex: 1; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) 340px; }
.drawer-main { overflow-y: auto; padding: 18px 20px 30px; }
.drawer-side { overflow-y: auto; border-left: 1px solid var(--line); background: var(--surface-2); padding: 16px; }
.drawer-f { display: flex; gap: 8px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
/* Окна (подтверждения и т.п.) всегда поверх выезжающей карточки поста (.drawer, z 41) */
.scrim.modal-scrim { z-index: 48; }
.modal { position: fixed; z-index: 49; left: 50%; top: 8vh; transform: translateX(-50%); width: min(var(--w, 560px), calc(100vw - 32px)); max-height: 84vh; display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-l); box-shadow: var(--sh-pop); animation: pop .18s cubic-bezier(.2,.8,.2,1); }
.modal-h { display: flex; align-items: center; padding: 16px 20px 6px; gap: 10px; }
.modal-h h2 { margin: 0; font-size: 18px; flex: 1; }
.modal-b { padding: 8px 20px 18px; overflow-y: auto; }
.modal-f { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@keyframes pop { from { transform: translate(-50%, 8px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .scrim, .drawer, .modal { animation: none; } }

.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; justify-items: center; }
.toast { background: var(--ctl); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--sh-pop); max-width: min(560px, 90vw); display: flex; gap: 12px; align-items: center; }
.toast.err { background: var(--bad); color: var(--on-bad); }
.toast button { background: none; border: 0; color: var(--marker); font-weight: 650; cursor: pointer; }

/* ---------- Редактор поста ---------- */
.title-input { width: 100%; border: 0; font-size: 22px; font-weight: 700; letter-spacing: -.01em; padding: 4px 0; background: none; outline: none; }
.title-input::placeholder { color: var(--faint); }
.meta-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 14px; align-items: center; }
.meta-row .input, .meta-row .select { width: auto; min-height: 34px; padding: 5px 9px; font-size: 13.5px; }
.nets-pick { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.nets-pick button { border: 1px solid var(--line-2); background: var(--surface); border-radius: 8px; height: 34px; padding: 0 9px 0 6px; display: inline-flex; gap: 6px; align-items: center; cursor: pointer; font-size: 13px; }
.nets-pick button:not(.on) .net svg path { fill: currentColor; }
.nets-pick button:not(.on) .net { opacity: .75; }
.nets-pick button:not(.on) { color: var(--muted); }
.editor { position: relative; }
.editor .textarea { min-height: 300px; font-size: 15.5px; line-height: 1.6; padding: 14px 16px; }
.editor, .drawer-main { min-width: 0; }
.editor-bar { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.editor-bar .count { margin-left: auto; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.media-strip { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.media-item { width: 92px; height: 92px; border-radius: 10px; background: var(--surface-2) center/cover; border: 1px solid var(--line); position: relative; overflow: hidden; }
.media-item video { width: 100%; height: 100%; object-fit: cover; }
.media-item button { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(18,24,38,.7); color: #fff; cursor: pointer; font-size: 13px; line-height: 1; }
.media-add { width: 92px; height: 92px; border-radius: 10px; border: 1.5px dashed var(--line-2); display: grid; place-items: center; color: var(--muted); cursor: pointer; font-size: 12.5px; text-align: center; background: none; }
.media-add:hover, .media-add.drop { border-color: var(--pen); color: var(--pen); background: var(--pen-soft); }
.side-tabs { display: flex; gap: 2px; margin-bottom: 14px; background: var(--line); padding: 3px; border-radius: 9px; }
.side-tabs button { flex: 1; border: 0; background: none; padding: 6px 4px; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--muted); font-weight: 500; }
.side-tabs button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(30,42,68,.12); }
.issue { padding: 9px 11px; border-radius: 9px; font-size: 13.5px; line-height: 1.4; margin-bottom: 8px; border: 1px solid var(--line); background: var(--surface); }
.issue.error { border-color: color-mix(in srgb, var(--bad) 35%, transparent); background: var(--bad-soft); }
.issue.warn { border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: var(--warn-soft); }
.issue .hint { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.issue .fixes { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.issue .fixes button { border: 1px solid var(--line-2); background: var(--surface); border-radius: 6px; padding: 2px 8px; font-size: 13px; cursor: pointer; }
.issue .fixes button:hover { border-color: var(--pen); color: var(--pen); }
.issue mark { background: var(--marker-soft); color: inherit; padding: 0 2px; border-radius: 3px; text-decoration: underline wavy var(--bad); text-underline-offset: 3px; }
.score { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.score b { font-size: 28px; font-weight: 750; }
.ai-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ai-actions button { text-align: left; border: 1px solid var(--line); background: var(--surface); padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.ai-actions button:hover { border-color: var(--pen); }
.ai-result { margin-top: 12px; padding: 12px; background: var(--surface); border: 1px solid var(--pen); border-radius: 10px; white-space: pre-wrap; font-size: 14px; line-height: 1.55; }
.preview { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.preview-h { display: flex; align-items: center; gap: 9px; padding: 10px 12px; }
.preview-h b { font-size: 14px; display: block; } .preview-h span { font-size: 12px; color: var(--muted); }
.preview-t { padding: 0 12px 12px; font-size: 14px; white-space: pre-wrap; line-height: 1.5; max-height: 360px; overflow: auto; word-break: break-word; }
.preview-img { aspect-ratio: 4 / 3; background: var(--surface-2) center/cover; }
.comments { display: grid; gap: 8px; }
.cmt { padding: 9px 11px; border-radius: 10px; font-size: 13.5px; background: var(--surface); border: 1px solid var(--line); }
.cmt.client { border-color: color-mix(in srgb, var(--marker) 80%, var(--text) 20%); background: var(--marker-soft); }
.cmt .who { font-size: 12px; color: var(--muted); margin-bottom: 2px; }

/* ---------- Умная вставка ---------- */
.paste-area { min-height: 220px; font-size: 14.5px; }
.paste-card { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; background: var(--surface); }
.paste-card.off { opacity: .5; }
.paste-card.drop { border-color: var(--pen); background: var(--pen-soft); }
.paste-title { font-weight: 650; border-color: transparent !important; padding-left: 0 !important; min-height: 30px; background: transparent; }
.paste-busy { display: flex; align-items: center; gap: 4px; }
.paste-media { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.pm-item { position: relative; width: 56px; height: 56px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); display: grid; place-items: center; }
.pm-item img { width: 100%; height: 100%; object-fit: cover; }
.pm-vid { font-size: 11px; color: var(--muted); }
.pm-item button { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%; border: 0; background: rgba(20, 18, 15, .7); color: #fff; font-size: 12px; line-height: 1; cursor: pointer; }
.paste-card .ptext { font-size: 13.5px; color: var(--muted); white-space: pre-wrap; max-height: 66px; overflow: hidden; margin: 4px 0 8px; }
.paste-card .row .input, .paste-card .row .select { width: auto; min-height: 32px; padding: 4px 8px; font-size: 13px; }

/* ---------- Палитра команд ---------- */
.palette { position: fixed; z-index: 51; left: 50%; top: 12vh; transform: translateX(-50%); width: min(660px, calc(100vw - 24px)); background: var(--surface); border-radius: 14px; box-shadow: var(--sh-pop); overflow: hidden; animation: pop .16s ease-out; }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 16px 18px; font-size: 16px; outline: none; background: none; }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow: auto; }
.palette li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 14.5px; }
.palette li.on { background: var(--pen-soft); }
.palette li small { margin-left: auto; color: var(--muted); font-size: 12.5px; }

/* ---------- ИИ-чат ---------- */
.chat { display: grid; grid-template-rows: 1fr auto; height: calc(100vh - 170px); min-height: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; }
.chat-log { overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; line-height: 1.55; font-size: 14.5px; }
.msg.me { align-self: flex-end; background: var(--ctl); color: #fff; border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg .msg-tools { display: flex; gap: 6px; margin-top: 8px; }
.chat-in { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); align-items: flex-end; }
.chat-in .textarea { min-height: 44px; max-height: 200px; }
.suggest { display: flex; gap: 6px; flex-wrap: wrap; }
.suggest button { border: 1px solid var(--line-2); background: var(--surface); border-radius: 18px; padding: 6px 12px; cursor: pointer; font-size: 13px; }
.suggest button:hover { border-color: var(--pen); color: var(--pen); }
.plan-item { display: grid; grid-template-columns: 22px 92px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); align-items: start; font-size: 14px; }
.typing::after { content: '▍'; animation: blink 1s steps(2) infinite; color: var(--pen); }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Сервисы и тренды ---------- */
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.svc { display: flex; gap: 12px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: inherit; align-items: flex-start; }
.svc:hover { border-color: var(--pen); }
.svc .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }
.svc b { display: block; font-size: 14.5px; } .svc span { font-size: 13px; color: var(--muted); line-height: 1.4; display: block; }
.svc .badge { margin-top: 6px; display: inline-block; font-size: 11.5px; font-weight: 600; color: var(--ok); background: var(--ok-soft); border-radius: 10px; padding: 1px 8px; }
.section-t { font-size: 15px; font-weight: 650; margin: 26px 0 10px; }
.section-t:first-child { margin-top: 0; }
.trend-list { display: grid; gap: 8px; }
.trend { display: flex; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.trend .d { width: 74px; flex: none; font-size: 13px; color: var(--muted); line-height: 1.25; }
.trend .d b { display: block; color: var(--text); font-size: 14px; }
.trend .w { flex: 1; min-width: 0; }
.trend .w b { font-weight: 600; } .trend .w span { display: block; font-size: 12.5px; color: var(--muted); }
.kind-gov { --c: var(--bad); } .kind-pro { --c: var(--pen); } .kind-med { --c: var(--ok); } .kind-church { --c: #8B6BD6; } .kind-fun { --c: var(--warn); }

/* ---------- Таблицы ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }

/* ---------- Вход ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: min(380px, 100%); background: var(--surface); border-radius: 18px; padding: 30px 28px; box-shadow: var(--sh-pop); }
.login h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -.02em; }
.login p { margin: 0 0 22px; color: var(--muted); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs a { padding: 9px 12px; text-decoration: none; color: var(--muted); font-weight: 500; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--text); border-bottom-color: var(--text); }
.tabs a:hover { color: var(--text); }
.tabs button { padding: 9px 12px; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--muted); font-weight: 500; font-size: 14px; cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--text); border-bottom-color: var(--text); }
.tabs button:hover { color: var(--text); }
/* Полезные материалы */
.mat-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.mat-search { flex: 1; min-width: 220px; max-width: 480px; position: relative; }
.mat-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.mat-search .input { padding-left: 34px; }
.cats { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.cat-btn { height: 30px; padding: 0 12px; border-radius: 20px; border: 1px solid var(--line-2); background: var(--surface); color: var(--muted); font-size: 13px; cursor: pointer; white-space: nowrap; }
.cat-btn:hover { color: var(--text); border-color: var(--faint); }
.cat-btn.on { background: var(--ctl); border-color: var(--ctl); color: #fff; }
.mat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.mat { display: flex; flex-direction: column; gap: 7px; min-width: 0; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.mat.pinned { border-left: 3px solid var(--marker); }
.mat-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; font-weight: 600; color: var(--pen); }
.mat-t { font-size: 15px; font-weight: 650; line-height: 1.3; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.mat-t:hover { color: var(--pen); text-decoration: underline; }
.mat-d { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mat-meta { font-size: 12.5px; color: var(--faint); overflow-wrap: anywhere; }
.mat-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.mat-acts { display: flex; gap: 4px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; border-top: 1px solid var(--line); }
.mat-hint { font-size: 12.5px; color: var(--faint); margin-top: 4px; }
@media (max-width: 640px) { .mat-grid { grid-template-columns: 1fr; } }

/* ---------- Адаптив ---------- */
@media (max-width: 1100px) {
  .today, .today.tasks-cols, .today.ai-cols { grid-template-columns: minmax(0, 1fr); }
  .drawer-b { grid-template-columns: minmax(0, 1fr); overflow-y: auto; }
  .drawer-main, .drawer-side { overflow: visible; }
  .drawer-side { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 45; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .side { transform: none; box-shadow: var(--sh-pop); }
  body.has-sso-bar .side { top: 36px; }
  .top { padding: 10px 16px; }
  .top .menu-btn { display: inline-flex; }
  .top-today { display: none; }
  .top-actions { flex: 1; justify-content: flex-end; }
  .cmd kbd, .ai-pill span { display: none; }
  .content { padding: 18px 16px 60px; }
  .cal-head { display: none; }
  .cal-grid { grid-template-columns: 1fr; }
  .cal-cell { min-height: 0; border-right: 0; }
  .cal-cell.out { display: none; }
  .cal-wd { display: inline; }
  .cal-add { opacity: 1; }
  .week-grid { grid-template-columns: 1fr; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .msg { max-width: 92%; }
  .page-h h1 { font-size: 22px; }
}


/* ========== Проект, входящие, согласование, команда, настройки (v0.4) ========== */
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.list-row:first-child { border-top: 0; }
.feed-item { cursor: pointer; align-items: flex-start; }
.feed-item:hover b { color: var(--pen); }
.feed-text { margin: 3px 0; padding-left: 10px; border-left: 3px solid var(--marker); font-size: 14px; white-space: pre-wrap; }
.ok-t { color: var(--ok); font-weight: 600; } .bad-t { color: var(--bad); font-weight: 500; }
.tag.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tag.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.fchip.on { background: var(--ctl); color: #fff; border-color: var(--ctl); }
.fchip b { font-size: 11.5px; background: var(--marker); color: var(--ink); border-radius: 9px; padding: 0 6px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.svc .ic svg { width: 20px; height: 20px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--text); }
.save-state { font-size: 12.5px; color: var(--faint); }
.linkish { border: 0; background: none; color: var(--pen); cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }

/* Входящие */
.inbox-wrap { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
.inbox-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; max-height: calc(100vh - 250px); overflow-y: auto; }
.inbox-item { padding: 11px 14px; border-top: 1px solid var(--line); cursor: pointer; display: grid; gap: 3px; }
[role="listitem"]:first-child .inbox-item { border-top: 0; }
.inbox-item:hover { background: var(--surface-2); }
.inbox-item.on { background: var(--pen-soft); }
.inbox-item.unread b { font-weight: 700; }
.inbox-item.unread::before { content: ''; }
.inbox-snip { font-size: 13.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.inbox-detail { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); min-height: 260px; }
.inbox-pane { padding: 16px 18px 20px; }
.inbox-msg { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); white-space: pre-wrap; word-break: break-word; line-height: 1.55; }
.inbox-msg.mine { background: var(--pen-soft); border-color: transparent; }
/* Вложения во входящих: значки и превью (картинки идут через прокси Постмаркера) */
.atts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.att { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; color: var(--text); text-decoration: none; max-width: 100%; }
a.att:hover { border-color: var(--pen); }
.att audio { height: 32px; max-width: 220px; }
.att.prev { position: relative; padding: 0; border-radius: 12px; overflow: hidden; display: inline-block; }
.att.prev img { display: block; max-width: 200px; max-height: 160px; min-width: 64px; min-height: 48px; object-fit: cover; }
.att.prev span { position: absolute; left: 5px; bottom: 5px; max-width: calc(100% - 10px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: rgba(0,0,0,.6); color: #fff; border-radius: 99px; padding: 0 8px; font-size: 12px; }
.att-line { color: var(--muted); font-style: italic; }
.inbox-back { display: none; }
@media (max-width: 820px) {
  .inbox-wrap { grid-template-columns: 1fr; }
  .inbox-wrap.has-sel .inbox-list { display: none; }
  .inbox-wrap:not(.has-sel) .inbox-detail { display: none; }
  .inbox-back { display: inline-flex; }
  .inbox-list { max-height: none; }
}

/* Проект */
.work-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr); gap: 22px; align-items: start; }
.note { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 10px; }
.note.pinned { border-color: color-mix(in srgb, var(--marker) 80%, var(--text) 20%); background: linear-gradient(var(--marker-soft), var(--surface) 60%); }
.dropzone { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; padding: 18px; border: 1.5px dashed var(--line-2); border-radius: var(--r-l); background: var(--surface); }
.dropzone.over { border-color: var(--pen); background: var(--pen-soft); }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.file-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 8px; min-width: 0; }
.file-prev { display: grid; place-items: center; aspect-ratio: 4 / 3; border-radius: 8px; background: var(--surface-2); color: var(--faint); overflow: hidden; margin-bottom: 8px; }
.file-prev img { width: 100%; height: 100%; object-fit: cover; }
.file-prev svg { width: 34px; height: 34px; }
.file-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn-entry { padding: 14px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface-2); margin-bottom: 12px; }
.conn-label { font-weight: 600; max-width: 320px; }
.conn-info { margin-bottom: 10px; }
.conn-meta { display: grid; grid-template-columns: max-content 1fr; gap: 3px 12px; margin: 0 0 8px; font-size: 13.5px; }
.conn-meta dt { color: var(--muted); }
.conn-meta dd { margin: 0; overflow-wrap: anywhere; }
.take-from { margin-bottom: 10px; }
.take-list { margin-top: 8px; display: grid; gap: 6px; }
.take-item { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-size: 14px; }
details.how { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
details.how summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--pen); }
details.how ol { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; color: var(--muted); line-height: 1.5; }
.report-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.metric-inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.top-row { display: grid; grid-template-columns: 2fr 2fr 1fr; gap: 8px; margin-bottom: 8px; }
.delta { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.delta.up { color: var(--ok); } .delta.down { color: var(--bad); }
.report-head { border-left: 5px solid var(--c, var(--marker)); padding-left: 12px; margin-bottom: 16px; }
.report-head h1 { margin: 0; font-size: 22px; } .report-head p { margin: 2px 0 0; color: var(--muted); }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.metric { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface-2); }
.metric .mv { font-size: 24px; font-weight: 750; letter-spacing: -.02em; } .metric .ml { font-size: 13px; color: var(--muted); }
.report-print h3 { font-size: 15px; margin: 18px 0 6px; }
.top-posts { padding-left: 20px; margin: 0; } .summary { white-space: pre-wrap; margin: 0; }
.slots { display: grid; gap: 8px; }
.slot-row { display: grid; grid-template-columns: 76px 120px minmax(0, 1fr); gap: 10px; align-items: center; }
.slot-row .input:disabled { opacity: .45; }
@media (max-width: 1100px) { .work-grid, .report-grid { grid-template-columns: 1fr; } }
@media (max-width: 820px) { .metric-inputs, .top-row { grid-template-columns: 1fr; } .slot-row { grid-template-columns: 70px 100px 1fr; } }

/* «Подробно из ВК» в отчёте */
.xr { margin-top: 26px; padding-top: 18px; border-top: 2px solid var(--line); }
.xr-h { font-size: 18px; margin: 0 0 4px; }
.xr h3 { font-size: 15px; margin: 20px 0 6px; }
.xr-small .metric .mv { font-size: 20px; }
.xr-chart { width: 100%; height: auto; display: block; }
.xr-legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.xr-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }
.xr-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px 22px; }
.xr-sub { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.xr-bars { display: grid; gap: 5px; }
.xr-bar { display: grid; grid-template-columns: minmax(64px, 110px) minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: 13px; }
.xr-bl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.xr-bt { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; border: 1px solid var(--line); }
.xr-bt i { display: block; height: 100%; border-radius: 5px; }
.xr-bar small { font-weight: 500; color: var(--muted); }
.xr-kv { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; font-size: 13.5px; } .xr-kv span { color: var(--muted); }
.xr-best { margin: 0 0 8px; font-size: 14px; }
.xr-posts li { margin-bottom: 4px; } .xr-meta { color: var(--muted); font-size: 12.5px; }
.xr-warn { margin: 0 0 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--warn-soft); color: var(--warn); font-size: 13.5px; }
.xr-warn summary { cursor: pointer; font-weight: 600; } .xr-warn ul { margin: 6px 0 0; padding-left: 20px; }

/* Печать отчёта: только блок «Так увидит клиент» */
@media print {
  body.print-report { background: #fff; color: #000; }
  body.print-report .side, body.print-report .top, body.print-report .no-print, body.print-report .toasts { display: none !important; }
  body.print-report .shell { display: block; height: auto; }
  body.print-report .main, body.print-report .content { display: block; overflow: visible; padding: 0; }
  body.print-report .report-grid { display: block; }
  body.print-report .report-print { border: 0; }
  body.print-report .report-print .panel-h { display: none; }
  body.print-report .xr { break-before: page; --text: #222; --muted: #555; --line: #ccc; --line-2: #999; --surface-2: #f2f2f2; --pen: #2E4A8B; --ok: #2B7349; --bad: #A93526; --warn: #7A5410; }
  body.print-report .xr h3, body.print-report .xr-cols > div, body.print-report .xr-chart { break-inside: avoid; }
  body.print-report .xr-bt, body.print-report .xr-bt i, body.print-report .xr-legend i, body.print-report .xr-chart { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}


/* ========== ИИ-чат v2 (диалоги, Markdown, рассуждения, агент) ========== */
.aic { display: grid; grid-template-columns: 264px minmax(0, 1fr); height: calc(100vh - 170px); min-height: 480px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; position: relative; }
.aic-side { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-right: 1px solid var(--line); background: var(--surface-2); min-height: 0; }
.aic-new { width: 100%; }
.aic-side { min-width: 0; overflow: hidden; }
.aic-list { overflow-y: auto; overflow-x: hidden; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; align-content: start; min-height: 0; }
.aic-item { display: flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 8px; cursor: pointer; min-height: 38px; font-size: 14px; color: var(--text); min-width: 0; }
.aic-item:hover { background: var(--line); }
.aic-item.on { background: var(--pen-soft); }
/* Длинные названия чатов обрезаются многоточием — без горизонтальной прокрутки */
.aic-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aic-t * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aic-acts { display: none; gap: 0; flex: none; }
.aic-item:hover .aic-acts, .aic-item.on .aic-acts, .aic-item:focus-within .aic-acts { display: inline-flex; }
.aic-item .btn.sm.icon { width: 26px; height: 26px; }
.aic-rename { min-height: 30px; padding: 2px 8px; font-size: 14px; }
.aic-main { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; }
.aic-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.aic-bar .select { width: auto; max-width: 200px; min-height: 34px; padding: 4px 10px; font-size: 13.5px; }
.aic-title { flex: 1; min-width: 0; font-weight: 650; font-size: 15px; }
.aic-toggle { display: none; }
.aic-log { overflow-y: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 18px; min-height: 0; }
.aic-empty { margin: auto; max-width: 560px; text-align: center; }
.aic-empty h2 { margin: 0 0 6px; font-size: 24px; letter-spacing: -.02em; }
.aic-msg { max-width: 860px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; min-width: 0; }
.aic-msg.me { align-items: flex-end; }
.aic-bubble { max-width: 82%; background: var(--ctl); color: #fff; padding: 10px 14px; border-radius: 14px 14px 4px 14px; font-size: 14.5px; line-height: 1.55; }
.aic-utext { white-space: pre-wrap; word-break: break-word; }
.aic-imgs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.aic-pic { max-width: 220px; max-height: 180px; border-radius: 8px; display: block; }
.aic-tools { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; opacity: .85; }
.aic-msg.me .aic-tools { opacity: 0; transition: opacity .15s; }
.aic-msg.me:hover .aic-tools, .aic-msg.me:focus-within .aic-tools { opacity: 1; }
.aic-edit { width: min(640px, 100%); display: grid; gap: 8px; }
.aic-md { font-size: 14.5px; line-height: 1.65; word-break: break-word; color: var(--text); }
.aic-md > :first-child { margin-top: 0; } .aic-md > :last-child { margin-bottom: 0; }
.aic-md p { margin: 0 0 10px; }
.aic-md h2, .aic-md h3, .aic-md h4, .aic-md h5, .aic-md h6 { margin: 16px 0 6px; line-height: 1.3; letter-spacing: -.01em; }
.aic-md h2 { font-size: 19px; } .aic-md h3 { font-size: 16.5px; } .aic-md h4, .aic-md h5, .aic-md h6 { font-size: 15px; }
.aic-md ul, .aic-md ol { margin: 0 0 10px; padding-left: 22px; } .aic-md li { margin: 2px 0; } .aic-md li > ul, .aic-md li > ol { margin: 2px 0; }
.aic-md a { color: var(--pen); text-decoration: underline; text-underline-offset: 2px; }
.aic-md blockquote { margin: 0 0 10px; padding: 2px 12px; border-left: 3px solid var(--marker); color: var(--muted); }
.aic-md hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.aic-md code { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: .88em; background: var(--code-bg); color: var(--text); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 5px; }
.md-code { margin: 0 0 12px; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; background: var(--code-bg); }
.md-code-h { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 4px 12px; border-bottom: 1px solid var(--line-2); font-size: 12px; color: var(--muted); }
.md-copy { border: 0; background: none; color: var(--muted); font: inherit; font-size: 12px; padding: 3px 8px; border-radius: 6px; cursor: pointer; }
.md-copy:hover { background: var(--surface-2); color: var(--text); }
.md-code pre { margin: 0; padding: 10px 12px; overflow-x: auto; }
.md-code pre code { background: none; border: 0; padding: 0; font-size: 13px; line-height: 1.55; color: var(--text); white-space: pre; }
.md-table { overflow-x: auto; margin: 0 0 12px; }
.md-table table { border-collapse: collapse; font-size: 13.5px; }
.md-table th, .md-table td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.md-table th { background: var(--surface-2); font-weight: 600; }
.aic-think { margin-bottom: 10px; border-left: 3px solid var(--line-2); padding-left: 10px; }
.aic-think.live { border-left-color: var(--marker); }
.aic-think-h { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 2px 0; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); }
.aic-think-h:hover { color: var(--text); }
.aic-chev svg { width: 14px; height: 14px; transition: transform .15s; display: block; } .aic-chev.open svg { transform: rotate(90deg); }
.aic-think-b { white-space: pre-wrap; font-size: 13px; line-height: 1.55; color: var(--muted); max-height: 280px; overflow-y: auto; margin-top: 4px; }
.aic-steps { display: grid; gap: 4px; margin-bottom: 8px; }
.aic-step { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.aic-step svg { width: 14px; height: 14px; flex: none; }
.aic-step b { font-weight: 600; color: var(--text); }
.aic-step.error { color: var(--bad); } .aic-step.rejected { text-decoration: line-through; }
.aic-wait { color: var(--muted); font-size: 14px; }
.aic-dots::after { content: ''; animation: aicdots 1.2s steps(4) infinite; }
@keyframes aicdots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
.aic-pend { border: 1px solid color-mix(in srgb, var(--marker) 80%, var(--text) 20%); background: var(--surface); border-radius: var(--r-m); padding: 12px; margin: 4px 0 10px; display: grid; gap: 10px; box-shadow: var(--sh-lift); }
.aic-pend-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.aic-pend-h b { font-size: 14.5px; }
.aic-pend-list { display: grid; gap: 8px; max-height: 420px; overflow-y: auto; }
.aic-pp { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.aic-pp:not(:has(> input[type=checkbox])) { grid-template-columns: minmax(0, 1fr); }
.aic-pp.off { opacity: .5; }
.aic-pp input[type=checkbox] { accent-color: var(--pen); width: 16px; height: 16px; margin-top: 8px; }
.aic-pp-f { display: grid; gap: 6px; min-width: 0; }
.aic-pp-f .row .input { width: auto; min-height: 32px; padding: 3px 8px; font-size: 13px; }
.aic-pp-f .input, .aic-pp-f .textarea { font-size: 13.5px; }
.aic-kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px; align-items: center; }
.aic-in { padding: 8px 14px 10px; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.aic-in.drag { background: var(--pen-soft); outline: 2px dashed var(--pen); outline-offset: -6px; }
.aic-opts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.aic-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: var(--surface); border-radius: 18px; padding: 4px 12px; font-size: 13px; cursor: pointer; user-select: none; color: var(--muted); }
.aic-chip input { position: absolute; opacity: 0; pointer-events: none; }
.aic-chip.on { background: var(--ctl); border-color: var(--ctl); color: #fff; }
.aic-chip:focus-within { box-shadow: 0 0 0 3px var(--pen-soft); }
.aic-row { display: flex; gap: 8px; align-items: flex-end; }
.aic-row .textarea { min-height: 44px; max-height: 220px; resize: none; }
.aic-row .btn { flex: none; height: 44px; } .aic-row .btn.icon { width: 44px; }
.btn.rec { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); animation: aicrec 1.2s ease-in-out infinite; }
@keyframes aicrec { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--bad) 25%, transparent); } }
.aic-thumb { position: relative; } .aic-thumb img { height: 64px; border-radius: 8px; display: block; border: 1px solid var(--line); }
.aic-thumb button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; cursor: pointer; line-height: 1; }
.aic-note { text-align: center; }
@media (max-width: 820px) {
  .aic { grid-template-columns: 1fr; height: calc(100vh - 150px); }
  .aic-side { position: absolute; z-index: 5; inset: 0 auto 0 0; width: min(290px, 86%); transform: translateX(-100%); transition: transform .2s; box-shadow: var(--sh-pop); }
  .aic.side-open .aic-side { transform: none; }
  .aic-toggle { display: inline-flex; }
  .aic-bar { flex-wrap: wrap; } .aic-bar .select { max-width: 150px; }
  .aic-log { padding: 14px 12px; } .aic-bubble { max-width: 94%; }
  .aic-item .aic-acts { display: inline-flex; }
}

/* Блоки кода и настроек (вкладка «Claude и другие нейронки») */
.code-wrap { margin: 6px 0 12px; }
.code-block { margin: 0 0 6px; padding: 12px; background: var(--code-bg); color: var(--text); border: 1px solid var(--line-2); border-radius: 8px; overflow: auto; white-space: pre-wrap; word-break: break-all; font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12.5px; line-height: 1.55; }
.mcp-step { border-top: 1px solid var(--line); padding: 10px 0; }
.mcp-step summary { cursor: pointer; font-weight: 650; font-size: 14.5px; }
.mcp-step-b { padding-top: 8px; }
.mcp-step-b code { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: .9em; background: var(--code-bg); color: var(--text); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 5px; }

/* Обучение ИИ и входящие */
.spin { display: inline-block; width: 13px; height: 13px; margin-right: 6px; border: 2px solid var(--line-2); border-top-color: var(--pen); border-radius: 50%; animation: kb-spin .8s linear infinite; vertical-align: -2px; }
@keyframes kb-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2.4s; } }
.inbox-group { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--surface-2); border-top: 1px solid var(--line); font-size: 13.5px; position: sticky; top: 0; z-index: 1; }
.inbox-group .btn { margin: -3px 0; }
/* ---------- ИИ-чат: живой статус и рассуждения «как в Ollama» ---------- */
.aic-live { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); padding: 6px 0; }
.aic-pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--pen); flex: none; animation: aic-pulse 1.2s ease-in-out infinite; }
@keyframes aic-pulse { 0%, 100% { opacity: .35; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.15); } }
.aic-think-b.live { max-height: 220px; overflow-y: auto; scroll-behavior: smooth; mask-image: linear-gradient(to bottom, transparent, #000 28px); }
@media (prefers-reduced-motion: reduce) { .aic-pulse { animation: none; } }

/* Поиск инфоповодов (Claude Code / Codex) */
.rs-prov{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:8px}
.rs-p{text-align:left;border:1px solid var(--line,#0002);border-radius:10px;padding:10px 12px;background:transparent;color:inherit;cursor:pointer;display:grid;gap:2px;font:inherit}
.rs-p span{font-size:12px;opacity:.7}
.rs-p.on{border-color:currentColor;box-shadow:0 0 0 2px #0001}
.rs-p.off b{opacity:.65}
.rs-how{margin-top:10px;padding:10px 14px;border-radius:10px;background:#0000000d}
.rs-how ol{margin:6px 0 0;padding-left:20px;display:grid;gap:4px}
.rs-how code{padding:1px 6px;border-radius:6px;background:#0000001a;font-size:13px;user-select:all}
.rs-cfg{margin-top:8px;padding:10px 14px;border-radius:10px;background:#0000000d;display:grid;gap:6px}

/* Мастер подключения ВК */
.vkw { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.vkw .btn { white-space: normal; height: auto; min-height: 30px; padding-top: 5px; padding-bottom: 5px; text-align: left; }
.vkw input.input { min-width: 0; }
.vkw-step { border: 1px solid var(--line); border-radius: var(--r-l); padding: 12px 16px 14px; background: var(--surface); }
.vkw-step h3 { margin: 0 0 8px; font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vkw-n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--marker); color: #22252A; font-size: 13px; font-weight: 700; }
.vkw-list { margin: 6px 0; padding-left: 20px; display: grid; gap: 4px; line-height: 1.45; }
.vkw-code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; font-size: 13px; word-break: break-all; }
.vkw-checks { display: grid; gap: 6px; margin: 8px 0; }
.vkw-check { font-size: 14px; line-height: 1.4; }
/* Автоответчик, очередь подтверждения, обучение ответов */
.ar-panel { margin-bottom: 4px; border-color: var(--line-2); }
.ar-panel .panel-h h2 { display: inline-flex; align-items: center; gap: 8px; }
.ar-chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.tag.ar-draft { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag.ar-auto { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.ar-row { display: grid; gap: 6px; padding: 12px 0; border-top: 1px solid var(--line); }
.ar-row:first-child { border-top: 0; padding-top: 4px; }
.ar-t b { font-size: 15px; }
.ar-seg { max-width: 100%; }
.ar-seg button { height: 38px; padding: 0 16px; font-weight: 600; }
.ar-seg button.on.auto { background: var(--ok); color: #fff; }
.ar-h { margin: 0; max-width: 70ch; }
.ar-notify { margin-top: 10px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.ar-more { margin-top: 12px; }
.ar-post { margin: 4px 0 8px; padding: 7px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.ar-post a { margin-left: 6px; display: inline-flex; gap: 4px; align-items: center; }
.ar-sum { display: grid; gap: 2px; }
.ar-sum-h, .ar-sum-r { display: grid; grid-template-columns: minmax(120px, 1.2fr) minmax(150px, 1fr) minmax(150px, 1fr) auto; gap: 10px; align-items: center; }
.ar-sum-h { font-size: 12.5px; color: var(--faint); padding: 0 0 4px; }
.ar-sum-r { padding: 8px 0; border-top: 1px solid var(--line); }
.ar-sel { height: 34px; padding: 0 8px; }
.ar-sel.auto { border-color: var(--ok); }
.ar-sel.draft { border-color: var(--warn); }
@media (max-width: 820px) { .ar-sum-h { display: none; } .ar-sum-r { grid-template-columns: 1fr 1fr; } .ar-sum-r > :first-child, .ar-sum-r > button { grid-column: 1 / -1; } }
kbd { font: inherit; font-size: 11.5px; padding: 0 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); color: var(--muted); }
.queue { display: grid; gap: 14px; }
.q-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; position: sticky; top: 0; z-index: 2; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); }
.q-card { display: grid; gap: 10px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); cursor: pointer; }
.q-card.on { border-color: var(--pen); box-shadow: 0 0 0 2px var(--pen-soft); }
.q-arrow { display: flex; align-items: center; gap: 5px; margin: -4px 0 -4px 6px; }
.train-head h2 { margin: 0; font-size: 18px; }
.imp-list { display: grid; max-height: 46vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.imp-row { display: flex; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); cursor: pointer; align-items: flex-start; }
.imp-row:first-child { border-top: 0; }
.imp-row input { margin-top: 4px; accent-color: var(--pen); }
.imp-q { color: var(--muted); white-space: pre-wrap; word-break: break-word; }
.imp-a { margin-top: 3px; white-space: pre-wrap; word-break: break-word; }

/* ---------- Автоответчик: пояснение режима «Автоматически» ---------- */
.ar-how { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface-2); }
.ar-how ul { margin: 6px 0 10px; padding-left: 18px; color: var(--muted); line-height: 1.5; }

/* Новости SMM и ленты трендов */
.nw-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.nw-bar .mat-search { position: relative; flex: 1 1 200px; max-width: 320px; }
.nw-bar .grow { flex: 1; }
.nw-item { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.nw-item.read .nw-t { font-weight: 500; color: var(--muted); }
.nw-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; margin-top: 7px; border: 1px solid var(--line-2); }
.nw-dot.on { background: var(--pen); border-color: var(--pen); }
.nw-body { flex: 1; min-width: 0; }
.nw-t { font-weight: 600; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.nw-t:hover { text-decoration: underline; }
.nw-sum { font-size: 13px; color: var(--muted); margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nw-act { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 280px; }
.nw-star.on { color: var(--pen); }
.nw-err { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: #b3261e; color: #fff; font-size: 11px; font-weight: 700; }
.nw-feed { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.nw-add { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.nw-add .input { flex: 1 1 200px; width: auto; }
@media (max-width: 640px) { .nw-item { flex-wrap: wrap; } .nw-act { max-width: none; justify-content: flex-start; } }

/* ---------- Тетрадь задач: закладки, перенос, рутина, неделя, цели, календарь архива ---------- */
.hand-task .carry { display: block; font-size: 17px; line-height: 20px; margin-top: -4px; color: var(--sheet-note); }
.hand-task .tag-gone { font-family: var(--font); font-size: 11.5px; margin-left: 8px; padding: 1px 6px; border-radius: 6px; background: rgba(169, 53, 38, .13); color: #A93526; vertical-align: 3px; }
.hand-task.gone .txt { opacity: .55; }
.hand-task.ro { cursor: default; }
.hand-task .ret { flex: none; align-self: center; font-family: var(--font); font-size: 12.5px; border: 1px solid var(--sheet-line); background: rgba(255,255,255,.5); color: #23408F; border-radius: 6px; padding: 1px 8px; cursor: pointer; }
.hand-task .ret:hover { background: rgba(242, 209, 107, .6); }
.hand-task .del.vis, .hand-task:focus-within .del { opacity: 1; }
.hand-task .mv { flex: none; display: flex; opacity: 0; }
.hand-task:hover .mv, .hand-task:focus-within .mv { opacity: 1; }
.hand-task .mv button { font: inherit; font-size: 22px; line-height: 22px; border: 0; background: none; color: var(--sheet-note); cursor: pointer; padding: 0 3px; align-self: center; }
.hand-task:focus-visible { outline-offset: 0; }
.sheet-sec { font-size: 22px; color: var(--sheet-note); margin-top: 6px; text-decoration: underline wavy rgba(102, 96, 85, .35); text-underline-offset: 6px; }
.sheet ul.routine .bullet { color: var(--sheet-margin); }
.ro-sheet { min-height: 200px; }

.nb { display: flex; align-items: flex-start; gap: 0; }
.nb-body { flex: 1; min-width: 0; }
.nb-tabs { flex: none; display: flex; flex-direction: column; gap: 6px; padding-top: 28px; margin-left: -2px; position: sticky; top: 16px; }
.nb-tab { --tab: #F2D16B; position: relative; font-family: var(--hand-font); font-size: 21px; font-weight: 700; line-height: 1.1; color: #2A2D34; background: var(--tab); border: 0; border-radius: 0 12px 12px 0; padding: 9px 14px 9px 12px; width: 104px; text-align: left; cursor: pointer;
  box-shadow: 1px 2px 3px rgba(40, 34, 26, .22); transform: translateX(-6px); transition: transform .15s, width .15s; }
.nb-tab:hover { transform: translateX(-2px); }
.nb-tab.on { transform: translateX(6px); width: 118px; box-shadow: 2px 2px 6px rgba(40, 34, 26, .3); }
.nb-tab.on::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: rgba(0,0,0,.25); }
.nb-tab.t-week { --tab: #A9C3E8; } .nb-tab.t-goals { --tab: #EDB5A6; } .nb-tab.t-routine { --tab: #B7D7B4; } .nb-tab.t-archive { --tab: #D8CFBD; }
.nb-tab:focus-visible { outline: 2px solid var(--pen); outline-offset: 2px; }

.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0 10px; margin-top: 6px; }
.week-col { min-width: 0; border-left: 1px dashed var(--sheet-line); padding: 0 6px 6px 8px; border-radius: 4px; }
.week-col.today { background: rgba(242, 209, 107, .28); }
.week-col.over { background: rgba(46, 74, 139, .14); outline: 2px dashed rgba(46, 74, 139, .5); }
.week-col h3, .week-loose h3 { margin: 0; font: 700 21px/36px var(--hand-font); color: var(--ink); }
.week-col .hand-task, .week-loose .hand-task { font-size: 20px; line-height: 24px; min-height: 28px; padding: 2px 0; cursor: grab; }
.week-col .hand-task .bullet { width: 10px; }
.week-col .hand-task .mv, .week-loose .hand-task .mv { opacity: .55; }
.week-col .hand-task .txt { overflow-wrap: anywhere; }
.col-add .hand-input { height: 28px; font-size: 20px; }
.wk-nav { display: flex; align-items: center; gap: 4px; font-size: 20px; }
.wk-nav button { font-family: var(--hand-font); font-size: 20px; font-weight: 700; border: 0; background: none; color: var(--hand); cursor: pointer; padding: 0 6px; display: inline-flex; align-items: center; }
.wk-nav svg { width: 20px; height: 20px; }
.week-loose { margin-top: 10px; border-top: 1px dashed var(--sheet-line); }
.week-loose ul { columns: 2; column-gap: 24px; }

.goal { padding-bottom: 6px; }
.goal-top { display: flex; align-items: flex-start; }
.goal-top .hand-task { flex: 1; }
.goal-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 4px 26px; min-height: 36px; }
.goal .bar { flex: 1; min-width: 120px; height: 12px; border-radius: 7px; border: 1.5px solid #23408F; background: rgba(255,255,255,.5); overflow: hidden; }
.goal .bar i { display: block; height: 100%; background: rgba(242, 209, 107, .95); border-right: 1.5px solid #23408F; }
.goal-ctl { display: inline-flex; align-items: center; gap: 6px; font-size: 22px; }
.goal-ctl button { font: inherit; width: 30px; height: 28px; line-height: 24px; border: 1.5px solid #23408F; border-radius: 8px; background: rgba(255,255,255,.5); color: var(--hand); cursor: pointer; }
.goal-ctl button:hover { background: rgba(242, 209, 107, .7); }
.goal-ctl input { width: 54px; text-align: center; font: inherit; border: 0; border-bottom: 1.5px dashed #23408F; background: transparent; color: var(--hand); }
.hand-input.num { width: 90px; flex: none; text-align: right; }
.hand-form select, .rt-sel { font-family: var(--hand-font); font-size: 20px; color: var(--hand); background: transparent; border: 0; border-bottom: 1.5px dashed #23408F; flex: none; max-width: 170px; }
.rt { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 36px; }
.rt .txt { flex: 1; min-width: 140px; }
.rt .bullet { width: 18px; color: var(--sheet-note); }
.rt .del { font-family: var(--font); border: 0; background: none; cursor: pointer; color: var(--sheet-note); }
.rt-days { display: inline-flex; gap: 4px; flex-wrap: wrap; margin: 4px 0 0 26px; }
.rt .rt-days { margin: 0; }
.rt-days button { font: 700 18px/1 var(--hand-font); padding: 3px 8px; border-radius: 8px; border: 1.5px solid #23408F; background: transparent; color: var(--hand); cursor: pointer; }
.rt-days button.on { background: rgba(242, 209, 107, .85); }
.rt-form { flex-wrap: wrap; }

.arch-cols { align-items: start; }
.mcal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.mcal-wd { text-align: center; font-size: 12px; font-weight: 650; color: var(--muted); padding-bottom: 2px; }
.mcal-d { position: relative; aspect-ratio: 1 / .9; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 0; color: var(--text); }
.mcal-d b { font-weight: 600; font-size: 14px; }
.mcal-d:hover { border-color: var(--line-2); }
.mcal-d.today b { background: var(--marker); color: #2A2D34; border-radius: 6px 10px 6px 10px; padding: 1px 7px; transform: rotate(-3deg); }
.mcal-d.sel { border-color: var(--pen); box-shadow: 0 0 0 1.5px var(--pen); }
.mcal-d .dots { display: flex; gap: 3px; height: 7px; }
.mcal i, .mcal-key i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.dc { background: var(--pen); } .dd { background: var(--ok); } .dx { background: var(--bad); }
.mcal-key { display: flex; gap: 16px; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.mcal-key span { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 1100px) { .week-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 700px) {
  .nb { flex-direction: column-reverse; }
  .nb-tabs { flex-direction: row; overflow-x: auto; padding: 0 0 0 4px; margin: 0; position: static; gap: 4px; width: 100%; }
  .nb-tab, .nb-tab.on { width: auto; flex: none; border-radius: 12px 12px 0 0; transform: none; padding: 7px 12px; font-size: 19px; }
  .nb-tab.on { box-shadow: 0 -2px 6px rgba(40, 34, 26, .25); }
  .week-grid { grid-template-columns: minmax(0, 1fr); }
  .week-col { border-left: 0; border-top: 1px dashed var(--sheet-line); }
  .week-loose ul { columns: 1; }
  .hand-task .mv, .week-col .hand-task .mv { opacity: 1; }
  .hand-task .del { opacity: .8; }
  .sheet { font-size: 23px; padding-right: 14px; }
  .hand-form { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { .nb-tab { transition: none; } }

/* Дайджест «Главное за неделю» и добавление инфоповодов в календарь */
.dg-list { display: grid; gap: 10px; }
.dg-item { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.dg-n { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--text); color: var(--surface); display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.dg-why { font-size: 13px; margin-top: 4px; } .dg-why i { color: var(--muted); }
.dg-src { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; font-size: 12px; color: var(--muted); }
.dg-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.rs-bulk { position: sticky; bottom: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 12px; margin-top: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.rs-ck { margin-top: 4px; flex: none; }
@media (max-width: 640px) { .dg-item { flex-wrap: wrap; } }
/* ---------- Заполнить с помощью ИИ (мастер импорта) ---------- */
.imp-steps { display: flex; gap: 8px; flex-wrap: wrap; list-style: none; margin: 0 0 14px; padding: 0; }
.imp-steps li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); padding: 5px 12px 5px 6px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); }
.imp-steps li span { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); font-size: 12px; font-weight: 700; }
.imp-steps li.on { color: var(--ink, inherit); border-color: var(--pen); background: var(--pen-soft); font-weight: 600; }
.imp-steps li.on span { background: var(--pen); color: #fff; }
.imp-steps li.done span { background: var(--ok-soft); color: var(--ok); }
.imp-prompt, .imp-answer { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; line-height: 1.45; }
.imp-attach { margin: 6px 0 0; padding-left: 20px; columns: 2; column-gap: 24px; font-size: 13.5px; }
.imp-attach li { break-inside: avoid; margin: 2px 0; }
.imp-here { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line-2); display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.imp-here > div { flex-basis: 100%; }
.imp-sec { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--surface); }
.imp-sec.off { opacity: .6; }
.imp-sec-h { display: flex; align-items: center; gap: 12px; padding: 8px 12px; flex-wrap: wrap; }
.imp-sec-b { border-top: 1px solid var(--line); padding: 8px 12px 10px; max-height: 300px; overflow-y: auto; }
.imp-item { font-size: 13.5px; padding: 4px 0; border-top: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.imp-item:first-child { border-top: 0; }
.imp-item.dup { color: var(--muted); }
.imp-fld { padding: 6px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.imp-fld:first-child { border-top: 0; }
.imp-val { display: block; white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 3px; padding: 4px 8px; border-radius: 6px; max-height: 120px; overflow-y: auto; }
.imp-val.old { background: var(--surface-2); color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 50%, transparent); }
.imp-val.new { background: var(--ok-soft); }
span.imp-val { display: inline; padding: 0; }
@media (max-width: 640px) { .imp-attach { columns: 1; } }
/* Контекстное меню проекта, перетаскивание в левом списке */
.pm { position: fixed; z-index: 70; min-width: 190px; background: var(--surface); color: var(--text); border: 1px solid var(--line-2); border-radius: var(--r-m); box-shadow: var(--sh-pop); padding: 5px; display: flex; flex-direction: column; }
.pm button { text-align: left; background: none; border: 0; color: inherit; font: inherit; font-size: 14px; padding: 8px 12px; border-radius: 6px; cursor: pointer; }
.pm button:hover:not(:disabled), .pm button:focus-visible { background: var(--marker-soft); outline: none; }
.pm button:disabled { color: var(--faint); opacity: .55; cursor: default; }
.pm button.danger { color: var(--bad); }
.pm-colors { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.pm-sw { height: 38px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.pm-sw.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface) inset; }
.nav-a.dragging { opacity: .4; }
.nav-a.drop-before { box-shadow: 0 -2px 0 var(--marker); }
.nav-a.drop-after { box-shadow: 0 2px 0 var(--marker); }
.side-team { margin-top: 6px; font-size: 13px; color: var(--side-muted); }
.side-team-h { background: none; border: 0; color: inherit; font: inherit; padding: 6px 10px; cursor: pointer; text-align: left; width: 100%; }
.side-team-h:hover { color: #fff; }
.side-team-sw { display: flex; align-items: center; gap: 8px; padding: 4px 10px 6px; cursor: pointer; font-size: 12.5px; }
.side-team-g { padding: 8px 12px 2px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; opacity: .75; }
.cal-err, .post-row.has-error { box-shadow: inset 3px 0 0 var(--bad); }
.side-arch { margin-top: 6px; font-size: 13px; color: var(--side-muted); }
.side-arch > button { background: none; border: 0; color: inherit; font: inherit; padding: 6px 10px; cursor: pointer; }

/* ---------- Контент-завод ---------- */
.fz-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.fz-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 18px; box-shadow: var(--sh-lift); }
.fz-card h3 { margin: 0 0 10px; font-size: 15px; }
.fz-side { display: grid; gap: 14px; position: sticky; top: 8px; }
.fz-month { min-width: 150px; text-align: center; text-transform: capitalize; }
.fz-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.fz-count { display: grid; gap: 4px; }
.fz-count span { font-size: 12.5px; color: var(--muted); }
.fz-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 1px solid var(--line-2); border-radius: 99px; font-size: 13.5px; cursor: pointer; background: var(--surface); }
.fz-pill input { position: absolute; opacity: 0; pointer-events: none; }
.fz-pill.on { background: var(--pen-soft); border-color: var(--pen); color: var(--pen); font-weight: 600; }
.fz-pill:focus-within { outline: 2px solid var(--pen); outline-offset: 2px; }
.fz-flags { display: grid; gap: 8px; }
.fz-check { display: flex; gap: 9px; align-items: center; font-size: 14px; cursor: pointer; }
.fz-check input { width: 17px; height: 17px; accent-color: var(--ctl); }
.fz-est { display: grid; gap: 6px; font-size: 14px; }
.fz-est > div { display: flex; justify-content: space-between; gap: 10px; }
.fz-est b { text-align: right; font-weight: 600; }
.fz-go { width: 100%; height: 42px; margin-top: 14px; }
.fz-job { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: 14px; }
.fz-job:first-of-type { border-top: 0; }
.fz-job small { display: block; color: var(--faint); font-size: 12.5px; }
.fz-st { font-size: 12px; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.fz-st.done { background: var(--ok-soft); color: var(--ok); }
.fz-st.error { background: var(--bad-soft); color: var(--bad); }
.fz-st.running, .fz-st.queued { background: var(--warn-soft); color: var(--warn); }
.fz-run { display: grid; gap: 14px; max-width: 760px; }
.fz-bar { height: 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.fz-bar i { display: block; height: 100%; background: var(--marker); transition: width .4s; }
.fz-list { display: grid; gap: 12px; padding-bottom: 8px; max-width: 900px; }
.fz-it { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--pen); border-radius: var(--r-m); padding: 12px 14px; display: grid; gap: 8px; }
.fz-it.kind-clip { border-left-color: var(--inst); }
.fz-it.kind-story { border-left-color: var(--ok); }
.fz-it.flash { box-shadow: 0 0 0 3px var(--marker); }
.fz-it.busy { opacity: .6; pointer-events: none; }
.fz-it-h { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fz-kind { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: var(--pen-soft); color: var(--pen); }
.fz-kind.clip { background: var(--bad-soft); color: var(--inst); }
.fz-kind.story { background: var(--ok-soft); color: var(--ok); }
.fz-fmt { font-size: 12.5px; color: var(--muted); }
.fz-date { width: 150px; min-height: 32px; padding: 3px 8px; }
.fz-time { width: 100px; min-height: 32px; padding: 3px 8px; }
.fz-nets { display: inline-flex; gap: 4px; }
.fz-net { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 5px; background: var(--surface-2); color: var(--muted); }
.fz-title { font-weight: 600; }
.fz-text { line-height: 1.5; resize: vertical; }
.fz-wish { display: flex; gap: 8px; }
.fz-notes summary { cursor: pointer; font-size: 13px; color: var(--muted); padding: 2px 0 6px; }
.fz-bar-act { position: sticky; bottom: 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 14px; margin-top: 8px; background: var(--paper); border-top: 1px solid var(--line-2); box-shadow: 0 -8px 16px -10px rgba(40, 34, 26, .25); z-index: 5; }
.fz-done { max-width: 720px; display: grid; gap: 12px; }
.fz-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; padding-bottom: 8px; }
.fz-cal-h { font-size: 12px; color: var(--faint); text-align: center; font-weight: 600; }
.fz-cal-d { min-height: 92px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 4px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fz-cal-d.out { opacity: .4; }
.fz-cal-d small { color: var(--faint); font-size: 11.5px; }
.fz-cal-i { border: 0; border-left: 3px solid var(--pen); background: var(--pen-soft); border-radius: 5px; padding: 2px 5px; font-size: 11.5px; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.fz-cal-i.clip { border-left-color: var(--inst); background: var(--bad-soft); }
.fz-cal-i.story { border-left-color: var(--ok); background: var(--ok-soft); }
@media (max-width: 860px) { .fz-grid { grid-template-columns: 1fr; } .fz-side { position: static; } .fz-counts { grid-template-columns: 1fr; } .fz-cal-d { min-height: 60px; } }
/* ---- UI-аудит 23.11: мобильные вкладки, футер поста, подсказки ---- */
.toasts { bottom: 76px; max-width: 94vw; }
.cal-hol.more { background: none; border: 0; font: inherit; font-size: 11.5px; color: var(--muted); text-align: left; cursor: pointer; padding: 0 4px; }
.cal-hol.more:hover { color: var(--text); text-decoration: underline; }
.pr-title, .chip .t, .hand-task .txt, .drawer-main .issue, .modal-b p { overflow-wrap: anywhere; }
.occ .when { overflow-wrap: anywhere; }
.drawer-f { position: sticky; bottom: 0; background: var(--surface); }
.drawer-main .meta-row .select, .drawer-main .meta-row .input { min-width: 0; max-width: 100%; }
.title-input { min-width: 0; text-overflow: ellipsis; }
@media (max-width: 820px) {
  .tabs, .nb-tabs { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); scrollbar-width: thin; }
  .tabs { scrollbar-width: none; }
  .ai-pill::after { content: 'ИИ'; font-size: 12px; }
  .top .menu-btn { min-width: 44px; min-height: 40px; }
  .cal-add { width: 32px; height: 32px; }
  .drawer-f { padding: 8px 12px; gap: 6px; }
  .drawer-f .btn { font-size: 13px; padding: 0 10px; height: 36px; }
  .drawer-f .btn.pub-later { flex: 1 1 100%; justify-content: center; }
  .drawer-f .spacer { display: none; }
  .tbl-wrap { max-width: 100%; }
}

/* ---- Постмаркер: перенос поста по кнопке, статусы, мелочи ---- */
.chip { position: relative; }
.chip-mv { flex: none; width: 24px; height: 24px; display: inline-grid; place-items: center; padding: 0; border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface-2); color: var(--muted); cursor: pointer; opacity: 0; align-self: flex-start; }
.chip-mv svg { width: 14px; height: 14px; }
.chip:hover .chip-mv, .chip:focus-within .chip-mv, .chip:focus .chip-mv { opacity: 1; }
.chip-mv:hover { color: var(--text); background: var(--surface); }
@media (hover: none), (pointer: coarse) { .chip-mv { opacity: 1; width: 32px; height: 32px; } .chip-mv svg { width: 16px; height: 16px; } }
.st { white-space: nowrap; }
@media (max-width: 1180px) { .top-today { flex-wrap: nowrap; overflow: hidden; } .tt-date { flex: none; } }
@media (max-width: 820px) { .side-foot { position: sticky; bottom: -18px; background: var(--ink); padding-bottom: 12px; z-index: 1; } }
@media (max-width: 640px) { .cal-filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; } .cal-filters .fchip { flex: none; white-space: nowrap; } }
.cal-week .week-col h3 { font: 650 14px/1.4 var(--font); color: var(--text); margin: 0 0 4px; }
.cal-week .week-col { padding: 8px; border: 1px solid var(--line); border-left: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); }
.cal-week .week-col.today { background: color-mix(in srgb, var(--marker-soft) 45%, var(--surface)); border-color: color-mix(in srgb, var(--marker) 80%, var(--text) 20%); }
.issue.info { background: var(--pen-soft); border-color: var(--pen); color: var(--text); }

/* ---- Карточка поста: правая колонка не вылезает за рамки панели ---- */
.input.invalid, .select.invalid { border-color: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 22%, transparent); }
.drawer, .drawer-b { max-width: 100%; }
.drawer-side { min-width: 0; max-width: 100%; overflow-x: hidden; overflow-wrap: anywhere; word-break: break-word; box-sizing: border-box; }
.drawer-side > div, .drawer-side .issue, .drawer-side .preview, .drawer-side .ai-result, .drawer-side .cmt, .drawer-side .comments, .drawer-side .row, .drawer-side form { min-width: 0; max-width: 100%; box-sizing: border-box; }
.drawer-side .row { flex-wrap: wrap !important; }
.drawer-side .input, .drawer-side .select, .drawer-side textarea { min-width: 0; max-width: 100%; }
.drawer-side .issue .row .btn, .drawer-side .issue .fixes button { max-width: 100%; white-space: normal; }
.drawer-side .issue a, .drawer-side .hint, .drawer-side .small { overflow-wrap: anywhere; }
.drawer-side details, .drawer-side details > div { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.drawer-side .seg { flex-wrap: wrap; max-width: 100%; }
.side-tabs { flex-wrap: wrap; max-width: 100%; box-sizing: border-box; }
.side-tabs button { flex: 1 1 auto; min-width: 0; padding: 6px 8px; white-space: nowrap; }
@media (max-width: 520px) {
  .side-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
  .side-tabs button { flex: none; padding: 6px 12px; }
  .drawer-side { padding: 12px; }
}

/* Календарь: меню «Добавить», события, подбор ИИ */
.add-menu { position: fixed; z-index: 60; min-width: 220px; max-width: calc(100vw - 16px); background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--sh-lift, 0 8px 28px rgba(0,0,0,.18)); padding: 6px; display: grid; gap: 2px; }
.add-menu-h { font-size: 12px; color: var(--muted); padding: 4px 8px 6px; }
.add-menu-i { display: flex; align-items: center; gap: 10px; border: 0; background: none; font: inherit; font-size: 14px; color: var(--text); text-align: left; padding: 8px 10px; border-radius: 7px; cursor: pointer; min-height: 38px; }
.add-menu-i:hover, .add-menu-i:focus-visible { background: var(--surface-2); outline: none; }
.am-ic { display: grid; place-items: center; width: 20px; height: 20px; color: var(--ec, var(--muted)); flex: none; }
.am-ic svg { width: 17px; height: 17px; }
.cal-hol.mine { max-width: 100%; box-sizing: border-box; overflow: hidden; }
.cal-hol.mine[draggable="true"] { cursor: grab; }
.cal-hol.mine.dragging { opacity: .4; }
.cal-hol.mine.approx span { font-style: italic; }
.mine-btn { border: 0; background: none; font: inherit; cursor: pointer; text-align: left; max-width: 100%; padding-top: 0; padding-bottom: 0; }
.mine-btn:hover { text-decoration: underline; }
.list-add { margin-left: 6px; vertical-align: middle; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 10px; cursor: pointer; }
.check-row input { width: 16px; height: 16px; flex: none; }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.ev-view-k { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.ev-view { border-left: 4px solid var(--ec); padding-left: 12px; }
.ev-view p { margin: 0 0 6px; overflow-wrap: anywhere; }
.ev-view-n { white-space: pre-wrap; }
.ev-view-idea { margin-top: 10px; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; font-size: 14px; overflow-wrap: anywhere; }
.gen-topics { display: grid; gap: 2px; }
.gen-err { margin-top: 8px; padding: 10px 12px; border-radius: 8px; background: var(--bad-soft); color: var(--bad); font-size: 14px; overflow-wrap: anywhere; }
.gen-bar { margin-bottom: 10px; }
.gen-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.gen-item { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--surface); }
.gen-item.off { opacity: .55; }
.gen-chk { padding-top: 8px; }
.gen-chk input { width: 18px; height: 18px; }
.gen-main { flex: 1; min-width: 0; display: grid; gap: 6px; }
.gen-row { display: flex; gap: 8px; flex-wrap: wrap; }
.gen-row .gen-date { width: 150px; flex: none; }
.gen-row .gen-title { flex: 1; min-width: 160px; }
.gen-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.gen-meta .check-row { margin: 0; }
.gen-why, .gen-idea { overflow-wrap: anywhere; }
.gen-mk { flex: none; }
@media (max-width: 520px) {
  .gen-item { flex-wrap: wrap; }
  .gen-main { flex-basis: calc(100% - 40px); }
  .gen-mk { margin-left: 28px; }
  .gen-row .gen-date { width: 100%; }
}
/* Поля секретов: type=text с маской, чтобы менеджер паролей не считал их полем пароля */
.secret-mask { -webkit-text-security: disc; text-security: disc; font-family: var(--mono, ui-monospace, monospace); letter-spacing: .04em; }
.secret-mask::placeholder { -webkit-text-security: none; letter-spacing: 0; }

/* Встроенные праздники кликабельны (изменить / скрыть); простая форма события с «Ещё…» */
button.cal-hol:not(.mine):not(.more) { background: none; border: 0; font: inherit; font-size: 11.5px; line-height: 1.3; text-align: left; cursor: pointer; width: 100%; padding: 0 4px; border-radius: 4px; }
button.cal-hol:not(.mine):not(.more):hover { background: var(--surface-2, rgba(0,0,0,.05)); text-decoration: underline; }
button.cal-hol.edited::after { content: ' ✎'; font-size: 10px; opacity: .6; }
.ev-more { align-self: flex-start; margin: 2px 0 8px; }
.ev-extra { border-top: 1px solid var(--line, rgba(0,0,0,.1)); padding-top: 12px; }

/* Переключатель ИИ: пилюля в шапке и список маршрутов */
button.ai-pill { font: inherit; font-size: 13px; cursor: pointer; }
.ai-pill .ai-caret { font-size: 10px; opacity: .6; }
.ai-sw-wrap { position: relative; }
.ai-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; width: min(360px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--sh-pop); padding: 6px; }
.ai-pop h4 { margin: 6px 10px 4px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.ai-opt { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 10px; border-radius: 8px; border: 0; background: none; font: inherit; font-size: 14px; color: var(--text); cursor: pointer; }
.ai-opt:hover:not(:disabled) { background: var(--pen-soft); }
.ai-opt .ai-chk { width: 18px; flex: none; color: var(--ok); font-weight: 700; }
.ai-opt small { display: block; color: var(--muted); font-size: 12.5px; }
.ai-opt.off { color: var(--faint); }
.ai-opt.off small { color: var(--faint); }
.ai-opt:disabled { cursor: default; }
.ai-opt.on { background: var(--ok-soft); }
.ai-opt .ai-setup { margin-left: auto; font-size: 12.5px; color: var(--pen); text-decoration: underline; white-space: nowrap; }
.aim-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.aim-rec { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.aim-rec.on { border-color: var(--ok); background: var(--ok-soft); }
.aim-rec b { font-size: 14px; }
.aim-why { font-size: 13px; color: var(--muted); }
.aim-img { max-width: 100%; max-height: 260px; border-radius: 10px; border: 1px solid var(--line); display: block; }
.fz-img { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; margin-top: 8px; }
.fz-img img { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

/* ---------- Шаблоны карточек (views/card-editor.js, card-maker.js) ---------- */
.ce-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-top: 14px; }
.ce-card { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: inherit; text-decoration: none; }
.ce-card:hover { border-color: var(--line-2); }
.ce-card-t { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ce-thumb { width: 100%; background: var(--surface-2); border-radius: 8px; overflow: hidden; display: grid; place-items: center; max-height: 280px; }
.ce-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.ce-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.ce-name { flex: 1; min-width: 160px; max-width: 320px; font-weight: 600; }
.ce-body { display: grid; grid-template-columns: 215px minmax(240px, 1fr) 295px; gap: 14px; align-items: start; }
.ce-left, .ce-right { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 10px; position: sticky; top: 8px; max-height: calc(100vh - 20px); overflow-y: auto; }
.ce-sec { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 12px 0 6px; }
.ce-sec:first-child { margin-top: 2px; }
.ce-sec small { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--faint); }
.ce-layer { display: flex; align-items: center; gap: 6px; width: 100%; padding: 5px 6px; border: 1px solid transparent; border-radius: 8px; background: none; cursor: pointer; text-align: left; font-size: 13.5px; color: inherit; }
.ce-layer:hover { background: var(--surface-2); }
.ce-layer.on { border-color: var(--line-2); background: var(--surface-2); }
.ce-layer.off .ce-ln { opacity: .5; text-decoration: line-through; }
.ce-ico { width: 20px; text-align: center; color: var(--muted); flex: none; font-weight: 700; }
.ce-ln { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ce-lb { display: inline-flex; flex: none; }
.ce-lb .btn { min-width: 24px; height: 24px; padding: 0 4px; }
.ce-add { display: flex; flex-wrap: wrap; gap: 6px; }
.ce-stage-wrap { display: flex; justify-content: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.ce-stage { position: relative; width: 100%; max-width: 440px; max-height: 72vh; background: #222; border-radius: 4px; overflow: hidden; user-select: none; touch-action: none; }
.ce-stage img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.ce-busy { position: absolute; top: 6px; right: 8px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 10px; pointer-events: none; }
.ce-box { position: absolute; border: 1px dashed rgba(255,255,255,.0); cursor: move; }
.ce-box:hover { border-color: rgba(255,255,255,.7); outline: 1px dashed rgba(0,0,0,.35); }
.ce-box.on { border: 1.5px solid #2f8cff; outline: 1px solid rgba(255,255,255,.7); }
.ce-h { position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px; background: #2f8cff; border: 2px solid #fff; border-radius: 50%; cursor: nwse-resize; }
.ce-f { display: grid; gap: 4px; margin-bottom: 10px; font-size: 13px; }
.ce-f > span { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.ce-f small { color: var(--faint); font-size: 12px; }
.ce-f .input, .ce-f .select, .ce-f .textarea { min-height: 34px; }
.ce-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.ce-chk { margin-bottom: 10px; }
.ce-col { display: flex; align-items: center; gap: 8px; }
.ce-col input[type=color] { width: 40px; height: 30px; padding: 0; border: 1px solid var(--line-2); border-radius: 6px; background: none; cursor: pointer; }
.ce-col code { font-size: 12px; color: var(--muted); }
.ce-fit { font-size: 12.5px; color: var(--muted); background: var(--surface-2); border-radius: 8px; padding: 6px 9px; margin-bottom: 10px; }
.ce-fit.warn { color: var(--warn); background: var(--warn-soft); }
.ce-fld { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.ce-fld .input { flex: 1; min-width: 90px; }
.ce-font { border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 8px; display: grid; gap: 6px; }
.ce-stop { border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 8px; }
@media (max-width: 900px) { .ce-body { grid-template-columns: 1fr; } .ce-left, .ce-right { position: static; max-height: none; } }

/* Карточка по шаблону в посте */
.cm { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 300px); gap: 16px; align-items: start; }
.cm-prev { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: grid; place-items: center; min-height: 160px; position: sticky; top: 0; }
.cm-prev img { width: 100%; max-height: 62vh; object-fit: contain; display: block; border-radius: 4px; }
.cm-photos { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.cm-photo { width: 56px; height: 56px; border-radius: 8px; border: 2px solid transparent; background: var(--surface-2) center/cover; cursor: pointer; padding: 0; }
.cm-photo.on { border-color: #2f8cff; }
.cm-warn { font-size: 12.5px; color: var(--warn); }
.media-item .cm-edit { right: auto; left: 4px; width: auto; border-radius: 10px; padding: 0 7px; height: 22px; font-size: 11px; }
@media (max-width: 760px) { .cm { grid-template-columns: 1fr; } .cm-prev { position: static; } }
.fz-card-prev { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; margin-top: 8px; padding: 10px; border: 1px dashed var(--line-2); border-radius: 10px; }
.fz-card-prev img { width: 150px; border-radius: 6px; border: 1px solid var(--line); }

/* Порядок строк, вложенные пункты задач, правка заметок на месте */
.grip { flex: none; width: 22px; min-height: 28px; padding: 0; border: 0; background: none; color: var(--sheet-note, var(--faint, #8a8f98)); font: inherit; font-size: 17px; line-height: 1; cursor: grab; opacity: .35; touch-action: none; user-select: none; border-radius: 4px; }
.grip:hover, .grip:focus-visible, .sorting .grip { opacity: 1; }
.grip:active { cursor: grabbing; }
@media (hover: none) { .grip { opacity: .7; width: 30px; min-height: 36px; } }
.sort-before { box-shadow: 0 -3px 0 0 var(--pen, #2563EB); }
.sort-after { box-shadow: 0 3px 0 0 var(--pen, #2563EB); }
.sorting { opacity: .55; }
.hand-row { list-style: none; }
/* Вложенные пункты, как в Google Keep: та же строка, только сдвинута вправо */
.hand-row, .proj-task { position: relative; }
.hand-row.child, .proj-task.child { margin-left: 28px; }
.proj-task-top input[type=checkbox] { accent-color: var(--pen); }
.proj-task { display: block; }
.proj-task-top { display: flex; align-items: center; gap: 6px; }
.proj-task-top.done .pt-title { text-decoration: line-through; opacity: .6; }
.pt-del { flex: none; border: 0; background: none; cursor: pointer; color: var(--faint); font: inherit; font-size: 16px; padding: 0 5px; opacity: 0; }
.proj-task:hover .pt-del, .proj-task:focus-within .pt-del { opacity: 1; }
@media (hover: none) { .pt-del { opacity: .8; } }
/* Правка текста строки на месте */
.inline-edit { font: inherit; color: inherit; line-height: inherit; width: 100%; min-width: 0; box-sizing: border-box; padding: 0 4px; margin: 0 -4px; background: rgba(255, 255, 255, .55); border: 0; border-bottom: 1.5px solid var(--pen, #23408F); border-radius: 3px; outline: none; user-select: text; cursor: text; }
.hand-task .txt.editing svg.strike { display: none; }
.hand-task .txt.editing { cursor: text; }
.hand-task .pen, .pt-pen { flex: none; align-self: flex-start; opacity: 0; font-family: var(--font); font-size: 14px; border: 0; background: none; cursor: pointer; color: var(--sheet-note, var(--faint)); padding: 0 4px; }
.pt-pen { align-self: center; color: var(--faint); font-size: 14px; }
.hand-task:hover .pen, .hand-task:focus-within .pen, .proj-task:hover .pt-pen, .proj-task:focus-within .pt-pen { opacity: 1; }
.hand-task .pen:hover, .pt-pen:hover { color: var(--pen, #23408F); }
.pt-title .inline-edit { background: var(--surface, rgba(255, 255, 255, .6)); border-bottom-color: var(--accent, var(--pen, #23408F)); }
@media (hover: none) { .hand-task .pen, .pt-pen { opacity: .7; } }
:root[data-theme="dark"] .inline-edit { background: rgba(255, 255, 255, .08); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .inline-edit { background: rgba(255, 255, 255, .08); } }
/* Куда встанет строка при перетаскивании: линия, сдвинутая вправо — станет вложенной */
.tree-before::before, .tree-after::after { content: ''; position: absolute; left: 0; right: 0; height: 3px; border-radius: 2px; background: var(--pen); pointer-events: none; z-index: 2; }
.tree-before::before { top: -2px; }
.tree-after::after { bottom: -2px; }
.tree-in:not(.child)::before, .tree-in:not(.child)::after { left: 28px; }
.child:not(.tree-in)::before, .child:not(.tree-in)::after { left: -28px; }
.note-main { display: flex; gap: 6px; align-items: flex-start; }
.note-text { flex: 1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; cursor: text; padding: 4px 6px; border-radius: 6px; min-height: 28px; }
.note-text:hover, .note-text:focus-visible { background: var(--surface-2, rgba(0, 0, 0, .04)); }
.note-edit { flex: 1; min-width: 0; }
.note-pen { flex: none; }
/* ========== Календарь 2.0 и рубрикатор (Постмаркер): компактные карточки, фильтры, флажки рубрик ========== */
.cal-cell { min-height: 156px; padding: 4px 5px 6px; gap: 3px; }
.cal-cell.weekend { background: color-mix(in srgb, var(--surface) 92%, var(--line-2)); }
.cal-cell.out { background: var(--paper); }
.cal-cell.out > *:not(.cal-top) { opacity: .6; }
.cal-cell.out .cal-num { color: var(--faint); font-weight: 500; }
.cal-cell.today { background: color-mix(in srgb, var(--marker-soft) 60%, var(--surface)); box-shadow: inset 0 3px 0 var(--marker); }
.cal-head div.we { color: var(--bad); }
.cal-mon { font-size: 11px; font-weight: 500; color: var(--muted); }
.cal-today-l { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text); background: var(--marker); padding: 0 6px; border-radius: 8px; line-height: 16px; white-space: nowrap; }
.cal-cnt { margin-left: auto; font-size: 11px; font-weight: 650; color: var(--muted); background: var(--surface-2); border-radius: 8px; padding: 0 6px; line-height: 16px; font-variant-numeric: tabular-nums; }
.cal-cnt + .cal-add { margin-left: 0; }
.cal-hol { -webkit-line-clamp: 1; line-height: 1.35; }
.cal-hol.mine span { -webkit-line-clamp: 1; }
button.cal-hol:not(.mine):not(.more) { font-size: 11.5px; }
.cal-hol .hd { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .55; margin-right: 5px; vertical-align: 1px; }
.cal-hol.more.more-posts { font-weight: 600; color: var(--pen); padding: 2px 6px; border-radius: 6px; background: var(--pen-soft); align-self: flex-start; }
.cal-hol.more.more-posts:hover { text-decoration: none; filter: brightness(.97); }

/* карточка поста: статус — цветная полоска слева */
.chip { padding: 4px 6px 4px 7px; border-radius: 7px; border-left-color: var(--sc); gap: 6px; font-size: 12.5px; transition: box-shadow .12s ease, border-color .12s ease; }
.chip:hover { border-left-color: var(--sc); }
.chip:focus-visible { outline: 2px solid var(--pen); outline-offset: 1px; }
.chip .cv { width: 28px; height: 28px; border-radius: 5px; }
.chip .cb { gap: 1px; }
.chip .mt { gap: 5px; flex-wrap: nowrap; overflow: hidden; }
.chip .tm { font-weight: 650; color: var(--text); }
.chip .t { font-weight: 600; -webkit-line-clamp: 1; line-height: 1.3; }
.chip.wide .t { -webkit-line-clamp: 2; }
.chip .cn { display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 10ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cn-nets { display: inline-flex; gap: 2px; flex: none; }
.chip .net, .chip .net svg { width: 14px; height: 14px; }
.chip .net { border-radius: 4px; }
.rb-e { font-style: normal; }
.chip.st-published { background: color-mix(in srgb, var(--surface) 90%, var(--line-2)); }
.chip.st-published .t { color: var(--muted); }
.chip[draggable="false"] { cursor: pointer; }
.chip.slot { background: color-mix(in srgb, var(--rc) 9%, var(--surface)); border: 1px dashed color-mix(in srgb, var(--rc) 55%, var(--line-2)); border-left: 4px solid var(--rc); }
.chip.slot .t { font-style: italic; color: var(--muted); }
.chip.ext { border: 1px dashed var(--line-2); border-left: 4px dashed var(--faint); background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--faint) 9%, transparent) 6px 7px); }
.chip.ext .t, .chip.ext .tm { color: var(--muted); }
.ext-tag { display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; line-height: 15px; padding: 0 5px; border-radius: 4px; background: var(--surface-2); color: var(--muted); border: 1px dashed var(--line-2); white-space: nowrap; flex: none; }
.ext-tag.ours { background: var(--marker-soft); color: var(--text); border: 1px solid var(--line-2); text-transform: none; letter-spacing: 0; }
.chip-act button.own.on { color: var(--ok, #1a7f4b); font-weight: 700; }
.own-switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; padding: 4px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface-2); cursor: pointer; }
.ext-tag.ans { background: var(--marker-soft); color: var(--text); border: 1px solid var(--marker); }
.ext-row td:first-child { border-left: 3px dashed var(--faint); }
.ext-row { opacity: .88; }
.post-row.ext { border-left: 3px dashed var(--faint); }

/* быстрые действия при наведении */
.chip-act { position: absolute; right: 3px; top: 3px; display: none; gap: 1px; padding: 2px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: var(--sh-lift); z-index: 2; }
.chip:hover .chip-act, .chip:focus-within .chip-act, .chip:focus .chip-act { display: inline-flex; }
.chip-act button { width: 24px; height: 24px; display: grid; place-items: center; padding: 0; border: 0; background: none; color: var(--muted); border-radius: 6px; cursor: pointer; }
.chip-act button svg { width: 14px; height: 14px; }
.chip-act button:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.chip-act button:focus-visible { outline: 2px solid var(--pen); outline-offset: 0; }
.chip-act button.ai { color: var(--pen); }
.chip-act button:disabled { opacity: .5; cursor: progress; }
@media (hover: none), (pointer: coarse) {
  .chip-act { display: flex; position: static; align-self: flex-start; background: none; border: 0; box-shadow: none; padding: 0; }
  .chip-act button { width: 32px; height: 32px; }
  .chip-act button svg { width: 16px; height: 16px; }
  .chip-act button:not(.mv):not(.ai) { display: none; }
}

/* перетаскивание: подсветка целевого дня */
.cal-cell, .week-col { position: relative; }
.cal-cell.target, .cal-week.dnd .week-col { outline: 1.5px dashed color-mix(in srgb, var(--pen) 38%, transparent); outline-offset: -3px; }
.cal-cell.drop, .week-col.drop { background: var(--pen-soft); outline: 2px solid var(--pen); outline-offset: -2px; }
.cal-cell.drop::after, .week-col.drop::after { content: attr(data-drop); position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); font-size: 11.5px; font-weight: 650; background: var(--pen); color: var(--paper); padding: 2px 9px; border-radius: 10px; pointer-events: none; white-space: nowrap; z-index: 3; }
.cal-wrap.dnd .chip:not(.dragging), .cal-week.dnd .chip:not(.dragging) { pointer-events: none; }

/* панель фильтров и статусы-легенда */
.cal-filter-bar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-st, .cal-fr, .fgrp { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.st-chip { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px 0 0; border: 1px solid var(--line-2); background: var(--surface); border-radius: 14px; overflow: hidden; font-size: 12.5px; cursor: pointer; color: var(--text); }
.st-chip i { width: 6px; align-self: stretch; background: var(--sc); }
.st-chip b { font-size: 11px; font-weight: 650; background: var(--surface-2); color: var(--muted); border-radius: 8px; padding: 0 6px; line-height: 17px; }
.st-chip:hover { border-color: var(--faint); }
.st-chip.on { background: var(--ctl); color: #fff; border-color: var(--ctl); }
.st-chip.on b { background: rgba(255, 255, 255, .2); color: #fff; }
.fnet { border: 1px solid transparent; background: none; padding: 3px; border-radius: 8px; cursor: pointer; line-height: 0; }
.fnet:hover { background: var(--surface-2); }
.fnet.on { border-color: var(--pen); background: var(--pen-soft); }
.fgrp.has-sel .fnet:not(.on) { opacity: .4; }
.seg.sm button { height: 28px; padding: 0 11px; font-size: 12.5px; }
.btn.is-now { border-color: var(--marker); box-shadow: inset 0 -3px 0 var(--marker); }
.cal-more { position: relative; }
.cal-more > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; }
.cal-more > summary::-webkit-details-marker { display: none; }
.cal-more-m { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 250px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--sh-pop); padding: 6px; display: grid; gap: 2px; }
.cal-more-m .btn { justify-content: flex-start; width: 100%; }

/* легенда */
.cal-legend { align-items: center; gap: 8px 18px; }
.lg { display: inline-flex; align-items: center; gap: 7px; }
.lg i { display: inline-block; flex: none; }
.lg-bar { width: 4px; height: 14px; border-radius: 2px; background: linear-gradient(var(--st-review) 0 33%, var(--st-approved) 33% 66%, var(--st-scheduled) 66%); }
.lg-slot { width: 20px; height: 12px; border-radius: 4px; border: 1px dashed var(--pen); background: var(--pen-soft); }
.lg-ext { width: 20px; height: 12px; border-radius: 4px; border: 1px dashed var(--faint); background: repeating-linear-gradient(135deg, transparent 0 4px, color-mix(in srgb, var(--faint) 25%, transparent) 4px 5px); }
.lg-hint { font-size: 12px; color: var(--faint); }

/* список дня «ещё N» */
.day-pop { position: fixed; z-index: 70; width: 320px; max-width: calc(100vw - 16px); max-height: 352px; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--sh-pop); }
.day-pop-h { display: flex; align-items: center; gap: 8px; padding: 8px 8px 6px 12px; border-bottom: 1px solid var(--line); }
.day-pop-h .btn { margin-left: auto; }
.day-pop-b { display: grid; gap: 6px; padding: 8px; overflow-y: auto; }
.day-pop-f { padding: 6px 8px 8px; border-top: 1px solid var(--line); }

/* рубрики: панель-флажки в календаре */
.rb-panel { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; padding: 8px 10px; margin-bottom: 10px; border: 1px dashed var(--line-2); border-radius: 10px; }
.rb-label { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-right: 2px; }
.rb-flag { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 20px 0 9px; font-size: 13px; font-weight: 600; background: color-mix(in srgb, var(--rc) 17%, var(--surface)); border-left: 5px solid var(--rc); clip-path: polygon(0 0, 100% 0, calc(100% - 9px) 50%, 100% 100%, 0 100%); cursor: grab; user-select: none; color: var(--text); }
.rb-flag small { font-size: 11px; font-weight: 500; color: var(--muted); }
.rb-flag.dragging { opacity: .45; }
.rb-flag:focus-visible { outline: 2px solid var(--pen); outline-offset: 2px; }
.rb-fe { font-size: 14px; line-height: 1; }
.rb-panel .spacer { flex: 1; }

/* рубрики: вкладка проекта */
.rb-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.rb-head .tools { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.rb-card { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--rc); border-radius: var(--r-m); padding: 10px 12px; display: grid; gap: 8px; align-content: start; }
.rb-card-h { display: flex; align-items: center; gap: 8px; }
.rb-card-h b { font-size: 15px; overflow-wrap: anywhere; }
.rb-emoji { font-size: 20px; line-height: 1; }
.rb-act { margin-left: auto; display: inline-flex; gap: 2px; flex: none; }
.rb-desc { overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.rb-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.rb-pick { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.rb-emoji-in { width: 64px; text-align: center; font-size: 18px; }
.rb-em { width: 34px; height: 34px; border: 1px solid var(--line-2); background: var(--surface); border-radius: 8px; cursor: pointer; font-size: 18px; line-height: 1; }
.rb-em.on { border-color: var(--pen); background: var(--pen-soft); }
.rb-sw { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--surface); background: var(--c); box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; padding: 0; }
.rb-sw.on { box-shadow: 0 0 0 2px var(--text); }

/* телефон: месяц списком по дням */
.cal-agenda { display: grid; gap: 8px; }
.ag-day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 6px 8px 8px; display: grid; gap: 6px; }
.ag-day.today { background: color-mix(in srgb, var(--marker-soft) 55%, var(--surface)); border-color: var(--marker); box-shadow: inset 0 3px 0 var(--marker); }
.ag-day.weekend:not(.today) { background: color-mix(in srgb, var(--surface) 92%, var(--line-2)); }
.ag-day.drop { background: var(--pen-soft); outline: 2px solid var(--pen); }
.ag-day header { display: flex; align-items: center; gap: 8px; }
.ag-date { display: inline-flex; align-items: baseline; gap: 6px; border: 0; background: none; cursor: pointer; padding: 2px 4px; border-radius: 6px; min-height: 32px; color: var(--text); }
.ag-date b { font-size: 20px; font-variant-numeric: tabular-nums; }
.ag-date span { font-size: 13px; color: var(--muted); }
.ag-day.weekend .ag-date b { color: var(--bad); }
.ag-hol { display: flex; flex-wrap: wrap; gap: 2px 8px; min-width: 0; flex: 1; }
.ag-hol .cal-hol { width: auto; max-width: 100%; }
.ag-empty { padding: 0 4px; }
.list-day.today .day-label .day-link { background: var(--marker); border-radius: 6px; padding: 0 6px; }
@media (max-width: 820px) {
  .cal-filter-bar { flex-direction: column; align-items: stretch; }
  .cal-st, .cal-fr { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .st-chip, .cal-fr > * { flex: none; }
  .cal-more-m { right: auto; left: 0; }
  .lg-hint { display: none; }
  .rb-flag { height: 34px; }
  .chip { padding: 6px 6px 6px 8px; font-size: 13px; }
  .chip.wide .t { font-size: 13.5px; }
  .day-pop { left: 8px !important; right: 8px; width: auto; }
}
@media (prefers-reduced-motion: reduce) { .chip { transition: none; } }

.cal-num { white-space: nowrap; }
@media (max-width: 820px) { .rb-panel { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .rb-panel > * { flex: none; } .rb-panel .spacer { display: none; } }
@media (max-width: 1180px) { .chip .t { -webkit-line-clamp: 2; } .chip .cn { display: none; } }

/* Ошибки публикации в календаре */
.chip.cal-err { box-shadow: inset 0 0 0 1px var(--bad); border-left-color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, var(--surface)); }
.err-ic { color: var(--bad); font-weight: 700; flex: none; }
.fchip.fchip-err { color: var(--bad); border-color: var(--bad); }
.fchip.fchip-err.on { background: var(--bad); color: var(--on-bad); }
.lg-err { color: var(--bad); font-style: normal; font-weight: 700; }
.plan-tbl tr.has-error td:first-child { box-shadow: inset 3px 0 0 var(--bad); }


/* Отчёты: точные даты и быстрые периоды */
.rp-dates{margin:-4px 0 14px;padding:10px 12px;border:1px solid var(--line,#e5e5e5);border-radius:10px}
.rp-presets{display:inline-flex;flex-wrap:wrap;gap:4px}
.rp-range-h{font-size:14px}

/* Выбор времени (time-pick.js) */
.tp { position: relative; display: inline-flex; align-items: center; }
.tp-in { width: 84px !important; padding-right: 30px !important; font-variant-numeric: tabular-nums; }
.tp-btn { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; display: grid; place-items: center; background: none; border: 0; color: var(--muted); border-radius: 6px; cursor: pointer; }
.tp-btn:hover { color: var(--text); background: var(--surface-2); }
.tp-pop { position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; width: 264px; padding: 10px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.22); }
.tp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tp-chip { min-height: 32px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.tp-chip:hover, .tp-cell:hover { border-color: var(--line-2); background: var(--line); }
.tp-chip.on, .tp-cell.on { background: var(--marker); color: #22252A; border-color: #CFAE45; font-weight: 650; }
.tp-cap { font-size: 12px; color: var(--muted); margin: 4px 0 6px; }
.tp-back { background: none; border: 0; padding: 0 4px 0 0; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.tp-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.tp-grid.m { grid-template-columns: repeat(4, 1fr); }
.tp-grid.m5 { grid-template-columns: repeat(4, 1fr); }
.tp-cell.cur { border-color: var(--pen); }
.tp-custom { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.tp-custom input { width: 64px !important; flex: none; min-height: 32px; text-align: center; font-variant-numeric: tabular-nums; }
.tp-cell { min-height: 34px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); color: var(--text); font: inherit; font-size: 13px; font-variant-numeric: tabular-nums; cursor: pointer; }
.tp-err { position: absolute; top: calc(100% + 2px); left: 0; font-size: 12px; color: var(--bad); white-space: nowrap; z-index: 61; }
.meta-row .tp-in { width: 84px !important; }
@media (max-width: 640px) {
  .tp-pop { position: fixed; left: 8px; right: 8px; bottom: 8px; top: auto; width: auto; padding: 14px; }
  .tp-chip { min-height: 40px; padding: 6px 14px; }
  .tp-cell { min-height: 44px; font-size: 15px; }
  .tp-in { min-height: 40px; }
}

/* Просмотр фото/видео (lightbox) и подсказка «перетащите файлы» */
.lb { position: fixed; inset: 0; z-index: 80; background: rgba(8, 10, 16, .92); display: grid; place-items: center; animation: fade .15s ease-out; touch-action: pan-y; }
.lb-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden;
  padding: max(56px, env(safe-area-inset-top)) max(64px, env(safe-area-inset-right)) max(56px, env(safe-area-inset-bottom)) max(64px, env(safe-area-inset-left)); }
/* размеры считаем от окна, а не от родителя: картинка и видео целиком, без обрезки */
.lb .lb-media { display: block; width: auto; height: auto; max-width: min(92vw, calc(100vw - 128px)); max-height: min(88vh, calc(100vh - 112px)); max-width: min(92vw, calc(100dvw - 128px)); max-height: min(88vh, calc(100dvh - 112px));
  object-fit: contain; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.5); background: #000; flex: none; }
.lb-x, .lb-nav { position: absolute; z-index: 2; border: 0; border-radius: 50%; width: 44px; height: 44px; background: rgba(255,255,255,.16); color: #fff; font-size: 28px; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0 0 3px; }
.lb-x:hover, .lb-nav:hover { background: rgba(255,255,255,.3); }
.lb-x { top: 12px; right: 12px; }
.lb-nav { top: 50%; transform: translateY(-50%); }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }
.lb-count { position: absolute; z-index: 2; bottom: 14px; left: 50%; transform: translateX(-50%); color: #fff; background: rgba(255,255,255,.16); padding: 3px 12px; border-radius: 12px; font-size: 13px; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .lb-stage { padding: max(56px, env(safe-area-inset-top)) 8px max(56px, env(safe-area-inset-bottom)); } .lb .lb-media { max-width: calc(100vw - 16px); max-width: calc(100dvw - 16px); max-height: calc(100vh - 112px); max-height: calc(100dvh - 112px); } .lb-nav { width: 38px; height: 38px; } .lb-x { top: max(12px, env(safe-area-inset-top)); } }
.media-item.zoomable { cursor: zoom-in; }
.drop-ov { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; background: var(--pen-soft); border: 2.5px dashed var(--pen); color: var(--pen); font-size: 18px; font-weight: 600; text-align: center; pointer-events: none; backdrop-filter: blur(1px); }
.preview-img.zoomable { cursor: zoom-in; }

/* статусы постов в календаре: цветная плашка + лёгкая заливка + толстая полоса слева */
.chip[class*="st-"] { border-left-width: 5px; }
.chip.st-idea, .chip.st-draft, .chip.st-review, .chip.st-changes, .chip.st-approved, .chip.st-scheduled { background: color-mix(in srgb, var(--sc) 10%, var(--surface)); }
.chip.st-review { --stf: #1C1E22; }
.chip.st-draft, .chip.st-scheduled, .chip.st-published { --stf: var(--st-flip); }
.st-pill { flex: none; padding: 0 5px; border-radius: 9px; background: var(--sc); color: var(--stf, #fff); font-size: 10px; font-weight: 700; line-height: 16px; letter-spacing: .01em; white-space: nowrap; }

/* ---------- База знаний по подключениям ---------- */
.kb-link { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--pen); border-radius: 12px; text-decoration: none; color: inherit; }
.kb-link:hover { border-color: var(--pen); background: var(--surface-2); }
.kb-link-ic { font-size: 26px; line-height: 1; }
.kb-link b { display: block; font-size: 15px; }
.kb-link small { display: block; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.kb-link > span:nth-child(2) { flex: 1; min-width: 0; }
.kb-link-go { color: var(--pen); font-weight: 600; white-space: nowrap; }
@media (max-width: 600px) { .kb-link-go { display: none; } }
.kb-human { max-width: 860px; }
.kb-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.kb-tools .input { flex: 1 1 260px; min-width: 0; }
.kb-toc { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.kb-toc a { padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); text-decoration: none; font-size: 13px; }
.kb-toc a:hover { border-color: var(--pen); color: var(--pen); }
.kb-toc a.dim { opacity: .4; }
.kb-intro { margin-bottom: 14px; color: var(--muted); }
.kb-sec { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; scroll-margin-top: 12px; }
.kb-sec > summary { cursor: pointer; padding: 13px 16px; font-weight: 600; font-size: 16px; list-style: none; display: flex; align-items: center; gap: 8px; }
.kb-sec > summary::-webkit-details-marker { display: none; }
.kb-sec > summary::before { content: '▸'; color: var(--muted); transition: transform .15s; }
.kb-sec[open] > summary::before { transform: rotate(90deg); }
.kb-sec-b { padding: 0 16px 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.kb-copy-big { padding-left: 22px; padding-right: 22px; font-size: 15px; }
.chip .tm { flex: none; }
.chip .cn-nets { min-width: 0; overflow: hidden; flex-shrink: 1; }
.tp-pop.flip { left: auto; right: 0; }
@media (max-width: 640px) { .tp-pop.flip { left: 8px; right: 8px; } }
