/* Контент-завод · основа оформления «Mediterraneo».
   Светлая тема — лён и песок, терракота (главные действия), глубокое море («куда уходит»),
   олива («всё в порядке»), бугенвиллея (сторис), охра (авто). Тёмная — «ночная Город-ТЕСТ», по настройке устройства.
   Этот файл — общая основа (токены, шрифты, компоненты). Экраны: home.css (главная), post.css (пост).
   CSP: только этот файл, никаких style="" и <style>; переменные на элементах — el.style.setProperty из JS. */

/* ───────────── шрифты (свои, без CDN) ───────────── */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/static/fonts/inter-cyrillic.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/static/fonts/inter-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/static/fonts/inter-latin.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: "Source Serif 4"; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url("/static/fonts/sourceserif4-cyrillic.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url("/static/fonts/sourceserif4-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url("/static/fonts/sourceserif4-latin.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: "Playfair Display"; font-style: italic; font-weight: 400 900; font-display: swap;
  src: url("/static/fonts/playfair-italic-cyrillic.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Playfair Display"; font-style: italic; font-weight: 400 900; font-display: swap;
  src: url("/static/fonts/playfair-italic-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Playfair Display"; font-style: italic; font-weight: 400 900; font-display: swap;
  src: url("/static/fonts/playfair-italic-latin.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: "Caveat"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/static/fonts/caveat-cyrillic.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-weight: 400 700; font-display: swap;
  src: url("/static/fonts/caveat-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Caveat"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/static/fonts/caveat-latin.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; }

/* ───────────── токены: светлая тема ───────────── */
:root {
  color-scheme: light;
  --bg: #F3ECE1;
  --bg-deep: #EADFCC;
  --paper: #FCF9F3;
  --paper-2: #F7F1E7;
  --sunk: #EEE5D6;
  --line: #E5D9C6;
  --line-2: #D3C3AA;
  --rule: rgba(29, 78, 105, .10);
  --ink: #2B231D;
  --ink-2: #4A3F35;
  --muted: #6D6052;
  --faint: #7A6D5F;        /* ≥ 4.3:1 на льне и бумаге — им пишут и текст (счётчики, подписи) */
  --terra: #B4532F;
  --terra-press: #9C4526;
  --terra-soft: #F5DFD2;
  --terra-ink: #FFF8F1;
  --sea: #1D4E69;
  --sea-2: #2F6A88;
  --sea-soft: #D3E4EE;
  --olive: #5B682A;
  --olive-soft: #E6E9D0;
  --olive-leaf: #8C9A55;
  --olive-fruit: #4A4630;
  --bougain: #AE3470;
  --bougain-soft: #F7D8E6;
  --ochre: #A8721A;
  --ochre-soft: #F5E6C4;
  --err: #B3261E;
  --err-soft: #F8DDD8;
  --on: var(--olive);
  --thread: rgba(120, 88, 48, .035);
  --sheen: rgba(255, 255, 255, .38);
  --shadow-paper: 0 1px 0 rgba(255, 255, 255, .75) inset, 0 1px 2px rgba(74, 50, 25, .06), 0 12px 28px -16px rgba(74, 50, 25, .28);
  --shadow-lift: 0 2px 4px rgba(74, 50, 25, .08), 0 22px 44px -20px rgba(74, 50, 25, .45);
  --shadow-up: 0 -10px 30px -12px rgba(74, 50, 25, .35);
  --backdrop: rgba(43, 35, 29, .42);
  --mark-err: #F6CFC9;
  --mark-warn: #F3DFAE;
  --toast-bg: #2B231D;
  --toast-ink: #FCF9F3;
  /* превью Instagram (как настоящий: белый/чёрный) */
  --ig-bg: #FFFFFF; --ig-text: #121212; --ig-muted: #737373; --ig-line: #EAEAEA; --ig-dot-off: #C9C9C9; --ig-dot: #3B8FE0;
  --phone: #1C1814;
  /* форма и шрифты */
  --r-card: 22px;
  --r-md: 16px;
  --r-sm: 10px;
  --f-serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --f-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --f-hand: "Caveat", "Bradley Hand", cursive;
  --f-italic: "Playfair Display", Georgia, serif;
  --top-h: 60px;
  --gutter: 16px;
  --page-max: 1240px;
  --nav-h: 0px;          /* нижнего меню больше нет; переменная осталась для старых правил */

  /* старые имена (на них ссылаются style={...} в app.js) — теперь из палитры Mediterraneo */
  --surface: var(--paper);
  --surface-2: var(--paper-2);
  --surface-3: var(--sunk);
  --line-strong: var(--line-2);
  --text: var(--ink);
  --accent: var(--terra);
  --accent-hover: var(--terra-press);
  --accent-ink: var(--terra-ink);
  --accent-soft: var(--terra-soft);
  --ok: var(--olive);
  --ok-soft: var(--olive-soft);
  --warn: var(--ochre);
  --warn-soft: var(--ochre-soft);
  --info: var(--sea);
  --info-soft: var(--sea-soft);
  --radius: var(--r-md);
  --radius-sm: var(--r-sm);
  --font: var(--f-sans);
  --shadow: var(--shadow-paper);
}

/* ───────────── токены: тёмная тема «ночная Город-ТЕСТ» ───────────── */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0E171D;
    --bg-deep: #0A1217;
    --paper: #15212A;
    --paper-2: #192832;
    --sunk: #1F303B;
    --line: #253743;
    --line-2: #354B5A;
    --rule: rgba(141, 195, 222, .09);
    --ink: #F3EBDF;
    --ink-2: #DCD1C2;
    --muted: #AEA595;
    --faint: #7F8C92;
    --terra: #E8875F;
    --terra-press: #F29C78;
    --terra-soft: #3A251D;
    --terra-ink: #1B0F09;
    --sea: #8EC4DF;
    --sea-2: #A9D3E8;
    --sea-soft: #16324A;
    --olive: #BBC67E;
    --olive-soft: #232D1E;
    --olive-leaf: #7E8C4E;
    --olive-fruit: #2E2C1C;
    --bougain: #F08DBA;
    --bougain-soft: #3E1E30;
    --ochre: #E6B762;
    --ochre-soft: #352B16;
    --err: #F2897F;
    --err-soft: #3D1F1D;
    --thread: rgba(255, 255, 255, .012);
    --sheen: rgba(255, 255, 255, 0);
    --shadow-paper: 0 1px 0 rgba(255, 255, 255, .035) inset, 0 1px 2px rgba(0, 0, 0, .35), 0 14px 30px -18px rgba(0, 0, 0, .7);
    --shadow-lift: 0 2px 6px rgba(0, 0, 0, .4), 0 24px 48px -20px rgba(0, 0, 0, .8);
    --shadow-up: 0 -10px 30px -10px rgba(0, 0, 0, .7);
    --backdrop: rgba(0, 0, 0, .6);
    --mark-err: #5C2621;
    --mark-warn: #4D3B12;
    --toast-bg: #F3EBDF;
    --toast-ink: #15212A;
    --ig-bg: #000000; --ig-text: #F5F5F5; --ig-muted: #A8A8A8; --ig-line: #262626; --ig-dot-off: #4A4A4A; --ig-dot: #4AA3F5;
    --phone: #050608;
  }
}

/* ───────────── база ───────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font: 400 16px/1.5 var(--f-sans);
  background-color: var(--bg);
  background-image:                                   /* льняное переплетение — только CSS */
    repeating-linear-gradient(0deg, var(--thread) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, var(--thread) 0 1px, transparent 1px 4px);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-wrap: anywhere;
  overflow-x: hidden;
}
body.locked { overflow: hidden; }
[hidden] { display: none !important; }
a { color: var(--sea); }
h1, h2, h3, h4 { margin: 0; font-family: var(--f-serif); font-weight: 500; color: var(--ink); }
h1 { font-size: 29px; line-height: 1.14; letter-spacing: -.016em; text-wrap: balance; }
h2 { font-size: 22px; line-height: 1.18; letter-spacing: -.01em; }
h3 { font-size: 19px; line-height: 1.2; letter-spacing: -.005em; }
p { margin: 0; }
img { max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--terra-soft); color: var(--ink); }
:focus-visible { outline: 2.5px solid var(--sea); outline-offset: 2px; }

/* утилиты */
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 14.5px; line-height: 1.4; }
.tiny { font-size: 13px; line-height: 1.4; }
.err-text { color: var(--err); }
.ok-text { color: var(--olive); }
.warn-text { color: var(--ochre); }
.sea-text { color: var(--sea); }
.terra-text { color: var(--terra); }
.nowrap { white-space: nowrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.center { text-align: center; }
.tnum { font-feature-settings: "tnum", "lnum"; }
.serif { font-family: var(--f-serif); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-lg { display: flex; flex-direction: column; gap: 28px; }

/* типографика-роли */
.eyebrow { font: 600 12px/1.2 var(--f-sans); letter-spacing: .12em; text-transform: uppercase; color: var(--terra-press); }
.eyebrow.sea { color: var(--sea); }
.hand { font-family: var(--f-hand); font-weight: 600; letter-spacing: 0; }
.hand-hint { font: 600 19px/1 var(--f-hand); color: var(--sea-2); }
.hand-note { font: 600 21px/1.1 var(--f-hand); color: var(--sea-2); }
.label { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font: 600 13.5px/1.3 var(--f-sans); color: var(--muted); margin: 0 0 10px; }
.label .val { font-weight: 500; color: var(--ink); }
.label .ic { width: 17px; height: 17px; vertical-align: -3px; margin-right: 6px; color: var(--ink-2); }
.fine { font: 400 13.5px/1.45 var(--f-sans); color: var(--muted); }
.display { font: 500 40px/1.02 var(--f-serif); letter-spacing: -.022em; }
.display em, .name-italic { font-family: var(--f-italic); font-style: italic; font-weight: 500; color: var(--terra); letter-spacing: -.01em; }

/* ───────────── иконки (svg() в app.js) ───────────── */
.ic, .ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; display: inline-block; vertical-align: middle; }
.ic .fill, .ico .fill { fill: currentColor; stroke: none; }
.ic-27 { width: 27px; height: 27px; stroke-width: 1.6; }
.ic-22 { width: 22px; height: 22px; }
.ic-20 { width: 20px; height: 20px; }
.ic-18 { width: 18px; height: 18px; }
.ic-16 { width: 16px; height: 16px; }
.ic-14 { width: 14px; height: 14px; stroke-width: 2; }
.ic-12 { width: 12px; height: 12px; stroke-width: 2.4; }
/* цвет формата — везде один: пост терракота, карусель море, сторис бугенвиллея, авто охра */
.c-post { color: var(--terra); }
.c-car, .c-carousel { color: var(--sea); }
.c-story, .c-stories { color: var(--bougain); }
.c-auto { color: var(--ochre); }
.c-ok { color: var(--olive); }
.c-sea { color: var(--sea); }
.c-err { color: var(--err); }
.f-post { --c: var(--terra); --cs: var(--terra-soft); }
.f-carousel { --c: var(--sea); --cs: var(--sea-soft); }
.f-stories, .f-story { --c: var(--bougain); --cs: var(--bougain-soft); }
.f-auto { --c: var(--ochre); --cs: var(--ochre-soft); }

/* знак бренда «солнце над морем» (brandMark() в app.js) */
.brand-mark { width: 32px; height: 32px; flex: none; display: block; }
.brand-mark .bm-disc { fill: var(--paper); stroke: var(--line-2); stroke-width: 1; }
.brand-mark .bm-sun { fill: var(--terra); }
.brand-mark .bm-wave { fill: none; stroke: var(--sea); stroke-width: 1.6; stroke-linecap: round; }
.brand-mark .bm-wave.w2 { opacity: .6; }
/* рукописная стрелка и оливковая ветка (handArrow(), oliveSprig()) */
.hand-arrow { width: 40px; height: 34px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.olive-sprig { width: 170px; height: 170px; color: var(--olive-leaf); }
.olive-sprig .os-stem { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.olive-sprig .os-leaf { fill: currentColor; }
.olive-sprig .os-fruit { fill: var(--olive-fruit); }

/* ───────────── каркас: шапка ───────────── */
.top {
  position: sticky; top: 0; z-index: 30;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.3) blur(14px); backdrop-filter: saturate(1.3) blur(14px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.top-in {
  max-width: var(--page-max); margin: 0 auto; padding: 0 8px 0 var(--gutter);
  height: var(--top-h); display: flex; align-items: center; gap: 4px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; min-width: 0;
  text-decoration: none; color: var(--ink); font: 600 19px/1 var(--f-serif); letter-spacing: -.01em; white-space: nowrap;
}
.brand .brand-name { overflow: hidden; text-overflow: ellipsis; }
.brand .badge { margin-left: -2px; }
.top .spacer { flex: 1; }
.nav { display: none; }
.top-spend { display: none; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; padding: 0;
  display: inline-grid; place-items: center; color: var(--ink-2); text-decoration: none; position: relative; flex: none;
}
.icon-btn:hover { background: var(--sunk); }
.icon-btn.on { color: var(--terra); background: var(--terra-soft); }
.who-btn {
  min-width: 44px; height: 44px; border: 0; background: none; padding: 3px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font: 600 15px/1 var(--f-sans);
}
.who-btn .who-name { display: none; }
.who-btn:hover .avatar { box-shadow: 0 0 0 3px color-mix(in srgb, var(--sea) 20%, transparent); }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center; font: 600 16px/1 var(--f-serif);
  background: var(--sea); color: var(--paper);
}
.avatar.oleg { background: var(--ochre); color: var(--paper); }
.avatar.sm { width: 22px; height: 22px; font-size: 11.5px; }

main {
  max-width: var(--page-max); margin: 0 auto;
  padding: 18px var(--gutter) calc(56px + env(safe-area-inset-bottom));
}
/* пока экран не переделан: главная — одна колонка по центру */
main.m-home > .stack, main.m-about > .stack { max-width: 720px; margin: 0 auto; }

@media (min-width: 768px) {
  :root { --gutter: 32px; }
  .top-in { padding: 0 20px 0 var(--gutter); }
  main { padding-top: 28px; padding-bottom: 64px; }
}
@media (min-width: 1024px) {
  .nav { display: flex; gap: 4px; margin-left: 28px; }
  .nav a {
    min-height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 999px;
    text-decoration: none; font: 500 15px/1 var(--f-sans); color: var(--muted); position: relative;
  }
  .nav a:hover { color: var(--ink); }
  .nav a.on { background: var(--paper); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
  .nav .ic { width: 20px; height: 20px; }
  .brand .badge { display: none; }
  .top .lib-btn { display: none; }
  .top-spend { display: inline-flex; align-items: center; gap: 8px; font: 500 14px/1 var(--f-sans); color: var(--muted); margin-right: 10px; white-space: nowrap; }
  .top-spend b { color: var(--ink); font-weight: 600; }
  .top-spend .meter { width: 70px; flex: none; }
  .top-spend.blocked, .top-spend.blocked b { color: var(--err); }
}

/* заголовок раздела в духе журнала: номер — название — линейка */
.sec-head { display: flex; align-items: baseline; gap: 12px; margin: 40px 0 16px; }
.sec-head:first-child { margin-top: 8px; }
.sec-head .num { font: italic 500 17px/1 var(--f-italic); color: var(--terra); font-feature-settings: "lnum"; flex: none; }
.sec-head h2 { font: 500 25px/1.15 var(--f-serif); letter-spacing: -.012em; white-space: nowrap; }
.sec-head::after { content: ""; flex: 1; height: 1px; background: var(--line-2); align-self: center; transform: translateY(2px); min-width: 16px; }
.sec-head .hand, .sec-head .hand-hint { font: 600 20px/1 var(--f-hand); color: var(--sea-2); white-space: nowrap; order: 3; }
.sec-head:has(.hand)::after, .sec-head:has(.hand-hint)::after { order: 2; }
/* шапка страницы (библиотека, настройки) */
.page-head { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 4px; }
.page-head h1 { font-size: 34px; line-height: 1.08; letter-spacing: -.02em; }
.page-head p { color: var(--muted); font-size: 15.5px; }
@media (min-width: 1024px) { .page-head h1 { font-size: 44px; } }

/* ───────────── бумажная карточка ───────────── */
.card {
  background-color: var(--paper);
  background-image: linear-gradient(180deg, var(--sheen), rgba(255, 255, 255, 0) 120px);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-paper);
  padding: 18px;
}
.card.flat { box-shadow: none; }
.card.tight { padding: 12px; }
.card.inset { background: var(--paper-2); box-shadow: none; }
.card-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-title h2 { font-size: 21px; }
.section-title { font: 600 12px/1.2 var(--f-sans); letter-spacing: .12em; text-transform: uppercase; color: var(--terra); }
.divider { height: 1px; background: var(--line); border: 0; margin: 14px 0; }
.divider.dashed { background: none; border-top: 1px dashed var(--line-2); height: 0; }

/* заметки и предупреждения */
.note { border-radius: 14px; padding: 12px 14px; background: var(--sunk); color: var(--ink); font-size: 15px; line-height: 1.45; }
.note.err { background: var(--err-soft); color: var(--err); }
.note.warn { background: var(--ochre-soft); color: var(--ink-2); }
.note.ok { background: var(--olive-soft); color: var(--olive); }
.note.info { background: var(--sea-soft); color: var(--sea); }
.note b { font-weight: 700; }
/* строка-тревога (главная: «1 сторис не ушла …») */
.alert {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  min-height: 60px; padding: 10px 12px; border-radius: 18px; text-decoration: none;
  background: var(--err-soft); color: var(--err); border: 1px solid color-mix(in srgb, var(--err) 22%, transparent);
}
.alert .tile { background: var(--paper); color: var(--err); }
.alert b { display: block; font: 600 15px/1.25 var(--f-sans); }
.alert small { display: block; font: 500 13.5px/1.3 var(--f-sans); color: var(--ink-2); margin-top: 2px; }

/* ───────────── кнопки ───────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 20px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--paper); color: var(--ink);
  font: 600 16px/1.1 var(--f-sans); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color .15s, border-color .15s, box-shadow .15s, opacity .15s, transform .06s;
  -webkit-user-select: none; user-select: none;
}
.btn .ic { width: 20px; height: 20px; }
.btn:hover { background: var(--paper-2); border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.btn-line { background: var(--paper); border-color: var(--line-2); color: var(--ink); }
.btn-line .ic { color: var(--ink-2); }
.btn-primary, .btn-terra {
  background: var(--terra); border-color: var(--terra); color: var(--terra-ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .22) inset, 0 12px 24px -12px var(--terra);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .22) inset, 0 12px 24px -12px color-mix(in srgb, var(--terra) 80%, transparent);
}
.btn-primary:hover, .btn-terra:hover { background: var(--terra-press); border-color: var(--terra-press); }
.btn-primary:disabled, .btn-terra:disabled { box-shadow: none; }
.btn-ink { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-ink:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn-sea { background: var(--sea); border-color: var(--sea); color: var(--paper); }
.btn-sea:hover { background: var(--sea-2); border-color: var(--sea-2); }
.btn-soft { background: var(--sea-soft); border-color: transparent; color: var(--sea); }
.btn-soft:hover { background: color-mix(in srgb, var(--sea-soft) 80%, var(--sea) 12%); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); box-shadow: none; }
.btn-ghost:hover { background: var(--sunk); color: var(--ink); border-color: transparent; }
.btn-danger { color: var(--err); background: var(--paper); border-color: color-mix(in srgb, var(--err) 35%, var(--line)); }
.btn-danger:hover { background: var(--err-soft); border-color: transparent; }
.btn-fix { color: var(--err); background: var(--err-soft); border-color: transparent; }
.btn-fix:hover { background: color-mix(in srgb, var(--err-soft) 80%, var(--err) 14%); border-color: transparent; }
.btn-big { min-height: 58px; font-size: 17px; padding: 0 24px; }
.btn-block { display: flex; width: 100%; }
.btn-sm { min-height: 44px; padding: 0 16px; font-size: 15px; gap: 8px; }
.btn-sm .ic { width: 18px; height: 18px; }
.btn .spin { width: 18px; height: 18px; }
.btn-text, .link-btn {
  background: none; border: 0; padding: 0 6px; min-height: 44px; color: var(--sea);
  font: 600 15px/1.2 var(--f-sans); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; text-decoration: none;
}
.btn-text .ic, .link-btn .ic { width: 18px; height: 18px; }
.link-btn.muted { color: var(--muted); }
.link-btn.danger, .danger-link { color: var(--err); }
.back {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 8px 0 4px; margin: -6px 0 2px -4px;
  color: var(--muted); text-decoration: none; font: 500 15px/1 var(--f-sans); align-self: flex-start;
}
.back:hover { color: var(--ink); }
.x-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--sunk); color: var(--ink-2);
  font-size: 20px; cursor: pointer; display: grid; place-items: center; flex: 0 0 auto; padding: 0;
}
.x-btn:hover { background: var(--line); }
.x-btn .ic { width: 20px; height: 20px; }

/* ───────────── чипы, метки, статусы ───────────── */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll, .scroller { display: flex; gap: 8px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips.scroll::-webkit-scrollbar, .scroller::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto;
  min-height: 44px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--paper); color: var(--ink);
  font: 500 15px/1.1 var(--f-sans); cursor: pointer; -webkit-user-select: none; user-select: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: var(--faint); }
.chip[aria-pressed="true"], .chip.is-on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip:disabled { opacity: .45; cursor: not-allowed; }
.chip.small { padding: 0 13px; font-size: 14px; }
.chip .ic { width: 18px; height: 18px; margin-left: -3px; }
.chip img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; margin-left: -10px; }
/* код языка в кружке: «RU Русский» */
.chip .code {
  font: 700 11.5px/1 var(--f-sans); letter-spacing: .07em; min-width: 30px; height: 30px; margin-left: -9px;
  display: grid; place-items: center; border-radius: 999px; background: var(--sunk); color: var(--ink-2);
}
.chip[aria-pressed="true"] .code, .chip.is-on .code { background: color-mix(in srgb, var(--paper) 16%, transparent); color: inherit; }
/* языковой чип полегче: включённый — контур + тёмный код (а не сплошная заливка) */
.chip.chip-lang[aria-pressed="true"], .chip.chip-lang.is-on { background: var(--paper); color: var(--ink); border-color: var(--ink); box-shadow: 0 0 0 .5px var(--ink) inset; }
.chip.chip-lang[aria-pressed="true"] .code, .chip.chip-lang.is-on .code { background: var(--ink); color: var(--paper); }
.chip-group { display: flex; flex-direction: column; gap: 8px; }
.chip-group > span { font: 600 13.5px/1.3 var(--f-sans); color: var(--muted); }

.tag { display: inline-flex; align-items: center; gap: 5px; font: 500 13px/1 var(--f-sans); padding: 6px 9px; border-radius: 999px; background: var(--sunk); color: var(--ink-2); white-space: nowrap; }
.tag .ic { width: 14px; height: 14px; }
.tag.dashed { background: transparent; border: 1px dashed var(--line-2); }
.mchips { display: flex; flex-wrap: wrap; gap: 6px; }
.mchip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 11px 0 9px; border-radius: 999px;
  background: var(--paper); border: 1px solid var(--line); font: 500 13.5px/1 var(--f-sans); color: var(--ink-2); white-space: nowrap;
}
.mchip .ic { width: 16px; height: 16px; }
/* языковая метка RU / ES */
.lt {
  display: inline-grid; place-items: center; min-width: 26px; height: 20px; padding: 0 5px; border-radius: 6px;
  font: 700 11px/1 var(--f-sans); letter-spacing: .06em; background: var(--sunk); color: var(--ink-2); text-transform: uppercase;
}
.lt.on { background: var(--ink); color: var(--paper); }
/* автор: О / А на миниатюрах */
.who-badge {
  display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  font: 600 11px/1 var(--f-serif); background: var(--sea); color: var(--paper); box-shadow: 0 0 0 2px var(--paper);
}
.who-badge.oleg { background: var(--ochre); }

