/* Кабинет «Парафа». Токены — из дизайн-системы «Параф» (site/src/style.css, brand/design-system):
   тёплая бумага, глубокие чернила, электрический ирис, бледная лаванда. Лайм — редкий акцент (метка
   «бесплатно», подсветка незаполненного): не для текста, кнопок и значков, не больше одного пятна на экран.
   Шрифт один — Manrope. Раскладка: сделки | переписка | карточка; на телефоне — вкладками. */
@font-face {
  font-family: "Manrope";
  src: url("/fonts/manrope.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f7f5f0;
  --raised: #ffffff;
  --sunken: #efece5;
  --line: #e2dfea;
  --line-soft: #ece9f1;
  --line-strong: #8e8ca3;
  --ink: #232335;
  --ink-muted: #5f5e73;
  --ink-faint: #8a889c;
  --iris: #6355db;
  --iris-hover: #5144c7;
  --iris-soft: #e8e3f7;
  --iris-tint: #f3f0fc;
  --on-iris: #ffffff;
  --lime: #ddf29a;
  --on-lime: #232335;
  --focus: #6355db;
  --wall: #6355db;
  --bad: #b3261e;
  --bad-soft: #fbe9e7;
  --warn: #8a5a00;
  --warn-soft: #fbf1dc;
  --ok: #1f6f4a;
  --ok-on-ink: #7fd4a4;   /* «готово» на тёмной плашке (тост): у плашки цвета темы наоборот */
  --shadow-card: 0 1px 2px rgba(35, 35, 53, 0.06), 0 10px 28px -14px rgba(35, 35, 53, 0.28);
  --shadow-lift: 0 2px 4px rgba(35, 35, 53, 0.05), 0 24px 48px -18px rgba(35, 35, 53, 0.3);
  --scrim: rgba(22, 22, 31, 0.45);
  --font: "Manrope", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --side-w: 316px;
  --card-w: 364px;
  --tabbar-h: 60px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #16161f;
    --raised: #20202c;
    --sunken: #1b1b25;
    --line: #34344a;
    --line-soft: #2a2a3b;
    --line-strong: #75738f;
    --ink: #f4f2fa;
    --ink-muted: #aba9c0;
    --ink-faint: #85839b;
    --iris: #8c82ee;
    --iris-hover: #a39bf3;
    --iris-soft: #2a2650;
    --iris-tint: #232040;
    --on-iris: #16161f;
    --focus: #8c82ee;
    --wall: #4b41c4;
    --bad: #ff8a80;
    --bad-soft: #3a2024;
    --warn: #f2c46b;
    --warn-soft: #362c17;
    --ok: #7fd4a4;
    --ok-on-ink: #1f6f4a;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 30px -14px rgba(0, 0, 0, 0.7);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.3), 0 24px 48px -18px rgba(0, 0, 0, 0.75);
    --scrim: rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #16161f;
  --raised: #20202c;
  --sunken: #1b1b25;
  --line: #34344a;
  --line-soft: #2a2a3b;
  --line-strong: #75738f;
  --ink: #f4f2fa;
  --ink-muted: #aba9c0;
  --ink-faint: #85839b;
  --iris: #8c82ee;
  --iris-hover: #a39bf3;
  --iris-soft: #2a2650;
  --iris-tint: #232040;
  --on-iris: #16161f;
  --focus: #8c82ee;
  --wall: #4b41c4;
  --bad: #ff8a80;
  --bad-soft: #3a2024;
  --warn: #f2c46b;
  --warn-soft: #362c17;
  --ok: #7fd4a4;
  --ok-on-ink: #1f6f4a;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 30px -14px rgba(0, 0, 0, 0.7);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.3), 0 24px 48px -18px rgba(0, 0, 0, 0.75);
  --scrim: rgba(0, 0, 0, 0.6);
}

/* ---------- основа ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; min-height: 100%;
  background: var(--paper); color: var(--ink);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}
img, svg { max-width: 100%; }
a { color: var(--iris); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--iris-hover); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
code { font-family: var(--mono); font-size: 0.9em; padding: 0.08em 0.36em; border-radius: 6px; background: var(--iris-tint); }
h1, h2, h3, h4 { margin: 0; text-wrap: balance; }
p { margin: 0; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.mk { flex: none; fill: currentColor; }
.label { font-size: 11.5px; line-height: 16px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); }
.muted { color: var(--ink-muted); }
.small { font-size: 13px; }
.block { display: block; }
.nowrap { white-space: nowrap; }
.noscript { padding: 40px 24px; text-align: center; }

.boot { display: grid; place-items: center; align-content: center; gap: 24px; min-height: 100vh; }
.boot-box { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 26px; letter-spacing: -0.03em; opacity: 0.9; }
.boot-mark { width: 32px; height: 32px; color: var(--iris); animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.45; } }

/* ---------- кнопки ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--r-md); border: 1.5px solid transparent;
  font: 700 15px/1.2 var(--font); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}
.btn .ico { width: 18px; height: 18px; }
.btn-primary { background: var(--iris); color: var(--on-iris); }
.btn-primary:hover { background: var(--iris-hover); color: var(--on-iris); }
.btn-ghost { background: var(--raised); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }
.btn-danger { background: var(--bad); color: #fff; }
:root[data-theme="dark"] .btn-danger { color: #16161f; }
.btn-onwall { background: #fff; color: #232335; }
.btn-onwall:hover { background: #efedfb; color: #232335; }
.btn-sm { min-height: 36px; padding: 0 13px; font-size: 14px; border-radius: 10px; gap: 7px; }
.btn-sm .ico { width: 16px; height: 16px; }
.btn-xs { min-height: 30px; padding: 0 10px; font-size: 13px; border-radius: 9px; gap: 6px; border-width: 1px; }
.btn-xs .ico { width: 15px; height: 15px; }
.btn-block { display: flex; width: 100%; }
.btn.is-danger { color: var(--bad); }
.btn:disabled { opacity: 0.55; cursor: default; }
.is-busy { pointer-events: none; }
.btn.is-busy { color: transparent !important; }
.btn.is-busy::after, .choice.is-busy::after, .theme-card.is-busy::after, .role-card.is-busy::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite;
}
.btn-primary.is-busy::after { border-color: var(--on-iris); border-right-color: transparent; }
.btn-ghost.is-busy::after { border-color: var(--ink); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; padding: 0;
  border: 0; border-radius: 10px; background: transparent; color: var(--ink-muted); cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--iris-tint); color: var(--ink); }
.link-btn { padding: 0; border: 0; background: none; color: var(--iris); font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.link-arrow { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; text-decoration: none; }
.link-arrow .ico { width: 16px; height: 16px; }
.link-arrow.is-small { font-size: 13.5px; margin-top: 10px; }
.only-phone { display: none !important; }

/* ---------- поля ---------- */
.input {
  width: 100%; min-height: 44px; padding: 10px 13px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--raised); color: var(--ink);
  font: 500 15px/1.4 var(--font); transition: border-color 0.15s, box-shadow 0.15s;
}
textarea.input { resize: vertical; min-height: 72px; line-height: 1.5; }
.input::placeholder { color: var(--ink-faint); font-weight: 400; }
.input:hover { border-color: var(--ink-muted); }
.input:focus { outline: none; border-color: var(--iris); box-shadow: 0 0 0 3px color-mix(in srgb, var(--iris) 22%, transparent); }
.input.is-invalid { border-color: var(--bad); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.is-wide { grid-column: 1 / -1; }
.field-label { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.field-hint { font-size: 12.5px; line-height: 1.45; color: var(--ink-muted); }
.field-err { font-size: 12.5px; line-height: 1.4; font-weight: 600; color: var(--bad); }
.field-err:empty { display: none; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14.5px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--iris); }
.file-input { font: inherit; font-size: 14px; color: var(--ink-muted); }
.file-input::file-selector-button { margin-right: 10px; padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--raised); color: var(--ink); font: 700 13px var(--font); cursor: pointer; }
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }

.seg { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--sunken); }
.seg.is-wrap { flex-wrap: wrap; border-radius: 16px; }
.seg-btn {
  min-height: 36px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent;
  font-weight: 700; font-size: 14px; color: var(--ink-muted); cursor: pointer;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.is-on { background: var(--ink); color: var(--paper); }

.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.choice {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px 16px 16px 46px; text-align: left;
  border: 1.5px solid var(--line); border-radius: var(--r-lg); background: var(--raised); cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.choice:hover { border-color: var(--line-strong); }
.choice b { font-size: 15.5px; line-height: 1.3; }
.choice span:not(.choice-mark) { font-size: 13.5px; line-height: 1.5; color: var(--ink-muted); }
.choice-mark { position: absolute; left: 16px; top: 18px; width: 18px; height: 18px; border: 1.5px solid var(--line-strong); border-radius: 50%; }
.choice.is-on { border-color: var(--iris); background: var(--iris-tint); }
.choice.is-on .choice-mark { border: 5px solid var(--iris); }

/* ---------- уведомления ---------- */
.toasts {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 90;
  display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(560px, calc(100vw - 24px));
  transform: translateX(-50%); pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px; max-width: 100%; padding: 10px 8px 10px 16px;
  border-radius: 14px; background: var(--ink); color: var(--paper); box-shadow: var(--shadow-lift);
  font-size: 14px; line-height: 1.45; pointer-events: auto; animation: toast-in 0.2s ease both;
}
.toast .ico { width: 18px; height: 18px; }
.toast.is-error { background: var(--bad); color: #fff; }
:root[data-theme="dark"] .toast.is-error { color: #16161f; }
.toast.is-ok .ico { color: var(--ok-on-ink); }
.toast-text { flex: 1; }
.toast-act { flex: none; padding: 6px 10px; border: 0; border-radius: 8px; background: color-mix(in srgb, currentColor 16%, transparent); color: inherit; font-weight: 800; font-size: 13.5px; cursor: pointer; }
.toast-x { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: inherit; opacity: 0.7; cursor: pointer; }
.toast-x .ico { width: 16px; height: 16px; }
.toast.is-out { animation: toast-out 0.2s ease both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ---------- окна ---------- */
.modal {
  width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 0; overflow: auto;
  border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--raised); color: var(--ink); box-shadow: var(--shadow-lift);
}
.modal.is-wide { width: min(720px, calc(100vw - 24px)); }
.modal::backdrop { background: var(--scrim); }
.modal[open] { animation: pop 0.18s ease both; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.99); } }
.modal-box { display: flex; flex-direction: column; gap: 14px; padding: 22px 24px 22px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-right: -10px; }
.modal-title { font-size: 20px; line-height: 1.25; font-weight: 800; letter-spacing: -0.015em; padding-top: 6px; }
.modal-lead { color: var(--ink-muted); line-height: 1.55; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ---------- меню ---------- */
.menu {
  position: fixed; z-index: 80; min-width: 220px; padding: 6px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--raised); box-shadow: var(--shadow-lift);
  animation: pop 0.14s ease both;
}
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 12px;
  border: 0; border-radius: 9px; background: transparent; text-align: left; font-weight: 600; font-size: 14.5px; cursor: pointer;
}
.menu-item .ico { color: var(--ink-muted); width: 18px; height: 18px; }
.menu-item:hover, .menu-item:focus-visible { background: var(--iris-tint); outline: none; }
.menu-item.is-danger { color: var(--bad); }
.menu-sep { height: 1px; margin: 5px 6px; background: var(--line); }

/* ---------- каркас ---------- */
.shell { position: fixed; inset: 0; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.cols { position: relative; flex: 1; min-height: 0; display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
.shell.has-card .cols { grid-template-columns: var(--side-w) minmax(0, 1fr) var(--card-w); }
.col-side, .col-main, .col-card { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.col-side { background: var(--raised); border-right: 1px solid var(--line); }
.col-main { background: var(--paper); }
.col-card { background: var(--raised); border-left: 1px solid var(--line); }
.shell:not(.has-card) .col-card { display: none; }
.tabbar { display: none; }
.scrim { display: none; position: fixed; inset: 0; z-index: 30; background: var(--scrim); animation: toast-in 0.2s ease both; }
.conn {
  position: absolute; left: 50%; top: calc(10px + env(safe-area-inset-top, 0px)); z-index: 70; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  background: var(--warn-soft); color: var(--warn); font-size: 13.5px; font-weight: 700; box-shadow: var(--shadow-card);
}
.conn .ico { width: 16px; height: 16px; animation: spin 1.4s linear infinite; }
.demo-bar {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 14px; padding: 7px 16px;
  background: #232335; color: #f4f2fa; font-size: 13px; text-align: center;
}
:root[data-theme="dark"] .demo-bar { background: #2a2650; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .demo-bar { background: #2a2650; } }
.demo-bar .link-btn { color: #fff; text-decoration: underline; text-underline-offset: 3px; }

.main-empty { flex: 1; display: grid; place-content: center; justify-items: center; gap: 18px; padding: 32px; text-align: center; color: var(--ink-muted); max-width: 420px; margin: auto; }
.mini-sheet { position: relative; width: 64px; height: 84px; padding: 16px 10px; border: 1px solid var(--line); background: var(--raised); box-shadow: var(--shadow-card); }
.mini-sheet::before { content: ""; position: absolute; left: 10px; right: 10px; top: 9px; height: 2px; background: var(--iris); }
.mini-sheet i { display: block; height: 5px; margin: 6px 0; border-radius: 3px; background: var(--iris-soft); }
.mini-sheet i.short { width: 60%; }
.mini-sheet.is-big { width: 96px; height: 128px; padding: 26px 16px; }
.mini-sheet.is-big i { height: 7px; margin: 9px 0; }

/* ---------- левая колонка: сделки ---------- */
.side-inner { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 12px 6px 18px; }
.brand { display: inline-flex; align-items: center; gap: 9px; min-height: 40px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand .mk { width: 22px; height: 22px; color: var(--iris); }
.brand-word { font-weight: 800; font-size: 20px; letter-spacing: -0.03em; }
.brand-sub { margin-left: 2px; padding: 2px 8px; border-radius: 999px; background: var(--iris-tint); color: var(--ink-muted); font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.brand.is-big .mk { width: 30px; height: 30px; }
.brand.is-big .brand-word { font-size: 26px; }
.side-tools { display: flex; flex-direction: column; gap: 10px; padding: 8px 14px 10px; }
.search { position: relative; display: flex; align-items: center; }
.search .ico { position: absolute; left: 12px; width: 17px; height: 17px; color: var(--ink-faint); pointer-events: none; }
.search-input {
  width: 100%; height: 40px; padding: 0 12px 0 38px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--sunken); color: var(--ink); font: 500 14px var(--font);
}
.search-input::placeholder { color: var(--ink-faint); }
.search-input:focus { outline: none; border-color: var(--iris); background: var(--raised); box-shadow: 0 0 0 3px color-mix(in srgb, var(--iris) 20%, transparent); }
.search-input::-webkit-search-cancel-button { cursor: pointer; }
.side-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 8px 12px; scrollbar-width: thin; }
.side-label { padding: 14px 10px 6px; font-size: 11.5px; line-height: 16px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); }
.side-label span { letter-spacing: 0; }
.side-empty { padding: 14px 10px; font-size: 14px; line-height: 1.55; color: var(--ink-muted); }
.side-empty .mini-sheet { margin: 6px 0 14px; }
.side-empty b { color: var(--ink); }

.deal-item {
  position: relative; display: flex; align-items: flex-start; gap: 11px; padding: 10px 10px; margin-bottom: 2px;
  border-radius: 13px; color: var(--ink); text-decoration: none; transition: background-color 0.12s;
}
.deal-item:hover { background: var(--iris-tint); color: var(--ink); }
.deal-item.is-active { background: var(--iris-soft); }
.deal-item.is-active::before { content: ""; position: absolute; left: -8px; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--iris); }
.deal-no {
  flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px;
  background: var(--sunken); color: var(--ink); font-weight: 800; font-size: 13.5px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
}
.deal-item.is-active .deal-no { background: var(--raised); }
.deal-item .deal-no.is-icon { background: var(--iris); color: var(--on-iris); }
.deal-no.is-icon .ico { width: 19px; height: 19px; }
.deal-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.deal-top { display: flex; align-items: baseline; gap: 8px; }
.deal-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: 14.5px; line-height: 1.35; }
.deal-when { flex: none; font-size: 12px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.deal-prev { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 13px; line-height: 1.4; color: var(--ink-muted); }
.deal-item.is-unread .deal-title { font-weight: 800; }
.deal-item.is-unread .deal-prev { color: var(--ink); }
.deal-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; min-height: 20px; padding: 0 7px; border-radius: 999px;
  background: var(--iris-tint); color: var(--ink-muted); font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.tag .ico { width: 12px; height: 12px; }
.tag.is-plain { background: transparent; padding: 0 2px; font-weight: 600; }
.tag.is-iris { background: var(--iris-soft); color: var(--ink); }
.dot { position: absolute; right: 12px; top: 40px; width: 9px; height: 9px; border-radius: 50%; background: var(--iris); box-shadow: 0 0 0 3px var(--raised); }
.deal-item.is-unread .deal-prev { padding-right: 18px; }
.deal-item:hover .dot { box-shadow: 0 0 0 3px var(--iris-tint); }

.side-foot { display: flex; flex-direction: column; gap: 4px; padding: 8px 8px calc(10px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); }
.side-link {
  display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 10px; border: 0; border-radius: 10px; background: transparent;
  color: var(--ink-muted); font-weight: 700; font-size: 14px; text-decoration: none; cursor: pointer;
}
.side-link .ico { width: 18px; height: 18px; }
.side-link:hover { background: var(--iris-tint); color: var(--ink); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 13px; color: var(--ink); text-decoration: none; }
.user-chip:hover, .user-chip.is-active { background: var(--iris-tint); color: var(--ink); }
.user-chip > .ico { color: var(--ink-muted); }
.user-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: 14px; }
.user-sub { font-size: 12.5px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.ava { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; object-fit: cover; }
.ava-user { background: var(--ink); color: var(--paper); font-weight: 800; font-size: 13px; letter-spacing: 0.02em; }
.ava-user.is-big { width: 64px; height: 64px; border-radius: 18px; font-size: 22px; }
.ava-bot { background: #6355db; color: #fff; }
.ava-bot .mk { width: 16px; height: 16px; }
.ava-bot.is-big { width: 56px; height: 56px; border-radius: 16px; }
.ava-bot.is-big .mk { width: 26px; height: 26px; }

.set-nav { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 8px 12px; }
.set-link {
  display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 12px; margin-bottom: 2px; border-radius: 12px;
  color: var(--ink); font-weight: 700; font-size: 14.5px; text-decoration: none;
}
.set-link > .ico:first-child { color: var(--ink-muted); }
.set-link span { flex: 1; }
.set-link:hover { background: var(--iris-tint); color: var(--ink); }
.set-link.is-active { background: var(--iris-soft); }
.set-link.is-active > .ico:first-child { color: var(--iris); }
.set-chev { display: none; color: var(--ink-faint); }

/* ---------- переписка ---------- */
.chat { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-head {
  display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 10px 16px 10px 22px;
  border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 88%, var(--raised));
}
.chat-titles { flex: 1; min-width: 0; }
.chat-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; line-height: 1.3; font-weight: 800; letter-spacing: -0.015em; }
.chat-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--ink-muted); }
.chat-actions { display: flex; align-items: center; gap: 6px; }
.chat-cardbtn { display: none; }
.chat-banner {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 9px 22px;
  background: var(--warn-soft); color: var(--ink); font-size: 13.5px; font-weight: 600;
}
.chat-banner .ico { color: var(--warn); width: 18px; height: 18px; }
.chat-banner span { flex: 1; min-width: 12em; }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scroll-behavior: auto; }
.chat-lane { max-width: 800px; margin: 0 auto; padding: 18px 22px 10px; }
.msgs { display: flex; flex-direction: column; }
.more-row { display: flex; justify-content: center; margin: 4px 0 8px; }
.more-ico { transform: rotate(90deg); }
.day { display: flex; justify-content: center; margin: 14px 0 10px; }
.day span { padding: 3px 12px; border-radius: 999px; background: var(--sunken); color: var(--ink-muted); font-size: 12px; font-weight: 700; }

.msg { display: flex; align-items: flex-end; gap: 10px; margin-top: 4px; }
.msg.is-first { margin-top: 12px; }
.msg.is-me { justify-content: flex-end; }
.msg .ava-bot, .ava-gap { width: 32px; height: 32px; border-radius: 10px; align-self: flex-start; }
.ava-gap { flex: none; }
.msg-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; max-width: min(620px, 84%); }
.msg.is-me .msg-col { align-items: flex-end; }
.bubble {
  position: relative; min-width: 0; max-width: 100%; padding: 10px 14px 8px; border-radius: 16px;
  font-size: 15px; line-height: 1.55; overflow-wrap: anywhere;
}
.is-bot .bubble { background: var(--iris-soft); border-top-left-radius: 6px; }
.is-bot:not(.is-first) .bubble { border-top-left-radius: 16px; }
.is-me .bubble { background: var(--raised); border: 1px solid var(--line); border-bottom-right-radius: 6px; }
.b-text { white-space: pre-wrap; }
.b-text.is-muted { color: var(--ink-muted); }
.b-text b { font-weight: 800; }
.b-text a { color: var(--iris); font-weight: 600; }
:root:not([data-theme="dark"]) .is-bot .b-text a { color: #4a3dbf; }
.b-text blockquote { margin: 6px 0; padding: 6px 12px; border-left: 3px solid var(--iris); border-radius: 4px 10px 10px 4px; background: color-mix(in srgb, var(--raised) 55%, transparent); white-space: pre-wrap; }
.b-text pre { margin: 6px 0; padding: 10px 12px; overflow-x: auto; border-radius: 10px; background: color-mix(in srgb, var(--raised) 60%, transparent); font-family: var(--mono); font-size: 13px; white-space: pre; }
.b-text pre code { padding: 0; background: none; }
.is-bot .b-text code { background: color-mix(in srgb, var(--raised) 60%, transparent); }
.spoiler { border-radius: 4px; background: var(--ink-muted); color: transparent; cursor: pointer; }
.spoiler.is-open { background: transparent; color: inherit; cursor: auto; }
.b-meta { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin-top: 2px; font-size: 11.5px; line-height: 1.2; color: var(--ink-faint); font-variant-numeric: tabular-nums; user-select: none; }
.is-bot .b-meta { color: color-mix(in srgb, var(--ink-muted) 80%, transparent); }
.b-src::after { content: "·"; margin-left: 6px; }
.b-meta .ico { width: 14px; height: 14px; color: var(--bad); }
.bubble.has-media, .bubble.has-doc { padding: 6px; }
.bubble.has-media .b-text, .bubble.has-doc .b-text { padding: 6px 8px 0; }
.bubble.has-media .b-meta, .bubble.has-doc .b-meta { padding: 0 8px 2px; }
.msg.is-pending .bubble { opacity: 0.7; }
.msg.is-failed .bubble { border-color: var(--bad); opacity: 1; }
.msg.is-failed .b-meta { color: var(--bad); }

.doc-card {
  display: flex; align-items: center; gap: 12px; min-width: min(300px, 100%); padding: 10px 8px 10px 10px;
  border-radius: 12px; background: var(--raised); border: 1px solid var(--line);
}
.is-me .doc-card { background: var(--sunken); border-color: transparent; }
.doc-ic {
  position: relative; flex: none; display: grid; place-items: center; width: 42px; height: 50px; border-radius: 4px 11px 4px 4px;
  background: var(--iris); color: var(--on-iris); font-size: 10.5px; font-weight: 800; letter-spacing: 0.03em;
}
.doc-ic::after { content: ""; position: absolute; right: 0; top: 0; width: 11px; height: 11px; border-bottom-left-radius: 4px; background: color-mix(in srgb, #fff 45%, transparent); }
.doc-card.k-word .doc-ic { background: #2f5aa8; color: #fff; }
.doc-card.k-файл .doc-ic { background: var(--line-strong); color: #fff; }
.doc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.doc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: 14px; line-height: 1.35; }
.doc-sub { font-size: 12.5px; color: var(--ink-muted); }
.doc-acts { display: flex; align-items: center; gap: 2px; }
.doc-acts .icon-btn { width: 36px; height: 36px; }
.doc-wait { font-size: 12px; color: var(--ink-faint); padding-right: 6px; }

.b-photo { display: block; padding: 0; border: 0; border-radius: 11px; overflow: hidden; background: var(--sunken); cursor: zoom-in; }
.b-photo-img { display: block; max-width: min(360px, 100%); max-height: 360px; object-fit: cover; }
.album { display: grid; gap: 6px; }
.album.n-2 { grid-template-columns: repeat(2, minmax(0, 170px)); }
.album.n-3 { grid-template-columns: repeat(3, minmax(0, 170px)); }
.album.is-single { grid-template-columns: minmax(0, 240px); }
.album-tile {
  position: relative; display: block; aspect-ratio: 210 / 297; padding: 0; overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); border-radius: 6px; background: #fff; cursor: zoom-in;
  transition: transform 0.15s, box-shadow 0.15s;
}
.album-tile:hover { transform: translateY(-1px); box-shadow: var(--shadow-card); }
.album-img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.album-n { position: absolute; left: 6px; bottom: 6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 7px; background: rgba(35, 35, 53, 0.78); color: #fff; font-size: 12px; font-weight: 800; line-height: 22px; text-align: center; }
.b-protect { display: flex; align-items: center; gap: 6px; margin: 8px 4px 0; font-size: 12.5px; font-weight: 600; color: var(--ink-muted); }
.b-protect .ico { width: 15px; height: 15px; }
.protected { background: #fff center top / cover no-repeat; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-user-drag: none; }
.protected:not(.is-loaded) { background-image: linear-gradient(90deg, #f3f2f7, #fafafc, #f3f2f7); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.is-broken { background: var(--sunken) !important; }
@keyframes shimmer { to { background-position: -200% 0; } }
.album-tile .protected { width: 100%; height: 100%; }

.kb { display: flex; flex-direction: column; gap: 6px; }
.kb-row { display: flex; flex-wrap: wrap; gap: 6px; }
.kb-btn {
  position: relative; flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 7px 14px; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--raised);
  color: var(--ink); font-weight: 700; font-size: 13.5px; line-height: 1.3; text-align: center; text-decoration: none; cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.kb-btn:hover { border-color: var(--iris); color: var(--ink); background: var(--iris-tint); }
.kb-btn.is-main { background: var(--iris); border-color: var(--iris); color: var(--on-iris); }
.kb-btn.is-main:hover { background: var(--iris-hover); color: var(--on-iris); }
.kb-btn.is-busy span { opacity: 0.35; }
.kb-btn.is-busy::after { content: ""; position: absolute; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
.kb-btn.is-done::before { content: ""; position: absolute; inset: -1px; border-radius: 11px; box-shadow: 0 0 0 2px var(--iris); animation: fade 1.6s ease forwards; }
@keyframes fade { to { opacity: 0; } }
.kb-ext { width: 14px; height: 14px; opacity: 0.7; }

.tap { display: flex; justify-content: flex-end; margin-top: 8px; }
.tap-pill {
  display: inline-flex; align-items: center; gap: 6px; max-width: 84%; padding: 5px 12px; border-radius: 999px;
  border: 1px dashed var(--line-strong); color: var(--ink-muted); font-size: 12.5px;
}
.tap-pill .ico { width: 14px; height: 14px; color: var(--iris); }
.tap-pill b { color: var(--ink); font-weight: 700; }
.tap-src { color: var(--ink-faint); }

.typing-slot .msg { margin-top: 12px; }
.typing { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-muted); font-size: 12.5px; font-weight: 600; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--iris); animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; margin-right: 4px; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
.typing-draft { margin-bottom: 6px; color: var(--ink-muted); }

.to-bottom {
  position: absolute; right: 22px; bottom: calc(100% + 8px); z-index: 5; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--raised); color: var(--ink); box-shadow: var(--shadow-card);
  font-weight: 700; font-size: 13px; cursor: pointer;
}
.to-bottom .ico { width: 16px; height: 16px; color: var(--iris); }

.chat-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 460px; margin: 8vh auto 0; padding: 0 12px; text-align: center; }
.chat-empty > .ico { width: 28px; height: 28px; color: var(--warn); }
.chat-empty b { font-size: 17px; font-weight: 800; }
.chat-empty p { color: var(--ink-muted); line-height: 1.55; }

.skeleton { display: flex; flex-direction: column; gap: 12px; padding: 8px 0; }
.skeleton i { display: block; border-radius: 14px; background: linear-gradient(90deg, var(--sunken), var(--line-soft), var(--sunken)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.sk-b { width: 46%; height: 64px; }
.sk-b.is-me { align-self: flex-end; width: 34%; height: 44px; }
.sk-b.is-long { width: 62%; height: 110px; }
.sk-l { height: 16px; width: 70%; }
.sk-l.is-short { width: 40%; }
.sk-box { height: 96px; }
.skeleton.is-card, .skeleton.is-form { padding: 16px 0; }

/* поле ввода */
.composer { position: relative; padding: 8px 22px calc(12px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(to top, var(--paper) 70%, transparent); }
.composer > :not(.to-bottom) { max-width: 756px; margin-left: auto; margin-right: auto; }
.comp-row {
  display: flex; align-items: flex-end; gap: 6px; padding: 5px;
  border: 1px solid var(--line-strong); border-radius: 22px; background: var(--raised); box-shadow: var(--shadow-card);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.comp-row:focus-within { border-color: var(--iris); box-shadow: 0 0 0 3px color-mix(in srgb, var(--iris) 18%, transparent), var(--shadow-card); }
.comp-attach { width: 40px; height: 40px; border-radius: 50%; }
.comp-input {
  flex: 1; min-width: 0; min-height: 40px; max-height: 200px; padding: 9px 4px; resize: none;
  border: 0; background: transparent; color: var(--ink); font: 500 15px/1.45 var(--font); outline: none;
}
.comp-input::placeholder { color: var(--ink-faint); font-weight: 400; }
.comp-send {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%;
  background: var(--sunken); color: var(--ink-faint); cursor: pointer; transition: background-color 0.15s, color 0.15s;
}
.comp-send.is-ready { background: var(--iris); color: var(--on-iris); }
.comp-send.is-ready:hover { background: var(--iris-hover); }
.comp-send .ico { width: 20px; height: 20px; stroke-width: 2.1; }
.comp-hint { margin-top: 6px; font-size: 11.5px; color: var(--ink-faint); text-align: center; }
.att-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.att {
  position: relative; display: flex; align-items: center; gap: 9px; max-width: 280px; padding: 7px 4px 7px 8px; overflow: hidden;
  border: 1px solid var(--line); border-radius: 12px; background: var(--raised);
}
.att-ic { flex: none; display: grid; place-items: center; width: 32px; height: 36px; border-radius: 3px 8px 3px 3px; background: var(--iris-soft); color: var(--ink); font-size: 9.5px; font-weight: 800; }
.att-main { min-width: 0; display: flex; flex-direction: column; }
.att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 700; }
.att-sub { font-size: 11.5px; color: var(--ink-muted); }
.att-x { width: 30px; height: 30px; }
.att-x .ico { width: 15px; height: 15px; }
.att.is-error { border-color: var(--bad); }
.att.is-error .att-sub { color: var(--bad); font-weight: 600; }
.att-track { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: transparent; }
.att-bar { display: block; width: 0; height: 100%; background: var(--iris); transition: width 0.2s; }
.att.is-uploading .att-x { visibility: hidden; }

.drop-veil { position: absolute; inset: 8px; z-index: 20; display: grid; place-items: center; border: 2px dashed var(--iris); border-radius: 20px; background: color-mix(in srgb, var(--paper) 88%, transparent); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); pointer-events: none; }
.drop-box { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.drop-box .ico { width: 34px; height: 34px; color: var(--iris); }
.drop-box b { font-size: 17px; }
.drop-box span { color: var(--ink-muted); font-size: 13.5px; }

/* ---------- карточка сделки ---------- */
.card-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.card-head { display: flex; align-items: center; gap: 8px; min-height: 64px; padding: 10px 12px 10px 20px; border-bottom: 1px solid var(--line); }
.card-titles { flex: 1; min-width: 0; }
.card-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; line-height: 1.35; font-weight: 800; }
.card-back, .card-close { display: none !important; }
.card-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 20px 28px; scrollbar-width: thin; }
.c-sec { padding: 18px 0; border-bottom: 1px solid var(--line-soft); }
.c-sec:last-child { border-bottom: 0; }
.c-h { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 11.5px; line-height: 16px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); }
.c-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--iris-tint); color: var(--ink); font-size: 11.5px; line-height: 20px; text-align: center; letter-spacing: 0; }
.c-empty { font-size: 14px; line-height: 1.55; color: var(--ink-muted); }
.c-note { margin-top: 12px; font-size: 12.5px; line-height: 1.5; color: var(--ink-faint); }
.c-more { margin-top: 10px; font-size: 13.5px; }
.card-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 24px 0; color: var(--ink-muted); }
.card-empty > .ico { width: 24px; height: 24px; color: var(--warn); }

.doc-row { padding: 14px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--raised); }
.doc-row:last-child { margin-bottom: 0; }
.doc-row-top { display: flex; align-items: flex-start; gap: 11px; }
.doc-row-ic { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--iris-soft); color: var(--iris); }
.doc-row.is-issued .doc-row-ic { background: var(--sunken); color: var(--ink-muted); }
.doc-row-main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.doc-row-title { font-size: 14.5px; line-height: 1.35; font-weight: 800; }
.doc-row-sub { font-size: 12.5px; color: var(--ink-muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; min-height: 24px; padding: 3px 9px; border-radius: 12px;
  background: var(--sunken); color: var(--ink-muted); font-size: 12px; line-height: 1.3; font-weight: 700;
}
.chip .ico { width: 13px; height: 13px; }
.chip.is-issued { background: var(--iris-soft); color: var(--ink); }
.chip.is-issued .ico { color: var(--iris); stroke-width: 2.4; }
.chip.is-draft { background: transparent; border: 1px solid var(--line-strong); color: var(--ink); }
.chip.is-free { background: var(--lime); color: var(--on-lime); text-transform: uppercase; letter-spacing: 0.04em; font-size: 11px; }
.chip.is-price { background: var(--ink); color: var(--paper); font-variant-numeric: tabular-nums; }
.doc-row-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.doc-row-acts .btn.is-file { min-width: 78px; }

.pkg { padding: 14px; border: 1px dashed var(--line-strong); border-radius: var(--r-lg); }
.pkg.is-on { border: 1px solid var(--line); background: var(--iris-tint); }
.pkg-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.pkg-head .ico { color: var(--iris); }
.pkg-head b { font-size: 14.5px; }
.pkg-head .chip { margin-left: auto; background: var(--raised); }
.pkg-list { list-style: none; display: grid; gap: 6px; margin: 12px 0 0; padding: 0; font-size: 13px; }
.pkg-list li { display: flex; justify-content: space-between; gap: 10px; padding-bottom: 6px; border-bottom: 1px dashed var(--line); }
.pkg-list li:last-child { padding-bottom: 0; border-bottom: 0; }
.pkg-list b { white-space: nowrap; font-weight: 700; }
.pkg-text { font-size: 13.5px; line-height: 1.5; color: var(--ink-muted); }
.pkg-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.checks-box { margin-top: 12px; padding: 14px; border-radius: var(--r-lg); background: var(--sunken); font-size: 13px; line-height: 1.5; color: var(--ink-muted); }
.checks-box p + p { margin-top: 8px; }
.checks-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--ink); }
.checks-head .ico { color: var(--iris); width: 18px; height: 18px; }
.checks-head b { font-size: 14px; line-height: 1.35; }
.checks-box.is-free .checks-head b { color: var(--ink); }
.checks-rule b { color: var(--ink); }
.checks-warn { display: flex; gap: 6px; color: var(--warn); font-weight: 600; }
.checks-warn .ico { width: 16px; height: 16px; margin-top: 2px; }
.meter { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; margin-bottom: 10px; }
.meter i { height: 6px; border-radius: 3px; background: var(--raised); box-shadow: inset 0 0 0 1px var(--line); }
.meter i.is-used { background: var(--iris); box-shadow: none; }
.meter.is-wide { margin: 10px 0 8px; }

