/* Manrope (SIL Open Font License) — локально, без Google Fonts: страницы не ждут внешний сервер */
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 400 800; font-display: swap; src: url('/fonts/manrope-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 400 800; font-display: swap; src: url('/fonts/manrope-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 {
    --bg: #f4f2ee;
    --surface: #ffffff;
    --surface-2: #faf8f5;
    --ink: #1b2533;
    --ink-2: #3c4655;
    --muted: #7a818c;
    --line: #e9e5de;
    --primary: #1f3a5f;
    --primary-ink: #ffffff;
    --primary-soft: #e8eef6;
    --accent: #c47f3f;
    --sand: #f7ece1;
    --sage: #e8f0ea;
    --sky: #e6edf6;
    --ok: #2f7a54;   --ok-bg: #e3f2e9;
    --warn: #9a6512; --warn-bg: #fbf0dc;
    --bad: #b03a32;  --bad-bg: #fbe5e2;
    --info: #2d5b8f; --info-bg: #e5eef9;
    --radius: 20px;
    --radius-sm: 12px;
    --shadow: 0 1px 2px rgba(27, 37, 51, .04), 0 8px 24px -12px rgba(27, 37, 51, .10);
    --side-w: 256px;
    --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #12161c; --surface: #1a2029; --surface-2: #161b23; --ink: #e9edf3; --ink-2: #c4cbd6; --muted: #8b94a3;
        --line: #283040; --primary: #8fb3e6; --primary-ink: #0f1722; --primary-soft: #1f2b3d; --sand: #2a241e; --sage: #1d2a23; --sky: #1c2635;
        --ok: #7fcf9f; --ok-bg: #1b3326; --warn: #e6b765; --warn-bg: #352a17; --bad: #f08c84; --bad-bg: #3a1f1d; --info: #94bbec; --info-bg: #1c2a3d;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #12161c; --surface: #1a2029; --surface-2: #161b23; --ink: #e9edf3; --ink-2: #c4cbd6; --muted: #8b94a3;
    --line: #283040; --primary: #8fb3e6; --primary-ink: #0f1722; --primary-soft: #1f2b3d; --sand: #2a241e; --sage: #1d2a23; --sky: #1c2635;
    --ok: #7fcf9f; --ok-bg: #1b3326; --warn: #e6b765; --warn-bg: #352a17; --bad: #f08c84; --bad-bg: #3a1f1d; --info: #94bbec; --info-bg: #1c2a3d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
}

/* ===== База ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; line-height: 1.15; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.art { width: 100%; height: auto; stroke: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ===== Каркас ===== */
.shell { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 22px 16px; border-right: 1px solid var(--line); display: flex; flex-direction: column; background: var(--bg); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 22px; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--primary); color: var(--primary-ink); }
.brand-name { font-weight: 800; font-size: 22px; letter-spacing: -.03em; }
.brand-name i { color: var(--accent); font-style: normal; }
.side-label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 6px 12px 10px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--ink-2); font-weight: 500; transition: background .15s, color .15s; }
.side-nav a:hover { background: var(--surface); color: var(--ink); }
.side-nav a.active { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: var(--shadow); }
.side-nav a.active svg { color: var(--accent); }
.side-foot { margin-top: auto; padding-top: 18px; display: flex; gap: 6px; flex-wrap: wrap; }
.link-btn { text-decoration: none; display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 8px 12px; border-radius: 10px; color: var(--muted); cursor: pointer; font-weight: 500; }
.link-btn:hover { background: var(--surface); color: var(--ink); }
.link-btn svg { width: 18px; height: 18px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 16px 40px; position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); }
.topbar-spacer { flex: 1; }
.me { display: flex; align-items: center; gap: 12px; }
.me-name { color: var(--muted); font-weight: 500; }
.avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--sand); color: var(--accent); font-weight: 700; flex: none; }
.avatar.sm { width: 34px; height: 34px; font-size: 14px; }
.content { padding: 8px 40px 56px; max-width: 1280px; width: 100%; }
.only-mobile { display: none !important; }
.tabbar, .scrim { display: none; }

/* ===== Заголовок страницы ===== */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 8px 0 24px; flex-wrap: wrap; }
.eyebrow { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.page-head h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 800; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ===== Карточки ===== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card + .card, .stack > * + * { margin-top: 16px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 16px; }
.card-head > h2 { flex: 1 1 180px; min-width: 0; }
.card-head h2 { font-size: 19px; font-weight: 700; }
.count { color: var(--muted); font-size: 13px; white-space: nowrap; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.split-l { display: grid; gap: 16px; grid-template-columns: 320px minmax(0, 1fr); align-items: start; }
.empty { color: var(--muted); padding: 8px 0; }
.empty-big { text-align: center; padding: 32px 12px; color: var(--muted); }
.empty-big svg { width: 36px; height: 36px; color: var(--line); stroke-width: 1.4; margin-bottom: 8px; }

/* Герой на главной */
.hero { position: relative; overflow: hidden; background: var(--sky); border: 0; display: grid; grid-template-columns: 1fr minmax(180px, 360px); gap: 24px; align-items: center; padding: 28px 32px; }
.hero h2 { font-size: 17px; font-weight: 700; }
.hero .big { font-size: clamp(64px, 9vw, 104px); font-weight: 800; letter-spacing: -.05em; line-height: 1; margin: 18px 0 6px; }
.hero .big small { font-size: 16px; font-weight: 600; letter-spacing: 0; color: var(--ink-2); margin-left: 6px; }
.hero .foot { display: flex; gap: 22px; margin-top: 18px; padding-top: 14px; border-top: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); font-size: 14px; color: var(--ink-2); }
.hero .foot b { color: var(--ink); }
.corner-link { position: absolute; top: 18px; right: 18px; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); }
.corner-link svg { width: 16px; height: 16px; }

.stat { border: 0; position: relative; }
.stat .val { font-size: clamp(36px, 5vw, 52px); font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.stat .val small { font-size: 14px; font-weight: 600; letter-spacing: 0; margin-left: 4px; color: var(--ink-2); }
.stat .lbl { margin-top: 10px; color: var(--ink-2); }
.stat .ico { position: absolute; top: 18px; right: 18px; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: color-mix(in srgb, var(--surface) 70%, transparent); color: var(--ink-2); }
.stat .ico svg { width: 18px; height: 18px; }
.stat .val.money { font-size: clamp(20px, 2.2vw, 26px); white-space: nowrap; }
.stat.sand { background: var(--sand); }
.stat.sage { background: var(--sage); }
.stat.sky { background: var(--sky); }
.stat.plain .val { font-size: 34px; }
.stat.plain .lbl { margin: 0 0 8px; font-size: 13px; font-weight: 600; }
.stat a.stretched::after { content: ""; position: absolute; inset: 0; }

/* ===== Формы ===== */
.form { display: grid; gap: 14px; }
.form-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: end; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input, select.input, textarea.input {
    width: 100%; height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface-2); outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea.input { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; }
.input:focus { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px var(--primary-soft); }
.searchbar { display: flex; gap: 10px; }
.searchbar .input { flex: 1; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent; background: var(--primary); color: var(--primary-ink); font-weight: 700; cursor: pointer; white-space: nowrap; transition: transform .1s, filter .15s; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; }
.btn.soft { background: var(--primary-soft); color: var(--primary); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.icon { width: 44px; padding: 0; }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }

/* ===== Чипы и бейджи ===== */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: 14px; white-space: nowrap; }
.chip.active { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.chip .n { font-size: 12px; opacity: .7; }
.badge { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--primary-soft); color: var(--primary); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.mute { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.tag { display: inline-flex; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }

/* ===== Списки-карточки ===== */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.tile { position: relative; display: flex; gap: 16px; align-items: center; padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); transition: border-color .15s, transform .15s, box-shadow .15s; }
a.tile:hover, .tile.hover:hover { border-color: color-mix(in srgb, var(--primary) 35%, var(--line)); box-shadow: var(--shadow); transform: translateY(-1px); }
.tile .body { flex: 1; min-width: 0; }
.tile .title { font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; }
.tile .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.tile .meta { display: flex; gap: 14px; margin-top: 8px; font-size: 13px; color: var(--ink-2); flex-wrap: wrap; }
.tile .thumb { width: 84px; flex: none; }
.letter { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--sand); color: var(--accent); font-weight: 800; font-size: 18px; flex: none; }
.letter.blue { background: var(--sky); color: var(--info); }