/* статус поста: точка + слово (+ следующий шаг) */
.status {
  display: inline-flex; align-items: center; gap: 6px; font: 600 12.5px/1.1 var(--f-sans);
  padding: 6px 10px 6px 8px; border-radius: 999px; white-space: nowrap; background: var(--sunk); color: var(--ink-2);
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.status .next { font-weight: 500; opacity: .85; }
.status .next::before { content: "· "; }
.st-wait, .st-waiting { background: var(--terra-soft); color: var(--terra-press); }   /* терракота светлее — мелкий текст не дотягивал до 4.5:1 */
.st-draft, .st-chernovik { background: var(--sunk); color: var(--ink-2); }
.st-queue, .st-odobreno, .st-v_ocheredi, .st-otpravka, .st-v_buffer { background: var(--sea-soft); color: var(--sea); }
.st-out, .st-vyshlo { background: var(--olive-soft); color: var(--olive); }
.st-err, .st-oshibka { background: var(--err-soft); color: var(--err); }
.st-neyasno { background: var(--ochre-soft); color: var(--ochre); }
.st-otmena { background: var(--sunk); color: var(--faint); }
.badge-ok { display: inline-flex; align-items: center; gap: 5px; font: 600 13px/1 var(--f-sans); padding: 7px 10px 7px 8px; border-radius: 999px; background: var(--olive-soft); color: var(--olive); white-space: nowrap; }
.badge-ok .ic { width: 14px; height: 14px; stroke-width: 2.4; }

/* счётчик */
.badge {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: var(--terra); color: var(--terra-ink);
  font: 600 12.5px/1 var(--f-sans); font-feature-settings: "tnum";
}
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.quiet { background: var(--sunk); color: var(--ink-2); }

/* точки статуса */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: 0 0 auto; }
.dot.chernovik { background: var(--faint); }
.dot.waiting { background: var(--terra); box-shadow: 0 0 0 3px var(--terra-soft); }
.dot.odobreno, .dot.v_ocheredi, .dot.otpravka, .dot.v_buffer { background: var(--sea); }
.dot.vyshlo, .dot.ok { background: var(--olive); }
.dot.oshibka, .dot.err { background: var(--err); }
.dot.neyasno, .dot.warn { background: var(--ochre); }
.dot.otmena { background: var(--line-2); }