.md { position: relative; font-size: 13.5px; line-height: 1.55; overflow-wrap: anywhere; }
.md.is-clamp:not(.is-open) { max-height: 420px; overflow: hidden; }
.md.is-clamp:not(.is-open)::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 64px; background: linear-gradient(to bottom, transparent, var(--raised)); }
.md-sec { margin: 14px 0 4px; font-size: 13px; font-weight: 800; color: var(--ink); }
.md-sec:first-child { margin-top: 0; }
.md p { margin: 0 0 6px; }
.md ul, .md ol { margin: 0 0 6px; padding-left: 18px; }
.md li { margin: 2px 0; }
.md li.md-sub { margin-left: 14px; }
.md blockquote { margin: 6px 0; padding: 6px 10px; border-left: 3px solid var(--iris); border-radius: 3px 8px 8px 3px; background: var(--iris-tint); color: var(--ink); }
.md blockquote p:last-child { margin-bottom: 0; }
.md .md-h { margin: 10px 0 4px; font-size: 13.5px; font-weight: 800; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }
.md-box { display: inline-block; width: 13px; height: 13px; margin: 0 7px -2px -18px; border: 1.5px solid var(--line-strong); border-radius: 4px; background: var(--raised); }
.md li:has(.md-box) { list-style: none; }
.md-box.is-done { border-color: var(--iris); background: var(--iris) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 11px no-repeat; }
.md-table { overflow-x: auto; margin: 6px 0; }
.md table { border-collapse: collapse; font-size: 12.5px; }
.md th, .md td { padding: 5px 8px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.md th { background: var(--sunken); font-weight: 700; }

.f-group + .f-group { margin-top: 14px; }
.f-label { margin-bottom: 6px; font-size: 12.5px; font-weight: 700; color: var(--ink-muted); }
.f-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; margin: 0 -8px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.f-row:hover { background: var(--iris-tint); color: var(--ink); }
.f-row > .ico { width: 17px; height: 17px; color: var(--ink-faint); opacity: 0; transition: opacity 0.15s; }
.f-row:hover > .ico, .f-row:focus-visible > .ico { opacity: 1; }
.f-ic { flex: none; display: grid; place-items: center; width: 30px; height: 34px; border-radius: 3px 8px 3px 3px; background: var(--sunken); color: var(--ink-muted); font-size: 9px; font-weight: 800; letter-spacing: 0.02em; }
.f-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.f-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 600; }
.f-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--ink-muted); }