/* Бронь */
.booking { padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); display: grid; gap: 14px; }
.booking-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.booking-top > div:first-child { min-width: 0; }
.booking .badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; flex: none; max-width: 50%; }
.pct { font-weight: 700; color: var(--muted); font-size: 14px; }
.pay-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.pay-line .badge { margin-left: auto; }
.pay-form { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.cards-auto { grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); }
.stats-auto { grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }
.booking-top .title { font-weight: 700; }
.booking-mid { display: flex; gap: 14px; align-items: center; }
.booking-mid .thumb { width: 92px; flex: none; padding: 8px; border-radius: 14px; background: var(--sky); }
.city { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 17px; }
.city svg { width: 16px; height: 16px; color: var(--muted); }
.specs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 99px; }
.booking-nums { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.booking-nums .q { font-size: 30px; font-weight: 800; letter-spacing: -.03em; }
.booking-nums .q small { font-size: 14px; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.booking-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.booking-actions form { display: flex; gap: 6px; }
.booking-actions .input { height: 34px; width: 70px; padding: 0 10px; border-radius: 10px; }

/* Таблица */
.table-wrap { overflow-x: auto; margin: 0 -24px; padding: 0 24px; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 600; letter-spacing: .02em; }
.right { text-align: right; }
.amount-in { color: var(--ok); font-weight: 700; }
.amount-out { color: var(--ink); font-weight: 700; }

/* Список строк (юрлица, журнал) */
.rows > * { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.rows > *:last-child { border-bottom: 0; }
.rows .t { font-weight: 700; }
.timeline > * { display: grid; grid-template-columns: 56px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.timeline > *:last-child { border-bottom: 0; }
.timeline time { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; padding-top: 2px; }

/* Задачи */
.task { padding: 18px 0; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.task:last-child { border-bottom: 0; }
.task-top { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; }
.task-title { font-weight: 700; }
.task.done .task-title { text-decoration: line-through; color: var(--muted); }
details.disc { border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
details.disc summary { cursor: pointer; padding: 12px 16px; font-weight: 600; font-size: 14px; list-style: none; display: flex; justify-content: space-between; }
details.disc summary::-webkit-details-marker { display: none; }
details.disc summary::after { content: "+"; color: var(--muted); font-weight: 400; font-size: 18px; line-height: 1; }
details.disc[open] summary::after { content: "–"; }
details.disc .disc-body { padding: 0 16px 14px; display: grid; gap: 10px; }
.comment { font-size: 14px; }
.comment b { font-weight: 700; }

/* Чат */
.chat { display: flex; flex-direction: column; height: min(72vh, 760px); padding: 0; overflow: hidden; }
.chat-head { padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.chat-feed { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }
.msg { max-width: min(560px, 85%); padding: 10px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); align-self: flex-start; }
.msg.mine { align-self: flex-end; background: var(--primary); color: var(--primary-ink); border-color: transparent; border-bottom-right-radius: 6px; }
.msg:not(.mine) { border-bottom-left-radius: 6px; }
.msg .who { font-size: 12px; font-weight: 700; display: flex; gap: 8px; margin-bottom: 2px; opacity: .85; }
.msg .who time { font-weight: 500; opacity: .7; }
.msg .text { white-space: pre-wrap; word-wrap: break-word; }
.msg.action { align-self: center; background: var(--ok-bg); color: var(--ok); border: 0; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; }
.chat-form { display: flex; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line); background: var(--surface); }
.chat-form textarea { flex: 1; min-height: 46px; height: 46px; max-height: 160px; padding: 12px 14px; resize: none; }
.rooms { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.room { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px; min-width: 0; }
.room:hover { background: var(--surface-2); }
.room.active { background: var(--sand); }
.room .body { min-width: 0; }
.room .t { font-weight: 700; font-size: 14px; }
.room .p { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ИИ */
.ai-hero { background: linear-gradient(135deg, var(--primary-soft), var(--sand)); border: 0; }
.ai-hero p { margin: 8px 0 0; color: var(--ink-2); max-width: 720px; }
.prompts { display: flex; flex-wrap: wrap; gap: 8px; }
.prompt { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 14px; font-size: 13px; cursor: pointer; text-align: left; color: var(--ink-2); }
.prompt:hover { border-color: var(--primary); color: var(--ink); }
.typing { display: none; align-self: flex-start; color: var(--muted); font-size: 13px; padding: 6px 2px; }
.typing.on { display: block; }

/* Уведомления */
.toast { padding: 12px 16px; border-radius: 14px; margin: 0 0 16px; font-weight: 600; font-size: 14px; animation: drop .25s ease-out; }
.toast.ok { background: var(--ok-bg); color: var(--ok); }
.toast.err { background: var(--bad-bg); color: var(--bad); }
.note { padding: 12px 16px; border-radius: 14px; background: var(--warn-bg); color: var(--warn); font-size: 14px; }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }

/* Модалка (<dialog>) */
dialog.modal { border: 0; padding: 0; border-radius: 22px; width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .35); }
dialog.modal::backdrop { background: rgba(18, 22, 28, .45); backdrop-filter: blur(2px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px 0; }
.modal-head h2 { font-size: 20px; }
.modal-body { padding: 18px 24px 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* Вход */
.login-wrap { min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--sky); display: flex; flex-direction: column; justify-content: space-between; padding: 40px; }
.login-art h1 { font-size: clamp(30px, 3.4vw, 46px); font-weight: 800; max-width: 460px; }
.login-art .art { max-width: 480px; align-self: center; }
.login-form { display: grid; place-items: center; padding: 32px 20px; }
.login-form .card { width: min(400px, 100%); }

/* ===== Мобильные ===== */
@media (max-width: 1100px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split, .split-l { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; z-index: 50; inset: 0 auto 0 0; width: min(300px, 84vw); transform: translateX(-102%); transition: transform .25s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .2); background: var(--bg); }
    body.menu-open .sidebar { transform: none; }
    .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(18, 22, 28, .4); opacity: 0; pointer-events: none; transition: opacity .2s; }
    body.menu-open .scrim { opacity: 1; pointer-events: auto; }
    .only-mobile { display: inherit !important; }
    .topbar { padding: 12px 16px; }
    .topbar .brand { padding: 0; }
    .topbar .brand-name { font-size: 20px; }
    .me-name { display: none; }
    .avatar { width: 36px; height: 36px; }
    .content { padding: 4px 16px calc(96px + env(safe-area-inset-bottom)); }
    .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
    .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: 11px; font-weight: 600; color: var(--muted); border: 0; background: none; border-radius: 12px; }
    .tabbar .active { color: var(--primary); }
    .tabbar .active svg { stroke-width: 2.1; }
    .card { padding: 18px; border-radius: 18px; }
    .table-wrap { margin: 0 -18px; padding: 0 18px; }
    .hero { grid-template-columns: 1fr; padding: 22px; }
    .hero .art-box { order: -1; width: 62%; max-width: 240px; margin: -6px auto 0 0; }
    .hero .art-box.art-sm { display: none; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .tiles { grid-template-columns: 1fr; }
    .searchbar { flex-wrap: wrap; }
    .searchbar .btn { flex: 1; }
    .page-head { margin-bottom: 16px; }
    .chat { height: calc(100dvh - 210px); }
    .login-wrap { grid-template-columns: 1fr; }
    .login-art { padding: 24px; gap: 12px; }
    .login-art .art { max-width: 260px; }
    /* таблица → карточки */
    table.stack-sm thead { display: none; }
    table.stack-sm, table.stack-sm tbody, table.stack-sm tr, table.stack-sm td { display: block; width: 100%; }
    table.stack-sm tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
    table.stack-sm td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; }
    table.stack-sm td::before { content: attr(data-l); color: var(--muted); font-size: 13px; }
    table.stack-sm td.right { text-align: right; }
}
@media (max-width: 420px) {
    .grid-4 { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat.plain .val { font-size: 28px; }
}
@media (max-width: 900px) { .hide-sm { display: none; } }
.msg.err { background: var(--bad-bg); color: var(--bad); border: 0; }
code { font-family: ui-monospace, Menlo, monospace; font-size: .92em; background: color-mix(in srgb, var(--ink) 7%, transparent); padding: 1px 5px; border-radius: 5px; }
.grid > .card, .split > .card, .split-l > .card { margin-top: 0; }
table.stack-sm td::before { font-family: var(--font); font-weight: 500; letter-spacing: 0; }
[hidden] { display: none !important; }

/* ===================================================================
   v2: защита от наездов + живость (анимации, глубина, акценты)
   =================================================================== */

/* --- Ничего не вылезает за свои блоки --- */
.card, .tile, .booking, .task, .rows > *, .timeline > * > div, .room .body, .field { min-width: 0; }
.tile .title, .booking .title, .rows .t, .task-title, h1, h2, h3 { overflow-wrap: anywhere; }
.page-head > div:first-child { min-width: 0; }
.corner-link { z-index: 2; }
.hero > *:not(.corner-link) { position: relative; z-index: 1; }

/* --- Фон страницы: лёгкие цветные пятна --- */
body {
    background:
        radial-gradient(900px 500px at 105% -10%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 60%),
        radial-gradient(700px 500px at -10% 110%, color-mix(in srgb, var(--primary) 7%, transparent), transparent 60%),
        var(--bg);
    background-attachment: fixed;
}

/* --- Герой: градиент, сетка, «плавающие» контейнеры --- */
.hero {
    background:
        radial-gradient(420px 260px at 85% 20%, color-mix(in srgb, #fff 55%, transparent), transparent 70%),
        linear-gradient(135deg, var(--sky), color-mix(in srgb, var(--sky) 70%, var(--sand)));
}
.hero::before {
    content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
    background-image: linear-gradient(color-mix(in srgb, var(--ink) 6%, transparent) 1px, transparent 1px),
                      linear-gradient(90deg, color-mix(in srgb, var(--ink) 6%, transparent) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: linear-gradient(110deg, transparent 35%, #000 90%);
}
/* Контейнеры «ставятся» на штабель при открытии главной, потом слегка покачиваются */
.hero .art > g { transform-box: fill-box; animation: drop .75s cubic-bezier(.34, 1.45, .6, 1) .05s backwards, bob 6s ease-in-out .9s infinite; }
.hero .art > g:nth-of-type(2) { animation-delay: .22s, 1.6s; }
.hero .art > g:nth-of-type(3) { animation: drop .85s cubic-bezier(.34, 1.45, .6, 1) .45s backwards, bob 7s ease-in-out 1.4s infinite; }
.hero .art > ellipse { transform-box: fill-box; transform-origin: center; animation: shadow-in .9s ease-out backwards; }
@keyframes drop { 0% { transform: translateY(-140%); opacity: 0; } 35% { opacity: 1; } 100% { transform: none; } }
@keyframes shadow-in { from { transform: scaleX(.3); opacity: 0; } }
/* Наклон и параллакс за курсором (только мышь) */
.hero .art-box { transition: transform .4s cubic-bezier(.2, .7, .2, 1); transform: perspective(800px) rotateY(calc(var(--px, 0) * 9deg)) rotateX(calc(var(--py, 0) * -7deg)); }
.hero .art > g:nth-of-type(3) { translate: calc(var(--px, 0) * 7px) calc(var(--py, 0) * 5px); transition: translate .4s cubic-bezier(.2, .7, .2, 1); }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* --- Живая точка у даты --- */
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 8px; vertical-align: 1px; box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 50%, transparent); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 45%, transparent); } 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* --- Акцентная полоска у карточек-статистик --- */
.stat.plain { overflow: hidden; }
.stat.plain::after { content: ""; position: absolute; left: 20px; right: 20px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: linear-gradient(90deg, var(--primary), var(--accent)); opacity: 0; transform: scaleX(.3); transform-origin: left; transition: opacity .25s, transform .35s cubic-bezier(.2, .7, .2, 1); }
a.stat.plain:hover::after { opacity: 1; transform: none; }

/* --- Ховеры: карточки слегка приподнимаются --- */
a.card, .stat, .booking, .tile, .card.hero { transition: transform .25s cubic-bezier(.2, .7, .2, 1), box-shadow .25s, border-color .2s; }
a.card:hover, .stat:hover, .booking:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(27, 37, 51, .04), 0 18px 40px -18px rgba(27, 37, 51, .25); }
.booking:hover { border-color: color-mix(in srgb, var(--primary) 25%, var(--line)); }
.booking:hover .thumb .art { transform: translateY(-2px) rotate(-1.5deg); }
.booking .thumb .art { transition: transform .35s cubic-bezier(.2, .7, .2, 1); }

/* --- Кнопки и чипы --- */
.btn { position: relative; overflow: hidden; box-shadow: 0 1px 0 rgba(255, 255, 255, .15) inset, 0 6px 16px -8px color-mix(in srgb, var(--primary) 60%, transparent); }
.btn.ghost, .btn.soft { box-shadow: none; }
.btn::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .25) 50%, transparent 70%); transform: translateX(-120%); transition: transform .6s; }
.btn:hover::after { transform: translateX(120%); }
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.chip { transition: background .2s, color .2s, border-color .2s, transform .15s; }
.chip:hover:not(.active) { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); color: var(--ink); transform: translateY(-1px); }

/* --- Боковое меню: плавная подсветка и полоска активного пункта --- */
.side-nav a { position: relative; }
.side-nav a::before { content: ""; position: absolute; left: -16px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); transform: scaleY(0); transition: transform .25s cubic-bezier(.2, .7, .2, 1); }
.side-nav a.active::before { transform: scaleY(1); }
.side-nav a svg { transition: transform .2s; }
.side-nav a:hover svg { transform: translateX(2px); }
.brand-mark { background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 60%, var(--accent))); box-shadow: 0 8px 18px -8px color-mix(in srgb, var(--primary) 70%, transparent); }

/* --- Прогресс-бары заполняются при загрузке --- */
.progress > i { animation: grow 1s cubic-bezier(.2, .7, .2, 1) both; animation-delay: .15s; }
@keyframes grow { from { width: 0; } }

/* --- Появление блоков (класс ставит app.js) --- */
.reveal { animation: rise .3s cubic-bezier(.2, .7, .2, 1) backwards; animation-delay: calc(var(--i, 0) * 18ms); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* --- Плавные переходы между страницами (Chrome/Edge/WebView2) --- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: .08s ease-in both vt-out; }
::view-transition-new(root) { animation: .14s ease-out both vt-in; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; } }
/* Меню, нижняя панель и шапка при переходе стоят на месте — плавно меняется только содержимое */
.sidebar { view-transition-name: sidebar; }
.tabbar { view-transition-name: tabbar; }
.topbar { view-transition-name: topbar; }
::view-transition-group(sidebar), ::view-transition-group(tabbar), ::view-transition-group(topbar) { animation-duration: .14s; }
::view-transition-old(sidebar), ::view-transition-old(tabbar), ::view-transition-old(topbar) { animation: none; opacity: 0; }
::view-transition-new(sidebar), ::view-transition-new(tabbar), ::view-transition-new(topbar) { animation: none; }
/* Переход внутри CRM (класс soft ставит _Layout): без повторных «въездов» */
html.soft .hero .art > g { animation: bob 6s ease-in-out .2s infinite; }
html.soft .hero .art > g:nth-of-type(3) { animation: bob 7s ease-in-out .4s infinite; }
html.soft .hero .art > ellipse, html.soft .progress > i, html.soft .msg:not(.fresh) { animation: none; }

/* --- Модалки и уведомления --- */
dialog.modal[open] { animation: pop .28s cubic-bezier(.2, .9, .3, 1.2) both; }
dialog.modal[open]::backdrop { animation: fade .2s both; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes fade { from { opacity: 0; } }
.toast { position: relative; overflow: hidden; animation: slide .35s cubic-bezier(.2, .9, .3, 1.2) both; }
.toast.ok::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; background: currentColor; opacity: .35; animation: drain 4.5s linear both; }
@keyframes slide { from { opacity: 0; transform: translateY(-10px); } }
@keyframes drain { from { width: 100%; } to { width: 0; } }

/* --- Чат: новые сообщения «всплывают» --- */
.msg { animation: msg-in .3s cubic-bezier(.2, .9, .3, 1.15) both; }
@keyframes msg-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.typing.on::after { content: ""; display: inline-block; width: 18px; text-align: left; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

/* --- Нижняя панель на телефоне: активная вкладка с подложкой --- */
@media (max-width: 900px) {
    .tabbar a.active { background: var(--primary-soft); }
    .tabbar a, .tabbar button { transition: color .2s, background .2s, transform .15s; }
    .tabbar a:active, .tabbar button:active { transform: scale(.94); }
    .stat .val.money { font-size: 20px; }
    .booking .badges { max-width: 45%; }
}
@media (max-width: 420px) {
    .stats-auto { grid-template-columns: 1fr 1fr; }
    .stat.plain { padding: 16px; }
    .stat .val.money { font-size: 16px; }
}

/* --- Уважаем настройку «уменьшить движение» --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after, ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; transition: none !important; }
}
.booking-actions details, .booking-actions .disc-body, .pay-form > * { min-width: 0; }
.booking-actions details { flex: 1 1 100%; width: 100%; }
details.disc .disc-body { grid-template-columns: minmax(0, 1fr); }
.form, .modal-body.form { grid-template-columns: minmax(0, 1fr); }

/* ===== v3: полосы прокрутки и вложения в чате ===== */

/* Тонкие полосы прокрутки в цвет темы, без стрелок (Chrome, Edge, приложение для Windows) */
::-webkit-scrollbar { width: 10px; height: 10px; background: transparent; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--ink) 18%, transparent) content-box;
    border: 3px solid transparent; border-radius: 99px; min-height: 40px;
}
::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--ink) 34%, transparent); }
::-webkit-scrollbar-thumb:active { background-color: color-mix(in srgb, var(--primary) 70%, transparent); }
/* Firefox */
@supports not selector(::-webkit-scrollbar) {
    * { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--ink) 22%, transparent) transparent; }
}
/* В ленте сообщений полоса появляется только при наведении */
.chat-feed::-webkit-scrollbar-thumb { background-color: transparent; }
.chat-feed:hover::-webkit-scrollbar-thumb { background-color: color-mix(in srgb, var(--ink) 20%, transparent); }
.chat-feed::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--ink) 36%, transparent); }

/* Форма отправки: строка ввода + полоска выбранных файлов */
.chat { position: relative; }
.card.chat { padding: 0; }
@media (max-width: 600px) { .chat-form { padding: 10px 12px; } .chat-row { gap: 8px; } }
.chat-form { flex-direction: column; gap: 10px; }
.chat-row { display: flex; gap: 10px; align-items: flex-end; }
.chat-row textarea { flex: 1; min-width: 0; min-height: 46px; height: 46px; max-height: 160px; padding: 12px 14px; resize: none; }
.attach-btn { flex: none; color: var(--ink-2); cursor: pointer; }
.attach-btn:hover { color: var(--primary); border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); }
.attach-btn svg { width: 20px; height: 20px; }
.chat-form.sending .chat-row button { opacity: .6; }

.chat-attach { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px; }
.att { position: relative; flex: none; height: 72px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); overflow: hidden; animation: msg-in .25s ease both; }
.att img { display: block; height: 100%; width: 72px; object-fit: cover; }
.att.doc { display: flex; align-items: center; gap: 10px; padding: 0 34px 0 12px; max-width: 240px; }
.att.doc > svg { flex: none; width: 26px; height: 26px; color: var(--primary); }
.att.doc span { display: grid; min-width: 0; line-height: 1.3; }
.att.doc b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att.doc small { font-size: 12px; color: var(--muted); }
.att .x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: rgba(15, 20, 28, .62); color: #fff; cursor: pointer; }
.att .x svg { width: 12px; height: 12px; }
.att .x:hover { background: var(--bad); }

/* Перетаскивание файлов на чат */
.chat-drop { display: none; }
.chat.dragging .chat-drop {
    display: flex; position: absolute; inset: 10px; z-index: 5; align-items: center; justify-content: center; gap: 10px;
    border: 2px dashed var(--primary); border-radius: calc(var(--radius) - 6px);
    background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(3px);
    color: var(--primary); font-weight: 700; font-size: 16px; pointer-events: none;
}
.chat-drop svg { width: 24px; height: 24px; }