/* плитка-значок формата / назначения */
.tile { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--cs, var(--sunk)); color: var(--c, var(--ink-2)); }
.tile .ic { width: 20px; height: 20px; }
.tile.t-post { --c: var(--terra); --cs: var(--terra-soft); }
.tile.t-car { --c: var(--sea); --cs: var(--sea-soft); }
.tile.t-story { --c: var(--bougain); --cs: var(--bougain-soft); }
.tile.t-auto { --c: var(--ochre); --cs: var(--ochre-soft); }
.tile.t-ig { background: var(--paper); color: var(--ink); box-shadow: 0 0 0 1px var(--line) inset; }
.tile.t-sea { background: var(--sea); color: var(--paper); }
.tile.lg { width: 46px; height: 46px; border-radius: 15px; }
.tile.lg .ic { width: 24px; height: 24px; }

/* аватар с кольцом (как у сторис, в нашей палитре) */
.av { width: 44px; height: 44px; border-radius: 50%; padding: 2px; flex: none; display: inline-block; background: conic-gradient(from 210deg, var(--terra), var(--ochre), var(--bougain), var(--terra)); }
.av > span { width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; background: var(--paper); border: 2px solid var(--paper); font: 600 14px/1 var(--f-serif); letter-spacing: .02em; color: var(--terra); }
.av.sm { width: 34px; height: 34px; }
.av.sm > span { font-size: 11.5px; border-width: 1.5px; }
.av.xs { width: 26px; height: 26px; padding: 1.5px; }
.av.xs > span { font-size: 9px; border-width: 1.5px; }