/* ---------- просмотр во весь экран ---------- */
.lb-open, .lb-open body { overflow: hidden; }
.lightbox { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); background: rgba(16, 16, 24, 0.94); color: #fff; animation: toast-in 0.15s ease both; }
.lb-bar { display: flex; align-items: center; gap: 12px; padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px 20px; }
.lb-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; }
.lb-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.lb-count { flex: none; font-size: 13px; color: rgba(255, 255, 255, 0.7); font-variant-numeric: tabular-nums; }
.lb-actions { display: flex; align-items: center; gap: 8px; }
.lb-close { display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, 0.1); color: #fff; cursor: pointer; }
.lb-close:hover { background: rgba(255, 255, 255, 0.18); }
.lb-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 8px 64px 16px; touch-action: pan-y pinch-zoom; }
.lb-img { max-width: 100%; max-height: 100%; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
img.lb-img { object-fit: contain; background: #fff; }
.lb-stage .protected.lb-img { aspect-ratio: 210 / 297; background-size: contain; background-position: center; width: min(100%, calc((100dvh - 140px) * 210 / 297)); height: auto; max-height: calc(100dvh - 140px); }
/* крупнее: лист вдвое шире (на компьютере — до 1100 px), прокрутка в обе стороны; листание свайпом выключено */
.lightbox.is-zoomed .lb-stage { display: block; overflow: auto; overscroll-behavior: contain; touch-action: pan-x pan-y pinch-zoom; }
.lightbox.is-zoomed .lb-img, .lightbox.is-zoomed .lb-stage .protected.lb-img { display: block; width: min(200%, 1100px); max-width: none; max-height: none; height: auto; margin: 0 auto; }
.lb-zoom { background: rgba(255, 255, 255, 0.1); color: #fff; }
.lb-zoom:hover { background: rgba(255, 255, 255, 0.18); color: #fff; }
.lb-zoom[aria-pressed="true"] { background: #fff; color: #232335; }
.lb-nav { position: absolute; top: 50%; display: grid; place-items: center; width: 48px; height: 48px; margin-top: -24px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.12); color: #fff; cursor: pointer; }
.lb-nav:hover:not(:disabled) { background: rgba(255, 255, 255, 0.22); }
.lb-nav:disabled { opacity: 0.25; cursor: default; }
.lb-prev { left: 10px; }
.lb-next { right: 10px; }
.lb-note { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px calc(14px + env(safe-area-inset-bottom, 0px)); font-size: 13px; color: rgba(255, 255, 255, 0.75); text-align: center; }
.lb-note .ico { width: 16px; height: 16px; }
.lightbox.is-protected { user-select: none; -webkit-user-select: none; }
.lightbox :focus-visible { outline-color: #fff; }

/* ---------- настройки ---------- */
.settings { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.set-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.set-page { position: relative; max-width: 820px; margin: 0 auto; padding: 28px 28px 110px; }
.set-head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 22px; }
.set-title { font-size: clamp(24px, 1.2vw + 18px, 30px); line-height: 1.15; font-weight: 800; letter-spacing: -0.025em; }
.set-lead { max-width: 64ch; margin-top: 8px; color: var(--ink-muted); line-height: 1.55; }
.set-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.set-actions.is-tight { margin: 0; }
.panel { padding: 20px 22px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--raised); }
.panel-title { margin-bottom: 14px; font-size: 16px; line-height: 1.3; font-weight: 800; letter-spacing: -0.01em; }
.panel-lead { margin: -8px 0 14px; font-size: 13.5px; line-height: 1.55; color: var(--ink-muted); }
.panel.is-note { display: flex; align-items: flex-start; gap: 12px; background: var(--sunken); border-color: transparent; font-size: 14px; line-height: 1.55; color: var(--ink-muted); }
.panel.is-note > .ico { color: var(--iris); margin-top: 1px; }
.panel.is-preview { background: var(--iris-tint); border-color: transparent; }
.panel.is-accent { border-color: var(--iris); }
.panel.is-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 32px 22px; text-align: center; }
.panel.is-empty > .ico { width: 28px; height: 28px; color: var(--iris); }
.panel.is-empty p { max-width: 46ch; color: var(--ink-muted); }
.party-line { font-size: 15px; line-height: 1.6; font-weight: 600; }
.party-line.is-muted { color: var(--ink-muted); font-weight: 500; }
.party-line.is-small { margin-top: 10px; padding: 8px 12px; border-radius: 10px; background: var(--sunken); font-size: 13px; font-weight: 500; color: var(--ink-muted); }
.panel.is-preview .field-hint { margin-top: 8px; }
.save-bar {
  position: sticky; bottom: 16px; z-index: 6; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; width: fit-content; max-width: 100%;
  margin: 18px 0 0 auto; padding: 8px 8px 8px 16px; border-radius: 16px; background: var(--ink); color: var(--paper); box-shadow: var(--shadow-lift);
  font-size: 14px; font-weight: 600; animation: toast-in 0.2s ease both;
}
.save-bar span { margin-right: 6px; }
.save-bar .btn-ghost { background: transparent; color: var(--paper); border-color: color-mix(in srgb, var(--paper) 40%, transparent); }
.save-bar .btn-primary { background: var(--iris); color: var(--on-iris); }
.notice.is-sync { align-items: center; flex-wrap: wrap; background: var(--iris-tint); }
.notice.is-sync > .ico { color: var(--iris); }
.notice.is-sync p { flex: 1 1 240px; }
.set-guide { margin-top: 8px; }
.field-warn { font-size: 12.5px; line-height: 1.4; font-weight: 600; color: var(--warn); }
.field-warn:empty { display: none; }
.boot-fail { max-width: 460px; margin: 0 auto; padding: 0 16px; text-align: center; color: var(--ink-muted); line-height: 1.55; }
.boot-fail .btn { margin-top: 12px; }
.notice { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; margin-bottom: 14px; border-radius: 14px; background: var(--warn-soft); font-size: 14px; line-height: 1.5; }
.notice > .ico { color: var(--warn); margin-top: 1px; }
.notice.is-bad { background: var(--bad-soft); }
.notice.is-bad > .ico { color: var(--bad); }

.profile-card { display: flex; align-items: center; gap: 16px; }
.profile-name { font-size: 18px; font-weight: 800; }
.profile-card p + p { margin-top: 2px; }

.signers .signer { padding: 18px 20px; }
.signer.is-default { border-color: var(--iris); }
.signer-top { display: flex; align-items: center; gap: 12px; }
.signer-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.signer-name { font-size: 15.5px; }
.signer-poa { margin-top: 12px; font-size: 14px; }
.signer-poa span { color: var(--ink-muted); }
.signer-status { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.signer-status .ico { width: 14px; height: 14px; }
.signer-status.is-bad { background: var(--bad-soft); color: var(--bad); }
.signer-status.is-warn { background: var(--warn-soft); color: var(--warn); }
.signer-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }

.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.theme-card {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 8px 8px 12px; text-align: left;
  border: 1.5px solid var(--line); border-radius: var(--r-lg); background: var(--raised); cursor: pointer; transition: border-color 0.15s, transform 0.15s;
}
.theme-card:hover { border-color: var(--line-strong); }
.theme-card.is-on { border-color: var(--iris); background: var(--iris-tint); }
.theme-img { position: relative; display: block; aspect-ratio: 210 / 297; overflow: hidden; border-radius: 6px; background: #fff; box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 8%, transparent); }
.theme-img img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.theme-on { position: absolute; left: 8px; top: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; background: var(--iris); color: #fff; font-size: 11.5px; font-weight: 800; }
.theme-on .ico { width: 13px; height: 13px; stroke-width: 2.6; }
.theme-name { display: flex; align-items: center; gap: 6px; padding: 4px 4px 0; font-size: 14.5px; }
.theme-about { padding: 0 4px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; font-size: 12.5px; line-height: 1.45; color: var(--ink-muted); }
.logo-row { display: flex; align-items: center; gap: 16px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.logo-row .field-hint { margin: 2px 0 10px; }
.logo-box { flex: none; display: grid; place-items: center; width: 120px; height: 80px; padding: 8px; border: 1px dashed var(--line-strong); border-radius: 14px; background: var(--sunken); }
.logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-ok, .logo-none { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink-muted); }
.logo-ok .ico { color: var(--iris); }
.table-wrap { overflow-x: auto; }
.price-table, .pay-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.price-table th, .price-table td, .pay-table th, .pay-table td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
.price-table thead th, .pay-table thead th { font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); }
.price-table tbody th { font-weight: 600; }
.price-table td { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.pay-table .num, .pay-table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 800; }
.pay-table .is-plus { color: var(--ok); }
.pay-table td.nowrap { color: var(--ink-muted); font-size: 13px; }
.premium { background: linear-gradient(135deg, var(--iris-tint), var(--raised) 60%); }
.premium-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.premium-head .ico { color: var(--iris); }
.premium-head .panel-title { margin: 0; }
.premium p { max-width: 66ch; line-height: 1.6; }
.premium p + p { margin-top: 8px; font-size: 13.5px; }
.premium .set-actions { margin: 16px 0 0; }

.stat-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.stat-row .panel { margin: 0; }
.stat-num { margin: 6px 0 4px; font-size: 34px; line-height: 1.05; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat-num small { font-size: 16px; font-weight: 700; color: var(--ink-muted); letter-spacing: 0; }
.stat-num.is-sm { font-size: 24px; margin: 4px 0 6px; }
.pkg-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.pkg-card { padding: 16px; border: 1px solid var(--line); border-radius: var(--r-lg); }
.pkg-card p:last-child { font-size: 13px; line-height: 1.5; color: var(--ink-muted); }
.plist { list-style: none; display: grid; gap: 7px; margin: 0 0 12px; padding: 0; font-size: 14px; }
.plist li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-bottom: 7px; border-bottom: 1px dashed var(--line); }
.plist b { white-space: nowrap; font-variant-numeric: tabular-nums; }
details.more { margin-top: 14px; }
details.more summary { cursor: pointer; font-weight: 700; color: var(--iris); }
.price-text { margin-top: 10px; padding: 14px; border-radius: 14px; background: var(--sunken); font-size: 13.5px; }

.sync { display: grid; grid-template-columns: minmax(96px, 0.5fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px 12px; align-items: stretch; }
.sync-col:first-child { grid-column: 2; }
.sync-head { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; }
.sync-head .ico { color: #2aa1da; }
.sync-head .mk { width: 18px; height: 18px; color: var(--iris); }
.sync-what { align-self: center; font-size: 12.5px; font-weight: 700; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.sync-cell { padding: 10px 12px; border-radius: 12px; background: var(--sunken); font-size: 13.5px; line-height: 1.45; }
.sync-cell:nth-child(3n + 2) { background: var(--iris-tint); }
.steps-list { margin: 0 0 14px; padding-left: 20px; line-height: 1.6; }
.steps-list li + li { margin-top: 6px; }
.faq details { border-top: 1px solid var(--line); }
.faq details:first-child { border-top: 0; }
.faq summary { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; list-style: none; cursor: pointer; font-size: 15.5px; font-weight: 700; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; flex: none; width: 12px; height: 12px; margin-top: 6px;
  background: linear-gradient(var(--iris), var(--iris)) center / 100% 2px no-repeat, linear-gradient(var(--iris), var(--iris)) center / 2px 100% no-repeat;
  transition: transform 0.2s;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { max-width: 68ch; padding: 0 0 16px; color: var(--ink-muted); line-height: 1.6; }
.disclaimer { margin-top: 18px; max-width: 70ch; line-height: 1.55; }

/* ---------- вход ---------- */
.login { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
.login-col { display: flex; flex-direction: column; gap: 28px; padding: clamp(24px, 5vw, 56px) clamp(20px, 5vw, 64px); }
.login-col .brand { align-self: flex-start; }
.login-card { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; max-width: 480px; margin: auto 0; }
.login-title { font-size: clamp(28px, 2vw + 16px, 40px); line-height: 1.08; font-weight: 800; letter-spacing: -0.03em; }
.login-lead { color: var(--ink-muted); font-size: 16px; line-height: 1.6; }
.login-status { width: 100%; }
.login-status .notice { margin: 4px 0 0; }
.login-actions { display: flex; flex-direction: column; gap: 10px; min-height: 48px; margin-top: 6px; }
.tg-widget { min-height: 44px; }
.tg-widget iframe { display: block; }
.tg-fake { display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 22px; border: 0; border-radius: 12px; background: #54a9eb; color: #fff; font: 600 16px var(--font); cursor: pointer; }
.tg-fake .ico { width: 20px; height: 20px; fill: #fff; stroke: none; }
.login-fallback { max-width: 44ch; font-size: 14px; color: var(--ink-muted); }
.login-alt { font-size: 14px; line-height: 1.55; color: var(--ink-muted); }
.login-foot { font-size: 13.5px; color: var(--ink-muted); }
/* картинка справа стоит на месте, пока левая колонка (форма входа) прокручивается */
.login-visual { position: sticky; top: 0; align-self: start; height: 100vh; height: 100dvh; overflow: hidden; display: grid; place-items: center; padding: 48px; background: var(--sunken); }
.lv-wall { position: absolute; top: 0; bottom: 0; left: 34%; right: 0; background: var(--wall); clip-path: polygon(22% 0, 100% 0, 100% 100%, 0 100%); }
.lv-sheet {
  position: relative; z-index: 1; width: min(380px, 80%); aspect-ratio: 210 / 297; padding: 8% 7.5%; margin-left: 18%;
  background: #fff; color: #232335; box-shadow: var(--shadow-lift); font-size: 11px; line-height: 1.55;
}
.lv-head { display: flex; align-items: center; gap: 8px; padding-bottom: 10px; margin-bottom: 14px; border-bottom: 2px solid #6355db; }
.lv-head .mk { width: 22px; height: 22px; color: #6355db; }
.lv-head span { display: flex; flex-direction: column; }
.lv-head b { font-size: 15px; font-weight: 800; letter-spacing: -0.02em; }
.lv-head small { font-size: 8px; color: #6a6980; }
.lv-title { font-size: 16px; font-weight: 800; line-height: 1.2; }
.lv-place { display: flex; justify-content: space-between; margin: 6px 0 12px; font-weight: 700; font-size: 10px; }
.lv-p mark { background: transparent; color: #232335; font-weight: 700; }
.lv-lines i { display: block; height: 6px; margin: 9px 0; border-radius: 3px; background: #f0eef9; }
.lv-lines i.short { width: 60%; }
.lv-mark { position: absolute; left: 50%; top: 55%; transform: translate(-50%, -50%) rotate(-30deg); font-size: 58px; font-weight: 800; letter-spacing: 0.1em; color: rgba(99, 85, 219, 0.07); }
.lv-chat {
  position: absolute; z-index: 2; left: 8%; bottom: 12%; width: min(300px, 60%); padding: 14px;
  border: 1px solid var(--line); border-radius: 20px; background: var(--raised); box-shadow: var(--shadow-lift);
}
.lv-bubble { padding: 10px 12px; border-radius: 6px 14px 14px 14px; background: var(--iris-soft); font-size: 13.5px; line-height: 1.45; }
.lv-btn { display: flex; align-items: center; justify-content: center; gap: 6px; height: 38px; margin-top: 8px; border-radius: 11px; background: var(--iris); color: var(--on-iris); font-weight: 700; font-size: 13.5px; }
.lv-btn .ico { width: 16px; height: 16px; stroke-width: 2.2; }
.lv-sync { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12px; color: var(--ink-muted); }
.lv-sync .ico { width: 15px; height: 15px; color: #2aa1da; }
.login.is-role, .login.is-fatal { grid-template-columns: minmax(0, 1fr); }
.login-col.is-wide .login-card { max-width: 760px; margin: auto; }
.role-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; width: 100%; margin-top: 8px; }
.role-card {
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 22px; text-align: left;
  border: 1.5px solid var(--line); border-radius: var(--r-xl); background: var(--raised); cursor: pointer; transition: border-color 0.15s, transform 0.15s;
}
.role-card:hover { border-color: var(--iris); transform: translateY(-1px); }
.role-card b { font-size: 19px; line-height: 1.25; font-weight: 800; letter-spacing: -0.01em; }
.role-card > span { color: var(--ink-muted); }
.role-card ul { list-style: none; display: grid; gap: 6px; margin: 6px 0 0; padding: 0; font-size: 14px; }
.role-card li { position: relative; padding-left: 22px; }
.role-card li::before { content: ""; position: absolute; left: 2px; top: 0.4em; width: 10px; height: 5px; border-left: 2px solid var(--iris); border-bottom: 2px solid var(--iris); transform: rotate(-45deg); }
.role-card .role-go { display: inline-flex; align-items: center; gap: 4px; margin-top: auto; padding-top: 10px; color: var(--iris); font-weight: 800; }
.role-go .ico { width: 16px; height: 16px; }

/* вход по логину и паролю: вкладки «Вход» и «Регистрация»; те же поля — в «Новом пароле» и в «Настройки → Вход» */
.login-accent { color: var(--iris); }
.login.is-pw .login-card { gap: 16px; }
.login-auth { display: flex; flex-direction: column; gap: 18px; width: 100%; }
.login-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--sunken); }
.login-tab {
  min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent;
  font: 700 15px/1.2 var(--font); color: var(--ink-muted); cursor: pointer; transition: background-color 0.15s, color 0.15s;
}
.login-tab:hover { color: var(--ink); }
.login-tab[aria-selected="true"] { background: var(--raised); color: var(--ink); box-shadow: 0 1px 2px rgba(35, 35, 53, 0.08), 0 2px 8px -4px rgba(35, 35, 53, 0.2); }
.login-panel { width: 100%; }
.login-form, .pw-form { display: flex; flex-direction: column; gap: 14px; width: 100%; }
.pw-form { max-width: 480px; margin-top: 4px; }
.input.is-big { min-height: 52px; padding: 12px 15px; font-size: 17px; border-radius: 14px; }
.btn-lg { min-height: 52px; font-size: 16px; border-radius: 14px; }
/* подпись поля и ссылка справа от неё («Забыли пароль?») */
.field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.pw-box { display: flex; flex-direction: column; gap: 6px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 54px; }
.pw-wrap.no-eye .input { padding-right: 15px; }
/* своя кнопка «показать пароль» — встроенную в Edge прячем, чтобы не было двух глаз */
.pw-input::-ms-reveal, .pw-input::-ms-clear { display: none; }
.pw-eye {
  position: absolute; top: 50%; right: 4px; display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 10px; background: transparent; color: var(--ink-muted); cursor: pointer; transform: translateY(-50%);
}
.pw-eye:hover { background: var(--iris-tint); color: var(--ink); }
.pw-eye[aria-pressed="true"] { color: var(--iris); }
.pw-eye .ico { width: 22px; height: 22px; }
.field-caps { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--warn); }
.field-caps .ico { width: 15px; height: 15px; }
.form-err { padding: 10px 12px; border-radius: 12px; background: var(--bad-soft); font-size: 14px; line-height: 1.45; font-weight: 600; color: var(--bad); }
.form-err:empty { display: none; }
.login-forgot { font-size: 13.5px; }
/* «Забыли пароль?»: почты нет — что делать */
.login-help { padding: 12px 14px; border-radius: 12px; background: var(--sunken); font-size: 14px; line-height: 1.55; color: var(--ink-muted); }
.login-help b { color: var(--ink); }
.login-help ul { display: grid; gap: 6px; margin: 8px 0 0; padding-left: 18px; }
.login-terms { font-size: 12.5px; line-height: 1.5; color: var(--ink-muted); }
/* закрытый тест под кнопкой «Зарегистрироваться»; «Пользуетесь ботом?» под кнопкой Telegram */
.login-note { padding: 10px 12px; border-radius: 12px; background: var(--sunken); font-size: 13.5px; line-height: 1.5; color: var(--ink-muted); }
.login-note b, .login-alt b { color: var(--ink); }
.login-or { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 8px; color: var(--ink-muted); font-size: 13px; font-weight: 700; }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.notice.is-ok { background: var(--iris-tint); }
.notice.is-ok > .ico { color: var(--iris); }
.lv-sync.is-web .ico { color: var(--iris); stroke-width: 2.2; }
.login-col.is-narrow .login-card { max-width: 560px; margin: auto; }
.login-badge { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--iris-soft); color: var(--iris); }
.login-badge .ico { width: 26px; height: 26px; }
.login-email { overflow-wrap: anywhere; color: var(--ink); }
.login-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
/* настройки → «Вход»: строка канала (почта, Telegram) со значком и отметкой */
.login-row { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.login-row > .ico { width: 22px; height: 22px; margin-top: 1px; color: var(--iris); }
.login-row > div { flex: 1; min-width: 0; }
.login-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-bottom: 2px; }
.login-line b { overflow-wrap: anywhere; }
.set-actions.is-tight + .field-hint { margin-top: 10px; }

/* ---------- планшет: карточка — выезжающей панелью ---------- */
@media (max-width: 1179px) {
  .shell.has-card .cols { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .shell.has-card .col-card {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 40; width: min(400px, 92vw); display: flex;
    padding-top: env(safe-area-inset-top, 0px); box-shadow: var(--shadow-lift);
    transform: translateX(105%); visibility: hidden; transition: transform 0.24s ease, visibility 0s linear 0.24s;
  }
  .shell.card-open .col-card { transform: none; visibility: visible; transition: transform 0.24s ease; }
  .shell.card-open .scrim { display: block; }
  .chat-cardbtn { display: inline-flex; }
  .card-close { display: inline-grid !important; }
}
@media (max-width: 980px) {
  :root { --side-w: 280px; }
  .chat-lane, .composer { padding-left: 16px; padding-right: 16px; }
  .chat-head { padding-left: 16px; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-visual { display: none; }
}

/* ---------- телефон: одна панель, вкладки снизу ---------- */
@media (max-width: 760px) {
  body { font-size: 15px; }
  .only-phone { display: inline-grid !important; }
  .shell { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); }
  .cols, .shell.has-card .cols { display: block; }
  .col-side, .col-main, .col-card, .shell.has-card .col-card {
    position: absolute; inset: 0; width: auto; z-index: auto; display: none; border: 0; box-shadow: none;
    transform: none; visibility: visible; transition: none; padding-top: 0;
  }
  .shell[data-pane="side"] .col-side, .shell[data-pane="main"] .col-main, .shell[data-pane="card"] .col-card { display: flex; }
  .shell.card-open .scrim { display: none; }
  .col-side { background: var(--paper); }
  .deal-item:hover { background: transparent; }
  .deal-item.is-active { background: transparent; }
  .deal-item.is-active::before { display: none; }
  .deal-item { padding: 12px 10px; }
  .deal-no { width: 44px; height: 44px; border-radius: 13px; }
  .side-foot .user-chip { display: none; }
  .side-foot { padding-bottom: 10px; }
  /* список сделок: «Архив» — последней строкой списка, прокручивается вместе с ним и не отнимает экран */
  .side-inner { overflow-y: auto; overscroll-behavior: contain; }
  .side-list { flex: none; overflow: visible; }
  .side-head { padding-top: 8px; padding-bottom: 2px; }
  .dot { box-shadow: 0 0 0 3px var(--paper); }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: grid; grid-template-columns: repeat(4, 1fr);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px);
    border-top: 1px solid var(--line); background: color-mix(in srgb, var(--raised) 94%, transparent);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  }
  .tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink-muted); font-size: 11.5px; font-weight: 700; text-decoration: none; }
  .tab .ico { width: 22px; height: 22px; }
  .tab.is-active { color: var(--iris); }
  .tab.is-off { opacity: 0.4; }
  .is-composing .tabbar { display: none; }
  .is-composing .shell { padding-bottom: 0; }
  .chat-head { min-height: 56px; padding: 6px 8px 6px 4px; }
  .chat-title { font-size: 16px; }
  .chat-cardbtn { display: none; }
  .chat-lane { padding: 10px 12px 8px; }
  .msg { gap: 8px; }
  .msg .ava-bot, .ava-gap { width: 28px; height: 28px; border-radius: 9px; }
  .msg .ava-bot .mk { width: 14px; height: 14px; }
  .msg-col { max-width: 88%; }
  .msg.is-me .msg-col { max-width: 86%; }
  .bubble { font-size: 15px; }
  .album.n-2, .album.n-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); width: min(100%, 300px); }
  .album.n-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); width: min(100%, 220px); }
  .doc-card { min-width: 0; }
  .kb-btn { min-height: 42px; }
  .composer { padding: 6px 10px 8px; }
  .comp-hint { display: none; }
  /* файлы в очереди — одной строкой с прокруткой вбок: три файла не вытесняют переписку над клавиатурой */
  .att-list { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
  .att-list::-webkit-scrollbar { display: none; }
  .att { flex: none; max-width: min(78vw, 320px); }
  .to-bottom { right: 12px; min-height: 44px; font-size: 14px; }
  .card-back { display: inline-grid !important; }
  .card-close { display: none !important; }
  .card-head { padding: 6px 12px 6px 4px; min-height: 56px; }
  .card-scroll { padding: 0 16px 24px; }
  .set-page { padding: 12px 16px 96px; }
  .set-head { margin: 0 0 16px -8px; }
  .set-head .icon-btn { margin-top: 0; }
  .set-title { font-size: 24px; padding-top: 4px; }
  .panel { padding: 16px; border-radius: var(--r-lg); }
  .grid-2, .grid-3, .choice-grid, .stat-row, .pkg-cards, .role-grid { grid-template-columns: minmax(0, 1fr); }
  .set-link { min-height: 54px; }
  .is-settings .side-tools { display: none; }
  .seg.is-wrap { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .set-chev { display: block; }
  .set-nav .set-link.is-active { background: transparent; }
  .theme-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  /* прокрутка настроек и так кончается над вкладками — отступ от её низа, а не от низа экрана (было +60 px: плашка висела над полем) */
  .save-bar { bottom: 10px; left: 0; right: 0; width: auto; margin-left: 0; }
  /* текст — строкой, обе кнопки — второй строкой поровну, «Сохранить» справа */
  .save-bar span { flex-basis: 100%; margin-right: 0; }
  .save-bar .btn { flex: 1 1 0; }
  /* подписант: чип «по умолчанию» — под именем, имя и должность занимают всю ширину */
  .signer-top { flex-wrap: wrap; row-gap: 8px; }
  .signer-top > .signer-main { flex-basis: calc(100% - 46px); }
  .signer-top > .chip { margin-left: 46px; }
  .sync { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .sync-col:first-child { grid-column: 1; }
  .sync-what { grid-column: 1 / -1; margin-top: 6px; }
  .toasts { bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom, 0px)); }
  .demo-bar { padding: 6px 12px; font-size: 12.5px; }
  .demo-long { display: none; }
  .modal-box { padding: 18px; }
  .lb-stage { padding: 8px 8px 12px; }
  .lb-nav { top: auto; bottom: calc(52px + env(safe-area-inset-bottom, 0px)); }
  .login-col { gap: 22px; }
  .main-empty { padding: 24px; }
  .logo-row { flex-direction: column; align-items: flex-start; }
}

/* обращения «Персональные данные» (настройки владельца) */
.pd-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 10px; }
.pd-no { font-size: 16px; font-weight: 800; }
.pd-meta { font-size: 13px; color: var(--ink-muted); }
.pd-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.55; }
.pd-answer { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.panel.pd-item.is-overdue { border-color: var(--bad); }
.chip.is-overdue { background: var(--bad-soft); color: var(--bad); }

@media (hover: none) {
  .f-row > .ico { opacity: 1; }
}

@media print {
  .protected, .album.is-protected, .lightbox { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ссылки на оферту и политику внизу меню настроек */
.side-legal { margin: 4px 10px 0; font-size: 12.5px; line-height: 1.5; color: var(--ink-muted); }
.side-legal a { color: inherit; text-underline-offset: 2px; }
.side-legal a:hover { color: var(--ink); }

/* ---------- телефон и планшет с пальцем: касание от 44 px, поля ввода 16 px (иначе iOS увеличивает страницу) ---------- */
@media (max-width: 760px), (pointer: coarse) {
  .input, .comp-input, .search-input { font-size: 16px; }
  .search-input { min-height: 44px; }
  .icon-btn, .comp-attach, .comp-send, .lb-close, .doc-acts .icon-btn { width: 44px; height: 44px; }
  .comp-input { min-height: 44px; padding-top: 11px; padding-bottom: 11px; }
  .btn-sm, .btn-xs, .seg-btn, .kb-btn, .side-link, .brand, .link-arrow, .toast-act { min-height: 44px; }
  .btn-xs { padding: 0 13px; }
  /* крестик у файла в очереди: зона касания 44 px, карточка файла той же высоты */
  .att-x { width: 44px; height: 44px; margin: -7px -4px -7px 0; }
  /* кнопка-ссылка в строке текста: зона касания выше и ниже, строки не раздвигаются */
  .link-btn { padding-top: 13px; padding-bottom: 13px; margin-top: -13px; margin-bottom: -13px; }
  /* ссылки под входом и внизу меню настроек — столбиком, строка в 44 px; точка-разделитель не висит в конце строки */
  .login-foot, .side-legal { display: flex; flex-direction: column; align-items: flex-start; }
  .login-foot .sep, .side-legal .sep { display: none; }
  .login-foot a { display: inline-flex; align-items: center; min-height: 44px; }
  .side-legal { margin-top: 0; }
  .side-legal a { display: inline-flex; align-items: center; min-height: 44px; line-height: 1.3; }
  /* длинная кнопка («Политика обработки персональных данных») переносится, а не вылезает за экран */
  .set-actions .btn { max-width: 100%; white-space: normal; text-align: left; line-height: 1.3; padding-top: 8px; padding-bottom: 8px; }
}
/* ---------- телефон: основной текст от 15 px, пояснения от 14 px; время, размеры, счётчики и подписи капсом — как были ---------- */
@media (max-width: 760px) {
  .deal-title, .set-link, .doc-row-title { font-size: 16px; }
  .side-empty, .side-link, .doc-name, .md, .md .md-h, .f-name, .pkg-text, .c-empty, .c-more, .link-arrow.is-small,
  .checks-head b, .field-label, .panel-lead, .panel.is-note, .check, .notice, .signer-poa, .price-text, .toast,
  .login-note, .login-alt, .login-foot, .login-fallback, .login-help, .form-err, .role-card ul, .kb-btn, .btn-sm, .seg-btn,
  .side-legal, .demo-bar { font-size: 15px; }
  .deal-prev, .md-sec, .doc-row-sub, .doc-sub, .c-note, .checks-box, .field-hint, .field-err, .field-warn, .choice span:not(.choice-mark),
  .party-line.is-small, .pkg-list, .pkg-card p:last-child, .sync-cell, .login-terms, .login-or, .field-caps, .lb-note, .att-name, .b-protect,
  .tap-pill, .small, .user-sub, .chat-sub, .theme-about, .md table { font-size: 14px; }
  /* поле ввода внизу: пока клавиатура закрыта (вкладки спрятаны на время ввода) — отступ от полоски «домой»;
     над открытой клавиатурой iOS отступ не нужен — --kb ставит main.js по visualViewport */
  .is-composing .composer { padding-bottom: calc(8px + max(0px, env(safe-area-inset-bottom, 0px) - var(--kb, 0px))); }
  /* меню настроек: низ («Выйти», оферта, политика) прокручивается вместе со списком, а не отнимает у него экран */
  .side-inner.is-settings { overflow-y: auto; overscroll-behavior: contain; }
  .is-settings .set-nav { flex: none; overflow: visible; }
}
/* планшет: карточка сделки выезжает до низа экрана — последний блок не под полоской «домой» */
@media (min-width: 761px) and (max-width: 1179px) {
  .shell.has-card .col-card .card-scroll { padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }
}