/* Фото и файлы в сообщениях */
.msg.has-photo { padding: 6px; }
.msg.has-photo .who, .msg.has-photo .text { padding: 0 8px; }
.msg.has-photo .who { padding-top: 4px; }
.msg.has-photo .text { padding-bottom: 6px; }
.msg-photos { display: grid; gap: 4px; margin: 4px 0; border-radius: 12px; overflow: hidden; width: min(360px, 68vw); }
.msg-photos.n2, .msg-photos.n4 { grid-template-columns: 1fr 1fr; }
.msg-photos.n3 { grid-template-columns: 1fr 1fr; }
.msg-photos.n3 a:first-child { grid-column: span 2; }
.msg-photos a { display: block; background: color-mix(in srgb, var(--ink) 8%, transparent); }
.msg-photos img { display: block; width: 100%; height: 100%; max-height: 320px; object-fit: cover; transition: transform .25s, filter .2s; }
.msg-photos:not(.n1) img { aspect-ratio: 1; }
.msg-photos.n3 a:first-child img { aspect-ratio: 2 / 1; }
.msg-photos a:hover img { filter: brightness(1.06); transform: scale(1.02); }
.msg-file { display: flex; align-items: center; gap: 10px; margin: 6px 0; padding: 8px 12px 8px 8px; border-radius: 12px; color: inherit; text-decoration: none; background: color-mix(in srgb, var(--ink) 6%, transparent); transition: background .15s; max-width: 320px; }
.msg.mine .msg-file { background: color-mix(in srgb, var(--primary-ink) 14%, transparent); }
.msg-file:hover { background: color-mix(in srgb, var(--ink) 11%, transparent); }
.msg.mine .msg-file:hover { background: color-mix(in srgb, var(--primary-ink) 22%, transparent); }
.msg-file .ic { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); }
.msg.mine .msg-file .ic { background: var(--primary-ink); }
.msg-file .ic svg { width: 20px; height: 20px; }
.msg-file .nm { display: grid; min-width: 0; line-height: 1.3; }
.msg-file b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-file small { font-size: 12px; opacity: .7; }

/* Просмотр фото */
.lightbox { padding: 0; border: 0; background: transparent; max-width: 96vw; max-height: 96vh; overflow: visible; }
.lightbox::backdrop { background: rgba(8, 11, 16, .82); backdrop-filter: blur(4px); }
.lightbox img { display: block; max-width: 96vw; max-height: 86vh; border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.lightbox > button.btn.ghost { position: absolute; top: -52px; right: 0; color: #fff; border-color: rgba(255, 255, 255, .3); }
.lightbox > a.btn.ghost { position: absolute; bottom: -54px; left: 50%; transform: translateX(-50%); color: #fff; border-color: rgba(255, 255, 255, .3); }
@media (max-width: 720px) {
    .lightbox > button.btn.ghost { top: 8px; right: 8px; background: rgba(0, 0, 0, .45); }
    .lightbox > a.btn.ghost { bottom: 8px; background: rgba(0, 0, 0, .45); }
}

/* ===== v4: выпадающие списки, живой поиск, анимация круглых иконок ===== */

/* Выпадающий список */
.sel { position: relative; min-width: 0; }
.sel > select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
.sel-btn.input { display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer; padding-right: 12px; }
.sel-btn:hover { border-color: color-mix(in srgb, var(--primary) 35%, var(--line)); }
.sel.open .sel-btn.input { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px var(--primary-soft); }
.sel-btn.invalid { border-color: var(--bad) !important; box-shadow: 0 0 0 4px var(--bad-bg) !important; animation: shake .35s; }
.sel-val { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-val.placeholder { color: var(--muted); }
.sel-chev { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); transition: transform .25s cubic-bezier(.3, 1.4, .5, 1), color .15s; }
.sel.open .sel-chev { transform: rotate(180deg); color: var(--primary); }
.sel-btn.picked .sel-val { animation: picked .35s ease; }
@keyframes picked { from { opacity: .2; transform: translateY(4px); } }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* Статус-«таблетка» в таблице склада */
.sel-badge { display: inline-block; }
.sel-btn.badge { display: inline-flex; gap: 4px; border: 0; cursor: pointer; padding: 0 6px 0 10px; transition: filter .15s, transform .15s; }
.sel-btn.badge:hover { filter: brightness(.96); transform: translateY(-1px); }
.sel-btn.badge .sel-chev { width: 14px; height: 14px; color: inherit; opacity: .7; }

.sel-list {
    position: fixed; inset: auto; margin: 0; z-index: 1000; overflow-y: auto; overscroll-behavior: contain;
    padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink);
    box-shadow: 0 18px 40px -12px rgba(15, 23, 36, .28), 0 2px 6px rgba(15, 23, 36, .06);
    transform-origin: top center; animation: sel-in .18s cubic-bezier(.2, .9, .3, 1.1);
}
.sel-list.up { transform-origin: bottom center; }
.sel-list.closing { animation: sel-out .14s ease forwards; }
@keyframes sel-in { from { opacity: 0; transform: translateY(-6px) scale(.97); } }
.sel-list.up { animation-name: sel-in-up; }
@keyframes sel-in-up { from { opacity: 0; transform: translateY(6px) scale(.97); } }
@keyframes sel-out { to { opacity: 0; transform: translateY(-4px) scale(.98); } }
.sel-opt {
    position: relative; display: flex; align-items: center; min-height: 38px; padding: 8px 34px 8px 12px; border-radius: 10px;
    cursor: pointer; white-space: nowrap; font-weight: 500; transition: background .12s, color .12s, padding .15s;
    animation: opt-in .22s ease both; animation-delay: var(--d, 0ms);
}
@keyframes opt-in { from { opacity: 0; transform: translateX(-6px); } }
.sel-opt.muted { color: var(--muted); }
.sel-opt.active { background: var(--primary-soft); color: var(--primary); padding-left: 16px; }
.sel-opt.selected { font-weight: 700; color: var(--primary); }
.sel-opt.selected::after {
    content: ""; position: absolute; right: 12px; width: 14px; height: 14px; background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5L20 7'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5L20 7'/%3E%3C/svg%3E") center / contain no-repeat;
}
.sel-opt[aria-disabled] { opacity: .45; cursor: default; }
.sel-filter { width: 100%; height: 38px; margin-bottom: 6px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); outline: none; position: sticky; top: 0; z-index: 1; }
.sel-filter:focus { border-color: var(--primary); }

/* Поле поиска с иконкой и живыми результатами */
.search-input { position: relative; display: block; flex: 1; min-width: 0; }
.search-input > svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); pointer-events: none; transition: color .15s, transform .3s; }
.search-input .input { padding-left: 42px; }
.search-input:focus-within > svg { color: var(--primary); transform: translateY(-50%) scale(1.1); }
.search-input input::-webkit-search-cancel-button {
    -webkit-appearance: none; width: 20px; height: 20px; cursor: pointer; opacity: .55; transition: opacity .15s, transform .2s;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='11' fill='%237a818c'/%3E%3Cpath d='m8 8 8 8M16 8l-8 8' stroke='white' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.search-input input::-webkit-search-cancel-button:hover { opacity: 1; transform: rotate(90deg); }
form.searching .search-input > svg { animation: search-pulse .7s ease-in-out infinite; color: var(--primary); }
@keyframes search-pulse { 50% { transform: translateY(-50%) scale(1.25) rotate(-12deg); } }
.swap-in { animation: swap-in .3s ease both; }
@keyframes swap-in { from { opacity: .35; } }
mark { background: color-mix(in srgb, var(--accent) 30%, transparent); color: inherit; border-radius: 4px; padding: 0 2px; margin: 0 -2px; }
.msg.mine mark { background: color-mix(in srgb, var(--accent) 55%, transparent); }
.link { color: var(--primary); font-weight: 700; }
.link:hover { text-decoration: underline; }
input[type=search] { -webkit-appearance: none; appearance: none; }

/* Круглые иконки-стрелки: на наведение стрелка «улетает» и возвращается, кружок заливается */
.corner-link { overflow: hidden; color: var(--ink); transition: background .25s, color .25s, transform .3s cubic-bezier(.3, 1.5, .5, 1), box-shadow .25s; }
.corner-link:hover, a.card:hover .corner-link, .hero:hover .corner-link { background: var(--primary); color: var(--primary-ink); transform: scale(1.1); box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--primary) 60%, transparent); }
.corner-link:hover svg, .hero:hover .corner-link svg { animation: arrow-fly .5s cubic-bezier(.5, 0, .3, 1); }
@keyframes arrow-fly {
    45% { transform: translate(14px, -14px); opacity: 0; }
    46% { transform: translate(-14px, 14px); opacity: 0; }
    100% { transform: none; opacity: 1; }
}
.corner-link:active { transform: scale(.95); }
/* Стрелка на плитках клиентов/поставщиков */
.tile > svg.muted { flex: none; width: 34px; height: 34px; padding: 9px; border-radius: 50%; background: var(--surface-2); transition: background .25s, color .25s, transform .3s cubic-bezier(.3, 1.5, .5, 1); }
a.tile:hover > svg.muted { background: var(--primary); color: var(--primary-ink); transform: rotate(45deg) scale(1.08); }
/* Иконки в карточках статистики */
.stat .ico { transition: transform .4s cubic-bezier(.3, 1.6, .5, 1), background .25s, color .25s; }
.stat:hover .ico { transform: rotate(-10deg) scale(1.12); background: var(--surface); color: var(--primary); }
/* Кнопки-иконки (закрыть и т.п.) */
.icon-btn { transition: background .2s, border-color .2s, transform .3s cubic-bezier(.3, 1.5, .5, 1); }
.icon-btn:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--primary) 35%, var(--line)); }
.icon-btn[data-close]:hover svg, .lightbox [data-close]:hover svg { transform: rotate(90deg); }
.icon-btn svg, .lightbox [data-close] svg { transition: transform .3s cubic-bezier(.3, 1.5, .5, 1); }
.btn.icon:hover svg { animation: nudge .45s ease; }
@keyframes nudge { 40% { transform: translate(2px, -2px) scale(1.12); } }
@media (prefers-reduced-motion: reduce) {
    .sel-list, .sel-opt, .corner-link svg, .btn.icon svg { animation: none !important; }
}

/* ===== v5: сотрудники, календарь, полировка ===== */

/* Тёмная тема: глубже фон, насыщенный акцент вместо бледно-голубого */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0f1217; --surface: #171b22; --surface-2: #13161c; --line: #242b36;
        --primary: #4d7ee8; --primary-ink: #ffffff; --primary-soft: #1b2740; --info: #8fb3f5;
        --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 1px 2px rgba(0, 0, 0, .4), 0 12px 28px -16px rgba(0, 0, 0, .6);
    }
}
:root[data-theme="dark"] {
    --bg: #0f1217; --surface: #171b22; --surface-2: #13161c; --line: #242b36;
    --primary: #4d7ee8; --primary-ink: #ffffff; --primary-soft: #1b2740; --info: #8fb3f5;
    --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 1px 2px rgba(0, 0, 0, .4), 0 12px 28px -16px rgba(0, 0, 0, .6);
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .hero { background: radial-gradient(460px 300px at 82% 30%, color-mix(in srgb, var(--primary) 22%, transparent), transparent 70%), linear-gradient(135deg, #18202d, #141a24); }
}
:root[data-theme="dark"] .hero { background: radial-gradient(460px 300px at 82% 30%, color-mix(in srgb, var(--primary) 22%, transparent), transparent 70%), linear-gradient(135deg, #18202d, #141a24); }

/* Фокус с клавиатуры — заметное кольцо, как в хороших приложениях */
:focus-visible { outline: 2px solid color-mix(in srgb, var(--primary) 70%, transparent); outline-offset: 2px; }
.input:focus-visible { outline: none; }
::selection { background: color-mix(in srgb, var(--primary) 30%, transparent); }

/* Аватарки: свой цвет у каждого человека */
.avatar[style*="--h"] {
    background: linear-gradient(135deg, hsl(var(--h) 70% 62%), hsl(calc(var(--h) + 35) 65% 48%));
    color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .18); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
}
.avatar.hash { background: var(--primary-soft); color: var(--primary); }
.avatar.hash svg, .avatar svg { width: 18px; height: 18px; }
.avatar.lg { width: 52px; height: 52px; font-size: 20px; border-radius: 16px; }

/* Карточки сотрудников */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.person { display: flex; flex-direction: column; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); transition: transform .25s cubic-bezier(.2, .7, .2, 1), box-shadow .25s, border-color .2s; }
.person:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--primary) 30%, var(--line)); box-shadow: var(--shadow); }
.person.off { opacity: .6; }
.person-top { display: flex; gap: 14px; align-items: center; min-width: 0; }
.person-name { min-width: 0; }
.person-name .title { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 17px; }
.person-name .sub { color: var(--muted); font-size: 14px; }
.person-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.badge svg { width: 12px; height: 12px; margin-right: 4px; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 6px; }
.person-info { display: grid; gap: 6px; margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 14px; }
.person-info > div { display: flex; justify-content: space-between; gap: 12px; min-width: 0; }
.person-info dt { color: var(--muted); }
.person-info dd { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-info a { color: var(--primary); }
.person-actions { display: flex; gap: 8px; margin-top: auto; }
.person-actions .btn { flex: 1; }
.modal-title { display: flex; align-items: center; gap: 12px; min-width: 0; }

/* Переключатели */
.switches { display: grid; gap: 8px; }
.switch { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); cursor: pointer; transition: border-color .15s; }
.switch:hover { border-color: color-mix(in srgb, var(--primary) 35%, var(--line)); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { position: relative; flex: none; width: 44px; height: 26px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 18%, transparent); transition: background .25s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .3s cubic-bezier(.3, 1.4, .5, 1); }
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--primary); outline-offset: 2px; }
.switch span { display: grid; line-height: 1.3; }
.switch small { color: var(--muted); font-size: 13px; }
.switch.locked { cursor: not-allowed; opacity: .6; }

/* Список чатов */
.room { transition: background .15s, transform .15s; }
.room:active { transform: scale(.99); }
.room.active { background: var(--primary-soft); }
.room.active .t span { color: var(--primary); }
.room.off { opacity: .55; }
.room .body { flex: 1; }
.room .t { display: flex; justify-content: space-between; gap: 8px; }
.room .t span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room .t time { flex: none; font-size: 12px; font-weight: 500; color: var(--muted); }
.chat-who { display: flex; align-items: center; gap: 12px; min-width: 0; }