/* ───────────── вкладки и сегменты ───────────── */
/* .tabs — лента вкладок-«таблеток» (на телефоне листается вбок внутри себя) */
.tabs {
  display: flex; gap: 8px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  padding: 2px 0 4px;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 15px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--paper);
  color: var(--ink-2); font: 500 15px/1 var(--f-sans); white-space: nowrap; cursor: pointer;
}
.tab:hover { border-color: var(--faint); }
.tab:has(.badge) { padding-right: 11px; }
.tab[aria-selected="true"], .tab[aria-pressed="true"], .tab.is-on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.tab .badge.quiet { background: var(--sunk); color: var(--ink-2); }
.tab[aria-selected="true"] .badge, .tab[aria-pressed="true"] .badge, .tab.is-on .badge { background: var(--terra); color: var(--terra-ink); }
.tab[aria-selected="true"] .badge.err, .tab.is-on .badge.err { background: var(--err-soft); color: var(--err); }
.tab .dot { width: 8px; height: 8px; }
.tabs.small .tab { font-size: 14.5px; }
@media (min-width: 1024px) { .tabs.wrap { flex-wrap: wrap; overflow: visible; } }

/* .seg — сегментированный переключатель (2–4 равные кнопки в «жёлобе») */
.seg, .tabs.seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 4px;
  border-radius: 999px; background: var(--sunk); overflow: visible;
}
.seg > button, .seg > a, .tabs.seg .tab {
  min-height: 44px; border: 0; border-radius: 999px; background: transparent; box-shadow: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 0;
  font: 600 14.5px/1.1 var(--f-sans); color: var(--muted); padding: 0 10px; white-space: nowrap; text-decoration: none;
  overflow: hidden; text-overflow: ellipsis;
}
.seg > button .ic, .tabs.seg .tab .ic { width: 18px; height: 18px; }
.seg > .is-on, .seg > [aria-pressed="true"], .seg > [aria-selected="true"],
.tabs.seg .tab[aria-pressed="true"], .tabs.seg .tab[aria-selected="true"] {
  background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(60, 40, 20, .12), 0 0 0 1px var(--line);
}
.seg .okdot { width: 7px; height: 7px; border-radius: 50%; background: var(--olive); }
@media (max-width: 360px) { .tabs.seg .tab, .seg > button { font-size: 12.5px; padding: 0 2px; letter-spacing: -.015em; } }

