/* Оформление как на сайте example.ru: navy + золото, Montserrat и Cormorant Garamond.
   Тёмная тема — по настройке устройства. Шрифты свои (OFL, см. fonts/OFL.txt), без Google Fonts. */
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 400; font-display: swap; src: url(/static/fonts/montserrat-400.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 400; font-display: swap; src: url(/static/fonts/montserrat-400-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 500; font-display: swap; src: url(/static/fonts/montserrat-500.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 500; font-display: swap; src: url(/static/fonts/montserrat-500-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 600; font-display: swap; src: url(/static/fonts/montserrat-600.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 600; font-display: swap; src: url(/static/fonts/montserrat-600-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 700; font-display: swap; src: url(/static/fonts/montserrat-700.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 700; font-display: swap; src: url(/static/fonts/montserrat-700-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 500; font-display: swap; src: url(/static/fonts/cormorant-garamond-500.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 500; font-display: swap; src: url(/static/fonts/cormorant-garamond-500-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 {
  --st-amber-bg: #FDF3DC; --st-amber: #7A5410; --st-red-bg: #FDE8E6; --st-red: #A6342A; --st-green-bg: #E4F4EA; --st-green: #1F6A43; --st-grey-bg: #EDF0F3; --st-grey: #55616E;
  /* палитра сайта */
  --navy: #0E2A47; --navy2: #163E66; --navy3: #254764; --ink: #18324D; --blue-muted: #9BB4CD;
  --beige: #D7D1C8; --beige-light: #E8E2DA; --paper: #F6F2EC; --white: #F8FAFC;
  --gold: #D4A64A; --gold-dark: #B9862C; --on-gold: #102941; --radius: 14px;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Montserrat", "Segoe UI", Arial, sans-serif;
  /* роли (на них опираются все правила ниже) */
  --bg: var(--paper); --surface: #FFFFFF; --surface-2: var(--beige-light); --mine: var(--beige-light);
  --text: var(--ink); --muted: #6E7E8D; --line: rgba(24,50,77,.17);
  --primary: var(--navy); --on-primary: var(--white); --accent: var(--gold); --accent-text: #8A6420; /* мелкий золотой текст: #B9862C на светлом читается плохо */
  --head: var(--navy); --head-text: #C6D5E2; --head-line: rgba(255,255,255,.12);
  --bad: #C8443A; --error-bg: #F7E3E1; --focus: rgba(212,166,74,.55);
  --shadow: 0 1px 2px rgba(24,50,77,.06), 0 6px 18px rgba(24,50,77,.07);
  color-scheme: light;
}
/* Тема: по устройству (по умолчанию) или выбранная вручную — data-theme на <html> (переключатель в шапке). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--navy); --surface: var(--navy2); --surface-2: #0B2239; --mine: var(--navy3);
    --text: var(--white); --muted: var(--blue-muted); --line: rgba(255,255,255,.14);
    --primary: var(--gold); --on-primary: var(--on-gold); --accent-text: var(--gold);
    --head: #0B2239; --head-line: rgba(255,255,255,.1);
    --error-bg: #4A2230; --shadow: 0 1px 2px rgba(0,0,0,.25); color-scheme: dark;
    --st-amber-bg: rgba(212,166,74,.2); --st-amber: #F0CE87; --st-red-bg: rgba(200,68,58,.25); --st-red: #F4A9A1; --st-green-bg: rgba(60,160,105,.25); --st-green: #8FD9B0; --st-grey-bg: rgba(255,255,255,.12); --st-grey: #C6D5E2;
  }
}
:root[data-theme="dark"] {
  --bg: var(--navy); --surface: var(--navy2); --surface-2: #0B2239; --mine: var(--navy3);
  --text: var(--white); --muted: var(--blue-muted); --line: rgba(255,255,255,.14);
  --primary: var(--gold); --on-primary: var(--on-gold); --accent-text: var(--gold);
  --head: #0B2239; --head-line: rgba(255,255,255,.1);
  --error-bg: #4A2230; --shadow: 0 1px 2px rgba(0,0,0,.25); color-scheme: dark;
  --st-amber-bg: rgba(212,166,74,.2); --st-amber: #F0CE87; --st-red-bg: rgba(200,68,58,.25); --st-red: #F4A9A1; --st-green-bg: rgba(60,160,105,.25); --st-green: #8FD9B0; --st-grey-bg: rgba(255,255,255,.12); --st-grey: #C6D5E2;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2 { font-family: var(--serif); font-weight: 500; letter-spacing: -.01em; line-height: 1.1; }
h1 { font-size: 34px; margin: 0 0 20px; }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
input, textarea, button, select { font: inherit; }
input, textarea { width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--focus); }

/* Кнопки — «таблетки», как на сайте: основная navy, акцентная золото, второстепенная контур. */
button { min-height: 40px; padding: 8px 20px; border: 1px solid transparent; border-radius: 999px; background: var(--primary); color: var(--on-primary); font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
button:hover { background: var(--navy2); }
button:disabled { opacity: .55; cursor: default; }
.btn-gold, button.btn-gold { background: var(--gold); color: var(--on-gold); }
.btn-gold:hover, button.btn-gold:hover { background: #E2B653; }
.btn-outline, button.btn-outline { background: transparent; color: var(--text); border-color: var(--line); }
.btn-outline:hover, button.btn-outline:hover { border-color: var(--gold); background: transparent; }
button.small { min-height: 32px; padding: 4px 14px; border-radius: 999px; background: transparent; color: var(--text); border-color: var(--line); font-size: 13px; font-weight: 600; }
button.small:hover { border-color: var(--gold); background: var(--surface-2); }
button.link { min-height: 0; background: none; border: 0; color: inherit; text-decoration: underline; text-underline-offset: 3px; padding: 0; font-weight: 500; border-radius: 0; }
button.link:hover { background: none; color: var(--accent-text); }
button.danger, button.small.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
button.danger:hover { background: #A9362E; }
@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) button:hover { background: #E2B653; }
  :where(:root:not([data-theme="light"])) button.small:hover, :where(:root:not([data-theme="light"])) .btn-outline:hover { background: rgba(255,255,255,.06); }
}
:where(:root[data-theme="dark"]) button:hover { background: #E2B653; }
:where(:root[data-theme="dark"]) button.small:hover, :where(:root[data-theme="dark"]) .btn-outline:hover { background: rgba(255,255,255,.06); }

/* Отдельные страницы (вход, регистрация, сотрудники) — карточка по центру на бумажном фоне. */
.page { max-width: 680px; margin: 8vh auto 32px; padding: 32px 36px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.page.auth { max-width: 440px; }
.page .brand { display: block; margin: 0 0 18px; font-family: var(--serif); font-size: 26px; font-weight: 500; color: var(--accent-text); text-decoration: none; }
.page > .muted { font-size: 14px; }
.stack { display: grid; gap: 16px; }
.stack label { display: grid; gap: 6px; font-size: 14px; font-weight: 500; }
.stack > button { justify-self: start; min-height: 46px; padding: 0 28px; }
.error { background: var(--error-bg); padding: 10px 14px; border-radius: 10px; margin: 8px 16px; }
.muted { color: var(--muted); }
.bad { color: var(--bad); }
.card { background: var(--surface-2); border-radius: var(--radius); padding: 14px 18px; margin: 16px 0; }
/* Настройки: строка с тумблером и список разделов */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.set-row label { font-size: 16px; }
.switch { appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 46px; height: 28px; margin: 0; border-radius: 999px; background: var(--muted); cursor: pointer; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.switch:checked { background: var(--gold); }
.switch:checked::after { transform: translateX(18px); }
.switch:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.set-list { display: flex; flex-direction: column; margin: 16px 0; border-top: 1px solid var(--line); }
.set-list a { display: flex; flex-direction: column; gap: 2px; padding: 14px 4px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.set-list a:hover b { color: var(--accent-text); }
.set-list .muted { font-size: 13px; }
.people { width: 100%; border-collapse: collapse; margin: 16px 0 24px; }
.people td { padding: 14px 8px 14px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.people form { display: inline-block; margin: 0 6px 6px 0; }
.people tr:has(+ .pos-row) td { padding-bottom: 6px; border-bottom: 0; }
.people .pos-row td { padding-top: 0; }
.people .pos-form { display: grid; gap: 8px; margin: 0; }
/* «Настройки → Клиенты»: поиск + выбор группы, заголовки групп по виду обслуживания */
.clients-filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.clients-filter #q { flex: 1 1 240px; min-width: 0; margin: 0; }
.clients-filter select { flex: 0 1 auto; max-width: 100%; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); }
.people .group-head th { text-align: left; padding: 22px 0 6px; font-weight: 600;
  border-bottom: 1px solid var(--line); }
.people .group-head:first-child th { padding-top: 4px; }
.pos-form .picks { gap: 6px; }
.pos-form button.small { justify-self: start; }
.pos-form .pick { min-height: 34px; padding: 2px 12px 2px 10px; font-size: 13px; }
.pos-title { margin: 32px 0 6px; font-family: var(--serif); font-size: 27px; font-weight: 500; }
.pos-list { margin: 12px 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.pos-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pos-list form { margin: 0; }
.pos-rename { flex: 1 1 280px; display: flex; gap: 8px; align-items: center; min-width: 0; }
.pos-rename input { flex: 1; min-width: 0; }
.pos-new { margin: 12px 0 0; }
@media (max-width: 560px) {
  .page { margin: 0; min-height: 100dvh; border: 0; border-radius: 0; box-shadow: none; padding: 24px 16px; }
  .people tr:has(+ .pos-row) { padding-bottom: 0; border-bottom: 0; }
  .people .pos-row { padding-top: 6px; }
  .pos-rename { flex-wrap: wrap; }
  .pos-rename input { flex: 1 1 100%; }
  .people tr { display: grid; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .people td { padding: 2px 0; border: 0; }
  .people tr.group-head { padding-bottom: 0; border-bottom: 0; }
}

/* Чаты: две колонки на компьютере, одна на телефоне. */
body.app { height: 100dvh; overflow: hidden; }
.layout { display: grid; grid-template-columns: var(--side-w, minmax(280px, 360px)) 1fr; height: 100dvh; }
.side { position: relative; container-type: inline-size; display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--surface); }
/* граница между списком и перепиской — тянется мышью, двойной щелчок возвращает как было */
.splitter { position: absolute; top: 0; right: -5px; z-index: 5; width: 9px; height: 100%; cursor: col-resize; touch-action: none; }
.splitter::after { content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 3px; background: transparent; transition: background .15s; }
.splitter:hover::after, .splitter.drag::after { background: var(--gold); opacity: .7; }
body.resizing { cursor: col-resize; user-select: none; }
body.resizing iframe { pointer-events: none; }
/* navy-шапка левой колонки: слово-логотип, ссылки, разделы */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px 10px; padding-top: max(14px, env(safe-area-inset-top)); background: var(--head); color: #fff; }
.top h1 { margin: 0; font-size: 27px; color: #fff; white-space: nowrap; }
.top nav { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--head-text); }
.top nav a { text-decoration: none; }
.top nav a:hover, .top nav button.link:hover { color: var(--gold); }
.top nav button.link { text-decoration: none; color: var(--head-text); }
/* шестерёнка «Настройки» — справа в navy-шапке */
.top nav .gear { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; color: var(--head-text); }
.top nav .gear:hover, .top nav .gear:focus-visible { color: var(--gold); background: rgba(255,255,255,.08); }
.top nav form { margin: 0; }
.calendar-note { margin: 0; padding: 8px 16px; background: var(--st-amber-bg); color: var(--st-amber); font-size: 13px; }
.push-note { margin: 0; padding: 0 16px 8px; background: var(--head); color: var(--head-text); font-size: 13px; }
.sections { display: flex; gap: 4px; padding: 0 8px; background: var(--head); border-bottom: 1px solid var(--head-line); }
.sections button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 4px; white-space: nowrap; min-height: 44px; padding: 8px 2px; background: transparent; color: var(--head-text); border: 0; border-bottom: 2px solid transparent; border-radius: 0; font-size: 14px; font-weight: 600; }
.sections button:hover { background: transparent; color: #fff; }
.sections button[aria-selected="true"] { color: var(--gold); border-bottom-color: var(--gold); }
.sections .count { margin-left: 0; }
/* узкая левая колонка (например, в почте) — всё помещается без обрезки */
@container (max-width: 330px) {
  .top h1 { font-size: 23px; }
  .top nav { gap: 10px; }
  .sections button { font-size: 13px; }
}
/* вкладки внутри раздела — подчёркивание золотом */
.tabs { display: flex; gap: 4px; padding: 6px 12px 0; margin-bottom: 10px; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; min-height: 38px; padding: 6px 2px; font-size: 13px; font-weight: 600; background: transparent; color: var(--muted); border: 0; border-bottom: 2px solid transparent; border-radius: 0; }
.tabs button:hover { background: transparent; color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--gold); }
#q { margin: 0 12px 10px; width: auto; border-radius: 999px; padding: 9px 16px; background: var(--bg); }
.list { flex: 1; margin: 0; padding: 0; list-style: none; overflow-y: auto; }
.list-empty { padding: 0 16px; }
.row { padding: 11px 16px 11px 18px; border-bottom: 1px solid var(--line); cursor: pointer; }
.row:hover { background: var(--bg); }
.row.active { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--gold); }
.row-top, .row-bottom { display: flex; align-items: center; gap: 6px; min-width: 0; }
.row-title, .row-preview { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-title { font-weight: 600; }
.row-preview { font-size: 14px; }
.row-at { font-size: 12px; }
.badge { padding: 1px 6px; border-radius: 999px; font-size: 10px; font-weight: 700; color: #fff; }
.badge.tg { background: #2AABEE; }
.badge.max { background: #7B4DFF; }
.wait { font-size: 12px; font-weight: 600; color: var(--bad); white-space: nowrap; }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--gold); color: var(--on-gold); font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; }
.count[hidden] { display: none; }
.pane, .pane-empty { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.pane-empty { align-items: center; justify-content: center; }
.pane-empty p { font-family: var(--serif); font-size: 24px; }
.pane[hidden], .pane-empty[hidden] { display: none; }
.chat-head { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); border-bottom: 1px solid var(--line); background: var(--surface); }
.chat-head > div { flex: 1; min-width: 0; }
.chat-head h2 { margin: 0; font-size: 25px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head .muted { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back { display: none; }
.messages { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 20px 16px; overflow-y: auto; }
.msg { max-width: min(600px, 85%); padding: 10px 14px; border-radius: var(--radius); border-top-left-radius: 4px; background: var(--surface); box-shadow: var(--shadow); }
.msg.mine { align-self: flex-end; background: var(--mine); border-top-left-radius: var(--radius); border-top-right-radius: 4px; box-shadow: none; }
.msg.failed { outline: 2px solid var(--bad); }
.who { font-size: 12px; font-weight: 700; color: var(--accent-text); }
.body { white-space: pre-wrap; overflow-wrap: anywhere; }
.body a.link { color: var(--accent-text); text-decoration: underline; }
.kind { font-size: 14px; color: var(--muted); }
.meta { font-size: 11px; color: var(--muted); text-align: right; }
.err { font-size: 12px; color: var(--bad); }
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 16px; padding-bottom: max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .splitter { display: none; }
  body.chat-open .side, body.chat-open .pane-empty { display: none; }
  body:not(.chat-open) .pane, body:not(.chat-open) .pane-empty { display: none; }
  .back { display: inline-block; }
  .top h1 { font-size: 25px; }
  .chat-head { gap: 8px; padding-left: 12px; padding-right: 12px; }
  .layout .chat-head { min-height: 64px; box-shadow: none; }   /* на телефоне колонки по очереди — равнять не с чем */
  .chat-head h2 { font-size: 22px; }
  input, textarea, select, .mc-body { font-size: 16px; } /* iPhone не увеличивает страницу при вводе */
  .msg { max-width: 90%; }
}
.stack label.show-pw { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.show-pw input { width: auto; accent-color: var(--gold); }
/* Вложения и лоток. */
button.icon { min-height: 0; padding: 6px 8px; background: transparent; color: var(--text); border: 1px solid var(--line); border-radius: 10px; font-size: 17px; font-weight: 400; line-height: 1; }
button.icon:hover { background: var(--surface-2); }
.tray[hidden], .upload[hidden] { display: none; }
.chip { display: flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-size: 13px; }
.chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.upload { margin: 0; padding: 4px 16px; background: var(--surface); font-size: 13px; }
.file { display: grid; gap: 4px; margin: 4px 0; justify-items: start; }
.thumb { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; }
.file audio { width: 260px; max-width: 100%; }
.file-link { font-size: 14px; overflow-wrap: anywhere; }
.pane.drop { outline: 3px dashed var(--gold); outline-offset: -6px; }
/* Действия с сообщением, правка, смайлы, реакции. */
.msg { position: relative; }
.msg .more { position: absolute; top: 2px; right: 4px; min-height: 0; padding: 0 6px; background: transparent; color: var(--muted); border: 0; font-size: 18px; line-height: 1; visibility: hidden; }
.msg:hover .more, .msg.open .more { visibility: visible; }
@media (pointer: coarse) { .msg .more { display: none; } }
.actions { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.actions .ask { font-size: 13px; font-weight: 600; margin-right: 4px; }
button.react { min-height: 0; padding: 2px 8px; background: transparent; border: 1px solid var(--line); color: var(--text); font-size: 18px; font-weight: 400; line-height: 1.2; }
button.react.on { border-color: var(--gold); background: var(--surface-2); }
.reaction { font-size: 13px; color: var(--muted); margin-top: 2px; }
.body.deleted { font-style: italic; color: var(--muted); }
.editbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0; padding: 6px 16px; background: var(--surface-2); font-size: 13px; }
.editbar[hidden], .emoji-panel[hidden] { display: none; }
.emoji-panel { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; padding: 8px 16px; background: var(--surface); border-top: 1px solid var(--line); }
button.emo { min-height: 0; padding: 4px; background: transparent; border-radius: 8px; font-size: 20px; font-weight: 400; line-height: 1; color: var(--text); }
button.emo:hover { background: var(--surface-2); }
/* Поле сообщения — одна рамка, как в Telegram: миниатюры вложений сверху, под ними скрепка, текст, смайлы. */
.box { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 22px; background: var(--bg); }
.box:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px var(--focus); }
.box .tray { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; padding: 10px 12px 0; }
.box .line { display: flex; align-items: flex-end; gap: 2px; padding: 2px 6px; }
.box textarea { flex: 1; min-height: 40px; line-height: 22px; max-height: 40vh; resize: none; border: 0; background: transparent; padding: 9px 6px; outline: none; box-shadow: none; }
.box button.icon { border: 0; padding: 8px 6px; font-size: 20px; background: transparent; }
.box textarea::placeholder { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumbwrap { position: relative; }
.thumbwrap img { display: block; width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
button.x { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; min-height: 0; padding: 0; border: 0; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-size: 14px; font-weight: 400; line-height: 22px; }
.chip button.x { position: static; flex: none; }
#send { min-height: 44px; }
.tabs[hidden], #q[hidden] { display: none; }
.badge.staff { background: transparent; font-size: 14px; padding: 0; }

/* Поиск. */
mark { background: #F3DCA2; color: inherit; border-radius: 2px; padding: 0 1px; }
.msg.current { outline: 2px solid var(--gold); }
.msg.flash { animation: flash 2s ease-out; }
@keyframes flash { from { box-shadow: 0 0 0 4px #F3DCA2; } to { box-shadow: var(--shadow); } }
@media (prefers-reduced-motion: reduce) { .msg.flash { animation: none; } }
.find-btn { margin-left: auto; min-height: 0; padding: 6px 8px; background: transparent; color: var(--text); border: 0; font-size: 18px; font-weight: 400; }
.find-btn:hover { background: var(--surface-2); }
.findbar { display: flex; align-items: center; gap: 6px; padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.findbar[hidden], .found[hidden] { display: none; }
.findbar input { flex: 1; min-width: 0; border-radius: 999px; padding: 7px 14px; }
#find-count { font-size: 13px; white-space: nowrap; }
.found-title { margin: 8px 16px 4px; font-size: 13px; font-weight: 600; }
.to-latest { align-self: center; margin: -48px auto 8px; position: relative; z-index: 2; padding: 6px 16px; box-shadow: var(--shadow); }
.to-latest[hidden] { display: none; }
.file video.video { display: block; max-width: min(100%, 480px); max-height: 60vh; border-radius: 10px; background: #000; margin-bottom: 4px; }

/* Почта. */
.side-part { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.side-part[hidden] { display: none; }
/* почта как в Mail.ru: слева папки, справа широкий список; письмо — на месте списка */
.mail-tools select { flex: 1; min-width: 0; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; }
.mail-new { margin: 12px 12px 10px; min-height: 44px; background: var(--gold); color: var(--on-gold); }
.mail-new:hover { background: #E2B653; }
.mail-folders { flex: 1; margin: 0; padding: 0 8px 12px; list-style: none; overflow-y: auto; }
.mail-folder { display: flex; align-items: center; gap: 6px; min-height: 38px; padding-right: 10px; border-radius: 10px; cursor: pointer; font-size: 14px; }
.mail-folder:hover { background: var(--bg); }
.mail-folder.active { background: var(--surface-2); font-weight: 600; box-shadow: inset 3px 0 0 var(--gold); }
.mf-twist { width: 18px; min-height: 0; flex: none; padding: 0; background: transparent; color: var(--muted); border: 0; font-size: 15px; font-weight: 400; line-height: 1; }
.mf-twist:hover { background: transparent; color: var(--text); }
.mf-icon { flex: none; width: 20px; text-align: center; font-size: 15px; }
.mf-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mf-count { flex: none; color: var(--muted); font-size: 13px; }
.mail-listview { flex: 1; min-height: 0; overflow-y: auto; background: var(--surface); }
.mail-listview[hidden], .mail-note[hidden], #mail-read-all[hidden] { display: none; }
.mail-listbar { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.mail-listbar input[type=search] { flex: 1 1 220px; min-width: 0; border-radius: 999px; padding: 8px 16px; background: var(--bg); }
.mail-all { display: flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.mail-all input { width: auto; accent-color: var(--gold); }
.mail-note { margin: 8px 16px 0; font-size: 13px; }
.mail-list { margin: 0; padding: 0 0 8px; list-style: none; }
.mail-group { padding: 16px 16px 4px 44px; font-size: 13px; font-weight: 600; color: var(--muted); }
.mail-row { display: grid; grid-template-columns: 12px 32px minmax(120px, 220px) 1fr auto; align-items: center; gap: 10px; min-height: 54px; padding: 0 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.mail-row:hover { background: var(--bg); }
.mail-row.active { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--gold); }
.mail-dot { width: 8px; height: 8px; border-radius: 50%; justify-self: center; }
.mail-row.unread .mail-dot { background: var(--gold); }
.mail-ava { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; color: #fff; font-size: 14px; font-weight: 600; }
.mail-who, .mail-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-who { font-size: 15px; }
.mail-subject { font-size: 15px; }
.mail-snippet { margin-left: 10px; color: var(--muted); font-size: 14px; }
.mail-row.unread .mail-who, .mail-row.unread .mail-subject { font-weight: 700; }
.mail-tail { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.mail-in { padding: 0 8px; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; }
.mail-status { margin-left: 10px; font-size: 13px; }
.mail-status.bad { color: var(--bad); }
.mail-out button.small { grid-column: 3 / -1; justify-self: start; margin-bottom: 8px; }
#mail-back.on { display: inline-block; }
@media (max-width: 760px) {
  .mail-row { grid-template-columns: 8px 36px 1fr auto; grid-template-rows: auto auto; column-gap: 8px; row-gap: 0; padding: 8px 12px; }
  .mail-dot { grid-row: 1 / 3; }
  .mail-ava { grid-row: 1 / 3; width: 36px; height: 36px; }
  .mail-who { grid-column: 3; grid-row: 1; }
  .mail-tail { grid-column: 4; grid-row: 1; }
  .mail-text { grid-column: 3 / 5; grid-row: 2; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 14px; }
  .mail-subject { font-size: 14px; }
  .mail-snippet { margin-left: 6px; font-size: 13px; }
  .mail-group { padding-left: 12px; }
  .mail-listbar { padding: 8px 12px; }
}
.mail-more { margin: 8px auto; }
.mail-more[hidden], .mail-banner[hidden], .mail-images[hidden] { display: none; }
.mail-more { display: block; }
.mail-banner { margin: 12px 12px 0; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13px; }
.mail-banner.bad { background: #FFF1C2; color: #5A4500; }
.mail-view, .mail-compose { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; background: var(--surface); }
.mail-view[hidden], .mail-compose[hidden] { display: none; }
.mail-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.mail-tools select { flex: 0 1 auto; font-size: 13px; padding: 4px 12px; }
.mail-line { margin: 2px 0; font-size: 14px; overflow-wrap: anywhere; }
.mail-atts { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.mail-atts a.chip { text-decoration: none; color: inherit; }
.mail-images { font-size: 13px; margin: 6px 0; }
.mail-frame { display: block; width: 100%; min-height: 200px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.mc-row { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 14px; }
.mc-row[hidden], .mc-suggest[hidden] { display: none; }
.mc-links { display: flex; gap: 12px; margin: -2px 0 8px 78px; font-size: 13px; }
.mc-suggest { list-style: none; margin: -4px 0 8px 78px; padding: 4px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.mc-suggest li { padding: 6px 12px; cursor: pointer; font-size: 14px; }
.mc-suggest li:hover { background: var(--surface-2); }
.mc-format { display: flex; gap: 4px; margin: 8px 0; }
.mc-body { min-height: 240px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); outline: none; overflow-wrap: anywhere; }
.mc-body:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--focus); }
.mc-body blockquote { margin: 0 0 0 .8ex; border-left: 2px solid var(--line); padding-left: 1ex; }
.mc-files { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.mc-status { font-size: 13px; min-height: 1.2em; }
.mc-actions { display: flex; justify-content: space-between; gap: 8px; }
.mail-compose.drop { outline: 3px dashed var(--gold); outline-offset: -6px; }
@media (max-width: 760px) {
  .mc-row { grid-template-columns: 1fr; gap: 2px; }
  .mc-links, .mc-suggest { margin-left: 0; }
}

/* ответы и отметки прочтения */
.quote { border-left: 3px solid var(--gold); background: var(--surface-2); padding: 3px 8px; margin: 2px 0 4px;
  border-radius: 6px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg.mine .quote { background: var(--surface); }
.quote.link { cursor: pointer; }
.replybar .quote { flex: 1; min-width: 0; margin: 0; }
.tick.read { color: var(--primary); }
.seen { flex-basis: 100%; font-size: 12px; color: var(--muted); }

/* Клиенты: пометки в списке групп. */
.row-client { margin: 1px 0 2px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unbound { display: inline-block; padding: 0 8px; border-radius: 999px; background: rgba(212,166,74,.18); color: var(--accent-text); font-size: 12px; font-weight: 600; line-height: 20px; }
.row-bday { margin-top: 3px; font-size: 13px; font-weight: 600; color: var(--accent-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-note { margin: 0 12px 10px; padding: 8px 14px; border-radius: 10px; background: var(--error-bg); font-size: 14px; }
.list-note[hidden] { display: none; }

/* Шапка переписки: ⓘ и «Привязать к клиенту». */
.info-btn { min-height: 0; padding: 4px 9px; background: transparent; color: var(--accent-text); border: 0; border-radius: 999px; font-size: 21px; font-weight: 400; line-height: 1; }
.info-btn:hover, .info-btn:focus-visible { background: var(--surface-2); color: var(--text); }
button.small.bind-btn { flex: none; border-color: var(--gold); color: var(--accent-text); }
button.small.bind-btn:hover { background: rgba(212,166,74,.14); color: var(--text); }
.info-btn[hidden], .bind-btn[hidden] { display: none; }
.group-also { display: block; font-size: 12px; }

/* Карточка клиента: на компьютере — на месте переписки, на телефоне — отдельный экран. */
.card-pane[hidden] { display: none; }
.card-top { min-height: 52px; background: var(--head); border-bottom: 0; }
button.small.card-back { border-color: rgba(255,255,255,.28); color: var(--head-text); }
button.small.card-back:hover { border-color: var(--gold); background: transparent; color: #fff; }
/* «Предыдущий / Следующий» — когда карточку открыли из «Настройки → Клиенты» */
.card-nav { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.card-nav[hidden] { display: none; }
.card-pos { font-size: 13px; color: var(--head-text); white-space: nowrap; }
@media (max-width: 480px) { .card-nav .nav-word { display: none; } }
.card-body { flex: 1; min-height: 0; overflow-y: auto; outline: none; }
.card-loading { padding: 24px; }
.card-wrap { padding-bottom: max(32px, env(safe-area-inset-bottom)); }
.card-wrap > *:not(.card-hero) { max-width: 920px; }
/* главное в карточке — navy-полоса с названием, как первый экран сайта */
.card-hero { padding: 6px 28px 28px; background: var(--head); color: #fff; border-bottom: 3px solid var(--gold); }
.hero-line { display: flex; align-items: flex-start; gap: 16px; }
.card-name { flex: 1; min-width: 0; margin: 0 0 14px; font-size: 44px; line-height: 1.05; color: #fff; overflow-wrap: anywhere; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; }
.card-hero .fact { display: inline-flex; align-items: center; min-height: 34px; padding: 4px 14px; border: 1px solid rgba(212,166,74,.55); border-radius: 999px; color: #fff; font-size: 14px; text-decoration: none; }
.card-hero a.fact:hover { background: rgba(212,166,74,.16); border-color: var(--gold); }
.card-hero .fact.plain { border-color: rgba(255,255,255,.2); color: var(--head-text); }
button.small.on-navy { flex: none; margin-top: 10px; border-color: rgba(255,255,255,.28); color: var(--head-text); }
button.small.on-navy:hover { border-color: var(--gold); background: transparent; color: #fff; }
.hero-acts { margin-top: 4px; }
/* «Ссылка на бота»: выбор контакта и готовая ссылка */
.bot-link-dialog .fld { display: grid; gap: 6px; margin: 0 0 16px; font-size: 14px; }
.bot-link-dialog select { width: 100%; min-height: 42px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); }
.bot-link-dialog .error { margin: 0 0 12px; }
.bot-link-dialog .error[hidden] { display: none; }
.link-box { margin-top: 14px; font-family: ui-monospace, Consolas, monospace; background: var(--bg); }  /* размер шрифта — общий: на телефоне 16px, без увеличения страницы */
.bot-link-dialog .dlg-hint { margin: 8px 2px 18px; }
.bot-link-dialog .dlg-acts { flex-wrap: wrap; }
.card-sec { padding: 22px 28px 4px; }
.sec-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.sec-head h3 { flex: 1; display: flex; align-items: baseline; gap: 10px; margin: 0; font-family: var(--serif); font-size: 27px; font-weight: 500; line-height: 1.1; }
.sec-count { font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--muted); }
.sec-note { font-size: 13px; }
.sec-empty, .sec-hint { margin: 0 0 8px; font-size: 14px; }
.sec-hint { margin-top: 10px; }
/* люди — единственное, что оформлено плитками: у каждого свой набор сведений */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 12px; }
.person { padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.person.soon { border-color: var(--gold); box-shadow: inset 0 3px 0 var(--gold); }
.person.editing { grid-column: 1 / -1; border-color: var(--gold); }
.person h4 { margin: 0 0 10px; font-family: var(--serif); font-size: 22px; font-weight: 500; }
.person-head { display: flex; align-items: flex-start; gap: 12px; }
.ava { flex: none; display: flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 50%; background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 2px var(--gold); font-family: var(--serif); font-size: 19px; font-weight: 500; }
.person-who { flex: 1; min-width: 0; display: grid; }
.person-name { font-weight: 600; overflow-wrap: break-word; }
.person-pos { font-size: 13px; }
/* Обособленные подразделения: строка «название · адрес · КПП» и кнопка справа. */
.branch-list { display: grid; gap: 8px; }
.branch { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.branch-text { flex: 1; min-width: 0; display: grid; gap: 2px; font-size: 14px; overflow-wrap: break-word; }
.branch-name { font-weight: 600; }
.branch-kpp { font-size: 13px; }
.branch.editing { display: block; border-color: var(--gold); }
.branch h4 { margin: 0 0 10px; font-family: var(--serif); font-size: 22px; font-weight: 500; }
@media (max-width: 560px) {               /* длинный заголовок — на всю строку, кнопка под ним */
  .branches-sec .sec-head { flex-wrap: wrap; }
  .branches-sec .sec-head h3 { flex-basis: 100%; display: block; }      /* число — сразу за текстом, а не у края */
  .branches-sec .sec-head .sec-count { margin-left: 8px; }
}
.bday-soon { display: inline-block; margin: 10px 0 0; padding: 2px 10px; border-radius: 999px; background: rgba(212,166,74,.18); color: var(--accent-text); font-size: 13px; font-weight: 600; }
.person-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 12px 0 0; font-size: 14px; }
.person-facts dt { color: var(--muted); }
.person-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.person-facts .fact { color: var(--text); }
.groups { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.group { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
button.group-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 4px; background: transparent; color: var(--text); border: 0; border-radius: 0; font-weight: 600; text-align: left; }
button.group-open:hover { background: transparent; color: var(--accent-text); }
.group-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-off { font-size: 13px; font-weight: 500; }
.picks { display: flex; flex-wrap: wrap; gap: 8px; }
.pick { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 16px 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; font-size: 14px; font-weight: 500; }
.pick input { width: 18px; height: 18px; margin: 0; accent-color: var(--navy); }
.pick:has(input:checked) { border-color: var(--gold); background: rgba(212,166,74,.14); }
.pick:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }
/* ведут клиента — строка на должность: название слева, плашки людей справа */
.staff-rows { border-top: 1px solid var(--line); }
.staff-row { display: grid; grid-template-columns: minmax(150px, 220px) 1fr; gap: 6px 16px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.staff-pos { font-size: 14px; font-weight: 600; }
.staff-people { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.staff-none { font-size: 14px; }
.staff-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 34px; padding: 2px 2px 2px 14px; border: 1px solid var(--gold); border-radius: 999px; background: rgba(212,166,74,.14); font-size: 14px; font-weight: 500; }
.staff-chip.off { border-style: dashed; border-color: var(--line); background: transparent; }
.staff-name { overflow-wrap: anywhere; }
.staff-note { font-size: 12px; color: var(--bad); }
button.staff-x { flex: none; width: 30px; height: 30px; min-height: 0; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 19px; font-weight: 400; line-height: 1; }
button.staff-x:hover { background: var(--surface-2); color: var(--bad); }
button.small.staff-add { min-height: 34px; border-style: dashed; color: var(--accent-text); }
.staff-opts, .staff-hint { grid-column: 2; }
.staff-opts { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); }
.staff-hint { margin: 0; font-size: 13px; }
@media (max-width: 560px) {
  .staff-row { grid-template-columns: 1fr; }
  .staff-opts, .staff-hint { grid-column: 1; }
  button.staff-x { width: 36px; height: 36px; }
}
.comment { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 70ch; }
.card-foot { padding: 28px 28px 8px; }
button.small.danger-outline { border-color: rgba(200,68,58,.45); color: var(--bad); }
button.small.danger-outline:hover { background: var(--error-bg); border-color: var(--bad); color: var(--bad); }
/* формы правки — на месте блока */
.edit .fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 14px; }
.fld { display: grid; gap: 4px; align-content: start; font-size: 13px; font-weight: 600; }
.fld.wide { grid-column: 1 / -1; }
.fld small { font-size: 12px; font-weight: 500; }
.edit textarea { resize: vertical; }
.edit select { min-height: 42px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); }
.bday-line { display: grid; grid-template-columns: 90px 1fr 1fr; gap: 8px; }
.form-error { margin: 12px 0 0; }
.form-error[hidden] { display: none; }
.form-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.form-acts .push-right { margin-left: auto; }
.edit.on-hero { padding-top: 16px; }
.edit.on-hero .fld { color: var(--head-text); }
.edit.on-hero button.small { border-color: rgba(255,255,255,.28); color: var(--head-text); }
.edit.on-hero button.small:hover { border-color: var(--gold); background: transparent; color: #fff; }
button.btn-gold:hover { background: #E2B653; color: var(--on-gold); }
.fld[hidden] { display: none; }
.form-sub { margin: 10px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-family: var(--serif); font-size: 21px; font-weight: 500; }
.edit.on-hero .form-error { color: var(--text); }   /* на navy-полосе текст белый — у плашки ошибки свой */
.edit.on-hero .form-sub { border-top-color: var(--head-line); color: #fff; }
.inn-line { display: flex; gap: 8px; align-items: center; min-width: 0; }
.inn-line input { flex: 1; min-width: 0; }
.inn-line button.small { flex: none; min-height: 42px; }
.fld.chk { display: flex; align-items: center; gap: 10px; align-self: end; min-height: 42px; font-size: 14px; cursor: pointer; }
.fld.chk input, .dlg-check input { width: 20px; height: 20px; margin: 0; accent-color: var(--gold); }
.check-boxes { display: flex; flex-wrap: wrap; gap: 4px 22px; }
.check-item { display: flex; align-items: center; gap: 10px; min-height: 42px; font-size: 14px; cursor: pointer; }
.check-item input { width: 20px; height: 20px; margin: 0; accent-color: var(--gold); }

/* Реквизиты: подпись слева, значение справа; на телефоне — подпись над значением. */
.req-facts { display: grid; grid-template-columns: minmax(130px, 190px) 1fr; gap: 6px 16px; margin: 0; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 14px; }
.req-facts dt { color: var(--muted); }
.req-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.req-post { display: block; font-size: 13px; }
.req-code { font-weight: 600; }
.req-meta { margin: 8px 0 0; font-size: 12px; }
.status-bad { display: inline-block; padding: 1px 10px; border-radius: 999px; background: var(--error-bg); color: var(--bad); font-weight: 600; }
.hist { margin-top: 10px; }
button.link.hist-toggle { font-size: 14px; font-weight: 600; text-decoration: none; color: var(--accent-text); }
button.link.hist-toggle:hover { text-decoration: underline; }
.hist-list { margin: 10px 0 0; padding: 0; list-style: none; border-left: 2px solid var(--gold); }
.hist-item { padding: 6px 0 8px 14px; }
.hist-head { margin: 0; font-size: 13px; font-weight: 600; }
.hist-lines { margin: 2px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.tax-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tax-chip { display: inline-flex; align-items: center; min-height: 32px; padding: 3px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 14px; font-weight: 500; }
/* окно «Заполнить по ИНН» и новый клиент в окне привязки */
.dlg-found { margin: -8px 0 12px; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.dlg-status { margin: 0 0 12px; }
.dlg-check { display: flex; align-items: center; gap: 10px; font-size: 15px; cursor: pointer; }
.dlg-rename { margin: 4px 0 16px 30px; font-size: 14px; overflow-wrap: anywhere; }
.dlg-inn-note:empty { display: none; }
.dlg-inn-note .error { margin: 0; }
.dlg-ask { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 14px; overflow-wrap: anywhere; }
.dlg-ask p { margin: 0 0 8px; }
.dlg-ask .dlg-acts { flex-wrap: wrap; }
@media (max-width: 560px) {
  .req-facts { grid-template-columns: 1fr; gap: 0; }
  .req-facts dt { margin-top: 6px; font-size: 12px; }
  .req-facts dt:first-child { margin-top: 0; }
}

/* Окно поверх (подтверждение, привязка). На телефоне привязка — на весь экран. */
.kc-dialog { width: min(520px, calc(100vw - 32px)); max-height: min(640px, calc(100dvh - 32px)); padding: 0; border: 0; border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(14,42,71,.35); }
.kc-dialog::backdrop { background: rgba(14,42,71,.55); }
.small-dialog { padding: 22px 24px 18px; width: min(440px, calc(100vw - 32px)); }
.dlg-title { margin: 0; font-family: var(--serif); font-size: 26px; font-weight: 500; line-height: 1.15; }
.dlg-text { margin: 10px 0 20px; font-size: 15px; }
.dlg-acts { display: flex; justify-content: flex-end; gap: 8px; }
.bind-dialog[open] { display: flex; flex-direction: column; }
.dlg-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 12px; padding-top: max(18px, env(safe-area-inset-top)); border-bottom: 1px solid var(--line); }
.dlg-head > div { flex: 1; min-width: 0; }
.dlg-sub { margin: 4px 0 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-note { margin: 6px 0 0; font-size: 13px; }
button.x-btn { flex: none; width: 40px; height: 40px; min-height: 0; padding: 0; background: transparent; color: var(--muted); border: 0; font-size: 26px; font-weight: 400; line-height: 1; }
button.x-btn:hover { background: var(--surface-2); color: var(--text); }
.dlg-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 20px 20px; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
.dlg-body .error { margin: 12px 0 0; }
.dlg-body .error[hidden] { display: none; }
.dlg-search { border-radius: 999px; padding: 10px 18px; background: var(--bg); }
.dlg-hint { margin: 10px 4px; font-size: 14px; }
.dlg-hint[hidden] { display: none; }
.found-clients { margin: 8px 0 0; padding: 0; list-style: none; }
button.client-pick { display: grid; justify-items: start; width: 100%; min-height: 52px; padding: 8px 12px; background: transparent; color: var(--text); border: 0; border-bottom: 1px solid var(--line); border-radius: 10px; text-align: left; font-weight: 500; }
button.client-pick:hover, button.client-pick:focus-visible { background: var(--surface-2); }
button.client-pick span { font-size: 13px; }
.dlg-new { display: grid; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); }
.dlg-or { margin: 0; font-size: 14px; font-weight: 600; }
.dlg-new .btn-gold { justify-self: start; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) {
  .card-hero { padding: 4px 16px 22px; }
  .card-name { font-size: 34px; }
  .card-sec { padding: 20px 16px 4px; }
  .card-foot { padding: 24px 16px 8px; }
  .people-grid { grid-template-columns: 1fr; }
  .bday-line { grid-template-columns: 80px 1fr; }
  .bday-line input { grid-column: 1 / -1; }
  .bind-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
  .dlg-new .btn-gold { justify-self: stretch; white-space: normal; }
  /* телефон: «Привязать к клиенту» — второй строкой шапки, чтобы название группы не пропадало */
  .chat-head:has(#bind:not([hidden]):not(.more)) { flex-wrap: wrap; row-gap: 6px; }
  .chat-head .bind-btn.more { display: none; }   /* «+ Клиент» на телефоне не теснит название — добавляют с компьютера */
  .chat-head .bind-btn { order: 10; }
}
@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) .unbound, :where(:root:not([data-theme="light"])) .bday-soon { background: rgba(212,166,74,.16); }
  :where(:root:not([data-theme="light"])) .ava { background: var(--navy3); }
  :where(:root:not([data-theme="light"])) .pick input { accent-color: var(--gold); }
  :where(:root:not([data-theme="light"])) button.group-open:hover, :where(:root:not([data-theme="light"])) button.client-pick:hover { color: var(--gold); background: transparent; }
  :where(:root:not([data-theme="light"])) button.client-pick:hover { background: rgba(255,255,255,.06); }
  :where(:root:not([data-theme="light"])) .info-btn:hover, :where(:root:not([data-theme="light"])) button.x-btn:hover { background: rgba(255,255,255,.06); }
  :where(:root:not([data-theme="light"])) .kc-dialog::backdrop { background: rgba(0,0,0,.6); }
}
:where(:root[data-theme="dark"]) .unbound, :where(:root[data-theme="dark"]) .bday-soon { background: rgba(212,166,74,.16); }
:where(:root[data-theme="dark"]) .ava { background: var(--navy3); }
:where(:root[data-theme="dark"]) .pick input { accent-color: var(--gold); }
:where(:root[data-theme="dark"]) button.group-open:hover, :where(:root[data-theme="dark"]) button.client-pick:hover { color: var(--gold); background: transparent; }
:where(:root[data-theme="dark"]) button.client-pick:hover { background: rgba(255,255,255,.06); }
:where(:root[data-theme="dark"]) .info-btn:hover, :where(:root[data-theme="dark"]) button.x-btn:hover { background: rgba(255,255,255,.06); }
:where(:root[data-theme="dark"]) .kc-dialog::backdrop { background: rgba(0,0,0,.6); }
@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) .status-bad { color: #F4A9A1; }
  :where(:root:not([data-theme="light"])) .tax-chip { background: transparent; }
}
:where(:root[data-theme="dark"]) .status-bad { color: #F4A9A1; }
:where(:root[data-theme="dark"]) .tax-chip { background: transparent; }

/* Рабочий телефон: пометки «личка»/«бот»/«новый», вид «По клиентам», шапка личной переписки, окно 24 часов. */
.badge.line { background: var(--gold); color: var(--on-gold); }
.badge.bot { background: #5A6B7D; }
.row-of { font-weight: 500; color: var(--muted); }
.row-bday-in { font-weight: 600; color: var(--accent-text); }   /* коллега: «🎂 завтра» сразу после имени */
.row-new { flex: none; padding: 0 8px; border-radius: 999px; background: rgba(212,166,74,.18); color: var(--accent-text); font-size: 11px; font-weight: 700; line-height: 18px; }
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 1 0 auto; padding: 6px 6px; }
.tabs button[hidden], .sections button[hidden] { display: none; }
/* пять вкладок (с «Личные» и «Новые») — плотнее, чтобы влезли в колонку 360 px и в телефон 390 px */
.tabs:has(> [data-tab="new"]:not([hidden])):has(> [data-tab="personal"]:not([hidden])) { gap: 0; padding: 6px 6px 0; }
.tabs:has(> [data-tab="new"]:not([hidden])):has(> [data-tab="personal"]:not([hidden])) button { padding: 6px 4px; font-size: 12px; }
.group-head { position: sticky; top: 0; z-index: 1; padding: 12px 16px 4px; background: var(--surface); border-bottom: 1px solid var(--line); }
.group-head-name, button.group-head-btn { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 700; letter-spacing: .02em; color: var(--accent-text); }
button.group-head-btn { min-height: 0; padding: 0; background: transparent; border: 0; border-radius: 0; text-align: left; }
button.group-head-btn:hover { background: transparent; color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.row.sub { padding-left: 28px; }
.reply-hint { margin: 0; padding: 8px 16px; background: rgba(212,166,74,.16); color: var(--text); font-size: 13px; border-top: 1px solid var(--line); }
.reply-hint[hidden], .head-act[hidden] { display: none; }
.chat-head button.small.head-act { flex: none; }
@media (max-width: 760px) {
  /* телефон: «Скрыть», «Показать», «Загрузить историю» — второй строкой шапки, вместе с «Привязать» */
  .chat-head:has(.head-act:not([hidden])) { flex-wrap: wrap; row-gap: 6px; }
  .chat-head .head-act { order: 11; }
  .chat-head:has(.head-act:not([hidden]))::after { content: ""; order: 9; flex-basis: 100%; height: 0; }   /* перенос строки: название не сжимается */
  .sections:has(> [data-section="personal"]:not([hidden])) button { font-size: 13px; gap: 2px; }
  .row.sub { padding-left: 24px; }
}
/* Настройки: вид списка */
.view-pick { border: 0; display: grid; gap: 6px; }
.view-pick legend { float: left; width: 100%; margin: 0 0 2px; padding: 0; font-size: 16px; font-weight: 600; }
.view-pick > p.muted { margin: 0 0 6px; font-size: 13px; }
.view-opt { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border: 1px solid transparent; border-radius: 12px; cursor: pointer; }
.view-opt:has(input:checked) { border-color: var(--gold); background: var(--surface); }
.view-opt input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--navy); }
.view-opt > span { display: grid; gap: 1px; }
.view-opt .muted { font-size: 13px; }
.view-status { margin: 2px 0 0; min-height: 1.2em; font-size: 13px; }
/* Образец вида списка: показан только выбранный. */
.pv-cap { margin: 4px 0 6px; font-size: 13px; color: var(--muted); }
.pv-box { display: none; max-width: 340px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 13px; }
.view-pick:has(input[value="all"]:checked) .pv-all,
.view-pick:has(input[value="split"]:checked) .pv-split,
.view-pick:has(input[value="clients"]:checked) .pv-clients { display: grid; gap: 4px; }
.pv-tabs { display: flex; gap: 6px; margin-bottom: 4px; padding-bottom: 6px; border-bottom: 1px solid var(--line); font-size: 12px; }
.pv-tabs > * { padding: 2px 10px; border-radius: 999px; }
.pv-tabs b { background: var(--navy); color: #fff; }
.pv-tabs span { color: var(--muted); }
.pv-row { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border-radius: 8px; background: var(--surface-2); white-space: nowrap; overflow: hidden; }
.pv-row i { flex: none; padding: 0 5px; border-radius: 5px; font-style: normal; font-size: 10px; font-weight: 700; color: #fff; }
.pv-tg { background: #2AABEE; }
.pv-max { background: #7B5CFF; }
.pv-row em { margin-left: auto; padding: 0 6px; border: 1px solid var(--gold); border-radius: 999px; font-style: normal; font-size: 10px; color: var(--muted); }
.pv-client { margin-top: 4px; font-weight: 700; }
.pv-client.pv-none { color: var(--muted); font-weight: 600; }
.pv-in { margin-left: 14px; }
.pv-note { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
/* «Рабочий телефон» */
.ph-sec { padding: 18px 0; border-top: 1px solid var(--line); }
.ph-title { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font-size: 27px; }
.ph-title .badge { font-family: var(--sans); font-size: 11px; }
.ph-state { margin: 0 0 6px; font-weight: 600; }
.ph-hint { margin: 0 0 10px; font-size: 13px; }
.ph-lines { display: grid; gap: 6px; margin: 0 0 10px; }
.ph-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-radius: 12px; background: var(--surface-2); font-size: 14px; }
.ph-line-text { min-width: 0; overflow-wrap: anywhere; }
.ph-ask { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.ph-form { display: grid; gap: 10px; margin-top: 8px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.ph-form[hidden], .ph-step[hidden] { display: none; }
.ph-step { display: grid; gap: 6px; }
.ph-inline { display: flex; flex-wrap: wrap; gap: 8px; }
.ph-inline input { flex: 1 1 200px; min-width: 0; }
.ph-again { justify-self: start; font-size: 13px; }
.ph-form > button.small { justify-self: start; }
.ph-note { margin: 0; min-height: 1.2em; font-size: 13px; }
.ph-note.bad, .ph-state.bad, .ph-line-text.bad, .view-status.bad { color: var(--bad); }
.ph-people { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 6px; padding: 0; list-style: none; }
.ph-hidden { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.ph-hidden:empty { border-top: 0; }
.ph-hid { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ph-hid-who { flex: 1 1 200px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.ph-hid-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-hid-at { font-size: 13px; }
.phone-page .error[hidden] { display: none; }
.phone-page .error { margin: 8px 0; }
@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) .view-opt input { accent-color: var(--gold); }
  :where(:root:not([data-theme="light"])) .badge.bot { background: #6B7F94; }
}
:where(:root[data-theme="dark"]) .view-opt input { accent-color: var(--gold); }
:where(:root[data-theme="dark"]) .badge.bot { background: #6B7F94; }
@media (prefers-color-scheme: dark) { :where(:root:not([data-theme="light"])) .pv-tabs b { background: var(--gold); color: var(--on-gold); } }
:where(:root[data-theme="dark"]) .pv-tabs b { background: var(--gold); color: var(--on-gold); }

/* рабочие разделы: строка ссылок под шапкой и страницы во всю ширину */
.work-nav { display: flex; flex-wrap: wrap; gap: 0 10px; padding: 0 10px; background: var(--head); }
.work-nav a { flex: none; padding: 6px; font-size: 13px; font-weight: 600; color: var(--head-text); text-decoration: none; white-space: nowrap; border-radius: 6px; }
.work-nav a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.work-nav a[aria-current="page"] { color: var(--gold); }
.side > .work-nav { padding-bottom: 4px; }
.work { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.work-top { display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: var(--head); border-bottom: 1px solid var(--head-line); }
.work-top .work-nav { padding: 0; flex: 1; min-width: 0; }
.work-icons { flex: none; display: flex; align-items: center; gap: 2px; }
.work-top .gear { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--head-text); cursor: pointer; }
.work-top .gear:hover, .work-top .gear:focus-visible { color: var(--gold); background: rgba(255,255,255,.08); }
/* колокольчик: перечёркнут, пока уведомления на этом устройстве выключены; включены — золотой */
.top nav .bell, .work-top .bell { min-height: 0; padding: 0; border: 0; background: none; cursor: pointer; }
.top nav .bell.on, .work-top .bell.on { color: var(--gold); }
.bell.on .bell-off { display: none; }
.bell[hidden] { display: none !important; }
/* число у «Требований» — сколько входящих ждут ответа */
.nav-count { display: inline-block; min-width: 18px; margin-left: 5px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.nav-count[hidden] { display: none; }
.work-brand { flex: none; font-family: var(--serif); font-size: 22px; font-weight: 500; color: #fff; text-decoration: none; }
.work-body { flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; padding: 24px 16px; box-sizing: border-box; }
.work-body h1 { margin: 0 0 8px; }
/* вкладки внутри раздела — как вкладки списка чатов, подчёркивание золотом */
.work-tabs { display: flex; gap: 4px 18px; flex-wrap: wrap; margin: 0 0 16px; border-bottom: 1px solid var(--line); }
.work-tabs a { padding: 8px 2px; font-size: 14px; font-weight: 600; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.work-tabs a:hover { color: var(--text); }
.work-tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--gold); }
@media (max-width: 600px) {
  .work-top { position: relative; flex-direction: column; align-items: stretch; gap: 4px; padding: 8px 10px; }
  .work-brand { padding: 0 6px; }
  .work-icons { position: absolute; top: 6px; right: 10px; }
}

/* Требования */
.tr-banner { margin: 0 0 10px; padding: 8px 12px; border-radius: 8px; background: rgba(212,166,74,.18); color: var(--text); font-size: 13px; font-weight: 600; }
.tr-wrap { display: flex; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; }
.tr-tree { width: 200px; flex: none; align-self: stretch; padding: 8px 0; background: var(--surface-2); border-right: 1px solid var(--line); }
.tr-g { padding: 10px 14px 2px; font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--muted); text-transform: uppercase; }
.tr-tree button.tr-i { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 6px; padding: 6px 12px 6px 18px; border: 0; border-left: 3px solid transparent; border-radius: 0; background: transparent; color: var(--text); font-size: 13px; font-weight: 400; text-align: left; }
.tr-tree button.tr-i:hover { background: rgba(127,127,127,.12); }
.tr-tree button.tr-i.on { background: rgba(127,127,127,.16); font-weight: 700; border-left-color: var(--gold); }
.tr-n { flex: none; min-width: 18px; padding: 0 6px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; text-align: center; }
.tr-n.grey { background: #6B7F94; }
.tr-select { display: none; width: 100%; margin: 0 0 10px; }
.tr-main { flex: 1; min-width: 0; padding: 10px 12px; }
.tr-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.tr-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tr-main button.tr-chip { padding: 3px 11px; border: 1px solid var(--line); border-radius: 14px; background: transparent; color: var(--text); font-size: 12px; font-weight: 500; }
.tr-main button.tr-chip.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.tr-table th.sortable, .tr-sort button { cursor: pointer; user-select: none; }
.tr-table th.sortable:hover, .tr-table th.sorted { color: var(--text); }
.tr-sort { display: none; }
.tr-q { flex: 1; min-width: 140px; max-width: 320px; margin-left: auto; padding: 4px 10px; border-radius: 14px; font-size: 13px; }
.tr-scroll { overflow-x: auto; }
.tr-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tr-table th { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tr-table td { padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tr-table td small { display: block; color: var(--muted); font-size: 11px; }
.tr-table td small.bad { color: var(--bad); font-weight: 600; }
.tr-row { cursor: pointer; }
.tr-row:hover, .tr-row.open { background: rgba(127,127,127,.09); }
.tr-st { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.tr-st.amber { background: var(--st-amber-bg); color: var(--st-amber); }
.tr-st.red { background: var(--st-red-bg); color: var(--st-red); }
.tr-st.green { background: var(--st-green-bg); color: var(--st-green); }
.tr-st.grey { background: var(--st-grey-bg); color: var(--st-grey); }
.tr-go { color: var(--accent-text); font-weight: 600; white-space: nowrap; text-decoration: none; }
.tr-go:hover { text-decoration: underline; }
.tr-edit { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 16px; padding: 6px 4px 10px; }
.tr-edit > small { flex-basis: 100%; }
.tr-edit .tr-comment { flex: 1 1 320px; max-width: 50%; }
.tr-edit.tr-bind { align-items: center; }
.tr-edit textarea { width: 100%; box-sizing: border-box; }
.tr-field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.tr-check { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; align-self: center; }
.tr-check input { margin: 0; width: auto; flex: none; }
.tr-select { padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-size: 14px; }
.tr-legacy-bar { margin: 0 0 8px; }
@media (max-width: 760px) {
  .tr-wrap { display: block; border: 0; background: transparent; overflow: visible; }
  .tr-tree { display: none; }
  .tr-select { display: block; }
  .tr-main { padding: 0; }
  .tr-q { max-width: none; margin-left: 0; width: 100%; }
  .tr-sort:not(:empty) { display: flex; gap: 16px; margin: 0 0 6px; padding: 0 2px 4px; border-bottom: 1px solid var(--line); }
  .tr-main .tr-sort button { padding: 2px 0; border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; }
  .tr-main .tr-sort button.sorted { color: var(--text); }
  .tr-chips { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; }
  .tr-main button.tr-chip { flex: none; padding: 3px 8px; font-size: 11px; white-space: nowrap; }
  .tr-edit .tr-comment { max-width: 100%; flex-basis: 100%; }
  .tr-edit { flex-direction: column; align-items: stretch; }
}
@media (max-width: 640px) {
  .tr-scroll { overflow-x: visible; }
  .tr-table, .tr-table tbody { display: block; }
  .tr-table thead { display: none; }
  .tr-table tr.tr-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
  .tr-table tr.tr-row td { border: 0; padding: 0; min-width: 0; overflow-wrap: anywhere; }
  .tr-table td.c-chk { order: 0; }
  .tr-table td.c-date { order: 1; font-weight: 700; }
  .tr-table td.c-client { order: 2; flex: 1; }
  .tr-table td.c-client div, .tr-table td.c-client small { display: inline; }
  .tr-table td.c-client small { margin-left: 6px; }
  .tr-table td.c-doc { order: 3; flex-basis: 100%; }
  .tr-table td.c-dl { order: 4; }
  .tr-table td.c-dl div, .tr-table td.c-dl small { display: inline; }
  .tr-table td.c-dl small { margin-left: 4px; }
  .tr-table td.c-dl div::before { content: "до "; }
  .tr-table td.c-st { order: 5; }
  .tr-table td.c-go { order: 6; margin-left: auto; }
  .tr-table td.c-resp { order: 7; flex-basis: 100%; }
  .tr-table td.c-empty { display: none; }
  .tr-table tr.tr-detail { display: block; }
  .tr-table tr.tr-detail td { display: block; border: 0; padding: 0; }
}

/* Голосовые: 🎤 на месте «Отправить», пока поле пустое; полоса записи вместо поля ввода. */
.mic { min-height: 44px; min-width: 44px; font-size: 20px; padding: 0 12px; }
.recbar { display: flex; gap: 10px; align-items: center; padding: 10px 16px; padding-bottom: max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.recbar[hidden], .composer[hidden], .mic[hidden], #send[hidden] { display: none; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #e5484d; animation: rec-blink 1s infinite; flex: none; }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 40px; }
.rec-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#rec-send { min-height: 44px; }
@keyframes rec-blink { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }
@media (max-width: 480px) { .rec-label { display: none; } #rec-cancel { margin-left: auto; } }

/* Телефон: удержание пальца на сообщении открывает меню — без выделения текста и меню браузера (копировать — «Скопировать»). */
@media (pointer: coarse) {
  .msg { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  .msg img, .msg a { -webkit-user-drag: none; }     /* iPhone: удержание на фото не «поднимает» его для перетаскивания */
  input, textarea, select { font-size: 16px; }    /* iPhone/iPad не увеличивают страницу при вводе (и в альбомном виде) */
  body.kb .composer, body.kb .recbar { padding-bottom: 10px; }   /* клавиатура открыта — без отступа под «чёлку» */
  /* Окно — по видимой части экрана: шапка с собеседником всегда сверху, и с клавиатурой тоже.
     Закрепляем всю страницу (синяя полоса разделов + .layout под ней — flex-колонка ниже), а не один .layout:
     закреплённый .layout с высотой от содержимого уводил строку ввода за край экрана (16.11). */
  body.app { position: fixed; left: 0; right: 0; top: var(--app-top, 0px); height: var(--app-h, 100dvh); }
  .messages { overscroll-behavior: contain; }
}

/* Скорость голосового — рядом с плеером, как в Telegram. */
.file:has(> button.rate) { display: flex; align-items: center; gap: 6px; }
.file:has(> button.rate) audio { flex: 1 1 auto; width: 240px; min-width: 0; }
button.rate { min-height: 32px; min-width: 48px; padding: 2px 8px; font-variant-numeric: tabular-nums; }

/* «Отчёты»: итоговая таблица клиенты × отчёты. Таблица прокручивается в своём блоке, клиент закреплён слева. */
.ot-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 14px; margin: 0 0 10px; }
.ot-f { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.ot-f select, .ot-period select { min-height: 34px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-size: 13px; }
.ot-period { display: flex; gap: 6px; }
.ot-q { flex: 1; min-width: 160px; max-width: 320px; padding: 6px 12px; border-radius: 14px; font-size: 13px; }
.ot-totals { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; font-size: 13px; }
.ot-total { padding: 3px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.ot-total b { font-variant-numeric: tabular-nums; }
.ot-scroll { overflow: auto; max-height: calc(100dvh - 260px); min-height: 200px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.ot-scroll[hidden] { display: none; }
.ot-table { border-collapse: separate; border-spacing: 0; font-size: 12px; }
.ot-table th, .ot-table td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); background: var(--surface); }
.ot-table thead th { position: sticky; top: 0; z-index: 2; padding: 6px 6px; font-size: 11px; font-weight: 600; color: var(--muted); text-align: center; vertical-align: bottom; min-width: 64px; max-width: 110px; }
.ot-table thead th small { display: block; font-weight: 400; }
.ot-table th.ot-client { position: sticky; left: 0; z-index: 1; width: var(--ot-cw, auto); min-width: var(--ot-cw, 280px); max-width: var(--ot-cw, 380px); padding: 3px 8px; text-align: left; font-weight: 400; vertical-align: middle; box-shadow: 2px 0 0 var(--line); }
.ot-line { display: flex; align-items: baseline; gap: 6px; min-width: 0; white-space: nowrap; }
.ot-line .ot-name { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ot-inn { flex: none; font-size: 11px; font-variant-numeric: tabular-nums; }
.ot-line .zero-mark { flex: none; }
.ot-warn { flex: none; display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--st-amber-bg); color: var(--st-amber); font-size: 11px; font-weight: 700; cursor: help; }
/* выпадающий список с галочками */
.ms { position: relative; }
.ms-btn { min-height: 34px; max-width: 260px; padding: 4px 28px 4px 10px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-size: 13px; text-align: left; text-overflow: ellipsis; white-space: nowrap; position: relative; }
.ms-btn::after { content: "▾"; position: absolute; right: 10px; color: var(--muted); }
.ms-btn.set { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.ms-pop { position: absolute; top: 100%; left: 0; z-index: 20; min-width: 240px; max-width: 360px; margin-top: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); color: var(--text); }
.ms-pop[hidden] { display: none; }
.ms-find { width: 100%; margin: 0 0 6px; padding: 6px 10px; font-size: 13px; }
.ms-list { max-height: 300px; overflow: auto; }
.ms-opt { display: flex; align-items: flex-start; justify-content: flex-start; gap: 8px; padding: 5px 6px; border-radius: 8px; font-size: 13px; line-height: 1.35; text-align: left; cursor: pointer; }
.ms-opt input { flex: none; width: 16px; height: 16px; margin: 1px 0 0; padding: 0; }
.ms-opt span { flex: 1; min-width: 0; }
.ms-opt:hover { background: var(--surface-2); }
.ms-none { margin: 6px; font-size: 13px; }
.ms-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); font-size: 13px; }
.ot-table thead th.ot-corner { z-index: 3; vertical-align: bottom; }
/* граница столбца «Клиент» — тянется мышью/пальцем */
.ot-splitter { position: absolute; top: 0; right: -6px; z-index: 4; width: 12px; height: 100%; cursor: col-resize; touch-action: none; }
.ot-splitter::after { content: ""; position: absolute; top: 0; bottom: 0; left: 4px; width: 3px; background: var(--line); transition: background .15s; }
.ot-splitter:hover::after, .ot-splitter.drag::after { background: var(--gold); opacity: .8; }
.ot-name { display: block; color: var(--text); font-weight: 600; font-size: 13px; text-decoration: none; }
.ot-name:hover { color: var(--accent-text); text-decoration: underline; }
.ot-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-size: 11px; }
.ot-flag { padding: 0 5px; border-radius: 4px; background: var(--st-amber-bg); color: var(--st-amber); font-weight: 600; }
.ot-flag.card { background: var(--st-card-bg); color: var(--st-card); }
button.ot-add { min-height: 0; padding: 0 6px; border: 1px dashed var(--line); border-radius: 6px; background: transparent; color: var(--accent-text); font-size: 11px; font-weight: 600; }
button.ot-add:hover { border-color: var(--gold); background: var(--surface-2); }
.ot-cell { padding: 3px; text-align: center; }
.ot-st { display: inline-block; box-sizing: border-box; min-width: 56px; min-height: 26px; padding: 3px 6px; border: 2px solid transparent; border-radius: 6px; font-size: 11px; font-weight: 700; line-height: 16px; white-space: nowrap; color: var(--text); background: transparent; }
button.ot-st { cursor: pointer; }
button.ot-st:hover { filter: brightness(.95); outline: 1px solid var(--gold); }
.ot-st.st-ok { background: var(--st-green-bg); color: var(--st-green); }
.ot-st.st-sent { background: var(--st-amber-bg); color: var(--st-amber); }
.ot-st.st-err { background: var(--st-red-bg); color: var(--st-red); border-color: var(--st-red); }
.ot-st.st-nd { border: 2px dashed rgba(200,68,58,.55); color: var(--st-red); }
.ot-st.st-nd.late { border-color: var(--bad); background: var(--st-red-bg); }
.ot-st.st-no { background: var(--st-grey-bg); color: var(--st-grey); min-height: 26px; }
.ot-st.st-card { background: var(--st-card-bg); color: var(--st-card); }
.ot-st.st-wait { border: 2px solid var(--st-amber); color: var(--st-amber); }
.ot-st.st-review { border: 2px dashed var(--st-card); color: var(--st-card); }
.ot-st.st-todo { border: 1px dashed var(--line); color: var(--muted); }
.zero-mark { padding: 0 6px; border-radius: 4px; background: var(--st-grey-bg); color: var(--st-grey); font-size: 12px; font-weight: 600; }
.work-status { margin: 10px 0 0; display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 14px; font-weight: 600; }
.work-status.ws-paused, .tag.ws-paused { background: var(--st-amber-bg); color: var(--st-amber); }
.work-status.ws-left, .tag.ws-left { background: var(--st-grey-bg); color: var(--st-grey); }
.purge-note { margin: 8px 0 0; font-size: 13px; color: var(--head-text); }
.purge-note.due { color: #F4A9A1; font-weight: 600; }
.purge-box { margin: 0 0 14px; padding: 10px 14px; border-radius: 12px; background: var(--st-red-bg); color: var(--st-red); font-size: 14px; }
.purge-box a { color: inherit; font-weight: 600; }
.purge-names { display: block; margin-top: 4px; }
.tax-chip.zero { background: var(--st-grey-bg); color: var(--st-grey); font-weight: 600; }
.ot-refresh { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0 0 10px; font-size: 13px; }
.ot-hide { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 0 0 10px; font-size: 13px; }
.ot-st.st-unk { border: 1px solid var(--line); color: var(--muted); }
.ot-st.manual { box-shadow: inset 0 -2px 0 currentColor; }
.ot-legend { margin: 10px 0 0; font-size: 12px; }
.ot-dialog h2 { margin: 0; }
.ot-dialog .dlg-sub { margin: 4px 0 12px; white-space: normal; }
.ot-now { margin: 0 0 6px; font-size: 14px; }
.ot-info { margin: 0 0 4px; font-size: 13px; }
.ot-sbis { color: var(--text); font-weight: 600; }
.ot-marks { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.ot-marks button.small.on { border-color: var(--gold); background: var(--surface-2); }
.ot-manual { padding-top: 10px; border-top: 1px solid var(--line); }
button.small.danger-outline { color: var(--bad); }
.ot-dialog .error { margin: 10px 0 0; }
.ot-dialog .error[hidden] { display: none; }
.ot-dialog .dlg-acts { margin-top: 14px; }
.ot-fld { display: flex; flex-direction: column; gap: 4px; margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.ot-fld select { min-height: 40px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; }
.ot-fld.ot-inline { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; }
.ot-fld input.ot-days { display: inline-block; width: 80px; padding: 6px 10px; }
.ot-row2 { display: flex; gap: 10px; }
.ot-row2 .ot-fld { flex: 1; min-width: 0; }
.ot-radios { display: flex; flex-wrap: wrap; gap: 6px 18px; }
:root { --st-card-bg: #E6EAF8; --st-card: #3A4A8C; }
:root[data-theme="dark"] { --st-card-bg: rgba(130,150,230,.22); --st-card: #B9C6F5; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --st-card-bg: rgba(130,150,230,.22); --st-card: #B9C6F5; } }
@media (max-width: 640px) {
  .ot-filters { gap: 6px 8px; }
  .ot-f { flex: 1 1 140px; }
  .ot-f select, .ot-period select { width: 100%; }
  .ot-period { width: 100%; }
  .ot-f.ot-f-period { flex-basis: 100%; }
  .ot-period select { flex: 1; min-width: 0; }
  .ot-q { max-width: none; width: 100%; flex-basis: 100%; }
  .ot-scroll { max-height: calc(100dvh - 140px); }
  .ot-table th.ot-client { min-width: var(--ot-cw, 150px); max-width: var(--ot-cw, 180px); padding: 4px 6px; }
  .ot-name { font-size: 12px; }
  .ot-table thead th { min-width: 56px; }
  .ot-st { min-width: 48px; }
  .ot-row2 { flex-direction: column; gap: 0; }
}
/* Телефон: поля 16px — иначе iPhone увеличивает страницу при вводе (наши правила выше перебивают общее). */
@media (max-width: 760px), (pointer: coarse) {
  .ot-f select, .ot-period select, .ms-find, .ot-fld select, .ot-fld input, .ot-fld input.ot-days { font-size: 16px; }
}

/* «Просьбы клиентов»: срочно, «В работе» / «Выполнено», пересылка сотруднику, вкладка «Не выполнено» */
.urg { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 17px; height: 17px; margin-right: 5px; border-radius: 50%; background: #F2C230; color: #3A2A00; font: 700 12px/1 var(--sans); vertical-align: -3px; }
.wait .urg { margin-right: 4px; }
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.p-amber { background: var(--st-amber-bg); color: var(--st-amber); }
.p-green { background: var(--st-green-bg); color: var(--st-green); }
.p-red { background: var(--st-red-bg); color: var(--st-red); }
.p-grey { background: var(--st-grey-bg); color: var(--st-grey); }
.svc { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 8px; padding-top: 7px; border-top: 1px dashed var(--line); }
.svc .pill { white-space: normal; }
.svc-note { color: var(--muted); font-size: 11px; }
button.small.ok { background: transparent; color: var(--text); border-color: var(--line); }
button.small.ok:hover { background: var(--surface-2); border-color: var(--st-green); }
.fwd-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; width: 100%; }
.fwd-pick-title { font-size: 13px; font-weight: 600; }
.fwd-pick select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); }
.fwd-pick input { flex: 1 1 200px; width: auto; padding: 6px 10px; }
.fwd-card { margin: 4px 0 6px; padding: 6px 10px; border-left: 3px solid var(--gold); border-radius: 6px; background: var(--surface-2); }
.fwd-head { color: var(--muted); font-size: 12px; margin-bottom: 2px; }
.req-switch { display: flex; gap: 6px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.req-switch button.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.req-row.old { background: var(--st-red-bg); }
.req-row .row-bottom button.ok { flex: none; min-height: 26px; padding: 0 10px; }
.req-who { font-size: 12px; margin-top: 2px; }
@media (max-width: 760px), (pointer: coarse) { .fwd-pick select, .fwd-pick input { font-size: 16px; } }

/* ---------- Настройки во всю ширину (settings_base.html): шапка, меню разделов слева, содержимое справа ---------- */
.set-top { display: flex; align-items: center; gap: 24px; padding: 12px 24px; background: var(--head); }
.set-top a { color: var(--head-text); text-decoration: none; font-size: 14px; }
.set-top a:hover { color: #fff; }
.set-top .set-logo { font: 500 26px var(--serif); color: var(--gold); }
.set-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: calc(100vh - 58px); }
.set-side { padding: 22px 12px; border-right: 1px solid var(--line); background: var(--surface-2); }
.set-side-title { margin: 0 12px 14px; font: 500 30px var(--serif); color: var(--text); }
.set-side a { display: block; margin-bottom: 2px; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 600; }
.set-side a small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 400; }
.set-side a:hover:not(.on) { background: var(--line); }
.set-side a.on { background: var(--surface); box-shadow: inset 3px 0 0 var(--gold); }
.set-main { min-width: 0; padding: 22px 32px 40px; }
.set-main.set-narrow > * { max-width: 760px; }
.set-main.set-mid > * { max-width: 1100px; }
.set-main h1 { margin: 0 0 16px; font: 500 36px var(--serif); }
/* клиенты таблицей */
.cl-title { display: flex; align-items: baseline; gap: 12px; }
.cl-title h1 { margin-bottom: 12px; }
.cl-title .cl-add { margin-left: auto; }
.cl-new-form { display: flex; flex-wrap: wrap; gap: 8px; }
.cl-new-form input { flex: 1 1 200px; margin: 0; }
.set-main .clients-filter { margin-bottom: 14px; gap: 6px; }
.set-main .clients-filter #q { flex: 1 1 220px; padding: 8px 14px; font-size: 14px; }
.set-main .clients-filter select { flex: 0 0 auto; width: auto; padding: 8px 12px; font-size: 14px; }
.clients-filter select.set { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.link-btn { padding: 6px 4px; border: 0; background: none; color: var(--accent-text); font: 600 14px var(--sans); cursor: pointer; }
.cl-wrap { overflow: auto; max-height: calc(100vh - 230px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.cl-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.cl-table th, .cl-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
.cl-table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--muted); font-size: 12.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; cursor: pointer; user-select: none; }
.cl-table thead th[aria-sort="ascending"]::after { content: " ▲"; color: var(--accent-text); }
.cl-table thead th[aria-sort="descending"]::after { content: " ▼"; color: var(--accent-text); }
.cl-table tbody tr[data-id] { cursor: pointer; }
.cl-table tbody tr[data-id]:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.cl-table tbody tr[data-id]:hover { background: color-mix(in srgb, var(--gold) 14%, transparent); }
.cl-table .group-head th { padding-top: 16px; background: var(--surface); color: var(--accent-text); font: 500 21px var(--serif); text-align: left; }
.cl-table .cl-name { min-width: 220px; white-space: normal; font-weight: 600; }
.cl-table .cl-name a { color: var(--text); text-decoration: none; }
.cl-table .cl-inn { color: var(--muted); font-variant-numeric: tabular-nums; }
.cl-table .cl-num { color: var(--muted); text-align: center; }
.tag { display: inline-block; margin: 1px 4px 1px 0; padding: 2px 8px; border-radius: 999px; background: var(--st-grey-bg); color: var(--st-grey); font-size: 12.5px; font-weight: 600; }
.tag.ok { background: var(--st-green-bg); color: var(--st-green); }
.tag.zero-mark { background: var(--st-amber-bg); color: var(--st-amber); }
.av { display: inline-grid; place-items: center; width: 26px; height: 26px; margin-right: 3px; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 600; }
.av-0 { background: #6A5B8C; } .av-1 { background: #0E2A47; } .av-2 { background: #B9862C; }
.av-3 { background: #3C7D5E; } .av-4 { background: #A6493E; } .av-5 { background: #3F6E9A; }
.cl-greet summary { cursor: pointer; font-weight: 600; }
.cl-greet form { margin-top: 12px; }
@media (max-width: 760px) {
  .set-top { padding: 10px 16px; gap: 16px; }
  .set-layout { grid-template-columns: 1fr; min-height: 0; }
  .set-side { display: flex; gap: 6px; padding: 8px 12px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .set-side-title, .set-side a small { display: none; }
  .set-side a { margin: 0; white-space: nowrap; }
  .set-main { padding: 16px; }
  .set-main h1 { font-size: 30px; }
  .cl-wrap { overflow: visible; max-height: none; border: 0; background: none; }
  .cl-table thead { display: none; }
  .cl-table, .cl-table tbody, .cl-table tr, .cl-table td { display: block; }
  .cl-table tbody tr[data-id] { margin-bottom: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface) !important; }
  .cl-table tbody tr[hidden], .cl-table .group-head[hidden] { display: none; }
  .cl-table td { padding: 2px 0; border: 0; white-space: normal; }
  .cl-table td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-size: 12.5px; }
  .cl-table .cl-num { text-align: left; }
  .cl-table .group-head { display: block; }
  .cl-table .group-head th { display: block; padding: 10px 2px 4px; border: 0; background: none; }
}
/* «Сотрудники»: каждый — своя карточка (шапка: кружок, имя, метки, кнопки; ниже — день рождения и должности) */
.staff-list { display: grid; gap: 14px; margin: 8px 0 22px; }
.staff-card { padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.staff-card.off { opacity: .7; background: var(--surface-2); }
.staff-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.av.av-big { width: 44px; height: 44px; margin: 0; font-size: 18px; flex: none; }
.staff-who { flex: 1 1 220px; min-width: 0; }
.staff-who h2 { margin: 0; font: 600 17px var(--sans); }
.staff-who p { margin: 2px 0 0; font-size: 13.5px; }
.staff-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px !important; }
.tag.bad-tag { background: var(--st-red-bg); color: var(--st-red); }
.staff-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; flex: 1 1 320px; }
.staff-actions form { margin: 0; }
.staff-body { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 10px 14px; align-items: center; padding-top: 12px; }
.staff-label { color: var(--muted); font-size: 13px; font-weight: 600; }
.staff-body .pos-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.staff-body .pos-form select, .staff-body .pos-form input { width: auto; margin: 0; }
.staff-body .picks { display: flex; flex-wrap: wrap; gap: 6px; }
button.danger-outline { border-color: var(--bad); color: var(--bad); }
@media (max-width: 760px) {
  .staff-actions { justify-content: flex-start; }
  .staff-body { grid-template-columns: 1fr; gap: 4px; }
  .staff-body .pos-form { margin-bottom: 8px; }
}

/* Отметки писем и требований: значок источника, блок «Проверить», пилюли в «Почте» */
.src-icon { flex: none; font-size: 13px; margin-right: 4px; }
.req-check-head { padding: 12px 14px 4px; font-weight: 600; font-size: 13px; color: var(--st-red); list-style: none; }
.req-who.check-no { color: var(--st-red); }
.mail-marks { display: contents; }
.mail-marks .fwd-pick { flex: 1 1 100%; }
.mail-mark { margin: 0 0 8px; }
.mail-tail .pill { font-size: 11px; padding: 0 7px; }

/* Вкладка «ЭП» (сроки электронных подписей) */
.ep-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; }
.ep-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ep-chip { min-height: 34px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; }
.ep-chip b { margin-left: 4px; font-variant-numeric: tabular-nums; }
.ep-chip:hover { border-color: var(--gold); }
.ep-chip.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.ep-q { margin-left: auto; width: 240px; max-width: 100%; padding: 7px 14px; border-radius: 18px; font-size: 13px; }
.ep-scroll { overflow-x: auto; }
.ep-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
.ep-table[hidden] { display: none; }
.ep-table th { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--muted); }
.ep-sort { padding: 0; min-height: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.ep-sort:hover { color: var(--text); }
.ep-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ep-table tbody tr:last-child td { border-bottom: 0; }
.ep-c-name { min-width: 190px; }
.ep-inn { font-size: 12px; }
.ep-ex { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 6px; border-radius: 50%; color: #fff; font-size: 13px; font-weight: 800; vertical-align: middle; cursor: help; }
.ep-ex.o { background: #E08A1E; }
.ep-ex.r { background: var(--bad); }
.ep-orange { color: #B96A0A; font-weight: 700; }
.ep-red, .ep-st { color: var(--st-red); font-weight: 700; }
.ep-pill { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.ep-p-token { background: #E6EEF7; color: #1F4D7A; }
.ep-p-copy { background: var(--st-amber-bg); color: var(--st-amber); }
.ep-p-none { background: var(--st-grey-bg); color: var(--st-grey); }
.ep-table tr.ep-expired td { background: var(--st-red-bg); }
.ep-table tr.ep-inactive td { background: var(--st-grey-bg); color: var(--muted); }
.ep-acts { white-space: nowrap; }
.ep-acts button { margin: 2px 4px 2px 0; }
button.small.ep-main { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.ep-in { min-height: 34px; padding: 4px 8px; font-size: 13px; border-radius: 8px; }
select.ep-in { width: auto; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.ep-date { width: 150px; }
.ep-legend { font-size: 12px; }
@media (prefers-color-scheme: dark) { :where(:root:not([data-theme="light"])) .ep-p-token { background: rgba(120,170,225,.22); color: #B7D3F2; } :where(:root:not([data-theme="light"])) .ep-orange { color: #F0B35C; } }
:where(:root[data-theme="dark"]) .ep-p-token { background: rgba(120,170,225,.22); color: #B7D3F2; }
:where(:root[data-theme="dark"]) .ep-orange { color: #F0B35C; }
@media (max-width: 600px) {          /* телефон: строка — карточка */
  .ep-q { margin-left: 0; width: 100%; }
  .ep-q, .ep-in { font-size: 16px; }          /* iPhone не увеличивает страницу при вводе */
  .ep-table, .ep-table tbody { display: block; background: none; border: 0; }
  .ep-table thead { display: none; }
  .ep-table tr { display: block; margin: 0 0 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
  .ep-table td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 5px 0; border: 0; text-align: right; }
  .ep-table td[data-label]:not([data-label=""])::before { content: attr(data-label); flex: none; font-size: 12px; color: var(--muted); text-align: left; }
  .ep-table td.ep-c-name { display: block; text-align: left; font-weight: 600; }
  .ep-table td.ep-c-name[data-label]::before { content: none; }
  .ep-table td:empty { display: none; }
  .ep-table tr.ep-expired { background: var(--st-red-bg); }
  .ep-table tr.ep-inactive { background: var(--st-grey-bg); }
  .ep-table tr.ep-expired td, .ep-table tr.ep-inactive td { background: none; }
  .ep-acts { justify-content: flex-end; flex-wrap: wrap; white-space: normal; }
  .ep-in { flex: 1; min-width: 0; max-width: 60%; }
  .ep-date { width: auto; }
}

/* «Настройки → Учёт → ЭП»: кто видит сроки подписей */
.ep-access { display: grid; gap: 6px; max-width: 560px; margin-top: 12px; }
.ep-person { display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-weight: 600; cursor: pointer; }
.ep-person input { width: auto; margin: 0; }
.ep-person small { margin-left: auto; font-weight: 400; text-align: right; }
.ep-access button { justify-self: start; margin-top: 8px; }
.set-saved { color: var(--st-green); font-weight: 600; }

/* «Учёт → Выписки → Интеграции»: счета из 1С и подключение выписки */
.vypiski-sub { margin-top: -6px; }
.vy-client td { background: var(--bg, #f6f6f4); font-weight: 600; }
tr.vy-saved td { background: var(--st-green-bg, #e7f6ec); }
.vy-comment { width: 100%; min-width: 140px; padding: 5px 8px; font-size: 13px; }
.vy-badge { white-space: nowrap; font-size: 13px; font-weight: 600; }
.vy-badge::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 7px;
  border-radius: 50%; background: currentColor; }
.vy-badge.s-on { color: var(--st-green); }
.vy-badge.s-error { color: var(--st-red); }
.vy-badge.s-off { color: var(--st-grey); }

/* «Учёт → Клиенты» */
.uk-sel { padding: 6px 10px; border-radius: 18px; font-size: 13px; }
.uk-count { font-size: 13px; }
.uk-table th[data-sort] { cursor: pointer; user-select: none; }
.uk-table th[aria-sort="ascending"]::after { content: " ▲"; font-size: 10px; }
.uk-table th[aria-sort="descending"]::after { content: " ▼"; font-size: 10px; }
.uk-table tbody tr { cursor: pointer; }
.uk-table tbody tr:hover td { background: rgba(127,127,127,.08); }
.uk-table tr[hidden] { display: none; }
.uk-name a { color: inherit; font-weight: 600; text-decoration: none; }
.uk-name a:hover { text-decoration: underline; }
.uk-inn { font-variant-numeric: tabular-nums; white-space: nowrap; }
.uk-chip { display: inline-block; padding: 2px 9px; border-radius: 11px; font-size: 12px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.uk-wait { background: #fff3d6; color: #8a5a00; }
.uk-need { background: #fff3d6; color: #8a5a00; }
.uk-overdue { background: #fde2e1; color: #b3261e; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .uk-wait, :root:not([data-theme="light"]) .uk-need { background: #4a3a12; color: #ffd98a; }
  :root:not([data-theme="light"]) .uk-overdue { background: #4d1f1d; color: #ffb4ab; }
}
:root[data-theme="dark"] .uk-wait, :root[data-theme="dark"] .uk-need { background: #4a3a12; color: #ffd98a; }
:root[data-theme="dark"] .uk-overdue { background: #4d1f1d; color: #ffb4ab; }

/* «Учёт → Закрытие периода» */
button.zk-cell, button.zk-cell:hover { min-height: 0; background: none; border: 0; border-radius: 11px; padding: 0; color: inherit; font: inherit; cursor: pointer; }
button.zk-cell:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
button.zk-cell:disabled { opacity: .5; cursor: progress; }
.zk { display: inline-block; padding: 2px 9px; border-radius: 11px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.zk-done, .zk-closed { background: #dcf1e2; color: #1d6b38; }
.zk-skip { background: rgba(127,127,127,.14); color: var(--muted); font-weight: 500; }
.zk-err { background: #fde2e1; color: #b3261e; }
.zk-wait, .uk-close { background: #fff3d6; color: #8a5a00; }
a.zk { text-decoration: none; }
.zk-na { color: var(--muted); font-size: 12px; padding: 2px 9px; white-space: nowrap; }
.zk-none { color: var(--muted); font-weight: 400; padding: 2px 9px; }
.zk-cell:hover .zk-none { background: rgba(127,127,127,.1); }
.zk-total { white-space: nowrap; font-size: 13px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .zk-done, :root:not([data-theme="light"]) .zk-closed { background: #1f4a2c; color: #a8e0b8; }
  :root:not([data-theme="light"]) .zk-err { background: #4d1f1d; color: #ffb4ab; }
  :root:not([data-theme="light"]) .zk-wait, :root:not([data-theme="light"]) .uk-close { background: #4a3a12; color: #ffd98a; }
}
:root[data-theme="dark"] .zk-done, :root[data-theme="dark"] .zk-closed { background: #1f4a2c; color: #a8e0b8; }
:root[data-theme="dark"] .zk-err { background: #4d1f1d; color: #ffb4ab; }
:root[data-theme="dark"] .zk-wait, :root[data-theme="dark"] .uk-close { background: #4a3a12; color: #ffd98a; }

/* «Мой день» */
.den { max-width: 980px; }
.den-sub { margin: 0 0 14px; }
.den-sum { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.den-num { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 16px; min-width: 96px; }
.den-num b { display: block; font-size: 22px; }
.den-num span { color: var(--muted); font-size: 12px; }
.den-over b { color: #b3261e; }
.den-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.den-pills button[aria-pressed="true"] { border-color: var(--gold); background: var(--surface-2); }
.den-group[hidden], .den-item[hidden] { display: none; }
.den-group h2 { margin: 18px 0 8px; font: inherit; font-size: 13px; }
.den-g-over { background: #fde2e1; color: #b3261e; }
.den-g-today { background: #fff3d6; color: #8a5a00; }
.den-g-week { background: #dcf1e2; color: #1d6b38; }
.den-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.den-item { display: grid; grid-template-columns: 130px 1fr auto; gap: 12px; align-items: center; background: var(--surface);
  border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.den-item.den-over { border-left-color: #d9534f; }
.den-item.den-today { border-left-color: #e0a526; }
.den-item.den-week { border-left-color: #4caf6e; }
.den-src { color: var(--muted); font-size: 12px; font-weight: 600; }
.den-main { min-width: 0; }
.den-title { color: inherit; font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.den-title:hover { text-decoration: underline; }
.den-meta { color: var(--muted); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.den-act { white-space: nowrap; font-size: 13px; font-weight: 600; border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 14px; color: inherit; text-decoration: none; }
.den-act:hover { border-color: var(--gold); }
.den-free { font-size: 16px; margin: 24px 0; }
@media (max-width: 640px) {
  .den-item { grid-template-columns: 1fr; gap: 4px; }
  .den-act { justify-self: start; margin-top: 4px; }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .den-g-over { background: #4d1f1d; color: #ffb4ab; }
  :root:not([data-theme="light"]) .den-g-today { background: #4a3a12; color: #ffd98a; }
  :root:not([data-theme="light"]) .den-g-week { background: #1f4a2c; color: #a8e0b8; }
  :root:not([data-theme="light"]) .den-over b { color: #ffb4ab; }
}
:root[data-theme="dark"] .den-g-over { background: #4d1f1d; color: #ffb4ab; }
:root[data-theme="dark"] .den-g-today { background: #4a3a12; color: #ffd98a; }
:root[data-theme="dark"] .den-g-week { background: #1f4a2c; color: #a8e0b8; }
:root[data-theme="dark"] .den-over b { color: #ffb4ab; }

/* ⚡ Шаблоны ответов */
.tpl-panel[hidden] { display: none; }
.tpl-panel { display: grid; gap: 4px; max-height: 45vh; overflow-y: auto; padding: 8px 16px; background: var(--surface); border-top: 1px solid var(--line); }
button.tpl-item { display: grid; gap: 2px; min-height: 0; text-align: left; padding: 8px 12px; border-radius: 10px; background: transparent;
  color: var(--text); border: 1px solid var(--line); font-weight: 400; }
button.tpl-item:hover { background: var(--surface-2); border-color: var(--gold); }
.tpl-item b { font-size: 14px; }
.tpl-item small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpl-note { margin: 4px 0; }
.tpl-foot { font-size: 13px; padding: 4px 2px; }
/* «Настройки → Шаблоны ответов» */
.sh-head { font: inherit; font-size: 15px; font-weight: 700; margin: 18px 0 8px; }
.sh-item { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; margin-bottom: 8px; }
.sh-main { min-width: 0; }
.sh-text { margin: 4px 0 0; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.sh-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.sh-form { display: grid; gap: 10px; margin-top: 20px; }
.sh-form h2 { margin: 0; font: inherit; font-size: 15px; font-weight: 700; }
.sh-form label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }
.sh-form label.sh-shared { display: flex; justify-content: flex-start; align-items: center; gap: 8px; font-weight: 400; }
.sh-shared input { width: auto; flex: none; margin: 0; }
.sh-item .sh-btns { flex-wrap: nowrap; }
@media (max-width: 640px) { .sh-item { flex-direction: column; } }

/* «Учёт → Патенты и взносы ИП» и «Напоминания» */
.ipu-table input.ipu-in, .nap-table input.ipu-in { width: 110px; padding: 5px 8px; font: inherit; font-size: 13px;
  border: 1px solid var(--line, #d8d2c8); border-radius: 6px; background: var(--paper, #fff); }
.ipu-table input.ipu-in:disabled { opacity: .45; }
.ipu-table input.ipu-ok, .nap-table input.ipu-ok { border-color: #3a8a4f; }
.ipu-table input.ipu-bad { border-color: #b3261e; }
.ipu-inn { font-size: 12px; }
.ipu .ep-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.nap-batch { margin: 14px 0; padding: 14px 16px; }
.nap-head { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.nap-head h2 { margin: 0; font: inherit; font-size: 15px; font-weight: 700; }
.nap-head .nap-all { margin-left: auto; }
.nap-when { margin: 4px 0 8px; font-size: 13px; }
.nap-text { max-width: 420px; font-size: 13px; }
.nap-text summary { cursor: pointer; }
.nap-full { white-space: pre-wrap; margin-top: 6px; }
.nap-chat { font-size: 12px; }
.nap-pill { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; background: #ece6dc; }
.nap-pill-ready { background: #e3efe1; color: #2f6b3a; }
.nap-pill-nosum, .nap-pill-nochat { background: #f6e7cf; color: #8a5a12; }
.nap-pill-sent { background: #e2e9f3; color: #2c4a73; }
.nap-row.nap-skip td, .nap-row.nap-sent td { color: var(--muted, #7a7368); }
.nap-btns { white-space: nowrap; }
button.nap-link, button.nap-link:hover { background: none; border: 0; padding: 0 0 0 8px; color: var(--link, #2c4a73);
  text-decoration: underline; cursor: pointer; font: inherit; font-size: 13px; box-shadow: none; }
.nap-tx { margin: 12px 0; }
.nap-tx-l { display: block; font-weight: 700; margin-bottom: 4px; }
.nap-tx textarea { width: 100%; box-sizing: border-box; font: inherit; }
.nap-tx-btns { display: flex; gap: 10px; align-items: center; margin-top: 6px; }
.nap-texts { margin-top: 18px; padding: 12px 16px; }
.nap-texts summary { cursor: pointer; font-weight: 700; }
.ipu-h { font: inherit; font-size: 16px; font-weight: 700; margin: 22px 0 4px; }
.ipu .ipu-add { margin-left: auto; }
.ipu-form { padding: 14px 16px; margin: 10px 0; }
.ipu-form h3 { margin: 0 0 10px; font: inherit; font-size: 15px; font-weight: 700; }
.ipu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 14px; }
.ipu-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.ipu-grid .ipu-wide { grid-column: 1 / -1; max-width: 520px; }
.ipu-grid input, .ipu-grid select { font: inherit; font-weight: 400; padding: 6px 8px; border: 1px solid var(--line, #d8d2c8);
  border-radius: 6px; background: var(--paper, #fff); }
.ipu-form-btns { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.ipu-pays { min-width: 260px; }
.ipu-pay { display: flex; justify-content: flex-start; gap: 6px; align-items: center; font-size: 13px; font-weight: 400;
  margin: 2px 0; cursor: pointer; white-space: nowrap; }
.ipu-table .ipu-pay input[type="checkbox"] { width: 16px; min-width: 0; height: 16px; flex: none; margin: 0; padding: 0; }
.ipu-pay input { margin: 0; }
select.ipu-st { font: inherit; font-size: 12px; padding: 2px 6px; border-radius: 8px; border: 1px solid transparent;
  background: #f6e7cf; color: #8a5a12; width: auto; }
.ipu-pay-sent select.ipu-st, select.ipu-st-sent { background: #e2e9f3; color: #2c4a73; }
.ipu-pay-paid select.ipu-st, select.ipu-st-paid { background: #e3efe1; color: #2f6b3a; }
.ipu-pay-over select.ipu-st { background: #f7dcd9; color: #a3271d; }
.ipu-old td { color: var(--muted, #7a7368); }

/* «Команда» */
.km-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 12px; }
.km-seg { display: inline-flex; border: 1px solid var(--line, #d8d2c8); border-radius: 10px; overflow: hidden; }
.km-seg a { padding: 6px 14px; font-size: 13px; text-decoration: none; color: inherit; }
.km-seg a[aria-current="page"] { background: #0e2a47; color: #f8fafc; }
.km-sums { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.km-sum { background: var(--paper, #fff); border: 1px solid var(--line, #d8d2c8); border-radius: 12px; padding: 8px 14px; min-width: 150px; }
.km-sum b { display: block; font-size: 20px; }
.km-sum span { font-size: 12px; color: var(--muted, #7a7368); }
.km-red { color: #a3271d; }
.km-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.km-card { padding: 14px 16px; margin-bottom: 14px; min-width: 0; }
.km-card h2 { margin: 0 0 10px; font: inherit; font-size: 15px; font-weight: 700; }
.km-bar { display: grid; grid-template-columns: 140px minmax(0, 1fr) 90px; gap: 10px; align-items: center; font-size: 13px; margin-bottom: 8px; }
.km-track { height: 12px; background: #ece6dc; border-radius: 6px; overflow: hidden; }
.km-track i { display: block; height: 100%; background: #d4a64a; border-radius: 6px; }
.km-track i.km-slow { background: #c8443a; }
.km-v { text-align: right; }
.km-note { font-size: 12px; margin: 8px 0 0; }
.km-chip { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; }
.km-chip-red { background: #f7dcd9; color: #a3271d; }

/* «← К учёту» / «← К «Моему дню»» вверху рабочих разделов */
.work-back { display: inline-block; margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--link, #2c4a73);
  text-decoration: none; padding: 4px 12px; border: 1px solid var(--line, #d8d2c8); border-radius: 18px; }
.work-back:hover { border-color: #d4a64a; }
/* «Учёт → АУСН» */
.ipu-table input.ausn-inh { color: var(--muted, #7a7368); font-style: italic; }
.ausn .ep-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
/* «Патенты»: «не нужно», прекращён, сотрудники */
.ipu-pay-none select.ipu-st { background: #ecebe8; color: #7a7368; }
.ipu-pay-none span { text-decoration: line-through; color: #7a7368; }
.ipu-stop { margin-top: 4px; font-size: 12px; font-weight: 600; color: #a5432e; }
.ipu-emp { font-weight: 600; }
.ipu-emp-no { color: #2f6b3a; }
.ipu-emp-yes { color: #2c4a73; }
.ipu-emp-unknown { color: #a5432e; }

/* Чаты: синяя полоса разделов во всю ширину сверху; под ней — светлые полосы (разделы списка слева, название справа) */
body.app { display: flex; flex-direction: column; }
body.app > .work-top { flex: none; padding-top: max(8px, env(safe-area-inset-top)); }
body.app > .push-note { flex: none; padding-top: 6px; }
body.app > .layout { flex: 1; min-height: 0; height: auto; }
.work-logout { margin: 0 6px 0 4px; }
.work-logout button.link { color: var(--head-text); font-size: 13px; text-decoration: none; }
.work-logout button.link:hover { color: var(--gold); }
.sections { min-height: 58px; align-items: stretch; background: var(--surface-2); border-bottom: 2px solid var(--gold); }
.sections button { color: var(--muted); border-bottom-width: 3px; }
.sections button:hover { color: var(--text); }
.sections button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--gold); }
.layout .chat-head { min-height: var(--head-h, 58px); padding-top: 6px; padding-bottom: 6px; background: var(--surface-2); border-bottom: 2px solid var(--gold); }
.chat-head h2 { font-size: 23px; line-height: 1.2; color: var(--text); }
.card-top { min-height: var(--head-h, 58px); background: var(--surface-2); border-bottom: 2px solid var(--gold); }
/* на компьютере полоса с названием — ровно той же высоты, что полоса слева: золотые линии на одном уровне */
@media (min-width: 761px) {
  .layout .chat-head, .layout .card-top { height: var(--head-h, 58px); min-height: 0; padding-top: 4px; padding-bottom: 4px; overflow: hidden; }
  .layout .chat-head .muted { line-height: 1.25; }
}
button.small.card-back { border-color: var(--line); color: var(--text); }
button.small.card-back:hover { border-color: var(--gold); background: transparent; color: var(--text); }
@media (max-width: 760px) {
  body.chat-open > .work-top, body.chat-open > .push-note { display: none; }   /* в открытой переписке на телефоне — только название, место сообщениям */
  .layout .chat-head { padding-top: max(8px, env(safe-area-inset-top)); }
}
/* граница между списком и перепиской — заметная: толще и темнее обычных линий */
.side { border-right: 2px solid #A9A39A; }
@media (prefers-color-scheme: dark) { :where(:root:not([data-theme="light"])) .side { border-right-color: rgba(255,255,255,.28); } }
:where(:root[data-theme="dark"]) .side { border-right-color: rgba(255,255,255,.28); }

/* АУСН: у нулевок налог серым (обычно его нет) — но сумму вписать и статус выбрать можно */
.ipu-table input.ipu-in.ausn-zero, .ipu-table select.ipu-st.ausn-zero { background: var(--st-grey-bg); color: var(--st-grey); border-color: transparent; }
.ipu-table input.ipu-in.ausn-zero::placeholder { color: var(--st-grey); }
.ipu-table input.ipu-in.ausn-zero:focus, .ipu-table select.ipu-st.ausn-zero:focus { border-color: var(--gold); }
/* Напоминания → Напоминания ЭП: лента, новые сверху */
.nap-ep { list-style: none; margin: 12px 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; }
.nap-ep li { display: flex; gap: 14px; align-items: baseline; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.nap-ep li:last-child { border-bottom: 0; }
.nap-ep li.new { background: var(--st-amber-bg); font-weight: 600; }
.nap-ep-at { flex: none; font-size: 13px; font-weight: 400; }
.nap-ep-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.nap-ep-new { flex: none; background: var(--bad); color: #fff; }
@media (max-width: 600px) { .nap-ep li { flex-wrap: wrap; gap: 2px 10px; } .nap-ep-text { flex-basis: 100%; } }

.work-tabs .nav-count { vertical-align: 1px; }
.nap-ep-read { margin: 12px 0 0; }
/* «Взносы»: комментарий к фиксированным; «Патенты»: уменьшение патента на взносы */
.ipu-table input.ipu-in.ipu-comment { width: 200px; }
.ipu-cut { min-width: 200px; }
.ipu-table textarea.ipu-note { width: 100%; min-width: 180px; padding: 5px 8px; font: inherit; font-size: 13px; resize: vertical;
  border: 1px solid var(--line, #d8d2c8); border-radius: 8px; box-sizing: border-box; }
.ipu-table textarea.ipu-ok { border-color: #3a8a4f; }
.ipu-table textarea.ipu-bad { border-color: #b3261e; }