/* Раскрывающиеся блоки: шеврон вместо «+» */
details.disc summary { align-items: center; transition: color .15s; }
details.disc summary:hover { color: var(--primary); }
details.disc summary::after {
    content: ""; width: 16px; height: 16px; background: currentColor; color: var(--muted); transition: transform .25s cubic-bezier(.3, 1.4, .5, 1);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
}
details.disc[open] summary::after { content: ""; transform: rotate(180deg); }
details.disc[open] .disc-body { animation: disc-open .25s ease; }
@keyframes disc-open { from { opacity: 0; transform: translateY(-4px); } }

/* Календарь */
.dp { position: relative; min-width: 0; }
.dp > input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
.dp-btn.input { display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer; }
.dp-btn > svg:first-child { flex: none; width: 18px; height: 18px; color: var(--muted); transition: color .15s, transform .3s cubic-bezier(.3, 1.5, .5, 1); }
.dp-btn:hover { border-color: color-mix(in srgb, var(--primary) 35%, var(--line)); }
.dp-btn:hover > svg:first-child, .dp.open .dp-btn > svg:first-child { color: var(--primary); transform: scale(1.1) rotate(-6deg); }
.dp.open .dp-btn.input { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px var(--primary-soft); }
.dp-btn.invalid { border-color: var(--bad) !important; box-shadow: 0 0 0 4px var(--bad-bg) !important; animation: shake .35s; }
.dp-val { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-val.placeholder { color: var(--muted); }
.dp-x { display: none; flex: none; width: 22px; height: 22px; padding: 5px; border-radius: 50%; color: var(--muted); transition: background .15s, color .15s; }
.dp.has-value .dp-x { display: block; }
.dp-x:hover { background: var(--bad-bg); color: var(--bad); }

.dp-panel {
    position: fixed; inset: auto; margin: 0; z-index: 1000; width: 304px; min-width: 0 !important; overflow: hidden auto;
    padding: 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink);
    box-shadow: 0 24px 50px -16px rgba(15, 23, 36, .35), 0 2px 6px rgba(15, 23, 36, .06);
    transform-origin: top left; animation: sel-in .2s cubic-bezier(.2, .9, .3, 1.1);
}
.dp-panel.up { transform-origin: bottom left; animation-name: sel-in-up; }
.dp-panel.closing { animation: sel-out .14s ease forwards; }
.dp-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.dp-title { border: 0; background: none; font-weight: 800; font-size: 15px; padding: 6px 10px; border-radius: 10px; cursor: pointer; transition: background .15s; }
.dp-title span { color: var(--muted); font-weight: 600; }
.dp-title:hover { background: var(--surface-2); }
.dp-title.static { cursor: default; }
.dp-nav { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; transition: background .15s, transform .15s; }
.dp-nav svg { width: 16px; height: 16px; transform: rotate(180deg); }
.dp-nav.next svg { transform: none; }
.dp-nav:hover { background: var(--primary-soft); color: var(--primary); }
.dp-nav:active { transform: scale(.92); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-months { grid-template-columns: repeat(3, 1fr); gap: 6px; }
.dp-grid.slide-l { animation: dp-l .28s cubic-bezier(.2, .8, .3, 1); }
.dp-grid.slide-r { animation: dp-r .28s cubic-bezier(.2, .8, .3, 1); }
@keyframes dp-l { from { opacity: 0; transform: translateX(24px); } }
@keyframes dp-r { from { opacity: 0; transform: translateX(-24px); } }
.dp-wd { text-align: center; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 4px 0 6px; }
.dp-wd.we { color: color-mix(in srgb, var(--accent) 80%, var(--muted)); }
.dp-day, .dp-month {
    position: relative; height: 38px; border: 0; border-radius: 10px; background: none; cursor: pointer; font-weight: 600; font-size: 14px;
    transition: background .12s, color .12s, transform .12s;
}
.dp-month { height: 46px; text-transform: capitalize; animation: opt-in .25s ease both; animation-delay: var(--d); }
.dp-day.we { color: color-mix(in srgb, var(--accent) 75%, var(--ink)); }
.dp-day.out { color: var(--muted); opacity: .45; }
.dp-day:hover, .dp-month:hover, .dp-day.focus { background: var(--primary-soft); color: var(--primary); }
.dp-day:active, .dp-month:active { transform: scale(.92); }
.dp-day.today::after, .dp-month.today::after { content: ""; position: absolute; left: 50%; bottom: 5px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--accent); }
.dp-day.sel, .dp-month.sel { background: var(--primary); color: var(--primary-ink); box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--primary) 70%, transparent); animation: dp-pop .3s cubic-bezier(.3, 1.6, .5, 1); }
.dp-day.sel.today::after, .dp-month.sel.today::after { background: var(--primary-ink); }
@keyframes dp-pop { from { transform: scale(.7); } }
.dp-foot { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.dp-chip { height: 30px; padding: 0 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface-2); font-size: 13px; font-weight: 600; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.dp-chip:hover { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.dp-chip.clear { margin-left: auto; color: var(--muted); }
.dp-chip.clear:hover { background: var(--bad-bg); color: var(--bad); }

@media (prefers-reduced-motion: reduce) {
    .dp-panel, .dp-grid, .dp-month, .dp-day.sel { animation: none !important; }
}

/* ===== v6: ровные отступы между блоками и кнопка «Назад» ===== */
.content > * + *:not(dialog):not(script) { margin-top: 16px; }
.content > .page-head + * { margin-top: 0; }

.back-btn {
    display: inline-flex; align-items: center; gap: 6px; height: 34px; margin-bottom: 10px; padding: 0 14px 0 8px;
    border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--ink-2);
    font-size: 14px; font-weight: 600; box-shadow: var(--shadow); transition: color .15s, border-color .15s, transform .2s;
}
.back-btn svg { width: 18px; height: 18px; transform: rotate(180deg); transition: transform .25s cubic-bezier(.3, 1.5, .5, 1); }
.back-btn:hover { color: var(--primary); border-color: color-mix(in srgb, var(--primary) 35%, var(--line)); }
.back-btn:hover svg { transform: rotate(180deg) translateX(3px); }
.back-btn:active { transform: scale(.97); }

/* ===== v7: окно подтверждения ===== */
.modal.confirm { width: min(420px, calc(100vw - 32px)); }
.confirm-body { padding: 28px 26px 22px; text-align: center; }
.confirm-ico {
    display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%;
    background: var(--ok-bg); color: var(--ok); animation: confirm-pop .45s cubic-bezier(.3, 1.6, .5, 1);
}
.confirm-ico svg { width: 26px; height: 26px; }
.confirm.danger .confirm-ico { background: var(--bad-bg); color: var(--bad); }
@keyframes confirm-pop { from { transform: scale(.4); opacity: 0; } }
.confirm h2 { font-size: 19px; margin: 0 0 6px; }
.confirm p { margin: 0; color: var(--ink-2); overflow-wrap: anywhere; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.btn.danger { background: var(--bad); color: #fff; }

/* v8: подсказки реквизитов DaData */
.party-list { padding: 6px; }
.party-opt { padding: 9px 12px; border-radius: 10px; cursor: pointer; animation: opt-in .22s ease both; animation-delay: var(--d, 0ms); transition: background .12s; }
.party-opt:hover, .party-opt.active { background: var(--primary-soft); }
.party-opt.dead { opacity: .6; }
.party-name { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.party-meta { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.party-note { padding: 10px 12px; color: var(--muted); font-size: 13px; }
.party-foot { padding: 6px 12px 2px; font-size: 11px; color: var(--muted); text-align: right; }
.input.filled { animation: filled 1.2s ease; }
@keyframes filled { 0% { background: var(--primary-soft); border-color: var(--primary); } 100% {} }

/* v9: кнопка «Очистить» в окнах */
.modal-foot .clear-btn { margin-right: auto; gap: 6px; opacity: 0; visibility: hidden; transform: translateX(-6px); transition: opacity .2s, transform .2s, visibility .2s; }
.modal-foot .clear-btn.on { opacity: 1; visibility: visible; transform: none; }
.clear-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.clear-btn:hover svg { animation: spin-back .5s ease; }
@keyframes spin-back { to { transform: rotate(-360deg); } }

/* v10: фото чеков в ИИ-ассистенте */
.msg-photos { max-width: 100%; }
#ai-feed .msg-photos { width: min(240px, 60vw); }
#ai-feed .msg-photos img { max-height: 240px; }
#ai-feed .msg-photos a { display: block; }
.msg.seen { align-self: flex-end; max-width: min(460px, 85%); padding: 8px 14px; background: var(--surface-2); color: var(--ink-2); font-size: 13px; }
.msg.seen summary { cursor: pointer; font-weight: 600; color: var(--muted); list-style: none; display: flex; align-items: center; gap: 6px; }
.msg.seen summary::-webkit-details-marker { display: none; }
.msg.seen summary::before { content: "📷"; }
.msg.seen summary::after { content: "›"; transition: transform .2s; font-size: 16px; line-height: 1; }
.msg.seen[open] summary::after { transform: rotate(90deg); }
.msg.seen .text { margin-top: 6px; }

/* v11: отчёты Excel в ИИ-ассистенте */
.msg.file { align-self: flex-start; display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 10px; text-decoration: none; color: var(--ink); transition: transform .2s, box-shadow .2s, border-color .2s; }
.msg.file:hover { transform: translateY(-2px); border-color: color-mix(in srgb, #1f7a4a 45%, var(--line)); box-shadow: 0 10px 24px -14px rgba(15, 23, 36, .35); }
.msg.file .xl { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; background: #1f7a4a; color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.msg.file > span:last-child { display: grid; line-height: 1.3; min-width: 0; }
.msg.file b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg.file small { font-size: 12px; color: var(--muted); }

/* v12: дни в ленте последних действий */
.timeline > .tl-day { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 14px 0 4px; border-bottom: 0; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); text-decoration: none; }
.timeline > .tl-day:first-child { padding-top: 4px; }
.timeline > .tl-day span { font-weight: 500; letter-spacing: 0; color: var(--muted); text-transform: none; }
.timeline > .tl-day:hover { color: var(--primary); }

/* v13: clickable recent actions + journal target highlight */
.timeline > a.tl-item { color: inherit; text-decoration: none; border-radius: 10px; margin: 0 -8px; padding-left: 8px; padding-right: 8px; transition: background .15s; }
.timeline > a.tl-item:hover { background: var(--primary-soft); }
.timeline > a.tl-item:hover > div { color: var(--primary); }
.timeline > .tl-entry { scroll-margin-top: 90px; border-radius: 10px; }
.timeline > .tl-entry:target { background: var(--primary-soft); margin: 0 -8px; padding-left: 8px; padding-right: 8px; animation: tl-flash 2.4s ease-out; }
@keyframes tl-flash { 0% { box-shadow: 0 0 0 2px var(--primary); } 100% { box-shadow: 0 0 0 0 transparent; } }

/* v14: страница «Скачать приложение» */
.dl-wrap { max-width: 980px; margin: 0 auto; padding: 24px 16px 48px; }
.dl-back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 14px; }
.dl-back svg { width: 16px; height: 16px; transform: rotate(180deg); }
.dl-back:hover { color: var(--primary); }
.dl-head { display: flex; gap: 16px; align-items: center; margin: 18px 0 22px; }
.dl-head img { border-radius: 16px; flex: none; }
.dl-head h1 { font-size: clamp(24px, 4vw, 32px); font-weight: 800; margin: 0; }
.dl-head p { margin: 6px 0 0; max-width: 560px; }
.dl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.dl-card { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.dl-card.mine { order: -1; box-shadow: 0 0 0 2px var(--primary); }
.dl-card .btn { align-self: flex-start; }
.dl-top { display: flex; gap: 12px; align-items: center; }
.dl-top h2 { font-size: 18px; margin: 0; }
.dl-top .badge { margin-top: 4px; display: inline-block; }
.dl-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; font-weight: 800; background: var(--primary-soft); color: var(--primary); }
.dl-ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dl-ico.android { background: #e3f4e8; color: #1f8a4c; }
.dl-steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; color: var(--ink-2); }
.dl-steps code, .dl-card code { font-size: 13px; background: var(--primary-soft); padding: 1px 6px; border-radius: 6px; overflow-wrap: anywhere; white-space: nowrap; }
.dl-addr { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }
.btn.sm { padding: 4px 10px; font-size: 13px; min-height: 0; }
.login-apps { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin-top: 14px; font-size: 14px; }
.login-apps a, .login-apps button { color: var(--muted); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; padding: 0; }
.login-apps a:hover, .login-apps button:hover { color: var(--primary); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .dl-ico.android { background: #1d2a23; color: #6fd29a; } }
:root[data-theme="dark"] .dl-ico.android { background: #1d2a23; color: #6fd29a; }

/* v15: кнопка уведомлений */
.link-btn[data-push].on svg { color: var(--primary); }
.side-foot > [data-push], .side-foot > [data-app-update], .side-foot > [data-install], .side-foot > a[data-web-only] { flex-basis: 100%; text-align: left; }

/* Кнопка удаления в карточке контрагента — слева в подвале окна */
.modal-foot .del-btn { margin-right: auto; color: var(--bad); }
.modal-foot .del-btn:hover { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); background: var(--bad-bg); }
.modal-foot .del-btn svg { width: 16px; height: 16px; }
@media (max-width: 600px) { .modal-foot:has(.del-btn) { flex-wrap: wrap; } .modal-foot .del-btn { order: 3; flex-basis: 100%; margin-right: 0; justify-content: center; } .modal-foot:has(.del-btn) > .btn:not(.del-btn) { flex: 1; } }


/* Оплаты: две вкладки внутри раздела — «Поступления» и «Поставщикам» */
.seg-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.seg-tab { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 12px 16px; border-radius: 12px; color: var(--ink-2); font-weight: 600; text-decoration: none; transition: background .2s, color .2s; }
.seg-tab svg { width: 20px; height: 20px; flex: none; }
.seg-tab .t { white-space: nowrap; }
.seg-tab .v { margin-left: auto; font-size: 14px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg-tab:hover:not(.active) { background: color-mix(in srgb, var(--primary) 7%, transparent); color: var(--ink); }
.seg-tab.active { background: var(--primary); color: var(--primary-ink); }
@media (max-width: 600px) {
    .seg-tab { flex-wrap: wrap; gap: 2px 8px; padding: 10px 12px; }
    .seg-tab .v { margin-left: 0; flex-basis: 100%; font-size: 13px; }
}
.page-actions .del-btn { color: var(--bad); }
.page-actions .del-btn:hover { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); background: var(--bad-bg); }

/* ===== «Живой» интерфейс ===== */
/* Мягкий свет за курсором на карточках (только мышь) */
@media (hover: hover) and (pointer: fine) {
    .card:not(.hero):not(.ai-hero):not(.chat).lit {
        background-image: radial-gradient(480px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--primary) 6%, transparent), transparent 45%);
    }
    .card.lit { border-color: color-mix(in srgb, var(--primary) 16%, var(--line)); }
}
/* Конфетти: задача выполнена, контейнеры получены или выданы */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 1000; overflow: hidden; }
.confetti i { position: absolute; width: 8px; height: 12px; border-radius: 2px; will-change: transform, opacity; }
.confetti i.r { border-radius: 50%; width: 9px; height: 9px; }
.celebrate-toast { position: fixed; left: 50%; top: 22px; z-index: 1001; translate: -50% 0; padding: 10px 18px; border-radius: 999px; background: var(--primary); color: var(--primary-ink); font-weight: 700; box-shadow: 0 10px 30px color-mix(in srgb, var(--primary) 35%, transparent); animation: toast-pop 2.6s cubic-bezier(.2, .7, .2, 1) forwards; pointer-events: none; }
@keyframes toast-pop { 0% { opacity: 0; transform: translateY(-14px) scale(.9); } 12%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-8px); } }

/* Загрузка банковской выписки */
.import-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.import-steps > div { display: flex; gap: 12px; align-items: flex-start; color: var(--ink-2); font-size: 14px; }
.import-steps > div > b { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 800; }
.import-drop { margin-top: 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 36px 20px; border: 2px dashed color-mix(in srgb, var(--primary) 30%, var(--line)); border-radius: var(--radius); color: var(--ink-2); text-align: center; transition: background .2s, border-color .2s; }
.import-drop svg { width: 34px; height: 34px; color: var(--primary); }
.import-drop.over { background: var(--primary-soft); border-color: var(--primary); }
.import-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: -6px 0 14px; }
.import-legend .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--ok); }
.import-legend .dot.warn { background: var(--warn); } .import-legend .dot.mute { background: var(--line); }
.import-list { display: grid; gap: 10px; }
.imp-row { display: flex; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; border-left: 4px solid var(--ok); }
.imp-row.out { border-left-color: var(--primary); }
.imp-row.manual { border-left-color: var(--warn); }
.imp-row.dup, .imp-row.skip { opacity: .55; border-left-color: var(--line); }
.imp-check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--primary); }
.imp-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.imp-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.imp-dir { font-weight: 700; }
.imp-sum { margin-left: auto; font-size: 17px; }
.imp-purpose { overflow-wrap: anywhere; }
.imp-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 8px; }
.import-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; position: sticky; bottom: 0; padding: 12px 0 4px; background: linear-gradient(transparent, var(--surface) 30%); }
@media (max-width: 760px) { .import-steps, .imp-fields { grid-template-columns: 1fr; } .import-foot { bottom: 64px; } }