/* ───────────── поля ───────────── */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { font: 600 13.5px/1.3 var(--f-sans); color: var(--muted); }
.input, .textarea, select.input {
  width: 100%; min-height: 48px; padding: 12px 14px;
  border: 1px solid var(--line-2); border-radius: 14px; background: var(--paper);
  font: 400 16px/1.45 var(--f-sans); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { resize: vertical; min-height: 110px; display: block; }
.input:focus, .textarea:focus, .task:focus {
  outline: none; border-color: var(--sea-2);
  box-shadow: 0 0 0 3px var(--sea-soft);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sea-2) 20%, transparent);
}
.input::placeholder, .textarea::placeholder, .task::placeholder { color: var(--faint); }
.input[type="date"] { font-family: var(--f-sans); appearance: none; -webkit-appearance: none; text-align: left; }
.input[type="date"]::-webkit-date-and-time-value { text-align: left; }
.input:disabled, .textarea:disabled { opacity: .6; }
/* поле задачи — «линованная бумага» (19 px на сетке 32 px) */
.task, .textarea.big {
  display: block; width: 100%; min-height: 128px; resize: vertical;
  border: 1px solid var(--line); border-radius: 16px; background-color: var(--paper-2);
  background-image: repeating-linear-gradient(to bottom, transparent 0 31px, var(--rule) 31px 32px);
  background-position: 0 13px; background-attachment: local;
  padding: 13px 14px 12px; font: 400 19px/32px var(--f-serif); color: var(--ink);
}
.textarea.caption { min-height: 260px; font-size: 16px; line-height: 1.55; background: var(--paper-2); border-color: var(--line); border-radius: 16px; }
.counter { font: 500 13px/1.2 var(--f-sans); color: var(--faint); text-align: right; font-feature-settings: "tnum"; }
.counter.over { color: var(--err); font-weight: 700; }

/* переключатель */
.switch {
  width: 50px; height: 30px; border-radius: 999px; background: var(--line-2); position: relative; flex: none;
  border: 0; padding: 0; cursor: pointer; transition: background-color .18s;
}
.switch::before { content: ""; position: absolute; inset: -7px -3px; }        /* попадание пальцем ≥ 44 px */
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: left .18s;
}
.switch.is-on, .switch[aria-checked="true"], .switch[aria-pressed="true"] { background: var(--on); }
.switch.is-on::after, .switch[aria-checked="true"]::after, .switch[aria-pressed="true"]::after { left: 23px; }
.switch:disabled { opacity: .5; cursor: not-allowed; }
/* строка с переключателем / раскрытием: плитка | текст | контрол */
.trow { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 0; width: 100%; }
.trow + .trow, .trow.sep { border-top: 1px dashed var(--line-2); }
.trow .txt { flex: 1; min-width: 0; }
.trow .txt b { display: block; font: 600 15.5px/1.25 var(--f-sans); }
.trow .txt small { display: block; font: 400 13.5px/1.3 var(--f-sans); color: var(--muted); margin-top: 2px; }
button.trow { border: 0; border-top: 1px dashed var(--line-2); background: none; text-align: left; color: inherit; }

/* полоски прогресса и расхода */
.meter { flex: 1 1 64px; min-width: 40px; height: 6px; border-radius: 99px; background: var(--sunk); overflow: hidden; }
.meter i { display: block; height: 100%; min-width: 6px; background: var(--olive); border-radius: inherit; }
.meter i.mid { background: var(--ochre); }
.meter i.high { background: var(--err); }
.spend-line { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-top: 14px; font: 500 14px/1.3 var(--f-sans); color: var(--muted); }
.spend-line .month { flex-basis: 100%; padding-left: 28px; font-size: 13px; color: var(--faint); }
.spend-line > .ic { width: 18px; height: 18px; color: var(--faint); }
.spend-line b { color: var(--ink); font-weight: 600; }
.spend-line .meter { flex: 1 1 60px; }
.spend-line[data-spend="full"] .meter { flex: 1 1 100%; margin-left: 28px; }   /* полоска — своей строкой, как на главной */
.spend-line.blocked, .spend-line.blocked b { color: var(--err); font-weight: 600; }
.spend-line .month { color: var(--faint); white-space: nowrap; }
.progress { display: flex; flex-direction: column; gap: 10px; }
.progress .row { flex-wrap: nowrap; align-items: flex-start; }
.progress .row > :last-child { min-width: 0; }
.bar { height: 6px; border-radius: 99px; background: var(--sunk); overflow: hidden; }
.bar i { display: block; height: 100%; width: 5%; background: var(--terra); border-radius: inherit; transition: width .6s ease; }
.bar.indet i { width: 35%; animation: indet 1.3s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
.spin {
  display: inline-block; width: 20px; height: 20px; border-radius: 50%; flex: none;
  border: 2.5px solid rgba(128, 128, 128, .3); border: 2.5px solid color-mix(in srgb, currentColor 22%, transparent); border-top-color: currentColor;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spin, .bar.indet i { animation-duration: 3s; }
  .bar i, .switch, .switch::after { transition: none; }
}

/* палитра: двухцветный кружок (фон | акцент по диагонали) — --s1, --s2 задаёт JS */
.sw {
  width: 44px; height: 44px; border-radius: 50%; border: 0; padding: 0; position: relative; flex: none; cursor: pointer;
  background: linear-gradient(135deg, var(--s1, #eee) 0 50%, var(--s2, #999) 50% 100%);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .1) inset;
}
.sw.is-on, .sw[aria-pressed="true"] { box-shadow: 0 0 0 1px rgba(0, 0, 0, .1) inset, 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }
/* маленькая полоска палитры в кнопке */
.swatch { display: inline-flex; margin-right: 2px; }
.swatch i { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--paper); margin-left: -6px; display: block; }
.swatch i:first-child { margin-left: 0; }

/* миниатюра-рамка с iframe предпросмотра */
.thumb {
  flex: 0 0 auto; width: 64px; height: 80px; border-radius: 10px; overflow: hidden; position: relative; display: block;
  background: var(--sunk); box-shadow: 0 0 0 1px rgba(0, 0, 0, .06), 0 4px 10px -6px rgba(0, 0, 0, .4);
}
.thumb.story { width: 45px; height: 80px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb iframe { position: absolute; top: 0; left: 0; border: 0; transform-origin: 0 0; pointer-events: none; background: #fff; }

/* ───────────── окна снизу (на компьютере — по центру) ───────────── */
.sheet-back {
  position: fixed; inset: 0; z-index: 50; background: var(--backdrop);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .15s ease-out;
}
.sheet {
  width: 100%; max-width: 560px; max-height: calc(100vh - 40px); max-height: calc(100dvh - 24px); overflow-y: auto;
  background-color: var(--paper);
  background-image: linear-gradient(180deg, var(--sheen), rgba(255, 255, 255, 0) 120px);
  border-radius: 26px 26px 0 0; padding: 8px 18px calc(20px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-up); animation: up .22s ease-out; overscroll-behavior: contain;
}
.sheet.wide { max-width: 780px; }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 4px auto 6px; }
.sheet-head { display: flex; align-items: center; gap: 10px; min-height: 52px; margin-bottom: 10px; }
.sheet-head h2 { flex: 1; font: 500 23px/1.15 var(--f-serif); letter-spacing: -.01em; }
.sheet > p.muted { font-size: 15.5px; line-height: 1.5; }
.sheet .btns { display: flex; gap: 10px; margin-top: 18px; }
.sheet .btns .btn { flex: 1; }
.menu-list { display: flex; flex-direction: column; gap: 8px; }
.menu-list .btn { justify-content: flex-start; border-radius: 16px; min-height: 52px; padding: 0 16px; background: var(--paper-2); border-color: var(--line); font-weight: 500; }
.menu-list .btn:hover { background: var(--sunk); }
.menu-list .btn .ic { color: var(--ink-2); }
.menu-list .btn.btn-danger { color: var(--err); }
.menu-list .btn.btn-danger .ic { color: var(--err); }
.menu-who { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.menu-who .avatar { width: 48px; height: 48px; font-size: 20px; }
.menu-who b { display: block; font: 500 20px/1.2 var(--f-serif); }
@media (min-width: 768px) {
  .sheet-back { align-items: center; padding: 24px; }
  .sheet { border-radius: 26px; padding-bottom: 22px; box-shadow: var(--shadow-lift); }
  .sheet-grip { visibility: hidden; height: 2px; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); } }

/* ───────────── всплывающие сообщения ───────────── */
.toasts {
  position: fixed; left: 0; right: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px;
  bottom: calc(16px + env(safe-area-inset-bottom)); pointer-events: none; padding: 0 16px;
}
body.has-actionbar .toasts { bottom: calc(96px + env(safe-area-inset-bottom)); }
@media (min-width: 768px) { .toasts { bottom: 28px; } }
.toast {
  max-width: 520px; padding: 13px 18px; border-radius: 16px; background: var(--toast-bg); color: var(--toast-ink);
  font: 500 15px/1.4 var(--f-sans); box-shadow: 0 12px 30px -8px rgba(0, 0, 0, .35); pointer-events: auto;
  animation: up .2s ease-out; transition: opacity .3s, transform .3s;
}
.toast.err { background: var(--err); color: #FFF8F1; }
.toast.ok { background: var(--olive); color: var(--paper); }
@media (prefers-color-scheme: dark) { .toast.err { background: #8E2A22; color: #FFF1EC; } .toast.ok { background: #49562A; color: #F3EBDF; } }
.toast.out { opacity: 0; transform: translateY(8px); }

.boot { min-height: 70vh; display: grid; place-items: center; color: var(--muted); }
.empty { padding: 28px 8px; text-align: center; color: var(--muted); font-size: 15px; }
.empty .hand { display: block; font-size: 22px; color: var(--faint); margin-top: 4px; }

/* ───────────── вход и «кто ты» ───────────── */
.gate {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  padding-top: calc(24px + env(safe-area-inset-top));
}
.gate-box {
  width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 18px;
  background-color: var(--paper); background-image: linear-gradient(180deg, var(--sheen), rgba(255, 255, 255, 0) 120px);
  border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow-lift); padding: 28px 22px 22px;
}
.gate-logo { width: 64px; height: 64px; }
.gate h1 { font-size: 32px; line-height: 1.08; }
.gate .hand-note { margin-top: -4px; }
.who-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.who-card {
  display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 22px 10px 18px; min-height: 140px;
  border-radius: var(--r-md); border: 1px solid var(--line-2); background: var(--paper-2); color: var(--ink);
  cursor: pointer; font: 500 19px/1.1 var(--f-serif);
}
.who-card:hover { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink) inset; }
.who-card .avatar { width: 58px; height: 58px; font-size: 24px; }

/* ═════════════ существующие экраны: приведены к новому стилю (экранные агенты переделают в home.css / post.css) ═════════════ */

/* ── главная ── */
.hello { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding-top: 6px; }
.hello h1 { font-size: 36px; line-height: 1.05; letter-spacing: -.02em; }
.hello .pill { align-self: center; }
.create { padding: 18px 18px 20px; }
.create .textarea { margin-bottom: 14px; }
.create-opts { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.create-opts .row { gap: 8px; }
.opt-sep { width: 1px; align-self: stretch; background: var(--line-2); margin: 6px 2px; }
details.more { border-top: 1px dashed var(--line-2); padding-top: 4px; }
details.more > summary {
  cursor: pointer; list-style: none; min-height: 48px; display: flex; align-items: center; gap: 10px;
  color: var(--ink); font: 600 15.5px/1.25 var(--f-sans);
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before {
  content: "+"; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--sunk); color: var(--ink-2); font: 500 20px/1 var(--f-sans);
}
details.more[open] > summary::before { content: "−"; }
.more-body { display: flex; flex-direction: column; gap: 16px; padding: 8px 0 12px; }

.topics { display: flex; flex-direction: column; margin-top: 12px; }
.topics > p { margin-bottom: 4px; }
.topic {
  display: flex; gap: 14px; align-items: center; text-align: left; width: 100%; color: var(--ink);
  padding: 13px 0; border: 0; border-top: 1px solid var(--line); background: none; cursor: pointer; min-height: 44px;
}
.topics > .topic:first-child, .topics > p + .topic { border-top: 0; }
.topic:disabled { opacity: .6; cursor: default; }
.topic .num { flex: 0 0 36px; text-align: center; font: italic 500 22px/1 var(--f-italic); color: var(--terra); }
.topic .t { font: 400 18px/1.28 var(--f-serif); color: var(--ink); }
.topic .b { font: 500 13.5px/1.35 var(--f-sans); color: var(--muted); margin-top: 5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.topic .go {
  margin-left: auto; flex: none; align-self: center; white-space: nowrap; min-height: 44px; padding: 0 14px;
  display: inline-flex; align-items: center; border-radius: 999px; border: 1px solid var(--line-2); background: var(--paper);
  font: 600 14.5px/1 var(--f-sans); color: var(--ink);
}
.topic:hover .go { border-color: var(--ink); }

.list { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.post-row {
  display: flex; gap: 14px; align-items: center; padding: 12px; min-height: 64px;
  text-decoration: none; color: inherit; background: var(--paper); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow-paper);
}
.post-row:hover { border-color: var(--line-2); }
.card .post-row { background: var(--paper-2); box-shadow: none; }
.post-row:hover .pr-title { color: var(--terra); }
.pr-title { font: 500 17.5px/1.25 var(--f-serif); letter-spacing: -.005em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pr-meta { display: flex; align-items: center; gap: 6px; font: 500 13.5px/1.3 var(--f-sans); color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.pr-meta .sep::before { content: "·"; }
.pr-go { color: var(--faint); font-size: 22px; flex: 0 0 auto; }
.pr-go .ic { width: 20px; height: 20px; }

/* ── пост ── */
.post-head { display: flex; flex-direction: column; gap: 12px; }
.brief { font: 500 24px/1.2 var(--f-serif); letter-spacing: -.012em; white-space: pre-wrap; color: var(--ink); text-wrap: balance; }
.brief.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.understood {
  position: relative; display: flex; gap: 6px 10px; align-items: flex-start; flex-wrap: wrap; margin-top: 10px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 4px 18px 18px 18px;
  padding: 18px 16px 8px 18px; box-shadow: var(--shadow-paper); transform: rotate(-.35deg); font-size: 15.5px; line-height: 1.5;
}
.understood::before {
  content: ""; position: absolute; top: -11px; left: 26px; width: 78px; height: 22px; transform: rotate(-4deg); border-radius: 2px;
  background: var(--sea-soft); background: color-mix(in srgb, var(--sea-2) 26%, transparent); box-shadow: 0 1px 0 rgba(255, 255, 255, .4) inset;
}
.understood .lbl { flex-basis: 100%; font: 700 23px/1 var(--f-hand); color: var(--terra); }
.understood .grow { flex: 1 1 200px; min-width: 0; color: var(--ink-2); padding-top: 1px; }
.meta-line { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 14px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 11px 0 10px; border-radius: 999px;
  background: var(--paper); border: 1px solid var(--line); font: 500 13.5px/1 var(--f-sans); color: var(--ink-2); white-space: nowrap;
}
.pill.accent { background: var(--terra-soft); border-color: transparent; color: var(--terra); font-weight: 600; }
.pill .dot { width: 7px; height: 7px; }

.variants { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
@media (min-width: 768px) { .variants { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .variants { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.variant { position: relative; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.variant.chosen { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink), var(--shadow-paper); }
.v-head { display: flex; flex-direction: column; gap: 4px; }
.v-head .row { gap: 8px; }
.v-head h3 { font: 500 21px/1.15 var(--f-serif); min-width: 0; }
.v-angle { font-size: 14.5px; line-height: 1.4; color: var(--muted); }
.viewer { display: flex; flex-direction: column; gap: 10px; }
.frame {
  position: relative; width: 100%; overflow: hidden; border-radius: 14px; cursor: pointer; touch-action: pan-y;
  background: var(--sunk); box-shadow: 0 0 0 1px var(--line), 0 18px 34px -24px rgba(60, 40, 20, .55);
}
.frame::before { content: ""; display: block; padding-top: 125%; }
.send-grid .frame { max-width: 480px; margin: 0 auto; }
.frame.story, .send-grid .frame.story { width: 74%; max-width: 340px; margin: 0 auto; }
.frame.story::before { padding-top: 177.78%; }
.frame iframe { position: absolute; top: 0; left: 0; border: 0; transform-origin: 0 0; pointer-events: none; background: #fff; }
.frame .loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); }
.frame-count {
  position: absolute; right: 10px; bottom: 10px; padding: 6px 9px; border-radius: 999px; pointer-events: none;
  background: rgba(18, 18, 18, .66); color: #fff; font: 600 12px/1 var(--f-sans); font-feature-settings: "tnum";
}
.frame-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, .92); color: #222; font-size: 20px; cursor: pointer;
  display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
}
.frame-nav .ic { width: 18px; height: 18px; stroke-width: 2.3; }
.frame-nav.prev { left: 8px; }
.frame-nav.next { right: 8px; }
@media (hover: none) { .frame-nav { display: none; } }
.frame-chips .chip { font-size: 14px; padding: 0 13px; }

.v-design { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.v-design .btn { padding: 0 10px; font-size: 14.5px; white-space: normal; line-height: 1.15; text-align: center; min-width: 0; }
.v-design .group { display: flex; gap: 0; min-width: 0; }
.v-design .group .btn { flex: 1 1 auto; }
.v-design .group .btn:first-child { border-radius: 999px 0 0 999px; }
.v-design .group .btn:last-child { flex: 0 0 48px; border-radius: 0 999px 999px 0; border-left: 0; }
.more-btn { font-size: 18px; letter-spacing: 1px; }

.caption {
  white-space: pre-wrap; position: relative; font: 400 16px/1.55 var(--f-sans); color: var(--ink);
  padding: 14px 15px 12px; border-radius: 16px; background: var(--paper-2); border: 1px solid var(--line);
}
.caption.clamp { max-height: 220px; overflow: hidden; }
.caption.clamp::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 64px; border-radius: 0 0 16px 16px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0), var(--paper-2));
}
.caption.off { opacity: .55; }
mark { border-radius: 4px; padding: 0 2px; color: inherit; }
mark.err { background: var(--mark-err); box-shadow: inset 0 -2px 0 var(--err); }
mark.warn { background: var(--mark-warn); box-shadow: inset 0 -2px 0 var(--ochre); }

.flags { display: flex; flex-direction: column; gap: 8px; }
.flag { display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px; border-radius: 14px; font-size: 15px; line-height: 1.4; }
.flag.err { background: var(--err-soft); }
.flag.warn { background: var(--ochre-soft); }
.flag .dot { margin-top: 6px; }
.flag .phrase { font-weight: 700; }
.flag .where { color: var(--muted); font-size: 15px; }
.flag .hint { color: var(--ink-2); font-size: 15px; margin-top: 2px; }
.flags-ok {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 14px;
  background: var(--olive-soft); color: var(--olive); font: 600 14.5px/1.3 var(--f-sans);
}
.editor { display: flex; flex-direction: column; gap: 14px; }
.editor .imgfields { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 16px; background: var(--paper-2); border: 1px solid var(--line); }
.save-state { font-size: 13.5px; color: var(--muted); min-height: 20px; }
.save-state.err { color: var(--err); }
.save-state.ok { color: var(--olive); }
.v-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.v-actions .btn { flex: 1 1 auto; }
.v-actions .btn-primary { flex-basis: 100%; }
.v-busy {
  position: absolute; inset: 0; border-radius: var(--r-card); z-index: 3;
  background: var(--paper); opacity: .96; background: color-mix(in srgb, var(--paper) 82%, transparent); opacity: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: 24px; text-align: center; font-weight: 600;
}
.v-busy .bar { width: 70%; }

.panel { display: flex; flex-direction: column; gap: 18px; }
.send-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
@media (min-width: 900px) {
  .send-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 400px); }
  .send-grid .panel { position: sticky; top: calc(var(--top-h) + 20px); }
}
.toggles { display: flex; gap: 8px; flex-wrap: wrap; }
.panel .times { display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.panel .times .t-row { display: flex; gap: 10px; align-items: baseline; }
.panel .times .t-lang { font: 700 11px/20px var(--f-sans); letter-spacing: .06em; min-width: 30px; text-align: center; border-radius: 6px; background: var(--sunk); color: var(--ink-2); flex: 0 0 auto; }
.reason { font-size: 14.5px; color: var(--err); text-align: center; }
.reason.muted { color: var(--muted); }

.status-head { display: flex; flex-direction: column; gap: 10px; }
.status-big { display: flex; align-items: center; gap: 10px; }
.status-big .dot { width: 12px; height: 12px; }
.status-big h1 { font-size: 26px; }
.assets { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; align-items: start; }
.assets a { display: block; border-radius: 10px; overflow: hidden; background: var(--sunk); box-shadow: 0 0 0 1px var(--line); }
.assets img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.assets a.story img { aspect-ratio: 9 / 16; }
.units { display: flex; flex-direction: column; }
.unit { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.unit:last-child { border-bottom: 0; }
.unit .u-main { display: flex; gap: 10px; align-items: center; }
.unit .u-what { font-weight: 600; }
.unit .u-when { color: var(--muted); font-size: 14px; }
.unit .u-st { margin-left: auto; font-size: 14px; color: var(--muted); white-space: nowrap; }
.unit .u-err { color: var(--err); font-size: 14px; }
.history { font-size: 14.5px; }
.history summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; color: var(--muted); }
.history ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.history li { display: flex; gap: 10px; }
.history .h-at { color: var(--faint); white-space: nowrap; flex: 0 0 auto; min-width: 104px; font-feature-settings: "tnum"; }
/* кнопка «Одобрить», прилипшая к низу экрана, пока панели одобрения не видно */
.sticky-approve {
  position: sticky; z-index: 15; bottom: calc(10px + env(safe-area-inset-bottom));
  margin-top: 12px; padding: 10px; border-radius: 22px; background: var(--paper);
  border: 1px solid var(--line); box-shadow: var(--shadow-lift); display: flex; flex-direction: column; gap: 6px;
}
.sticky-approve .row { flex-wrap: nowrap; gap: 8px; }
.sticky-approve .btn { padding: 0 14px; font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sticky-approve .grow { flex: 1 1 auto; min-width: 0; }
.sticky-approve .sa-reason { font-size: 13.5px; color: var(--err); line-height: 1.3; }
@media (min-width: 900px) { .sticky-approve { display: none !important; } }

/* ── библиотека ── */
.lib-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 560px) { .lib-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; } }
@media (min-width: 900px) { .lib-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; } }
.lib-item {
  position: relative; padding: 0; border: 0; border-radius: 14px; overflow: hidden; display: block; width: 100%;
  background: var(--sunk); cursor: pointer; aspect-ratio: 1 / 1;
  box-shadow: 0 0 0 1px var(--line), 0 10px 20px -16px rgba(60, 40, 20, .6);
  transition: transform .12s, box-shadow .12s;
}
.lib-item:hover { transform: translateY(-1px); box-shadow: 0 0 0 1px var(--line-2), 0 14px 24px -14px rgba(60, 40, 20, .6); }
.lib-item img { width: 100%; height: 100%; object-fit: cover; display: block; background: #fff; }
.lib-item .lib-title {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 8px 6px; font: 500 12px/1.2 var(--f-sans); color: #fff;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, .58)); text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lib-item.on { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }
.lib-item.on::after {
  content: "✓"; position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--ink); color: var(--paper); display: grid; place-items: center; font: 700 13px/1 var(--f-sans);
}
.lib-grid .empty { grid-column: 1 / -1; }
.lib-none {
  aspect-ratio: 1 / 1; border: 1.5px dashed var(--line-2); border-radius: 14px; background: none;
  color: var(--muted); font: 600 14px/1.2 var(--f-sans); cursor: pointer; padding: 6px;
}
.lib-none.on { border-color: var(--ink); color: var(--ink); border-style: solid; }
.upload-line { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14.5px; }
.lib-big { width: 100%; border-radius: 16px; background: #fff; display: block; max-height: 60vh; object-fit: contain; }
.lib-tools { display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 768px) {
  .lib-tools { flex-direction: row; align-items: center; justify-content: space-between; }
  .lib-tools .stack-sm { flex: 0 0 280px; }
}

/* ── настройки ── */
.about dl { margin: 0; display: grid; grid-template-columns: 1fr; gap: 4px 20px; }
.about dt { color: var(--muted); font: 600 13.5px/1.3 var(--f-sans); margin-top: 14px; }
.about dt:first-child { margin-top: 0; }
.about dd { margin: 0; font-weight: 500; line-height: 1.45; }
@media (min-width: 560px) {
  .about dl { grid-template-columns: 220px 1fr; row-gap: 14px; }
  .about dt { margin-top: 0; padding-top: 2px; }
}
.feat { display: flex; flex-wrap: wrap; gap: 6px; }
.feat .pill.accent { background: var(--olive-soft); color: var(--olive); }

/* ───────────── тёмная тема: мелкие поправки ───────────── */
@media (prefers-color-scheme: dark) {
  .switch::after { background: var(--ink); }
  .switch.is-on::after, .switch[aria-checked="true"]::after, .switch[aria-pressed="true"]::after { background: var(--bg); }
  .sw { box-shadow: 0 0 0 1px rgba(255, 255, 255, .16) inset; }
  .sw.is-on, .sw[aria-pressed="true"] { box-shadow: 0 0 0 1px rgba(255, 255, 255, .16) inset, 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }
  .frame-nav { background: rgba(21, 33, 42, .9); color: var(--ink); }
  .lib-item img, .frame iframe { background: #1b1b1b; }
  .thumb iframe { background: var(--sunk); }
  /* выбранный сегмент — светлее жёлоба (а не «дыра» темнее него) */
  .seg > .is-on, .seg > [aria-pressed="true"], .seg > [aria-selected="true"],
  .tabs.seg .tab[aria-pressed="true"], .tabs.seg .tab[aria-selected="true"] {
    background: var(--line-2); color: var(--ink); box-shadow: 0 0 0 1px rgba(255, 255, 255, .08) inset;
  }
  :focus-visible { outline-color: color-mix(in srgb, var(--sea-2) 65%, transparent); }
  .eyebrow, .st-wait, .st-waiting { color: var(--terra); }
}

/* ───────────── наведение мышью: только там, где есть мышь (на телефоне после нажатия не «залипает») ───────────── */
@media (hover: hover) {
  .sw:not(:disabled):not(.is-on):not([aria-pressed="true"]):hover { box-shadow: 0 0 0 1px rgba(0, 0, 0, .1) inset, 0 0 0 2px var(--paper), 0 0 0 4px var(--line-2); }
  .seg > button:not(.is-on):not([aria-pressed="true"]):not([aria-selected="true"]):hover { color: var(--ink); }
  .btn-text:not(:disabled):hover, .link-btn:not(:disabled):hover { text-decoration: underline; text-underline-offset: 3px; }
  .switch:not(:disabled):hover { box-shadow: 0 0 0 3px color-mix(in srgb, var(--sea) 14%, transparent); }
}

.toast-act { display: inline-block; margin-left: 10px; padding: 3px 11px; border: 1px solid currentColor; border-radius: 999px; background: transparent; color: inherit; font: 600 14px/1.3 var(--f-sans); cursor: pointer; }