/* Долги */
.debt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.debt-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.debt-row:first-of-type { border-top: 0; }
.debt-row .who { flex: 1; min-width: 0; }
.debt-row .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.debt-row .sum { text-align: right; font-weight: 800; white-space: nowrap; }
.debt-row:hover .who b { color: var(--primary); }
.debt-total { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin: -4px 0 8px; }
@media (max-width: 900px) { .debt-grid { grid-template-columns: 1fr; } }

/* Документы к брони */
details.docs summary > span { display: inline-flex; align-items: center; gap: 8px; }
details.docs summary .ico { width: 16px; height: 16px; color: var(--muted); }
.doc-list { display: grid; gap: 6px; }
.doc { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 6px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.doc-thumb, .doc-ico { width: 44px; height: 44px; border-radius: 9px; overflow: hidden; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.doc-ico svg { width: 20px; height: 20px; }
.doc-name { font-size: 13.5px; font-weight: 600; color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-name:hover { text-decoration: underline; }
.doc-size { font-size: 12px; white-space: nowrap; }
.doc form { margin: 0; }
.doc-del { width: 30px; height: 30px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.doc-del:hover { background: var(--bad-bg, #fde8e8); color: var(--bad, #c0392b); }
.doc-del svg { width: 16px; height: 16px; }
.doc-upload { display: flex; gap: 8px; flex-wrap: wrap; }
.doc-upload .btn { cursor: pointer; }
.doc-upload .ico { width: 15px; height: 15px; }
.doc-upload.busy { opacity: .55; pointer-events: none; }
@media (pointer: fine) { .cam-only { display: none !important; } }

/* Быстрый поиск (Ctrl+K) */
.search-trigger { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 8px 0 12px; margin-right: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; min-width: 220px; transition: border-color .2s, box-shadow .2s; }
.search-trigger:hover { border-color: var(--ink-2); box-shadow: 0 4px 14px -8px rgba(0,0,0,.25); }
.search-trigger svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.search-trigger span { flex: 1; text-align: left; }
kbd { font: 600 11px/1 inherit; font-family: inherit; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); white-space: nowrap; }
@media (max-width: 900px) {
  .search-trigger { min-width: 0; width: 40px; height: 40px; padding: 0; justify-content: center; margin-right: 8px; }
  .search-trigger span, .search-trigger kbd { display: none; }
}
dialog.palette { border: 0; padding: 0; margin: 12vh auto auto; width: min(620px, calc(100vw - 24px)); max-height: 70vh; border-radius: 20px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0,0,0,.4); overflow: hidden; }
dialog.palette[open] { animation: pop .22s cubic-bezier(.2, .9, .3, 1.2) both; }
dialog.palette::backdrop { background: rgba(18, 22, 28, .45); backdrop-filter: blur(2px); }
.palette-box { display: flex; flex-direction: column; max-height: 70vh; }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.palette-input > svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.palette-input input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 17px; }
.palette-input input::-webkit-search-cancel-button { display: none; }
.palette-list { overflow-y: auto; padding: 6px; overscroll-behavior: contain; }
.palette-list:empty { display: none; }
.pal-group { padding: 10px 10px 4px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pal-item { display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 12px; align-items: center; padding: 8px 10px; border-radius: 12px; color: var(--ink); text-decoration: none; }
.pal-item .pi { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); }
.pal-item .pi svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pal-item b { display: block; font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-item small { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-item mark { background: color-mix(in srgb, var(--accent, #e07a3f) 28%, transparent); color: inherit; border-radius: 3px; }
.pal-item.sel { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent, #e07a3f); }
.pal-item.sel .pi { background: var(--ink); color: var(--surface); }
.pal-empty { padding: 26px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.palette-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; }
.palette-foot kbd { margin-right: 4px; }
@media (pointer: coarse) { .palette-foot { display: none; } dialog.palette { margin-top: 10px; } }
/* Переход из поиска к конкретной брони или задаче */
.booking[id], .task[id] { scroll-margin-top: 90px; }
.booking:target, .task:target { animation: target-flash 2.2s ease-out 1; }
@keyframes target-flash { 0%, 30% { box-shadow: 0 0 0 3px var(--accent, #e07a3f), 0 10px 40px -10px rgba(224,122,63,.5); } 100% { box-shadow: none; } }
.chat.swap-in .msg:not(.fresh) { animation: none; }

/* Правка и удаление сообщений */
.msg { position: relative; }
.msg.static { animation: none !important; }
.msg .edited { font-style: normal; font-weight: 500; opacity: .65; }
.msg.deleted { background: transparent !important; color: var(--muted) !important; border: 1px dashed var(--line) !important; }
.msg.deleted .text { display: flex; align-items: center; gap: 6px; font-style: italic; font-size: 13.5px; }
.msg.deleted .text svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.msg.editing, .msg.menu-on { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 55%, transparent); }
.msg-more { position: absolute; top: 6px; left: -38px; width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); display: grid; place-items: center; cursor: pointer; opacity: 0; transition: opacity .15s; }
.msg-more svg { width: 16px; height: 16px; fill: currentColor; stroke: currentColor; }
.msg[data-own]:hover .msg-more, .msg.menu-on .msg-more, .msg-more:focus-visible { opacity: 1; }
@media (pointer: coarse) { .msg-more { display: none; } .msg[data-own] { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; } }
.msg-menu { position: absolute; z-index: 30; min-width: 200px; padding: 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 18px 40px -12px rgba(0,0,0,.35); display: grid; gap: 2px; animation: sel-in .16s cubic-bezier(.2, .9, .3, 1.1); transform-origin: top right; }
.msg-menu[hidden] { display: none; }
.msg-menu button { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; text-align: left; cursor: pointer; }
.msg-menu button:hover { background: var(--surface-2); }
.msg-menu button[hidden] { display: none; }
.msg-menu button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); }
.msg-menu .danger, .msg-menu .danger svg { color: var(--bad); }
.chat-editing { display: grid; grid-template-columns: 20px minmax(0, 1fr) 30px; align-items: center; gap: 10px; padding: 8px 10px; margin-bottom: 8px; border-radius: 12px; background: var(--surface-2); border-left: 3px solid var(--accent); }
.chat-editing[hidden] { display: none; }
.chat-editing > svg { width: 18px; height: 18px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chat-editing b { display: block; font-size: 13px; color: var(--accent); }
.chat-editing small { display: block; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-editing .x { width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.chat-editing .x:hover { background: var(--surface); }
.chat-editing .x svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
/* Долги: переход в подробный список */
.debt-head { display: block; color: inherit; text-decoration: none; border-radius: 12px; }
.debt-head .count { display: inline-flex; align-items: center; gap: 4px; }
.debt-head .count svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; transition: transform .2s; }
.debt-head:hover h2 { color: var(--primary); }
.debt-head:hover .count svg { transform: translate(2px, -2px); }
.debt-more { margin-top: 10px; width: 100%; justify-content: center; }
.debt-more svg { width: 14px; height: 14px; }
.debt-detail-head { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin: 16px 0; }
.debt-detail-head .debt-switch { align-self: stretch; }
.debt-switch { box-shadow: none; }
.debt-partner { margin-top: 12px; scroll-margin-top: 90px; }
.debt-partner:target { animation: target-flash 2.2s ease-out 1; }
.debt-partner-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.debt-partner-head .who { flex: 1; min-width: 0; }
.debt-partner-head .title { font-weight: 700; font-size: 16px; color: var(--ink); text-decoration: none; }
.debt-partner-head .title:hover { color: var(--primary); text-decoration: underline; }
.debt-partner-head .sum { text-align: right; display: grid; gap: 4px; justify-items: end; }
.debt-sum { font-size: 20px; font-weight: 800; }
.debt-lines { display: grid; gap: 6px; }
.debt-line { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); color: inherit; text-decoration: none; transition: background .15s, transform .15s; }
.debt-line:hover { background: color-mix(in srgb, var(--primary) 7%, var(--surface-2)); transform: translateX(2px); }
.debt-line .n { font-weight: 800; color: var(--muted); }
.debt-line .what b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.debt-line .what small { display: block; font-size: 12.5px; }
.debt-line .amt { display: grid; justify-items: end; gap: 3px; font-weight: 800; white-space: nowrap; }
@media (max-width: 600px) {
  .debt-partner-head { flex-wrap: wrap; }
  .debt-partner-head .sum { flex-basis: 100%; grid-auto-flow: column; justify-content: space-between; align-items: center; justify-items: start; }
  .debt-line { grid-template-columns: 30px minmax(0, 1fr) auto; gap: 8px; padding: 10px; }
}
/* Выписка: наше юрлицо по счёту */
.imp-accounts { display: grid; gap: 10px; margin-bottom: 14px; }
.imp-acc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 340px); gap: 8px 16px; align-items: end; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.imp-acc.ask { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.imp-acc > .small { grid-column: 1 / -1; }
.imp-acc-info { display: flex; gap: 12px; align-items: center; min-width: 0; align-self: center; }
.imp-acc-info > div { min-width: 0; }
.imp-acc-info .small { overflow-wrap: anywhere; }
.imp-acc-ico { width: 38px; height: 38px; flex: none; border-radius: 11px; display: grid; place-items: center; background: var(--surface); color: var(--ink-2); }
.imp-acc-ico svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.imp-acc .field { margin: 0; }
@media (max-width: 700px) { .imp-acc { grid-template-columns: 1fr; } }

/* ===== ИИ-ассистент в стиле Gemini ===== */
:root { --ai-grad: linear-gradient(90deg, #4285f4 0%, #9b72cb 45%, #d96570 100%); }
.content:has(.ai-shell) { padding-bottom: 16px; }
.chat.ai-shell { height: calc(100dvh - 104px); min-height: 420px; max-width: 900px; margin: 0 auto; background: transparent; border: 0; box-shadow: none; border-radius: 0; overflow: visible; }
.ai-top { display: flex; align-items: center; gap: 12px; padding: 4px 0 10px; }
.ai-logo { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--ai-grad); color: #fff; flex: none; box-shadow: 0 8px 20px -10px #9b72cb; }
.ai-logo svg { width: 20px; height: 20px; fill: currentColor; stroke: none; }
.ai-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.ai-title b { font-size: 16px; }
.ai-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.ai-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.ai-status.on i { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.ai-more { position: relative; }
.ai-more summary { list-style: none; }
.ai-more summary::-webkit-details-marker { display: none; }
.ai-more summary svg { width: 18px; height: 18px; fill: currentColor; }
.ai-more-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 260px; padding: 6px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 18px 40px -12px rgba(0,0,0,.35); animation: sel-in .16s cubic-bezier(.2, .9, .3, 1.1); transform-origin: top right; }
.ai-more-menu form { margin: 0; }
.ai-more-menu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-align: left; }
.ai-more-menu button:hover { background: var(--surface-2); }
.ai-more-menu button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; color: var(--muted); }
.ai-more-menu .danger, .ai-more-menu .danger svg { color: var(--bad); }
.ai-more-note { padding: 8px 12px 6px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); margin-top: 4px; }

.ai-feed.chat-feed { background: transparent; padding: 8px 4px 16px; gap: 18px; }
.ai-empty { margin: auto 0; padding: 12px 0; }
.ai-hello { margin: 0; font-size: clamp(30px, 6vw, 46px); font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.ai-hello span { background: var(--ai-grad); -webkit-background-clip: text; background-clip: text; color: transparent; background-size: 200% 100%; animation: ai-sheen 6s ease-in-out infinite alternate; }
@keyframes ai-sheen { to { background-position: 100% 0; } }
.ai-sub { margin: 6px 0 26px; font-size: clamp(22px, 4.6vw, 34px); font-weight: 600; letter-spacing: -.02em; color: color-mix(in srgb, var(--muted) 80%, transparent); line-height: 1.15; }
.ai-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.ai-card { position: relative; min-height: 112px; padding: 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; text-align: left; cursor: pointer; display: flex; flex-direction: column; justify-content: space-between; gap: 12px; transition: background .2s, transform .2s, border-color .2s; }
.ai-card:hover { background: var(--surface-2); transform: translateY(-2px); border-color: color-mix(in srgb, #9b72cb 40%, var(--line)); }
.ai-card i { align-self: flex-end; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); color: var(--ink-2); }
.ai-card i svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Сообщения: пользователь — облачко справа, ассистент — просто текст со значком */
.ai-feed .msg.mine { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 22px 22px 6px 22px; padding: 10px 16px; max-width: min(620px, 85%); }
.ai-feed .msg.bot { background: transparent; border: 0; padding: 4px 0 0 40px; max-width: 100%; position: relative; line-height: 1.6; }
.ai-feed .msg.bot::before { content: ""; position: absolute; left: 0; top: 2px; width: 28px; height: 28px; border-radius: 50%; background: var(--ai-grad); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2c.6 5.4 3 7.8 8.4 8.4-5.4.6-7.8 3-8.4 8.4-.6-5.4-3-7.8-8.4-8.4C9 9.8 11.4 7.4 12 2z'/%3E%3C/svg%3E") center / 22px no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2c.6 5.4 3 7.8 8.4 8.4-5.4.6-7.8 3-8.4 8.4-.6-5.4-3-7.8-8.4-8.4C9 9.8 11.4 7.4 12 2z'/%3E%3C/svg%3E") center / 22px no-repeat; }
.ai-feed .msg.err { margin-left: 40px; border-radius: 14px; }
.ai-feed .msg.action { align-self: flex-start; margin-left: 40px; border-radius: 999px; background: var(--ok-bg); color: var(--ok); }
.ai-feed .msg.file { margin-left: 40px; align-self: flex-start; }
.ai-feed .msg.seen { border-radius: 14px; }
.ai-feed .typing { align-items: center; gap: 10px; padding: 4px 0; font-size: 14px; }
.ai-feed .typing.on { display: flex; }
.ai-feed .typing.on::after { display: none; }
.ai-feed .typing .t { background: linear-gradient(90deg, var(--muted) 30%, var(--ink) 50%, var(--muted) 70%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: ai-shimmer 1.4s linear infinite; font-weight: 600; }
@keyframes ai-shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.ai-spin { width: 28px; height: 28px; border-radius: 50%; background: conic-gradient(from 0deg, #4285f4, #9b72cb, #d96570, #4285f4); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px)); mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px)); animation: spin 1s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Поле ввода — «таблетка» */
.chat-form.ai-form { border: 0; background: transparent; padding: 6px 0 0; gap: 6px; }
.ai-pill { border-radius: 28px; background: var(--surface); border: 1px solid var(--line); padding: 8px; box-shadow: 0 10px 30px -18px rgba(0,0,0,.45); transition: border-color .2s, box-shadow .2s; }
.ai-pill:focus-within { border-color: color-mix(in srgb, #9b72cb 55%, var(--line)); box-shadow: 0 10px 34px -16px color-mix(in srgb, #9b72cb 55%, transparent); }
.ai-pill .chat-attach { padding: 4px 6px 8px; }
.ai-pill .chat-row { align-items: flex-end; gap: 6px; }
.ai-pill textarea { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 16px; line-height: 1.45; resize: none; padding: 9px 6px; min-height: 40px; height: 40px; max-height: 180px; }
.ai-plus, .ai-send { width: 40px; height: 40px; flex: none; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; transition: background .2s, color .2s, transform .15s; }
.ai-plus { background: var(--surface-2); color: var(--ink-2); }
.ai-plus:hover { background: var(--line); }
.ai-plus svg, .ai-send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ai-send { background: transparent; color: var(--muted); }
.ai-form.ready .ai-send { background: var(--ai-grad); color: #fff; }
.ai-form.ready .ai-send:active { transform: scale(.92); }
.ai-send:disabled { opacity: .45; cursor: default; }
.ai-foot { text-align: center; font-size: 11.5px; color: var(--muted); }
@media (max-width: 900px) {
  .chat.ai-shell { height: calc(100dvh - 64px - 84px - env(safe-area-inset-bottom)); min-height: 360px; }
  .content:has(.ai-shell) { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .ai-cards { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none; }
  .ai-cards::-webkit-scrollbar { display: none; }
  .ai-card { flex: 0 0 148px; min-height: 120px; scroll-snap-align: start; }
  .ai-feed .msg.bot { padding-left: 34px; }
  .ai-feed .msg.action, .ai-feed .msg.file, .ai-feed .msg.err { margin-left: 34px; }
  .ai-foot { display: none; }
}

/* ===== Мобильная полировка ===== */
.icon-btn { padding: 0; color: var(--ink); line-height: 0; }
.icon-btn > svg { display: block; }
.seg-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.seg-mini { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.seg-mini a { padding: 7px 14px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--ink-2); text-decoration: none; white-space: nowrap; text-align: center; transition: background .2s, color .2s; }
.seg-mini a:hover:not(.active) { color: var(--ink); background: var(--surface-2); }
.seg-mini a.active { background: var(--primary); color: var(--primary-ink); }
@media (max-width: 900px) {
    .eyebrow { display: none; }
    .page-head { align-items: center; }
    .page-head h1 { font-size: 26px; }
    /* меню: нижние пункты на одной линии с основными */
    .sidebar { overflow-y: auto; }
    .side-foot { flex-direction: column; flex-wrap: nowrap; gap: 2px; padding-top: 10px; margin-top: auto; border-top: 1px solid var(--line); }
    .side-foot > *, .side-foot form, .side-foot .link-btn { width: 100%; }
    .side-foot .link-btn { gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--ink-2); font-size: inherit; justify-content: flex-start; }
    .side-foot .link-btn svg { width: 20px; height: 20px; }
    /* фильтры: без подписей, кнопка не нужна — поиск живой */
    form.filters { padding: 12px; }
    form.filters .field > span:first-child, form.filters > .label { display: none; }
    form.filters .form-row { grid-template-columns: 1fr 1fr; gap: 8px; }
    form.filters .form-row > .field:first-child { grid-column: 1 / -1 !important; }
    form.filters .btn, form.filters .searchbar { margin-top: 0 !important; }
    form.filters .btn { display: none; }
    /* компактные строки таблиц: заголовок + сумма, ниже одна строка деталей */
    table.compact-sm tr { display: flex; flex-wrap: wrap; align-items: center; row-gap: 3px; padding: 12px 0; }
    table.compact-sm tr::after { content: ""; order: 1; flex-basis: 100%; height: 0; }
    table.compact-sm td { display: block; width: auto; padding: 0; border: 0; }
    table.compact-sm td::before { content: none; }
    table.compact-sm td.t { order: 0; flex: 1 1 0; min-width: 0; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    table.compact-sm td.a { order: 0; flex: none; margin-left: 12px; font-weight: 700; }
    table.compact-sm td.m { order: 2; font-size: 13px; color: var(--muted); }
    table.compact-sm td.m::before { content: "·"; margin: 0 6px; color: var(--muted); }
    table.compact-sm td.m0::before { content: none; }
    table.compact-sm td.hide-sm { display: none; }
    table.compact-sm td .badge, table.compact-sm td select.badge { font-size: 12px; }
    /* сегменты задач — во всю ширину */
    .seg-bar { flex-wrap: nowrap; gap: 8px; }
    .seg-mini { flex: 1; min-width: 0; }
    .seg-mini a { flex: 1; padding: 7px 6px; font-size: 13px; }
    /* ленты чипов: прокрутка до края с мягким затуханием */
    .chips { margin: 0 -16px; padding: 0 16px 2px; -webkit-mask: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 24px), transparent); mask: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 24px), transparent); }
    /* ассистент: карточки в ленте без обрезки */
    .ai-cards { margin: 0; padding: 2px 0 6px; }
    .ai-hello { font-size: 32px; }
    .ai-sub { font-size: 22px; margin-bottom: 20px; }
}
@media (max-width: 900px) {
    .page-head { flex-wrap: wrap; gap: 10px; }
    .page-actions { flex-wrap: nowrap; gap: 8px; }
    .page-actions .btn { padding-inline: 14px; }
}
@media (max-width: 900px) {
    .sidebar .brand { margin-bottom: 10px; }
    .sidebar .side-nav a, .side-foot .link-btn { padding-block: 9px; }
}
.ai-feed .text.md { white-space: normal; }
.ai-feed .text.md p { margin: 0 0 10px; }
.ai-feed .text.md p:last-child, .ai-feed .text.md ul:last-child, .ai-feed .text.md ol:last-child { margin-bottom: 0; }
.ai-feed .text.md ul, .ai-feed .text.md ol { margin: 0 0 10px; padding-left: 20px; }
.ai-feed .text.md li { margin: 3px 0; }
.ai-feed .text.md li::marker { color: #9b72cb; }
/* нижние пункты меню — ровно под основными и на компьютере */
.side-foot { flex-direction: column; flex-wrap: nowrap; gap: 2px; padding-top: 10px; margin-top: auto; border-top: 1px solid var(--line); }
.side-foot > *, .side-foot form, .side-foot .link-btn { width: 100%; }
.side-foot .link-btn { gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--ink-2); font-size: inherit; justify-content: flex-start; text-align: left; }
.side-foot .link-btn svg { width: 20px; height: 20px; }
.side-foot .link-btn { min-width: 0; } .side-foot .link-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Кнопка меню: значок строго по центру (only-mobile наследует flex от шапки) */
@media (max-width: 900px) { .topbar .icon-btn.only-mobile { display: grid !important; place-items: center; } }
/* Нижняя панель: плавающая «таблетка», только значки; у активного раздела — подпись */
@media (max-width: 900px) {
    .tabbar { left: 50%; right: auto; bottom: calc(10px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(calc(100% - 24px), 420px); display: flex; justify-content: space-between; gap: 4px; padding: 6px; border: 1px solid var(--line); border-radius: 26px; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); box-shadow: 0 12px 32px -12px rgba(0,0,0,.45); }
    .tabbar a { flex: 1 1 0; min-width: 0; flex-direction: row; justify-content: center; gap: 6px; height: 44px; padding: 0 10px; border-radius: 20px; font-size: 13px; color: var(--muted); transition: flex-grow .3s cubic-bezier(.2,.8,.2,1), background .2s, color .2s; }
    .tabbar a span { display: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .tabbar a svg { width: 22px; height: 22px; }
    .tabbar a.active { flex-grow: 2.2; background: var(--primary); color: var(--primary-ink); }
    .tabbar a.active span { display: block; }
    .tabbar a.active svg { stroke-width: 2; }
    .content { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
    .chat.ai-shell { height: calc(100dvh - 64px - 78px - env(safe-area-inset-bottom)); }
    .content:has(.ai-shell) { padding-bottom: calc(74px + env(safe-area-inset-bottom)); }
}
/* Поле ассистента: без полосы прокрутки, пока текст помещается */
.ai-pill textarea { overflow-y: hidden; scrollbar-width: thin; }
.ai-pill textarea::-webkit-scrollbar { width: 6px; }
.ai-pill textarea::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
/* Кнопка отправки: «загорается» с пружинкой, при отправке самолётик улетает и возвращается */
.ai-send { position: relative; overflow: hidden; background-size: 200% 200%; }
.ai-send svg { transition: transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.ai-form.ready .ai-send { animation: ai-pop .35s cubic-bezier(.3, 1.6, .5, 1), ai-flow 4s ease-in-out infinite alternate; box-shadow: 0 6px 18px -6px #9b72cb; }
.ai-form.ready .ai-send svg { transform: rotate(-12deg); }
.ai-form.ready .ai-send:hover svg { transform: rotate(-12deg) translate(2px, -2px) scale(1.08); }
.ai-send.fly svg { animation: ai-fly .6s cubic-bezier(.5, 0, .3, 1); }
@keyframes ai-pop { 0% { transform: scale(.7); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes ai-flow { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }
@keyframes ai-fly { 0% { transform: rotate(-12deg); opacity: 1; } 45% { transform: translate(26px, -26px) rotate(-12deg) scale(.7); opacity: 0; } 46% { transform: translate(-22px, 22px) scale(.7); opacity: 0; } 100% { transform: rotate(0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ai-send, .ai-send svg { animation: none !important; } }

/* ===== Чаты и обсуждения в стиле ассистента ===== */
.chat:not(.ai-shell) .chat-form.ai-form { padding: 10px 16px 14px; background: transparent; border-top: 0; }
.chat:not(.ai-shell) .chat-feed { background: transparent; }
.chat:not(.ai-shell) .chat-head { border-bottom: 1px solid var(--line); }
.ai-pill .chat-editing { margin: 0 0 6px; }
.ai-pill .chat-attach:not([hidden]) { display: flex; }
.ai-form .chat-drop { border-radius: 28px; }
.chat:not(.ai-shell) .msg { border-radius: 20px; padding: 9px 14px; }
.chat:not(.ai-shell) .msg.mine { border-radius: 20px 20px 6px 20px; }
.chat:not(.ai-shell) .msg:not(.mine):not(.sys) { border-radius: 20px 20px 20px 6px; }
/* мини-версия для обсуждения задач */
.ai-form.mini { margin-top: 10px; padding: 0; }
.ai-form.mini .ai-pill { padding: 5px 5px 5px 14px; border-radius: 24px; box-shadow: none; }
.ai-form.mini .chat-row { display: flex; align-items: center; gap: 6px; }
.ai-form.mini input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 15px; padding: 8px 0; }
.ai-form.mini .ai-send { width: 36px; height: 36px; }
.ai-form.mini .ai-send svg { width: 18px; height: 18px; }
/* все многострочные поля: аккуратная тонкая полоса и только при переполнении */
textarea { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
textarea::-webkit-scrollbar { width: 6px; }
textarea::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
textarea::-webkit-scrollbar-track { background: transparent; }
textarea.input { overflow-y: hidden; resize: none; }

.party-group { padding: 8px 12px 4px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
a.party-opt.party-own { display: block; text-decoration: none; color: var(--ink); box-shadow: inset 3px 0 0 var(--glow-b); }

/* ===== Наши юрлица: раскрывающиеся карточки ===== */
.ents { display: flex; flex-direction: column; gap: 10px; }
details.ent { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); transition: border-color .2s, box-shadow .2s; }
details.ent:hover { border-color: color-mix(in srgb, var(--glow-b) 30%, var(--line)); }
details.ent[open] { border-color: color-mix(in srgb, var(--glow-b) 40%, var(--line)); box-shadow: 0 16px 40px -24px color-mix(in srgb, var(--glow-b) 70%, transparent); }
details.ent summary { list-style: none; display: flex; align-items: center; gap: 14px; padding: 14px 16px; cursor: pointer; }
details.ent summary::-webkit-details-marker { display: none; }
.ent-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ent-main b { font-size: 16px; overflow-wrap: anywhere; }
.ent-main small { color: var(--muted); font-size: 13px; }
.ent-stats { display: flex; gap: 6px; }
details.ent .chev { width: 18px; height: 18px; color: var(--muted); transition: transform .25s; }
details.ent[open] .chev { transform: rotate(180deg); }
.ent-body { padding: 4px 16px 16px; border-top: 1px solid var(--line); animation: fade .25s both; }
.ent-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
.ent-kpis > * { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); color: var(--ink); text-decoration: none; }
.ent-kpis a:hover { background: color-mix(in srgb, var(--glow-b) 8%, var(--surface-2)); }
.ent-kpis small { color: var(--muted); font-size: 12px; }
.ent-kpis b { font-size: 18px; }
.ent-req { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; margin: 0; }
.ent-req > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); align-items: baseline; }
.ent-req dt { color: var(--muted); font-size: 13px; }
.ent-req dd { margin: 0; display: flex; align-items: baseline; gap: 6px; font-size: 14.5px; overflow-wrap: anywhere; }
.ent-req dd span { flex: 1; min-width: 0; }
.copy-btn { flex: none; width: 26px; height: 26px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; opacity: .5; transition: opacity .2s, background .2s, color .2s; }
.ent-req > div:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
.copy-btn:hover { background: var(--surface-2); color: var(--ink); }
.copy-btn svg { width: 15px; height: 15px; }
.copy-btn.copied, [data-copy-all].copied { color: var(--ok); opacity: 1; }
.ent-note { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 14px; white-space: pre-wrap; }
.ent-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
@media (max-width: 900px) {
    .ent-kpis { grid-template-columns: 1fr 1fr; }
    .ent-req { grid-template-columns: 1fr; }
    .ent-req > div { grid-template-columns: 1fr; gap: 2px; }
    .copy-btn { opacity: 1; }
}
details.ent .chev { transform: rotate(90deg); }
details.ent[open] .chev { transform: rotate(-90deg); }
@media (max-width: 900px) { .ent-stats { display: none; } details.ent summary { gap: 12px; padding: 12px 14px; } }

/* =====================================================================
   v8 · Дизайн-система. Этот слой последний и задаёт итоговые правила:
   токены (цвет, шрифт, отступы, радиусы, тени, движение) и единый вид
   кнопок, полей, карточек, вкладок, окон и состояний.
   Принцип: спокойные поверхности, один акцентный цвет для действий,
   цвет статусов — только там, где он что-то значит. Градиент остаётся
   только у ИИ-ассистента как его опознавательный знак.
   ===================================================================== */
:root {
    /* поверхности и текст — нейтральная холодная гамма */
    --bg: #f4f5f7; --surface: #ffffff; --surface-2: #f7f8fa; --line: #e3e6eb; --line-strong: #cfd4dc;
    --ink: #161c26; --ink-2: #3a4250; --muted: #677080;
    /* единственный акцент для действий и выбранного состояния */
    --primary: #2a5bd7; --primary-hover: #224bb5; --primary-ink: #ffffff; --primary-soft: #eaf0fd;
    --accent: #d9792b;           /* фирменная точка в логотипе */
    --sand: var(--surface); --sage: var(--surface); --sky: var(--surface);
    --ok: #1f7a4c; --ok-bg: #e4f4ea; --warn: #92600e; --warn-bg: #fcf1dc; --bad: #b4342b; --bad-bg: #fce8e6; --info: #2a5bd7; --info-bg: #eaf0fd;
    /* типографика */
    --fs-h1: clamp(24px, 2.6vw, 30px); --fs-h2: 18px; --fs-body: 15px; --fs-sm: 13px; --fs-xs: 12px;
    /* отступы: шаг 4px */
    --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
    /* радиусы: элементы управления 10, карточки 16, окна 20 */
    --r-sm: 8px; --r-md: 10px; --r-lg: 16px; --r-xl: 20px; --radius: var(--r-lg); --radius-sm: var(--r-md);
    /* тени: 1 — карточка, 2 — всплывающее меню, 3 — окно */
    --sh-1: 0 1px 2px rgba(16, 24, 40, .05); --sh-2: 0 8px 24px -8px rgba(16, 24, 40, .18); --sh-3: 0 24px 64px -16px rgba(16, 24, 40, .32);
    --shadow: var(--sh-1);
    /* движение */
    --dur-1: .12s; --dur-2: .2s; --ease: cubic-bezier(.2, .7, .2, 1);
    --focus: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent);
    --glow-a: #4285f4; --glow-b: #8b6fd6; --glow-c: #d96570;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0f1217; --surface: #161a21; --surface-2: #1b2029; --line: #262c37; --line-strong: #3a4250;
        --ink: #e8ecf2; --ink-2: #c3cad5; --muted: #8d96a5;
        --primary: #3d6fe0; --primary-hover: #5381ea; --primary-ink: #ffffff; --primary-soft: #1b2740;
        --ok: #7fcf9f; --ok-bg: #16301f; --warn: #e6b765; --warn-bg: #33281a; --bad: #f08c84; --bad-bg: #3a1f1d; --info: #8fb0f5; --info-bg: #1b2740;
        --sh-1: 0 1px 2px rgba(0, 0, 0, .35); --sh-2: 0 10px 28px -8px rgba(0, 0, 0, .6); --sh-3: 0 28px 70px -16px rgba(0, 0, 0, .75);
    }
}
:root[data-theme="dark"] {
    --bg: #0f1217; --surface: #161a21; --surface-2: #1b2029; --line: #262c37; --line-strong: #3a4250;
    --ink: #e8ecf2; --ink-2: #c3cad5; --muted: #8d96a5;
    --primary: #3d6fe0; --primary-hover: #5381ea; --primary-ink: #ffffff; --primary-soft: #1b2740;
    --ok: #7fcf9f; --ok-bg: #16301f; --warn: #e6b765; --warn-bg: #33281a; --bad: #f08c84; --bad-bg: #3a1f1d; --info: #8fb0f5; --info-bg: #1b2740;
    --sh-1: 0 1px 2px rgba(0, 0, 0, .35); --sh-2: 0 10px 28px -8px rgba(0, 0, 0, .6); --sh-3: 0 28px 70px -16px rgba(0, 0, 0, .75);
}

/* --- База: ровный фон без декоративных пятен --- */
body { background: var(--bg); font-size: var(--fs-body); }
::selection { background: color-mix(in srgb, var(--primary) 25%, transparent); }

/* --- Фокус с клавиатуры виден везде, мышью — не мешает --- */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--r-sm); }
.input:focus-visible, textarea:focus-visible, .ai-pill textarea:focus-visible, .ai-pill input:focus-visible { outline: none; }

/* --- Заголовок страницы: один уровень, без конкуренции с цифрами --- */
.page-head { margin: var(--sp-2) 0 var(--sp-6); align-items: center; }
.page-head h1 { font-size: var(--fs-h1); font-weight: 750; letter-spacing: -.025em; }
.eyebrow { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; margin-bottom: var(--sp-1); }
h2 { font-size: var(--fs-h2); }

/* --- Карточки: одна форма для всех --- */
.card { border-radius: var(--r-lg); box-shadow: var(--sh-1); padding: var(--sp-6); }
a.card:hover, .stat:hover, .booking:hover, .person:hover, a.tile:hover, .tile.hover:hover, .msg.file:hover, .ai-card:hover { transform: none; }
a.card:hover, .booking:hover, a.tile:hover, .person:hover { border-color: var(--line-strong); box-shadow: var(--sh-1); }
.card-head h2 { font-size: var(--fs-h2); }
.count { font-size: var(--fs-sm); color: var(--muted); }

/* --- Показатели: нейтральный фон, цвет — только у метки --- */
.stat.sand, .stat.sage, .stat.sky { background: var(--surface); border: 1px solid var(--line); }
.stat.sand .lbl::before, .stat.sage .lbl::before, .stat.sky .lbl::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.stat.sand .lbl::before { background: var(--warn); }
.stat.sage .lbl::before { background: var(--ok); }
.stat.sky .lbl::before { background: var(--info); }
.stat .ico { background: var(--surface-2); }
.stat::before { display: none; }

/* --- Главный блок на главной и в бронях: спокойная поверхность, иллюстрация без «полёта» --- */
.hero { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--sh-1); padding: var(--sp-6) var(--sp-8); }
.hero::before { opacity: .35; }
:root[data-theme="dark"] .hero { background: var(--surface); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero { background: var(--surface); } }
.hero .art > g, .hero .art > g:nth-of-type(3), .hero .art > ellipse { animation: none; }
.hero .art-box { transform: none; max-height: 220px; }
.hero .big { font-size: clamp(56px, 7vw, 88px); }

/* --- Кнопки: сплошной акцент, понятные состояния --- */
.btn { height: 40px; padding: 0 var(--sp-4); border-radius: var(--r-md); font-weight: 650; font-size: 14.5px; box-shadow: none; transition: background var(--dur-1), border-color var(--dur-1), color var(--dur-1), transform var(--dur-1); }
.btn::after { display: none; }
.btn:not(.ghost):not(.soft):not(.danger) { background: var(--primary); color: var(--primary-ink); }
.btn:not(.ghost):not(.soft):not(.danger):hover { background: var(--primary-hover); filter: none; }
.btn:hover { transform: none; filter: none; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn.ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn.soft { background: var(--primary-soft); color: var(--primary); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.sm { height: 32px; padding: 0 var(--sp-3); font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn:disabled, .btn[aria-disabled="true"], .icon-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.page-actions .del-btn { background: transparent; border-color: transparent; color: var(--bad); }
.page-actions .del-btn:hover { background: var(--bad-bg); border-color: transparent; }
.icon-btn { border-radius: var(--r-md); transition: background var(--dur-1), border-color var(--dur-1); }
.icon-btn:hover { transform: none; border-color: var(--line-strong); }
.icon-btn.ghost { border-color: transparent; background: transparent; color: var(--muted); width: 34px; height: 34px; }
.icon-btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.ghost svg { width: 18px; height: 18px; }
.corner-link:hover, a.card:hover .corner-link, .hero:hover .corner-link { transform: none; box-shadow: none; }

/* --- Поля ввода --- */
.input, select.input, textarea.input { min-height: 42px; border-radius: var(--r-md); background: var(--surface); border-color: var(--line); transition: border-color var(--dur-1), box-shadow var(--dur-1); }
.input:hover:not(:focus):not(:disabled) { border-color: var(--line-strong); }
.input:focus, .search-input:focus-within .input { border-color: var(--primary); box-shadow: var(--focus); background: var(--surface); }
.input:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.input:user-invalid { border-color: var(--bad); }
.input:user-invalid:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 25%, transparent); }
.field > span, .label { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.search-input:focus-within > svg { transform: translateY(-50%); }
.search-trigger { border-radius: var(--r-md); background: var(--surface); }
.search-trigger:hover { border-color: var(--line-strong); box-shadow: none; }

/* --- Фильтры-чипы и сегменты: выбранное — мягкий акцент, не «кнопка» --- */
.chip { height: 34px; padding: 0 var(--sp-3); border-radius: 999px; font-size: 14px; font-weight: 600; }
.chip:hover:not(.active) { transform: none; border-color: var(--line-strong); background: var(--surface-2); }
.chip.active { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 35%, transparent); color: var(--primary); }
:root[data-theme="dark"] .chip.active { color: var(--info); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.active { color: var(--info); } }
.seg-mini, .seg-tabs { background: var(--surface-2); border-color: var(--line); box-shadow: none; }
.seg-mini a.active, .seg-tab.active { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1), 0 0 0 1px var(--line); }
.seg-tab.active svg { color: var(--primary); }
.seg-tab:hover:not(.active) { background: color-mix(in srgb, var(--ink) 4%, transparent); }

/* --- Бейджи --- */
.badge { height: 22px; padding: 0 var(--sp-2); font-size: var(--fs-xs); font-weight: 650; }
.badge.info { background: var(--info-bg); color: var(--info); }

/* --- Боковое меню: группы, одна полоска-индикатор, профиль внизу --- */
.sidebar { padding: var(--sp-5) var(--sp-3); }
.brand { margin-bottom: var(--sp-4); }
.brand-mark { background: var(--primary); color: #fff; box-shadow: none; border-radius: var(--r-md); }
.side-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; padding: var(--sp-4) var(--sp-3) var(--sp-1); }
.side-nav .side-label:first-child { padding-top: 0; }
.side-nav { gap: 1px; }
.side-nav a { padding: 8px 12px; border-radius: var(--r-md); font-size: 14.5px; }
.side-nav a:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.side-nav a.active { background: var(--surface); box-shadow: var(--sh-1), 0 0 0 1px var(--line); font-weight: 650; }
.side-nav a.active svg { color: var(--primary); }
.side-nav a::before { background: var(--primary); left: -12px; }
.side-nav a svg { width: 19px; height: 19px; }
.side-foot { gap: 2px; padding-top: var(--sp-3); }
.side-foot .link-btn { padding: 8px 12px; font-size: 14px; }
.side-user { display: flex; align-items: center; gap: 10px; margin-top: var(--sp-2); padding: 8px 6px 2px 8px; border-top: 1px solid var(--line); padding-top: var(--sp-3); }
.side-user form { margin: 0; width: auto !important; }
.side-user-name { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; color: var(--ink); text-decoration: none; }
.side-user-name b { font-size: 14px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-name small { font-size: var(--fs-xs); color: var(--muted); }
.side-foot > .side-user { width: 100%; }

/* --- Окна и меню: один уровень тени, без цветного свечения; у поиска — лёгкий акцент --- */
dialog.modal { border-radius: var(--r-xl); border: 1px solid var(--line); box-shadow: var(--sh-3); }
dialog.palette { border-radius: var(--r-xl); border: 1px solid var(--line); box-shadow: var(--sh-3), 0 0 0 1px color-mix(in srgb, var(--primary) 10%, transparent), 0 20px 70px -24px color-mix(in srgb, var(--primary) 45%, transparent); }
dialog.modal::backdrop, dialog.palette::backdrop { background: rgba(10, 14, 20, .5); backdrop-filter: blur(3px); }
.sel-pop, .msg-menu, .ai-more-menu, .party-list { box-shadow: var(--sh-2); border-radius: var(--r-lg); }
.pal-item.sel { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.pal-item.sel .pi { background: var(--primary); color: #fff; }
.pal-item mark, mark { background: color-mix(in srgb, var(--primary) 22%, transparent); color: inherit; border-radius: 3px; }
a.party-opt.party-own { box-shadow: inset 3px 0 0 var(--primary); }

/* --- Сообщения: свои — сплошной акцент --- */
.chat:not(.ai-shell) .msg.mine { background: var(--primary); color: var(--primary-ink); }

/* --- Пустые состояния: значок в круге, текст, при наличии — действие --- */
.empty-big { padding: var(--sp-8) var(--sp-4); }
.empty-big svg { width: 22px; height: 22px; padding: 13px; box-sizing: content-box; border-radius: 50%; background: var(--surface-2); color: var(--muted); stroke-width: 1.7; margin-bottom: var(--sp-3); }
.empty-big div { max-width: 360px; margin: 0 auto; line-height: 1.5; }

/* --- Загрузка: живой поиск показывает, что идёт запрос --- */
form[data-live].searching ~ [data-results], form[data-live].searching + [data-results] { opacity: .55; transition: opacity var(--dur-2); }
[data-results] { transition: opacity var(--dur-2); }
form[data-live] .search-input::after { content: ""; position: absolute; right: 12px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--primary); opacity: 0; animation: spin .7s linear infinite; pointer-events: none; }
form[data-live].searching .search-input::after { opacity: 1; }

/* --- Уведомления --- */
.toast { border-radius: var(--r-md); }

/* --- Список-строки и таблицы --- */
.table th { font-size: var(--fs-xs); font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.table tbody tr:hover { background: var(--surface-2); }

/* --- Нижняя панель и мобильная шапка: тот же акцент, без градиента --- */
.tabbar a.active { background: var(--primary); }
.topbar .icon-btn { background: var(--surface); }

/* --- Меньше движения, если так настроено в системе --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
/* профиль уже внизу бокового меню — в шапке на компьютере не дублируем */
@media (min-width: 901px) { .topbar .me { display: none; } .search-trigger { margin-right: 0; min-width: 260px; } }
.empty-inline { padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-2); border-radius: var(--r-md); background: var(--surface-2); color: var(--muted); font-size: var(--fs-sm); }
button.link { border: 0; background: none; padding: 0; font: inherit; color: var(--primary); font-weight: 600; cursor: pointer; }
button.link:hover { text-decoration: underline; }
.topbar { align-items: center; }
.topbar .brand-name { line-height: 1; }
@media (max-width: 900px) { .hero .art-box { width: 46%; max-width: 190px; } }
/* инициалы: нейтральная плашка вместо цветной */
.letter { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); border-radius: var(--r-md); font-size: 16px; }
.letter.blue { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
:root[data-theme="dark"] .letter.blue { color: var(--info); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .letter.blue { color: var(--info); } }
/* длинные названия — не больше двух строк, полное в подсказке */
.tile .title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile { align-items: center; }
/* телефон: действия в шапке не вылезают за экран, «Удалить» — значком */
@media (max-width: 900px) {
    .page-actions { flex-wrap: wrap; }
    .page-actions .del-btn { width: 40px; padding: 0; font-size: 0; gap: 0; }
    .page-actions .del-btn svg { margin: 0; }
    .grid-3 > .stat { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 16px; }
    .grid-3 > .stat .lbl { margin: 0 !important; }
    .grid-3 > .stat .val.money { font-size: 18px; }
    .grid.grid-3 { gap: 8px; }
}
.avatar[style*="--h"] { background: hsl(var(--h) 52% 50%); text-shadow: none; box-shadow: none; }

/* ===== v9 · Переливающаяся подсветка всплывающих окон (как приветствие ассистента) ===== */
:root { --glow-a: #4285f4; --glow-b: #9b72cb; --glow-c: #d96570; --glow-k: 48%; }
:root[data-theme="dark"] { --glow-k: 72%; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --glow-k: 72%; } }
dialog.palette, dialog.modal {
  border: 1.5px solid transparent;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(90deg, var(--glow-a), var(--glow-b), var(--glow-c), var(--glow-b), var(--glow-a)) border-box;
  background-size: 100% 100%, 300% 100%;
  animation: glow-flow 8s ease-in-out infinite alternate, glow-halo 8s ease-in-out infinite alternate;
}
dialog.palette[open], dialog.modal[open] {
  animation: pop .22s cubic-bezier(.2, .9, .3, 1.2) both, glow-flow 8s ease-in-out infinite alternate, glow-halo 8s ease-in-out infinite alternate;
}
@keyframes glow-flow { from { background-position: 0 0, 0% 0; } to { background-position: 0 0, 100% 0; } }
@keyframes glow-halo {
  0%   { box-shadow: var(--sh-3), -30px -10px 80px -16px color-mix(in srgb, var(--glow-a) var(--glow-k), transparent), 30px 10px 80px -16px color-mix(in srgb, var(--glow-c) var(--glow-k), transparent), 0 0 90px -30px color-mix(in srgb, var(--glow-b) var(--glow-k), transparent); }
  50%  { box-shadow: var(--sh-3), 0 -26px 80px -16px color-mix(in srgb, var(--glow-b) var(--glow-k), transparent), 0 26px 80px -16px color-mix(in srgb, var(--glow-a) var(--glow-k), transparent), 0 0 90px -30px color-mix(in srgb, var(--glow-c) var(--glow-k), transparent); }
  100% { box-shadow: var(--sh-3), 30px -10px 80px -16px color-mix(in srgb, var(--glow-c) var(--glow-k), transparent), -30px 10px 80px -16px color-mix(in srgb, var(--glow-a) var(--glow-k), transparent), 0 0 90px -30px color-mix(in srgb, var(--glow-b) var(--glow-k), transparent); }
}
.palette-input { border-bottom-color: color-mix(in srgb, var(--glow-b) 22%, var(--line)); }
.palette-input > svg { stroke: var(--glow-b); }
@media (prefers-reduced-motion: reduce) {
  dialog.palette, dialog.modal, dialog.palette[open], dialog.modal[open] { animation: none !important; box-shadow: var(--sh-3), 0 0 80px -28px color-mix(in srgb, var(--glow-b) var(--glow-k), transparent); }
}

/* ===== Уведомление «Скопировано» ===== */
.notice { position: fixed; left: 50%; bottom: 24px; z-index: 1002; display: inline-flex; align-items: center; gap: 8px; max-width: calc(100vw - 32px); padding: 10px 16px 10px 12px; border-radius: 999px; background: var(--ink); color: var(--surface); font-size: 14px; font-weight: 600; box-shadow: var(--sh-3); pointer-events: none; opacity: 0; transform: translate(-50%, 12px); transition: opacity var(--dur-2, .2s) ease, transform var(--dur-2, .2s) ease; }
.notice span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notice svg { width: 18px; height: 18px; flex: none; padding: 3px; border-radius: 50%; background: var(--ok); color: #fff; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; box-sizing: border-box; }
.notice.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 900px) { .notice { bottom: calc(86px + env(safe-area-inset-bottom)); } }
[data-copy-all].copied { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.notice.err { white-space: normal; border-radius: var(--r-lg, 16px); max-width: min(480px, calc(100vw - 32px)); align-items: flex-start; }
.notice.err span { white-space: normal; }
.notice.err svg { background: var(--bad); }
.ai-status.off i { background: var(--bad); }
.ai-status.checking i { background: var(--primary); animation: ai-check-pulse 1s ease-in-out infinite; }
@keyframes ai-check-pulse { 50% { opacity: .3; } }
/* уведомление сверху, чтобы не перекрывать поле ввода в чатах */
.notice { top: 18px; bottom: auto; transform: translate(-50%, -12px); }
.notice.show { transform: translate(-50%, 0); }
@media (max-width: 900px) { .notice { top: calc(76px + env(safe-area-inset-top)); bottom: auto; } }

/* ===== Групповые чаты ===== */
.card-head .new-chat { margin-left: auto; }
.avatar.group { position: relative; }
.avatar.group i { position: absolute; right: -3px; bottom: -3px; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--ink-2); box-shadow: 0 0 0 1.5px var(--surface); }
.avatar.group i svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.chat-head { display: flex; align-items: center; gap: 10px; }
.chat-head .chat-who { flex: 1; min-width: 0; }
.chat-people { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-more { position: relative; flex: none; }
.members { display: grid; gap: 4px; max-height: min(320px, 42vh); overflow-y: auto; padding: 4px; margin: 0 -4px; overscroll-behavior: contain; }
.member { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--r-md, 10px); border: 1px solid var(--line); cursor: pointer; transition: background var(--dur-1, .12s), border-color var(--dur-1, .12s); }
.member[hidden] { display: none; }
.member:hover { background: var(--surface-2); }
.member input { position: absolute; opacity: 0; pointer-events: none; }
.member .mb { flex: 1; min-width: 0; display: grid; }
.member .mb b { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member .mb small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member .mk { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 1.5px solid var(--line-2, var(--line)); display: grid; place-items: center; color: transparent; transition: background var(--dur-1, .12s), border-color var(--dur-1, .12s); }
.member .mk svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.member:has(input:checked) { border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); background: var(--primary-soft); }
.member:has(input:checked) .mk { background: var(--primary); border-color: var(--primary); color: #fff; }
.member:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.members-tools { display: flex; justify-content: flex-end; }
.members-field > span small { font-weight: 500; }
.card-head:has(.new-chat) { flex-wrap: nowrap; } .card-head:has(.new-chat) > h2 { flex: 0 1 auto; } .card-head .new-chat { white-space: nowrap; flex: none; }

/* ===== Голосовые сообщения ===== */
.ai-mic { width: 40px; height: 40px; flex: none; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: transparent; color: var(--muted); transition: background .2s, color .2s, transform .15s; }
.ai-mic:hover { background: var(--surface-2); color: var(--ink); }
.ai-mic:active { transform: scale(.92); }
.ai-mic svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ai-mic[hidden] { display: none; }
/* пока поле пустое — микрофон, когда что-то набрано — «Отправить» */
.composer.can-voice:not(.ready) .chat-row > .ai-send { display: none; }
.composer.can-voice.ready .ai-mic { display: none; }
.composer:has(.chat-editing:not([hidden])) .ai-mic { display: none; }
.composer:has(.chat-editing:not([hidden])) .chat-row > .ai-send { display: grid; }
.composer.recording .chat-row, .composer.recording .chat-attach { display: none !important; }
.rec-bar { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 2px 0 4px; }
.rec-bar[hidden] { display: none; }
.rec-bar .rec-x { width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%; display: grid; place-items: center; background: transparent; color: var(--bad); cursor: pointer; }
.rec-bar .rec-x:hover { background: var(--bad-bg); }
.rec-bar .rec-x svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); flex: none; animation: rec-blink 1s ease-in-out infinite; }
@keyframes rec-blink { 50% { opacity: .25; } }
.rec-bar time { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; min-width: 38px; }
.rec-wave { flex: 1; min-width: 0; height: 28px; display: flex; align-items: center; justify-content: flex-end; gap: 2px; overflow: hidden; }
.rec-wave i, .vwave i { flex: none; width: 3px; height: var(--v); min-height: 3px; border-radius: 2px; background: currentColor; }
.rec-wave i { color: var(--glow-b, #9b72cb); }
.rec-bar .rec-send { background: var(--ai-grad); color: #fff; }
.composer.sending .rec-bar, .composer.sending .ai-mic { opacity: .5; pointer-events: none; }
/* плеер в сообщении */
.msg .voice { --p: 0; display: flex; align-items: center; gap: 10px; min-width: 220px; max-width: 320px; padding: 2px 0; }
.voice .vplay { width: 38px; height: 38px; flex: none; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: var(--primary); color: #fff; transition: transform .15s; }
.voice .vplay:active { transform: scale(.92); }
.voice .vplay svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; }
.voice .vwave { flex: 1; height: 30px; display: flex; align-items: center; gap: 2px; cursor: pointer; color: color-mix(in srgb, var(--ink) 28%, transparent);
  -webkit-mask: none; background: none; position: relative; }
.voice .vwave i { flex: 1 1 0; width: auto; max-width: 4px; }
.voice .vwave::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.voice time { font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--muted); min-width: 34px; text-align: right; }
.voice.playing .vwave i { transition: background .1s; }
.msg.mine .voice .vplay { background: #fff; color: var(--primary); }
.msg.mine .voice .vwave { color: color-mix(in srgb, #fff 45%, transparent); }
.msg.mine .voice time { color: color-mix(in srgb, #fff 80%, transparent); }
.voice .vwave i.on { background: var(--primary); }
.msg.mine .voice .vwave i.on { background: #fff; }

/* ===== Фото профиля ===== */
.avatar { overflow: hidden; }
.avatar > img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
.avatar.xl { width: 76px; height: 76px; font-size: 28px; }
.ava-pick { display: flex; align-items: center; gap: 16px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-lg, 16px); background: var(--surface-2); }
.ava-txt { display: grid; gap: 4px; min-width: 0; }
.ava-txt small { color: var(--muted); font-size: 12.5px; }
.ava-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.ava-btns .btn[hidden] { display: none; }
.ava-btns label.btn { cursor: pointer; }
.avatar.group { overflow: visible; }
