:root {
  --accent: #2563eb;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --bg: #f4f6fa;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --border: #e3e8ef;
  --text: #0f172a;
  --muted: #64748b;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #d97706;
  --weekend: #fff7ed;
  --today: color-mix(in srgb, var(--accent) 14%, transparent);
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .06);
  --radius: 10px;
  --pad: 16px;
  --row-h: 40px;
  --fs: 14px;
}
:root[data-theme="dark"] {
  --bg: #0b1120;
  --panel: #111827;
  --panel-2: #0f172a;
  --border: #1f2a3c;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --weekend: #1c1917;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
}
:root[data-density="compact"] { --pad: 10px; --row-h: 32px; }
:root[data-density="comfortable"] { --pad: 22px; --row-h: 48px; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: var(--fs)/1.45 var(--font, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif); }
a { color: var(--accent); }
h1 { font-size: 1.5em; margin: 0; }
h2 { font-size: 1.15em; margin: 0 0 12px; }
h3 { font-size: 1em; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: .86em; }
.hidden { display: none !important; }
code, .mono { font-family: ui-monospace, Consolas, monospace; font-size: .9em; }
code { background: var(--panel-2); border: 1px solid var(--border); padding: 1px 5px; border-radius: 5px; word-break: break-all; }
pre { background: var(--panel-2); border: 1px solid var(--border); padding: 10px; border-radius: 8px; overflow: auto; font-size: .85em; }

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 240px; flex: none; background: var(--panel); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; transition: width .15s; }
.app.collapsed .sidebar { width: 64px; }
.app.collapsed .sidebar .label, .app.collapsed .sidebar .nav-group, .app.collapsed .brand .label { display: none; }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px; font-weight: 700; border-bottom: 1px solid var(--border); }
.brand .logo { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.brand .logo.has-img, .login .logo.has-img { background: #fff; border: 1px solid var(--border); padding: 2px; overflow: hidden; width: 40px; height: 40px; }
.logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.app.collapsed .brand .logo.has-img { width: 36px; height: 36px; }
.logo-preview { width: 88px; height: 88px; border: 1px dashed var(--border); border-radius: 12px; display: grid; place-items: center; background: #fff; overflow: hidden; flex: none; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.nav { padding: 8px; flex: 1; }
.nav-group { font-size: .72em; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; white-space: nowrap; }
.nav a:hover { background: var(--panel-2); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav a .label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav a .label.long { font-size: .8em; letter-spacing: -.02em; }
.nav .ico { width: 22px; text-align: center; flex: none; display: inline-flex; justify-content: center; }

/* Иконки Hosmans: контур цвета текста + деталь с лёгкой заливкой (в активном пункте — насыщеннее) */
.ic { display: inline-flex; align-items: center; justify-content: center; flex: none; line-height: 0; }
.ic svg { width: 1.3em; height: 1.3em; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.ic .d { fill: currentColor; fill-opacity: .12; }
.ic .f { fill: currentColor; stroke: none; }
.btn .ic svg { width: 1.15em; height: 1.15em; }
/* Фото объекта (окно объекта) и ссылка страницы бронирования (Интеграции) */
.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.ph { position: relative; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: var(--panel-2); border: 1px solid var(--border); }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph.cover { outline: 2px solid var(--accent); outline-offset: 1px; }
.ph-tag { position: absolute; left: 6px; top: 6px; background: var(--accent); color: #fff; font-size: .7em; font-weight: 700; border-radius: 6px; padding: 1px 6px; }
.ph-act { position: absolute; right: 4px; top: 4px; display: flex; gap: 4px; }
.ph-act button { width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .55); color: #fff; cursor: pointer; font-size: .85em; }
.ph-add { display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; border-style: dashed; color: var(--muted); gap: 2px; }
.ph-add span { font-size: 1.6em; line-height: 1; }
.ph-add:hover { border-color: var(--accent); color: var(--accent); }
.bp-link { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; word-break: break-all; }
.bp-link code { font-size: .88em; }
/* Поле поиска: лупа из набора Hosmans вместо эмодзи 🔍 */
input.search-ico { padding-left: 32px !important; background: var(--panel) no-repeat 10px 50% / 16px 16px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b918a' stroke-width='1.9' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='M15.5 15.5l5 5'/%3E%3C/svg%3E"); }
/* Поле пароля с кнопкой «показать / скрыть» */
.pw-wrap { position: relative; }
.pw-wrap input { width: 100%; padding-right: 40px !important; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 6px; padding: 0; }
.pw-eye:hover { color: var(--accent); background: var(--panel-2); }
/* Иконка вместо эмодзи в надписи (кнопки, вкладки, заголовки, подсказки) */
.ic-inline { vertical-align: -.2em; margin-right: .38em; }
.btn .ic-inline, .tabs button .ic-inline { margin-right: 0; }
.ic-inline.ic-tight { margin-right: .12em; }
.ic-inline.ic-tight svg { width: 1em; height: 1em; }
.chat-human .ic svg { width: 1.05em; height: 1.05em; }
.tabs button { display: inline-flex; align-items: center; gap: 6px; }
h1 .ic-inline svg, h2 .ic-inline svg, h3 .ic-inline svg { width: 1.1em; height: 1.1em; }
.note .ic-inline svg, .badge .ic-inline svg, label .ic-inline svg { width: 1.05em; height: 1.05em; }
.nav a .ic { color: var(--muted); transition: color .15s, transform .15s; }
.nav a:hover .ic { color: var(--text); }
.nav a.active .ic { color: var(--accent); }
.nav a.active .ic .d { fill-opacity: .28; }
.nav a:active .ic { transform: scale(.92); }
.side-foot { border-top: 1px solid var(--border); padding: 10px; }
/* Кнопка «Мой профиль» внизу меню: интерфейс, данные, защита */
.side-foot .profile-btn { justify-content: flex-start; gap: 10px; margin-bottom: 6px; text-align: left; }
.side-foot .profile-btn .label { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.side-foot .profile-btn .label > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .profile-btn.active { border-color: var(--accent); background: var(--accent-soft); }
.side-foot .profile-btn.active .ico { color: var(--accent); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar .spacer { flex: 1; }
/* Поиск по CRM */
.gs { position: relative; flex: 0 1 360px; min-width: 120px; }
.gs-input { width: 100%; }
.gs-panel { position: absolute; top: calc(100% + 6px); left: 0; width: min(520px, 92vw); max-height: 70vh; overflow: auto; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0,0,0,.18); z-index: 60; padding: 6px; }
.gs-group { font-size: .75em; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 8px 4px; font-weight: 600; }
.gs-item { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.gs-item.active, .gs-item:hover { background: var(--accent-soft); }
.gs-empty { padding: 12px 8px; }
@media (max-width: 900px) {
  .gs { flex: 1 1 auto; }
  .gs-panel { position: fixed; top: 58px; left: 8px; right: 8px; width: auto; }
}
@media (max-width: 600px) {
  .topbar #page-title { display: none; }
  /* Всё в одну строку на телефоне: компактный выбор языка, меньше отступов */
  .topbar { gap: 6px; padding: 8px 10px; }
  .topbar select { width: auto; max-width: 72px; padding-left: 6px; padding-right: 2px; }
  .gs { min-width: 60px; }
  /* Путеводитель на телефоне — в выезжающем меню, в шапке для него нет места */
  .topbar .guide-btn { display: none; }
}
.content { padding: 24px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .spacer { flex: 1; }

/* Controls */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--panel); color: var(--text); padding: 7px 13px; border-radius: 8px; cursor: pointer; font: inherit; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 4px 9px; font-size: .9em; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* «Кнопки в рамках» (Настройки → Интерфейс): у всех кнопок, вкладок и пунктов меню — чёткая рамка */
:root[data-boxed="1"] { --box-line: color-mix(in srgb, var(--text) 30%, var(--border)); }
:root[data-boxed="1"] .btn:not(.primary):not(.solid) { border-color: var(--box-line); }
:root[data-boxed="1"] .btn.ghost { background: var(--panel); }
:root[data-boxed="1"] .btn:hover { border-color: var(--accent); }
:root[data-boxed="1"] .tabs { gap: 6px; border-bottom: 0; }
:root[data-boxed="1"] .tabs button { border: 1px solid var(--box-line); border-radius: 8px; margin-bottom: 0; padding: 7px 13px; background: var(--panel); }
:root[data-boxed="1"] .tabs button.active { border-color: var(--accent); background: var(--accent-soft); }
:root[data-boxed="1"] .nav a { border: 1px solid var(--box-line); margin-bottom: 4px; }
:root[data-boxed="1"] .bottom-nav a { border: 1px solid var(--box-line); border-radius: 8px; margin: 3px; }
:root[data-boxed="1"] .pop-menu button { border: 1px solid var(--box-line); border-radius: 6px; margin: 2px 0; }
:root[data-boxed="1"] table.sh td.rn .row-menu { border: 1px solid var(--box-line); opacity: 1; }

/* «Таблицы с сеткой»: линии между всеми ячейками, как в Excel */
:root[data-grid="1"] { --grid-line: color-mix(in srgb, var(--text) 22%, var(--border)); }
:root[data-grid="1"] table.t, :root[data-grid="1"] table.linked { border-collapse: collapse; }
:root[data-grid="1"] table.t th, :root[data-grid="1"] table.t td,
:root[data-grid="1"] table.linked th, :root[data-grid="1"] table.linked td { border: 1px solid var(--grid-line); }
:root[data-grid="1"] table.sh th, :root[data-grid="1"] table.sh td { border-right-color: var(--grid-line); border-bottom-color: var(--grid-line); }
:root[data-grid="1"] .table-wrap { border-color: var(--grid-line); }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); }
input[type="color"] { padding: 2px; height: 36px; width: 56px; }
textarea { min-height: 90px; resize: vertical; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: .86em; color: var(--muted); margin-bottom: 4px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tabs button { background: none; border: none; padding: 10px 14px; cursor: pointer; color: var(--muted); font: inherit; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* Cards & tables */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--pad); box-shadow: var(--shadow); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .v { font-size: 1.7em; font-weight: 700; }

/* Главная-конструктор */
.dash { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; align-items: start; }
.dash > .wide { grid-column: 1 / -1; }
.dash-w { min-width: 0; }
.dash-head { margin-bottom: 8px; }
.dash-head h2 { margin: 0; }
.dash-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.dash-stat { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.dash-line { padding: 7px 0; border-bottom: 1px solid var(--border); gap: 8px; }
.dash-line:last-child { border-bottom: none; }
.dash-line.click { cursor: pointer; }
.dash-line.click:hover { background: var(--panel-2); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-bars { display: flex; flex-direction: column; gap: 10px; margin: 8px 0; }
.plan-row .row { gap: 6px; margin-bottom: 4px; }
.plan-track { position: relative; height: 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); margin-top: 4px; }
.plan-fill { height: 100%; border-radius: 999px; background: var(--accent); }
.plan-fill.ok { background: var(--ok); }
.plan-fill.warn { background: var(--warn); }
.plan-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text, #333); opacity: .45; }
.dash-editor { display: flex; flex-direction: column; gap: 4px; }
.dash-ed-row { padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius); gap: 8px; }
.dash-ed-row.off { opacity: .55; }
.dash-ed-ico { width: 1.6em; text-align: center; }
@media (max-width: 600px) {
  .dash { grid-template-columns: 1fr; }
  .dash-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .dash-stat { padding: 8px 10px; }
  .dash-stat .v { font-size: 1.4em; }
}
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
table.t { width: 100%; border-collapse: collapse; }
table.t th, table.t td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
table.t th { background: var(--panel-2); font-weight: 600; font-size: .86em; color: var(--muted); position: sticky; top: 0; z-index: 1; }
table.t tr.click { cursor: pointer; }
/* Таблица с настраиваемыми столбцами (Бронирования): ширина — из colgroup, длинный текст прокручивается внутри ячейки */
table.t.t-fixed { table-layout: fixed; width: auto; }
table.t.t-fixed th { position: sticky; top: 0; vertical-align: bottom; }
table.t.t-fixed th .th-in { overflow: hidden; text-overflow: ellipsis; }
table.t.t-fixed td { vertical-align: top; }
table.t.t-fixed .cell { max-height: var(--row-max, none); overflow: auto; overflow-wrap: anywhere; }
.col-grip { position: absolute; top: 0; right: -3px; width: 8px; height: 100%; cursor: col-resize; z-index: 2; }
.col-grip:hover, body.col-resizing .col-grip { background: color-mix(in srgb, var(--accent) 35%, transparent); }
body.col-resizing { cursor: col-resize; user-select: none; }
.table-wrap.tall { max-height: 72vh; }
.status-pop { padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; min-width: 220px; }
.status-pop label { display: flex; gap: 8px; align-items: center; cursor: pointer; padding: 3px 2px; }
table.t tr.click:hover td { background: var(--panel-2); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .8em; font-weight: 600; background: var(--panel-2); border: 1px solid var(--border); white-space: nowrap; }
.badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.badge.err { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.note { padding: 12px 14px; border-radius: 8px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); margin-bottom: 14px; }
.note.warn { background: color-mix(in srgb, var(--warn) 10%, transparent); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.note.note-fix { cursor: pointer; transition: border-color .15s, background .15s; }
.note.note-fix:hover { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.note-fix-link { color: var(--accent); font-weight: 600; white-space: nowrap; }
.fix-table th.fix-col, .fix-table td.fix-col { background: color-mix(in srgb, var(--warn) 14%, transparent); }
.fix-table td { min-width: 140px; }
.fix-table input:not([type=checkbox]), .fix-table select { width: 100%; }
.note.err { background: color-mix(in srgb, var(--danger) 10%, transparent); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 100; overflow-y: auto; }
.modal { background: var(--panel); border-radius: 14px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal.wide { max-width: 900px; }
.modal.xwide { max-width: 1200px; }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); gap: 10px; }
.modal-head h2 { margin: 0; flex: 1; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* Toast */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: #0f172a; color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); max-width: 420px; animation: tin .2s; white-space: pre-line; }
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }
@keyframes tin { from { transform: translateY(10px); opacity: 0; } }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-col { width: 100%; max-width: 560px; display: flex; flex-direction: column; align-items: center; gap: 22px; }
.login { width: 100%; max-width: 380px; }

/* Фирменная надпись Hosmans: «Hosmans.», подзаголовок, слоган в плашке */
.hm-brand { text-align: center; color: var(--text); font-family: "Manrope", var(--font, system-ui), sans-serif; }
.hm-name { font-weight: 800; letter-spacing: -.02em; line-height: 1; color: var(--accent); }
.hm-dot { color: var(--accent); }
.hm-sub { text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-top: .5em; }
.hm-pill { display: inline-block; text-transform: uppercase; letter-spacing: .06em; color: var(--text); background: color-mix(in srgb, var(--muted) 18%, transparent); border-radius: 999px; padding: .45em 1.3em; margin-top: .8em; font-weight: 500; }
.hm-by { display: block; margin-top: .9em; font-size: .78em; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); text-decoration: none; }
.hm-by b { color: #c98b3c; font-weight: 800; }
.hm-by:hover b { text-decoration: underline; }
.hm-brand.sm .hm-by { font-size: .56em; margin-top: .6em; }
.hm-brand.lg .hm-name { font-size: 3.4em; }
.hm-brand.lg .hm-sub { font-size: 1.05em; }
.hm-brand.lg .hm-pill { font-size: .9em; }
.hm-hero { background: var(--panel); border: 1px solid var(--border); border-radius: 28px; padding: 30px 36px 26px; width: 100%; box-shadow: var(--shadow); }
.side-brand { padding: 6px 4px 10px; }
.hm-brand.sm .hm-name { font-size: 1.15em; }
.hm-brand.sm .hm-sub { font-size: .58em; letter-spacing: .05em; }
.hm-brand.sm .hm-pill { font-size: .58em; padding: .35em .9em; margin-top: .5em; }
@media (max-width: 520px) { .hm-brand.lg .hm-name { font-size: 2.5em; } .hm-brand.lg .hm-sub { font-size: .78em; } .hm-hero { padding: 22px 16px 18px; } }

/* Chessboard */
.chess-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.chess-toolbar input[type="date"] { width: auto; }
.chess { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); max-height: calc(100vh - 210px); user-select: none; }
.chess-inner { display: grid; position: relative; }
.chess .c-corner, .chess .c-name { position: sticky; left: 0; background: var(--panel); z-index: 3; border-right: 1px solid var(--border); }
.chess .c-corner { top: 0; z-index: 5; display: flex; align-items: flex-end; padding: 8px 12px; font-weight: 600; border-bottom: 1px solid var(--border); }
.chess .c-head { position: sticky; top: 0; z-index: 4; background: var(--panel); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; }
.chess .c-month { display: flex; height: 22px; border-bottom: 1px solid var(--border); }
.chess .c-month div { font-size: .78em; font-weight: 600; padding: 3px 6px; border-right: 1px solid var(--border); overflow: hidden; white-space: nowrap; color: var(--muted); }
.chess .c-days { display: flex; }
.chess .c-day { flex: none; text-align: center; font-size: .78em; padding: 3px 0; border-right: 1px solid var(--border); line-height: 1.2; }
.chess .c-day b { display: block; font-size: 1.15em; }
.chess .c-day.we { background: var(--weekend); color: var(--danger); }
.chess .c-day.td { background: var(--accent); color: #fff; }
.chess .c-name { height: var(--row-h); display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--border); white-space: nowrap; overflow: hidden; }
.chess .c-name .cap { margin-left: auto; color: var(--muted); font-size: .8em; }
/* Цвет объекта: мягкая заливка ячейки названия + насыщенная полоска слева */
.chess .c-name.tinted { background: color-mix(in srgb, var(--oc) 24%, var(--panel)); box-shadow: inset 4px 0 0 var(--oc); }
.chess .c-name.tinted .c-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.chess .c-name.tinted .cap { color: color-mix(in srgb, var(--oc) 45%, var(--text)); }
.chess .c-group { position: sticky; left: 0; background: var(--panel-2); font-weight: 600; font-size: .8em; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 4px 12px; border-bottom: 1px solid var(--border); z-index: 2; }
.chess .c-group-fill { background: var(--panel-2); border-bottom: 1px solid var(--border); }
.chess .c-row { position: relative; height: var(--row-h); display: flex; border-bottom: 1px solid var(--border); }
.chess .c-cell { flex: none; height: 100%; border-right: 1px solid var(--border); cursor: cell; }
.chess .c-cell.we { background: var(--weekend); }
.chess .c-cell.td { background: var(--today); }
.chess .c-cell.sel { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.chess .c-cell.ro { cursor: default; }
/* Цена ночи в свободной клетке (из «Актуальных цен») */
.chess .c-cell { display: flex; align-items: center; justify-content: center; }
.chess .c-price { font-size: .72em; color: var(--muted); pointer-events: none; user-select: none; letter-spacing: -.02em; }
.chess .bar { position: absolute; top: 4px; bottom: 4px; border-radius: 6px; color: #fff; font-size: .8em; padding: 0 8px; display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; cursor: pointer; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); z-index: 1; line-height: 1.15; }
.chess .bar:hover { filter: brightness(1.1); z-index: 2; }
.chess .bar .t2 { opacity: .85; font-size: .9em; }
.chess .bar .t2.debt { opacity: 1; background: rgba(0, 0, 0, .28); border-radius: 4px; padding: 1px 5px; font-weight: 600; }
/* Личный вид шахматки (Настройки → Интерфейс → Шахматка) */
.chess .bar { font-size: var(--bar-fs, .8em); }
.chess .bar b.thin { font-weight: 400; }
.chess.bar-square .bar { border-radius: 2px; }
.chess.bar-pill .bar { border-radius: 999px; padding: 0 12px; }
.chess.no-lines .c-cell, .chess.no-lines .c-day, .chess.no-lines .c-free div { border-right-color: transparent; }
.chess.stack .bar { flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px; padding: 3px 8px; line-height: 1.2; }
.chess.stack .bar > * { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chess.stack .bar .t2 { font-size: 1em; }
.chess.stack .bar .t2.debt { padding: 0 4px; }
/* Свои цвета текста (--cc-*), если не заданы — как в теме */
.chess .c-name, .chess .c-name.tinted .c-title { color: var(--cc-name, inherit); }
.chess .c-name .cap { color: var(--cc-cap, var(--muted)); }
.chess .c-name.tinted .cap { color: var(--cc-cap, color-mix(in srgb, var(--oc) 45%, var(--text))); }
.chess .c-group { color: var(--cc-group, var(--muted)); }
.chess .c-month div { color: var(--cc-month, var(--muted)); }
.chess .c-day, .chess .c-corner { color: var(--cc-day, inherit); }
.chess .c-day.we { color: var(--cc-we, var(--danger)); }
.chess .c-day.td { color: #fff; }
.chess .bar { color: var(--cc-bar, #fff); }
.chess .bar .t2.debt { color: var(--cc-debt, inherit); }
.chess .c-price { color: var(--cc-price, var(--muted)); }
/* Окно брони: сумма к оплате / оплата / долг */
.money-info { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; margin: 4px 0 12px; }
.money-info > div { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.money-info-val { font-size: 1.15em; font-weight: 700; margin-top: 2px; }
@media (max-width: 520px) { .money-info { grid-auto-flow: row; grid-template-columns: 1fr; } }
/* Окно брони: баня / чан / услуги и полный расчёт суммы */
.svc-row { border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; margin-bottom: 6px; }
.svc-line { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.svc-line > select { flex: 1 1 160px; min-width: 0; }
.svc-line > input[type=date] { flex: 0 1 150px; }
.svc-time { display: inline-flex; gap: 4px; align-items: center; }
.svc-price { margin-left: auto; white-space: nowrap; }
.svc-err { color: var(--danger); margin-top: 4px; }
.calc-box { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin: 4px 0 12px; font-size: .92em; }
.calc-line { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }
.calc-line.err { color: var(--danger); }
.calc-line.warn { color: var(--warn); }
.edge-row { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0 0 10px; }
.calc-line.total { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 6px; font-weight: 700; font-size: 1.05em; }
.chess .bar.conflict { outline: 2px solid var(--danger); outline-offset: 1px; background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, .18) 0 6px, transparent 6px 12px); }
.chess .bar.cut-l { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.chess .bar.cut-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.chess .c-free { display: flex; position: sticky; bottom: 0; background: var(--panel-2); border-top: 1px solid var(--border); z-index: 2; }
.chess .c-free div { flex: none; text-align: center; font-size: .78em; padding: 4px 0; border-right: 1px solid var(--border); font-weight: 600; }
.chess .c-free-name { position: sticky; left: 0; bottom: 0; background: var(--panel-2); z-index: 4; padding: 4px 12px; font-size: .8em; font-weight: 600; border-top: 1px solid var(--border); border-right: 1px solid var(--border); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: .86em; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.tip { position: fixed; z-index: 150; background: #0f172a; color: #fff; padding: 8px 12px; border-radius: 8px; font-size: .85em; pointer-events: none; max-width: 320px; white-space: pre-line; }

/* Finance grid */
.fin-layout { display: grid; grid-template-columns: 184px minmax(0, 1fr); gap: 12px; align-items: start; }
.fin-layout.collapsed { grid-template-columns: 26px minmax(0, 1fr); }
.fin-list { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px; position: sticky; top: 8px; max-height: calc(100vh - 110px); overflow: auto; font-size: .88em; }
.fin-list.collapsed { padding: 0; overflow: visible; }
.fin-list .fl-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 4px; font-size: .78em; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.fin-list .fl-head + a, .fin-list a + .fl-head { margin-top: 2px; }
.fin-list a + .fl-head { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 8px; }
.fin-list a { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 6px; text-decoration: none; color: var(--text); line-height: 1.3; }
.fin-list .fl-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fin-list .fl-meta { flex: none; font-size: .8em; color: var(--muted); font-variant-numeric: tabular-nums; }
.fin-list a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.fin-list a.active .fl-meta { color: var(--accent); }
.fin-list a:hover { background: var(--panel-2); }
.fin-list .fl-actions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.fin-list .fl-actions .btn { flex: 1; justify-content: center; padding: 3px 6px; font-size: .92em; }
.fl-toggle { border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer; border-radius: 6px; padding: 0 6px; font: inherit; font-size: 1.1em; line-height: 1.4; }
.fl-toggle:hover { border-color: var(--border); color: var(--text); background: var(--panel-2); }
.fin-list.collapsed .fl-toggle { width: 26px; height: 40px; border: 1px solid var(--border); background: var(--panel); }
/* Строка инструментов таблицы учёта */
.fin-toolbar { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; }
.fin-head { display: flex; align-items: center; gap: 6px; padding: 6px 8px; flex-wrap: wrap; }
.fin-title { margin: 0 6px 0 2px; font-size: 1.1em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
.fin-head .spacer { flex: 1; }
.fin-search { width: 190px; padding: 4px 8px; font-size: .9em; }
.fin-toolbar .fin-bar { border: 0; border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); margin: 0; padding: 4px 8px; font-size: .9em; background: transparent; }
.fin-toolbar .fin-bar select, .fin-toolbar .fin-bar input { padding: 3px 6px; font-size: .95em; }
.fin-info { margin-top: 6px; }
.pop-menu { position: fixed; z-index: 120; min-width: 200px; background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, .2); padding: 4px; display: flex; flex-direction: column; }
.pop-menu button { text-align: left; border: 0; background: none; color: inherit; font: inherit; padding: 7px 10px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.pop-menu button:hover { background: var(--panel-2); }
.pop-menu button.danger { color: var(--danger); }
/* Аналитика из Кассы */
/* ===== Аналитические отчёты ===== */
/* Цвета серий: слоты 1–3 проверенной палитры (дальтонизм — проверено скриптом для светлой и тёмной темы) */
:root { --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --chart-grid: #e6e2d8; --chart-axis: #c3c2b7; --good: #006300; --bad: #b5483a; }
:root[data-theme="dark"] { --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --chart-grid: #2c3444; --chart-axis: #4b5563; --good: #0ca30c; --bad: #e66767; }
.rp-title { min-width: 0; }
.rp-title h1 { margin: 2px 0 2px; font-size: 1.45em; letter-spacing: -.01em; }
.rp-kicker { font-size: .72em; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.rp-period { font-weight: 600; margin-bottom: 2px; }
.rp-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 10px; margin: 8px 0; }
.rp-kpi { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.rp-kpi-click { position: relative; cursor: pointer; }
.rp-kpi-click:hover { border-color: var(--accent, #888); }
.rp-kpi-info { position: absolute; top: 8px; right: 10px; color: var(--muted); font-size: .85em; }
.pnl-card-ed { margin-bottom: 10px; }
.pnl-card-secs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 6px 14px; }
.pnl-card-ed label { cursor: pointer; }
.rp-kpi-label { font-size: .8em; color: var(--muted); font-weight: 600; }
.rp-kpi-value { font-size: 1.55em; font-weight: 700; margin: 4px 0 2px; white-space: nowrap; }
.rp-kpi-value.neg { color: var(--bad); }
.rp-kpi-sub { font-size: .8em; color: var(--muted); }
.rp-delta { font-size: .8em; margin-top: 4px; color: var(--muted); }
.rp-delta.up { color: var(--good); }
.rp-delta.down { color: var(--bad); }
.rp-charts { margin-bottom: 0; }
.ch-svg svg { width: 100%; height: auto; display: block; }
.ch-svg rect:hover { opacity: .8; }
.ch-grid { stroke: var(--chart-grid); stroke-width: 1; }
.ch-axis { stroke: var(--chart-axis); stroke-width: 1; }
.ch-tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.ch-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .85em; color: var(--muted); margin-bottom: 4px; }
.ch-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ch-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.ch-table { margin-top: 6px; font-size: .85em; }
.ch-table summary { cursor: pointer; color: var(--muted); }
.ch-htable { width: 100%; }
.ch-htable td { white-space: nowrap; }
.ch-htable td.ch-hlabel { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.ch-htable td.ch-hbar { width: 40%; min-width: 80px; }
.ch-htrack { height: 10px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.ch-hfill { height: 100%; border-radius: 0 3px 3px 0; min-width: 2px; }
/* Справочник финансов — блоки рядом, как столбцы вкладки «Справочник» в Google Таблице */
.dict-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: 10px; margin-top: 8px; align-items: start; }
.dict-card { padding: 10px 12px; min-width: 0; }
.dict-card[data-key="articles"] { grid-column: 1 / -1; }
.dict-table input, .dict-table select { padding: 3px 6px; font-size: inherit; min-width: 110px; }
.dict-table td.dict-act { white-space: nowrap; width: 1%; }
.dict-table td.dict-act .btn { padding: 2px 7px; margin-left: 2px; }
.dict-add { display: flex; gap: 6px; margin-top: 8px; }
.dict-add input { padding: 4px 8px; }
/* Финансы → Настройки: источники данных, формулы встроенных отчётов, конструктор своих отчётов */
.fs-page { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.fs-page h3 { margin: 10px 0 4px; font-size: 1em; }
.fs-page td.dict-act { white-space: nowrap; width: 1%; }
.fs-page td.dict-act .btn { margin-left: 2px; }
.fs-doc { border-top: 1px solid var(--border); padding: 6px 0; }
.fs-doc > summary { cursor: pointer; padding: 4px 0; }
.fs-doc-body { padding: 4px 0 8px 18px; display: flex; flex-direction: column; gap: 8px; }
.fs-block-title { font-weight: 600; margin-bottom: 2px; }
code.fs-formula { font-family: ui-monospace, Consolas, monospace; font-size: .92em; background: var(--panel-2); padding: 1px 5px; border-radius: 4px; white-space: normal; }
.fin-list a.fl-new { color: var(--accent); font-size: .92em; }
.cr-editor { display: flex; flex-direction: column; gap: 10px; }
.cr-section { border-top: 1px solid var(--border); padding-top: 8px; }
.cr-filters { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; align-items: flex-start; }
.cr-filter { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.cr-filter select, .cr-filter input { width: auto; padding: 3px 6px; }
.cr-filter input { min-width: 220px; }
.cr-col { border: 1px solid var(--border); border-radius: 8px; padding: 8px; margin: 8px 0; background: var(--panel); }
.cr-col-head, .cr-col-body { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.cr-col-head select, .cr-col-body > select { width: auto; }
.cr-col-body { margin-top: 6px; align-items: flex-start; }
.cr-col-opts { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; font-size: .9em; }
.cr-letter { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; background: var(--accent); color: #fff; font-weight: 700; flex: none; }
.cr-eq { font-weight: 700; font-size: 1.2em; padding-top: 4px; }
.cr-formula { flex: 1; min-width: 220px; font-family: ui-monospace, Consolas, monospace; }
.cr-chips { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; position: sticky; bottom: -16px; background: var(--panel); padding: 6px 0; z-index: 1; }
.cr-chip { font-family: ui-monospace, Consolas, monospace; padding: 2px 8px; }
.cr-preview:empty { display: none; }
/* Модули CRM: «Управление отелем» / «Конструктор» */
.module-switch { display: flex; gap: 4px; padding: 6px 8px; margin: 4px 0; background: var(--panel-2); border-radius: 10px; }
.module-switch .ms-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 4px; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; font: inherit; font-size: .82em; font-weight: 600; white-space: nowrap; }
.module-switch .ms-btn .ic { width: 16px; height: 16px; }
.module-switch .ms-btn.active { background: var(--panel); color: var(--accent); border-color: var(--border); box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.app.collapsed .module-switch { flex-direction: column; padding: 4px; }
/* Больше двух модулей — по два в ряд */
.module-switch.many { flex-wrap: wrap; }
.module-switch.many .ms-btn { flex: 1 1 calc(50% - 4px); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.app.collapsed .module-switch.many { flex-wrap: nowrap; }
/* Конструктор: меню, свои страницы, расположение блоков */
.st-group-row td { background: var(--panel-2); }
tr.st-hidden td { opacity: .5; }
.st-ico .ic { width: 16px; height: 16px; vertical-align: -3px; }
.st-groups { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.st-groups input { width: auto; min-width: 160px; }
.st-icons { display: flex; flex-wrap: wrap; gap: 3px; }
.st-icons .btn { padding: 3px 5px; }
.st-links { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.st-perms > summary { cursor: pointer; padding: 4px 0; }
.st-perms .check { display: flex; font-size: .85em; }
.st-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 10px; }
.st-block { grid-column: 1 / -1; min-width: 0; }
.st-block.half { grid-column: auto; }
@media (max-width: 900px) { .st-block.half { grid-column: 1 / -1; } }
.st-block-title { margin-top: 0; }
.lay-bar { position: sticky; top: 0; z-index: 20; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 10px; border: 2px solid var(--accent); border-radius: 10px; background: var(--accent-soft, var(--panel)); }
.lay-block { position: relative; outline: 2px dashed var(--accent); outline-offset: 2px; margin-top: 30px !important; }
.lay-tools { position: absolute; top: -30px; right: 0; display: flex; gap: 3px; z-index: 5; }
.lay-tools .btn { padding: 1px 7px; background: var(--panel); }
.lay-btn { outline: 2px dashed var(--warn); outline-offset: 1px; }
.lay-off { opacity: .35; }
/* Код конструктора: редактор с подсветкой (прозрачный textarea поверх раскрашенного pre) и справка */
.sc-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 12px; align-items: start; }
@media (max-width: 1100px) { .sc-wrap { grid-template-columns: 1fr; } }
.sc-bar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 6px; }
.sc-ed { display: flex; height: calc(100vh - 260px); min-height: 420px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--panel); }
.sc-ed, .sc-ta, .sc-hl, .sc-gut { font: 13px/20px ui-monospace, Consolas, "Cascadia Mono", monospace; }
.sc-gut { flex: none; width: 46px; overflow: hidden; padding: 10px 0; text-align: right; color: var(--muted); background: var(--panel-2); border-right: 1px solid var(--border); user-select: none; }
.sc-gut div { padding-right: 8px; height: 20px; }
.sc-gut div.bad { background: color-mix(in srgb, var(--danger, #dc2626) 22%, transparent); color: var(--danger, #dc2626); font-weight: 700; }
.sc-area { position: relative; flex: 1; min-width: 0; }
.sc-ta, .sc-hl { position: absolute; inset: 0; margin: 0; padding: 10px 12px; border: 0; white-space: pre; overflow: auto; tab-size: 2; box-sizing: border-box; }
.sc-hl { pointer-events: none; color: var(--text); background: transparent; scrollbar-width: none; }
.sc-hl::-webkit-scrollbar { display: none; }
.sc-ed .sc-area textarea.sc-ta { padding: 10px 12px; margin: 0; border: 0; box-shadow: none; min-height: 0; font: 13px/20px ui-monospace, Consolas, "Cascadia Mono", monospace; }
.sc-ta { resize: none; background: transparent; color: transparent; caret-color: var(--text); outline: none; width: 100%; height: 100%; border-radius: 0; }
.sc-ta::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); color: transparent; }
.sc-cm { color: var(--muted); font-style: italic; }
.sc-hd { color: var(--accent); font-weight: 700; }
.sc-kw { color: #7c3aed; font-weight: 600; }
.sc-key { color: #0369a1; }
.sc-str { color: #15803d; }
.sc-ref { color: #b45309; }
.sc-tx { color: #92400e; }
[data-theme="dark"] .sc-kw { color: #c4b5fd; } [data-theme="dark"] .sc-key { color: #7dd3fc; } [data-theme="dark"] .sc-str { color: #86efac; } [data-theme="dark"] .sc-ref, [data-theme="dark"] .sc-tx { color: #fcd34d; }
.sc-out { margin-top: 8px; }
.sc-res { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--panel); }
.sc-res.ok { border-color: var(--ok, #16a34a); }
.sc-res.bad { border-color: var(--danger, #dc2626); }
.sc-res ul { margin: 6px 0 0; padding-left: 20px; }
.sc-err { display: flex; gap: 10px; padding: 5px 4px; border-bottom: 1px dashed var(--border); cursor: pointer; }
.sc-err:hover { background: var(--panel-2); }
.sc-ln { flex: none; min-width: 74px; font-weight: 700; color: var(--danger, #dc2626); }
.sc-help { position: sticky; top: 8px; max-height: calc(100vh - 120px); overflow: auto; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--panel); }
.sc-help h3 { margin: 0 0 6px; }
.sc-help-sec { border-top: 1px solid var(--border); padding: 6px 0; }
.sc-help-sec > summary { cursor: pointer; font-weight: 600; }
.sc-help-body p { margin: 6px 0; }
.sc-ex { margin: 6px 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.sc-ex pre { margin: 0; padding: 8px; font: 12px/17px ui-monospace, Consolas, monospace; white-space: pre-wrap; background: var(--panel-2); }
.sc-ex-foot { display: flex; gap: 6px; align-items: center; justify-content: space-between; padding: 4px 6px; }
.sc-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 8px; }
.sc-chip { border: 1px solid var(--border); background: var(--panel-2); color: var(--text); border-radius: 6px; padding: 1px 6px; font-size: .8em; cursor: pointer; }
.sc-chip:hover { border-color: var(--accent); }
/* ===== Чаты с гостями ===== */
.chat-layout { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 12px; height: calc(100vh - 190px); min-height: 420px; }
.chat-list { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-list-head { display: flex; gap: 6px; padding: 8px; border-bottom: 1px solid var(--border); }
.chat-list-head input { flex: 1; padding: 5px 8px; }
.chat-list-head select { width: auto; padding: 5px 6px; }
.chat-list-head input { min-width: 0; }
.chat-items { overflow: auto; flex: 1; }
.chat-item { display: flex; gap: 10px; padding: 9px 10px; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); }
.chat-item:hover { background: var(--panel-2); }
.chat-item.active { background: var(--accent-soft); }
.chat-item.unread .chat-name, .chat-item.unread .chat-last { font-weight: 700; color: var(--text); }
.chat-ava { width: 36px; height: 36px; border-radius: 50%; background: var(--panel-2); display: flex; align-items: center; justify-content: center; flex: none; font-size: 1.1em; }
.chat-meta { flex: 1; min-width: 0; }
.chat-row1, .chat-row2 { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.chat-name, .chat-last { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-last { color: var(--muted); font-size: .87em; }
.chat-badge, .nav-badge { background: var(--accent); color: #fff; border-radius: 10px; padding: 0 7px; font-size: .75em; font-weight: 700; line-height: 18px; flex: none; }
.nav-badge { margin-left: auto; }
.bottom-nav .nav-badge { position: absolute; top: 2px; right: 18%; margin: 0; }
.bottom-nav a { position: relative; }
.chat-thread { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; min-width: 0; }
.chat-empty { margin: auto; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.chat-back { display: none; }
.chat-msgs { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.chat-msg { max-width: 75%; align-self: flex-start; }
.chat-msg.out { align-self: flex-end; }
.chat-bubble { background: var(--panel); border: 1px solid var(--border); border-radius: 12px 12px 12px 4px; padding: 7px 11px; white-space: pre-wrap; word-wrap: break-word; }
.chat-msg.out .chat-bubble { background: var(--accent); color: #fff; border-color: var(--accent); border-radius: 12px 12px 4px 12px; }
.chat-msg.failed .chat-bubble { background: var(--panel); color: var(--text); border-color: var(--danger); }
.chat-info { font-size: .72em; color: var(--muted); margin-top: 2px; padding: 0 4px; }
.chat-msg.out .chat-info { text-align: right; }
.chat-err { color: var(--danger); }
.chat-compose { display: flex; gap: 8px; padding: 8px; border-top: 1px solid var(--border); align-items: flex-end; }
.chat-compose textarea { flex: 1; resize: vertical; min-height: 42px; max-height: 200px; }
/* Лицензия */
.install-code { font-size: 1.25em; letter-spacing: .08em; padding: 6px 10px; background: var(--panel-2); border-radius: 8px; user-select: all; }
.card.activation { max-width: 460px; }
/* Безопасность */
.sec-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.qr-box { display: flex; justify-content: center; padding: 8px; background: #fff; border-radius: 8px; width: fit-content; margin: 0 auto; }
.recovery-codes { font-size: 1.15em; letter-spacing: .08em; background: var(--panel-2); padding: 12px 16px; border-radius: 8px; columns: 2; }
/* ИИ-помощник в чатах */
.chat-human { font-size: .9em; flex: none; }
.chat-msg.by-ai .chat-bubble { background: color-mix(in srgb, var(--accent) 82%, #6250d6); }
.chat-teach { border: 0; background: none; color: var(--accent); cursor: pointer; font: inherit; padding: 0 0 0 6px; }
.chat-teach:hover { text-decoration: underline; }
.chat-draft { margin: 0 8px; padding: 8px 10px; border: 1px dashed var(--accent); border-radius: 10px; background: var(--accent-soft); }
.chat-draft-text { white-space: pre-wrap; margin-top: 4px; }
.chat-note { margin: 6px 8px 0; }
.btn.ai-on { border-color: var(--accent); color: var(--accent); }
.ai-test-msgs { height: 320px; border: 1px solid var(--border); border-radius: 10px; }
.ai-knowledge { white-space: pre-wrap; max-height: 420px; overflow: auto; background: var(--panel-2); padding: 10px; border-radius: 8px; }
/* Обучение в диалоге: наставник слева, администратор справа; предложения правок — карточки под ответом */
.ai-train-msgs { height: 460px; border: 1px solid var(--border); border-radius: 10px; }
.ai-train-msgs .chat-msg.in { max-width: 92%; }
.ai-prop { margin-top: 6px; padding: 8px 10px; border: 1px solid var(--accent); border-radius: 10px; background: var(--panel); display: flex; flex-direction: column; gap: 4px; }
.ai-prop.done { border-color: var(--border); opacity: .8; }
.ai-prop textarea { width: 100%; }
.ai-trace { margin-top: 6px; font-size: .85em; }
.ai-trace pre { white-space: pre-wrap; margin: 4px 0 0; background: var(--panel-2); padding: 6px 8px; border-radius: 6px; }
.ai-hints { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.ai-handoff { padding: 8px 0; border-bottom: 1px solid var(--border); }
.ai-handoff:last-child { border-bottom: 0; }
@media (max-width: 760px) {
  .ai-train-msgs { height: 60vh; }
  .chat-layout { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 210px); }
  .chat-layout.has-chat .chat-list { display: none; }
  .chat-layout:not(.has-chat) .chat-thread { display: none; }
  .chat-back { display: inline-flex; }
  .chat-msg { max-width: 88%; }
}
/* Периоды блоков — в шапке отчёта */
.lk-periods { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.lk-periods .lk-period { margin: 0; }
.lk-period-name { display: inline-block; width: 300px; max-width: 40vw; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lk-card-period { margin-left: 8px; font-size: .78em; font-weight: 400; color: var(--muted); white-space: nowrap; }
.lk-card-period-edit { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; white-space: normal; }
.lk-card-period-edit select, .lk-card-period-edit input { width: auto; padding: 3px 6px; font-size: 1em; }
table.linked td.paid-cell { text-align: center; white-space: nowrap; }
table.linked td.paid-cell input { width: auto; margin: 0; vertical-align: middle; }
.rp-section { font-size: 1.05em; margin: 18px 0 4px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
@media (max-width: 760px) { .lk-period-name { width: 100%; max-width: none; } }
.update-bar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 200; background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.2); padding: 8px 12px; display: flex; gap: 10px; align-items: center; }
/* Режим презентации: полоса над рабочей областью и выбор демо-сотрудника */
.demo-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 24px; background: color-mix(in srgb, var(--warn) 18%, var(--panel)); border-bottom: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); font-size: .9em; }
.demo-bar .spacer { flex: 1; }
.demo-users { display: grid; gap: 8px; margin-top: 10px; }
.btn.demo-user { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 10px 14px; text-align: left; }
@media (max-width: 600px) { .demo-bar { padding: 6px 12px; } }
/* Отчёт о прибылях и убытках — как финансовая отчётность */
.rp-statement table.linked { font-size: .9em; }
.rp-statement table.linked th { text-transform: none; }
table.linked tr.lk-head td { font-weight: 700; font-size: 1.02em; background: var(--panel-2); border-top: 2px solid var(--text); }
table.linked tr.lk-subtotal td { font-weight: 700; border-top: 1px solid var(--text); background: var(--panel-2); }
table.linked tr.lk-grand td { font-weight: 800; border-top: 1px solid var(--text); border-bottom: 3px double var(--text); background: var(--accent-soft); }
.rp-statement table.linked tr.lk-total td { border-top: 1px solid var(--text); border-bottom: 1px solid var(--text); }
.rp-statement table.linked tr.lk-item td { color: var(--muted); }
.rp-statement table.linked tr.lk-item td:first-child { color: var(--text); }
table.linked td.delta { font-size: .9em; }
table.linked td.delta.up { color: var(--good); }
table.linked td.delta.down { color: var(--bad); }
table.linked td.pct-bar { background-image: linear-gradient(to left, color-mix(in srgb, var(--series-1) 18%, transparent) var(--w), transparent var(--w)); }
@media print {
  .sidebar, .topbar, .fin-list, .tabs, .no-print, .fin-toolbar .btn, .bottom-nav, .lk-period select { display: none !important; }
  .fin-layout, .fin-layout.collapsed { display: block !important; }
  body, .main, .content { background: #fff !important; }
  .card, .rp-kpi, .fin-toolbar { box-shadow: none !important; break-inside: avoid; }
  .linked-grid { display: block; }
  .linked-grid .card { margin-bottom: 10px; }
  .sheet { max-height: none !important; height: auto !important; overflow: visible !important; }
  .pop-menu, .page-head .btn, .page-head select { display: none !important; }
  body.no-print-perm > * { display: none !important; }
  body.no-print-perm::before { content: attr(data-no-print); display: block; padding: 40px; font-size: 18px; }
}
.lk-period { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin: -4px 0 8px; font-size: .85em; }
.lk-period select, .lk-period input { width: auto; padding: 2px 5px; font-size: inherit; }
.fin-list .fl-archive { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 4px; }
.fin-list .fl-archive summary { cursor: pointer; list-style: none; }
.fin-list .fl-archive summary::before { content: '▸ '; }
.fin-list .fl-archive[open] summary::before { content: '▾ '; }
.fin-list .fl-archive a { opacity: .75; }
.linked-inputs { margin-top: 8px; padding: 10px 12px; }
.linked-inputs summary { cursor: pointer; margin-bottom: 8px; }
/* Табель учёта рабочего времени: Р — светло-серый, Б — светло-красный, О — светло-голубой */
.ts-table { width: auto; }
.ts-table th.ts-day, .ts-table td.ts-cell { width: 26px; min-width: 26px; padding: 3px 0; text-align: center; }
.ts-table th.ts-day { font-weight: 600; line-height: 1.1; }
.ts-table .ts-wd { font-size: .7em; font-weight: 400; color: var(--muted); }
.ts-table th.ts-we { color: var(--danger); }
.ts-table td.ts-cell { cursor: pointer; user-select: none; font-weight: 700; border-left: 1px solid var(--border); }
.ts-table td.ts-cell.ts-we:not(.ts-w):not(.ts-v):not(.ts-s) { background: rgba(127, 127, 127, .06); }
.ts-table td.ts-cell:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.ts-table .ts-sum { text-align: center; font-weight: 600; min-width: 28px; }
.ts-w { background: #e5e7eb; color: #374151; }
.ts-v { background: #dbeafe; color: #1e40af; }
.ts-s { background: #fee2e2; color: #b91c1c; }
.btn.ts-brush.active { outline: 2px solid var(--accent); outline-offset: 1px; font-weight: 700; }
.linked-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: 10px; margin-top: 8px; }
.linked-grid .card { margin: 0; min-width: 0; }
.linked-grid .card.wide { grid-column: 1 / -1; }
.linked-grid h3 { margin: 0 0 10px; }
.linked-grid .card { padding: 10px 12px; }
.linked-grid h3 { font-size: 1em; }
table.linked { font-size: .87em; }
table.linked th, table.linked td { padding: 4px 8px; }
table.linked input, table.linked select { padding: 3px 6px; font-size: inherit; min-width: 120px; }
table.linked th.num, table.linked td.num { text-align: right; white-space: nowrap; }
table.linked td.neg { color: var(--danger); }
table.linked tr.lk-total td { font-weight: 700; background: var(--panel-2); }
table.linked tr.lk-group td { font-weight: 600; background: var(--accent-soft); }
table.linked tr.lk-item td:first-child { padding-left: 26px; }
.sheet { overflow: auto; max-height: calc(100vh - 250px); border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
table.sh { border-collapse: separate; border-spacing: 0; min-width: 100%; }
table.sh { font-size: .87em; }
table.sh th, table.sh td { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 0; height: 26px; }
table.sh th { background: var(--panel-2); position: sticky; top: 0; z-index: 2; font-size: .92em; text-align: left; padding: 4px 6px; cursor: pointer; white-space: nowrap; }
table.sh td .cell { padding: 3px 7px; min-height: 25px; max-width: 360px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: text; line-height: 19px; }
/* Ячейки со справочником — видно, что это выпадающий список */
table.sh td.dict .cell { position: relative; padding-right: 18px; cursor: pointer; }
table.sh td.dict .cell::after { content: '▾'; position: absolute; right: 5px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .85em; }
table.sh td.dict:hover .cell::after { color: var(--accent); }
/* Группы строк (по месяцу и т.п.) */
table.sh tr.grp td { background: var(--panel-2) !important; cursor: pointer; font-weight: 600; border-bottom: 1px solid var(--border); }
table.sh tr.grp td .cell { overflow: visible; cursor: pointer; }
table.sh tr.grp td.rn { color: var(--accent); font-size: 1em; }
/* «Год → Месяц»: год — главная группа, месяц — с отступом внутри года */
table.sh tr.grp-year td { background: color-mix(in srgb, var(--accent) 12%, var(--panel-2)) !important; font-weight: 700; }
table.sh tr.grp-month td .grp-label { padding-left: 22px; }
table.sh tr.grp-month td { font-weight: 600; }
table.sh tr.grp:hover td { background: var(--accent-soft) !important; }
table.sh td.off-dict .cell { color: var(--warn); text-decoration: underline wavy color-mix(in srgb, var(--warn) 60%, transparent); text-underline-offset: 3px; }
table.sh td select { width: 100%; min-width: 140px; }
table.sh tbody tr:nth-child(even) td:not(.rn) { background: color-mix(in srgb, var(--panel-2) 45%, var(--panel)); }
table.sh td.num .cell { text-align: right; font-variant-numeric: tabular-nums; }
/* Касса: расход без минуса — выделен цветом, приход — обычным */
table.sh td.amt-out .cell { color: var(--danger); }
table.sh td.formula .cell { background: color-mix(in srgb, var(--accent) 5%, transparent); cursor: default; }
table.sh td input, table.sh td select { border-radius: 0; border: 2px solid var(--accent); height: 26px; padding: 2px 5px; font-size: inherit; }
table.sh td.rn .check { font-size: .95em; }
table.sh td.rn, table.sh th.rn { width: 44px; text-align: center; color: var(--muted); font-size: .8em; position: sticky; left: 0; background: var(--panel-2); z-index: 1; }
table.sh th.rn { z-index: 3; }
table.sh td.rn:has(.rn-in), table.sh thead th.rn { width: 62px; min-width: 62px; }
table.sh td.rn .rn-in { display: flex; align-items: center; justify-content: center; gap: 2px; white-space: nowrap; }
table.sh td.rn .row-menu { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 3px; font-size: 1.15em; line-height: 1; border-radius: 4px; opacity: .55; }
table.sh tr:hover td.rn .row-menu, table.sh td.rn .row-menu:focus-visible { opacity: 1; }
table.sh td.rn .row-menu:hover { background: var(--accent-soft); color: var(--text); }
@media (hover: none) { table.sh td.rn .row-menu { opacity: 1; } }
table.sh tfoot td { position: sticky; bottom: 0; background: var(--panel-2); font-weight: 700; padding: 3px 7px; text-align: right; z-index: 2; }
/* Строка ввода новой записи — внизу, над итогами (как пустая строка в Excel) */
table.sh tfoot tr.entry td { padding: 0; font-weight: 400; text-align: left; background: var(--panel); border-top: 2px solid var(--accent); }
table.sh tfoot tr.entry td.rn { background: var(--accent-soft); z-index: 3; padding: 2px; }
table.sh tfoot tr.entry td.rn .btn { padding: 1px 9px; min-height: 0; line-height: 20px; }
table.sh tfoot tr.entry td.formula { background: var(--panel-2); }
table.sh tfoot tr.entry input, table.sh tfoot tr.entry select { width: 100%; min-width: 0; border: 1px solid transparent; background: transparent; height: 28px; border-radius: 0; padding: 2px 6px; font-size: inherit; }
table.sh tfoot tr.entry input:focus, table.sh tfoot tr.entry select:focus { border: 2px solid var(--accent); background: var(--panel); outline: none; }
table.sh tfoot tr.entry td.num input { text-align: right; }
table.sh tfoot tr.entry input[type=checkbox] { width: auto; height: auto; margin: 6px; }
table.sh tbody tr.flash td { animation: row-flash 2s ease-out; }
@keyframes row-flash { from { background: color-mix(in srgb, var(--ok, #16a34a) 30%, var(--panel)); } }
table.sh tr.auto td.rn { color: var(--accent); }
table.sh tr.selrow td { background: var(--accent-soft); }

/* Таблицы учёта: панель периода, фильтры столбцов, закрепление */
.fin-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 10px; }
.fin-bar input[type="date"] { width: auto; }
.sheet { max-height: calc(100vh - 200px); }
.th-in { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.th-filter { border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer; border-radius: 6px; padding: 0 4px; font: inherit; line-height: 1.4; }
.th-filter:hover { border-color: var(--border); color: var(--text); }
.th-filter.on { color: #fff; background: var(--accent); }
.col-filter { position: fixed; z-index: 120; width: 280px; background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .2); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.cf-list { max-height: 220px; overflow: auto; display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.cf-list .check { font-size: .9em; }
.sheet.freeze table.sh td:nth-child(2), .sheet.freeze table.sh th:nth-child(2) { position: sticky; left: 44px; z-index: 1; background: var(--panel); box-shadow: 2px 0 0 var(--border); }
.sheet.freeze table.sh th:nth-child(2) { z-index: 3; background: var(--panel-2); }
.sheet.freeze table.sh tfoot td:nth-child(2) { z-index: 3; background: var(--panel-2); }
table.sh tbody tr:hover td { background: color-mix(in srgb, var(--accent) 5%, var(--panel)); }

/* Permissions matrix */
.matrix th.rot { writing-mode: vertical-rl; transform: rotate(180deg); text-align: left; white-space: nowrap; padding: 10px 6px; min-width: 40px; }
.matrix td.c { text-align: center; }
.matrix tr.grp td { background: var(--panel-2); font-weight: 700; }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 10px; }
.bars .b { flex: 1; background: var(--accent); border-radius: 4px 4px 0 0; position: relative; min-height: 2px; }
.bars .b span { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: .7em; color: var(--muted); white-space: nowrap; }
.bars-x { display: flex; gap: 6px; font-size: .75em; color: var(--muted); }
.bars-x div { flex: 1; text-align: center; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--border); background: var(--panel-2); padding: 3px 8px; border-radius: 6px; cursor: pointer; font-size: .82em; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip-x { border: 0; background: none; color: inherit; cursor: pointer; font: inherit; padding: 0 0 0 4px; }
.task-people { max-height: 200px; margin-top: 6px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; }
.swatch.active { border-color: var(--text); }
.copy { display: flex; gap: 6px; }
.copy input { font-family: ui-monospace, Consolas, monospace; font-size: .85em; }

/* Вид списков: список и плитка */
.view-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.view-switch .btn { border: none; border-radius: 0; }
.list-view { display: flex; flex-direction: column; gap: 8px; }
.lv-row { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 10px 14px; }
.lv-row.click { cursor: pointer; }
.lv-row.click:hover { border-color: var(--accent); }
.lv-icon, .cv-icon { font-size: 1.4em; flex: none; }
.lv-main { flex: 1; min-width: 0; }
.lv-title { font-weight: 600; }
.lv-sub { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .88em; margin-top: 2px; }
.lv-badge { flex: none; }
.lv-foot { margin-top: 10px; padding: 10px 14px; background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); font-weight: 600; }
.card-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.cv-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.cv-card.click { cursor: pointer; }
.cv-card.click:hover { border-color: var(--accent); transform: translateY(-1px); }
.cv-strip { height: 5px; }
.cv-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 6px; }
.cv-title { font-weight: 700; flex: 1; min-width: 0; }
.cv-fields { padding: 0 14px 12px; display: grid; gap: 4px; }
.cv-field { display: flex; justify-content: space-between; gap: 10px; font-size: .9em; }
.cv-field > span:last-child { text-align: right; }
.prio-high { color: var(--danger); font-weight: 700; }

/* Индикатор живой синхронизации */
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; opacity: .6; }
.refresh-btn .refresh-ico { display: inline-block; }
.refresh-btn.spinning .refresh-ico { animation: refresh-spin .8s linear infinite; }
@keyframes refresh-spin { to { transform: rotate(360deg); } }
.live-dot.on { background: var(--ok); opacity: 1; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }

/* Нижнее меню и фон под выезжающим меню — только на телефоне */
.bottom-nav, .mobile-backdrop { display: none; }

@media (max-width: 900px) {
  .vs-label, .role-label { display: none; }
  .topbar { gap: 6px; }
  .topbar h1 { font-size: 1.15em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; background: var(--panel); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -2px 12px rgba(0, 0, 0, .08); }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: .72em; padding: 4px 0; border-radius: 8px; }
  .bottom-nav a.active { color: var(--accent); font-weight: 600; background: var(--accent-soft); }
  .bn-ico { font-size: 1.5em; line-height: 1; display: inline-flex; }
  .bn-ico .ic svg { width: 24px; height: 24px; stroke-width: 1.6; }
  .bottom-nav a.active .ic .d { fill-opacity: .3; }
  .app.mobile-open .sidebar { z-index: 70; }
  .app.mobile-open .mobile-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 45; }
  .modal-bg { padding: 0; align-items: stretch; }
  .modal, .modal.wide, .modal.xwide { max-width: none; border-radius: 0; min-height: 100%; }
  .modal-foot { position: sticky; bottom: 0; background: var(--panel); }
  .btn { min-height: 38px; }
  .page-head { gap: 8px; }
  .chess { max-height: calc(100vh - 230px); }
  .toasts { bottom: calc(var(--bn-h, calc(80px + env(safe-area-inset-bottom))) + 8px); left: 12px; right: 12px; }
  .sidebar { position: fixed; z-index: 50; left: 0; transform: translateX(-100%); transition: transform .2s; }
  .app.mobile-open .sidebar { transform: none; }
  /* Низ страницы не прячется под нижним меню (с запасом на «Кнопки в рамках» и полоску iPhone) */
  .content { padding: 16px 16px calc(var(--bn-h, calc(80px + env(safe-area-inset-bottom))) + 24px); }
  .topbar { padding: calc(10px + env(safe-area-inset-top)) 16px 10px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .fin-layout, .fin-layout.collapsed { grid-template-columns: minmax(0, 1fr); }
  .fin-list { position: static; max-height: 260px; }
  .fin-list.collapsed .fl-toggle { width: 100%; height: 30px; }
  .fin-search { width: 100%; order: 10; }
  /* Широкие таблицы (класс .stack ставит app.js): каждая строка — карточка, подписи колонок слева */
  .table-wrap:has(> table.stack) { border: 0; background: none; overflow: visible; }
  table.t.stack, table.t.stack tbody, table.t.stack tfoot, table.t.stack tr, table.t.stack td { display: block; width: 100%; }
  table.t.stack thead { display: none; }
  table.t.stack tr { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 8px; }
  table.t.stack tr.click:active { border-color: var(--accent); }
  table.t.stack td { border: 0 !important; padding: 3px 0; display: flex; gap: 10px; justify-content: space-between; align-items: baseline; text-align: right; min-width: 0; white-space: normal; overflow-wrap: anywhere; background: none; }
  table.t.stack td::before { content: attr(data-label); color: var(--muted); font-size: .86em; text-align: left; flex: 0 0 40%; }
  table.t.stack td:not([data-label])::before, table.t.stack td[data-label=""]::before { display: none; }
  table.t.stack td:not([data-label]), table.t.stack td[data-label=""] { justify-content: flex-start; text-align: left; }
  table.t.stack td:empty { display: none; }
  /* Первая колонка — заголовок карточки */
  table.t.stack tbody td:first-child { font-weight: 600; font-size: 1.03em; justify-content: flex-start; text-align: left; padding-bottom: 6px; }
  table.t.stack tbody td:first-child::before { display: none; }
  table.t.stack td input, table.t.stack td select { min-width: 0; max-width: 60%; }
  .scroll-box > :has(> table.stack) { max-height: none; }
  /* Длинные кнопки и примеры кода переносятся, а не вылезают за экран */
  .content .btn { max-width: 100%; white-space: normal; text-align: left; }
  .content pre { white-space: pre-wrap; overflow-wrap: anywhere; }
}

/* ---------- Сотрудники и отделы ---------- */
.dept-list { display: flex; flex-direction: column; gap: 10px; }
.dept-group { padding: 10px 14px; }
.dept-head { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.dept-caret { width: 12px; color: var(--muted); }
.dept-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dept-table { margin-top: 8px; }
.dept-table td { padding: 6px 8px; }
.dept-table tr.clickable { cursor: pointer; }
.dept-table tr.clickable:hover td { background: var(--accent-soft); }
.dept-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.dept-btn { --dc: var(--accent); border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 999px; padding: 4px 12px; cursor: pointer; font: inherit; font-size: 13px; }
.dept-btn:hover { border-color: var(--dc); }
.dept-btn.on { border-color: var(--dc); background: color-mix(in srgb, var(--dc) 14%, transparent); font-weight: 600; }
.chip.dept { background: var(--accent-soft); }

/* ---------- Типы задач, чек-листы, объявления ---------- */
.type-switch { display: flex; gap: 4px; padding: 3px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px; }
.type-switch button { flex: 1; border: 0; background: transparent; color: var(--text); padding: 8px 10px; border-radius: 8px; cursor: pointer; font: inherit; }
.type-switch button.on { background: var(--panel); box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 600; color: var(--accent); }
.cl-edit { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.cl-edit-row { display: flex; align-items: center; gap: 4px; width: 100%; }
.cl-edit-row input { flex: 1; }
.cl-num { width: 22px; text-align: right; }
.cl-items { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.cl-item { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); }
.cl-item.done > span:first-of-type { text-decoration: line-through; color: var(--muted); }
.mini-bar { display: inline-block; width: 60px; height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; vertical-align: middle; }
.mini-bar i { display: block; height: 100%; background: var(--ok); border-radius: 3px; }
.mini-bar.wide { width: 100%; margin-top: 4px; }
.progress-cell { white-space: nowrap; }
.ack-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ack { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); font-size: 13px; }
.ack.yes { border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: color-mix(in srgb, var(--ok) 8%, transparent); }
.tpl-row { display: flex; align-items: center; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--border); }
@media (max-width: 700px) {
  .dept-table, .dept-table tbody { display: block; }
  .dept-table tr { display: flex; flex-wrap: wrap; gap: 2px 10px; padding: 6px 4px; border-bottom: 1px solid var(--border); }
  .card .dept-table.t td { padding: 0; border: 0; background: none; }
  .dept-table td:empty { display: none; }
  .dept-table td:first-child { width: 100%; }
  .dept-head { flex-wrap: wrap; }
}

/* Длинные списки (Клиенты): своё окно с прокруткой и закреплённой шапкой */
.scroll-box > * { max-height: 62vh; overflow: auto; }

/* Актуальные цены: цены по дням и анализ месяц к месяцу */
table.t.pd { width: auto; font-size: .82em; }
table.t.pd th, table.t.pd td { padding: 4px 5px; }
table.t.pd .pd-obj { position: sticky; left: 0; z-index: 2; background: var(--panel); min-width: 110px; white-space: nowrap; }
table.t.pd thead .pd-obj { z-index: 3; background: var(--panel-2); }
table.t.pd .pd-d { text-align: center; min-width: 44px; font-weight: 400; }
table.t.pd .pd-d div { font-size: .85em; }
table.t.pd .pd-c { text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.t.pd .we { background: var(--weekend); }
table.t.pd .td { box-shadow: inset 0 0 0 2px var(--accent); }
table.t.pd .pd-c.booked { background: color-mix(in srgb, var(--ok) 22%, transparent); font-weight: 600; }
table.t.pd .pd-c.past { opacity: .7; }
table.t.pd sup { color: var(--warn); font-weight: 700; margin-left: 1px; }
.pd-key { display: inline-block; width: 12px; height: 12px; border: 1px solid var(--border); border-radius: 3px; vertical-align: -2px; }
.pd-key.booked { background: color-mix(in srgb, var(--ok) 22%, transparent); }
table.t .pd-total td { background: var(--panel-2); font-weight: 600; }
table.t.pa th.pd-grp { text-align: center; border-left: 1px solid var(--border); }
table.t.pa td, table.t.pa th { white-space: nowrap; }
table.t.pa td:last-child { white-space: normal; min-width: 220px; }
table.t.pa tr.pa-cur td { background: var(--today); }

/* Окно-таблица цен и чек-лист согласования */
table.t.bp th, table.t.bp td { padding: 4px 5px; }
table.t.bp td:first-child { white-space: nowrap; }
table.t.bp input, table.t.bp select { min-width: 0; width: 100%; padding: 5px 7px; }
table.t.bp .c-price, table.t.bp .c-priceWeekend { min-width: 96px; }
table.t.bp .c-unit { min-width: 92px; }
table.t.bp .c-minQty, table.t.bp .c-discount, table.t.bp .c-discountMinNights { width: 70px; min-width: 64px; }
table.t.bp .c-discountType { min-width: 62px; }
table.t.bp .c-discountNote, table.t.bp .c-note { min-width: 130px; }
table.t.bp .c-date { min-width: 130px; }
table.t .pa-group td { background: var(--panel-2); font-weight: 700; color: var(--muted); font-size: .86em; text-transform: uppercase; letter-spacing: .03em; }
table.t.pa-list td { padding: 6px 8px; }
table.t.pa-list input[type=checkbox] { width: 18px; height: 18px; cursor: pointer; }
table.t.pd .pd-c.nop { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); font-weight: 600; }
table.t.pd .pd-pick { cursor: pointer; }
table.t.pd td.pd-pick:hover { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ================= Деловой компактный вид (Настройки → Мой интерфейс → «Вид интерфейса») =================
 * Плотнее и строже: меньше отступов и скруглений, без теней, таблицы с сеткой и полосами,
 * служебные сообщения — тонкой строкой с цветной кромкой, панели фильтров — как шапка таблицы. */
:root[data-skin="table"] { --radius: 3px; --pad: 10px; --row-h: 30px; --shadow: none; }
:root[data-skin="table"] body { line-height: 1.35; }
:root[data-skin="table"] h1 { font-size: 1.15em; white-space: nowrap; }
:root[data-skin="table"] h2 { font-size: .98em; margin: 0 0 6px; padding-bottom: 4px; border-bottom: 2px solid var(--accent); text-transform: none; }
:root[data-skin="table"] h3 { font-size: .92em; margin: 0 0 6px; }
:root[data-skin="table"] .content { padding: 12px 16px; }
:root[data-skin="table"] .topbar { padding: 6px 16px; gap: 8px; }
:root[data-skin="table"] .topbar .btn, :root[data-skin="table"] .topbar select, :root[data-skin="table"] .topbar input { padding: 3px 8px; }

/* Меню слева — плотный список */
:root[data-skin="table"] .sidebar { width: 216px; }
:root[data-skin="table"] .app.collapsed .sidebar { width: 56px; }
:root[data-skin="table"] .brand { padding: 10px 12px; }
:root[data-skin="table"] .nav { padding: 4px 6px; }
:root[data-skin="table"] .nav-group { margin: 8px 8px 2px; font-size: .68em; }
:root[data-skin="table"] .nav a { padding: 4px 8px; gap: 8px; border-radius: 3px; font-size: .93em; }
:root[data-skin="table"][data-boxed="1"] .nav a { margin-bottom: 2px; }
:root[data-skin="table"] .side-foot { padding: 6px; }

/* Панели, карточки, вкладки */
:root[data-skin="table"] .card { border-radius: 3px; box-shadow: none; padding: 10px; }
:root[data-skin="table"] .cards, :root[data-skin="table"] .card-view { gap: 8px; }
:root[data-skin="table"] .grid { gap: 8px; }
:root[data-skin="table"] .row { gap: 6px; }
:root[data-skin="table"] .page-head { margin-bottom: 8px; gap: 6px; padding: 6px 8px; background: var(--panel); border: 1px solid var(--border); border-radius: 3px; }
:root[data-skin="table"] .tabs { margin-bottom: 8px; gap: 0; }
:root[data-skin="table"] .tabs button { padding: 6px 12px; }
:root[data-skin="table"][data-boxed="1"] .tabs button { border-radius: 3px; padding: 5px 10px; }

/* Служебные сообщения — тонкая строка с цветной кромкой слева */
:root[data-skin="table"] .note { padding: 5px 10px; margin-bottom: 6px; border-radius: 2px; font-size: .88em; background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--accent); }
:root[data-skin="table"] .note.warn { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn) 6%, var(--panel)); }
:root[data-skin="table"] .note.err { border-left-color: var(--danger); background: color-mix(in srgb, var(--danger) 6%, var(--panel)); }
:root[data-skin="table"] .note .muted.small, :root[data-skin="table"] .note .small { font-size: .95em; }

/* Кнопки, поля, значки */
:root[data-skin="table"] .btn { padding: 4px 10px; border-radius: 3px; gap: 5px; }
:root[data-skin="table"] .btn.sm { padding: 2px 7px; }
:root[data-skin="table"] input, :root[data-skin="table"] select, :root[data-skin="table"] textarea { padding: 4px 8px; border-radius: 3px; }
:root[data-skin="table"] input[type="color"] { height: 30px; }
:root[data-skin="table"] textarea { min-height: 64px; }
:root[data-skin="table"] label.field { margin-bottom: 8px; }
:root[data-skin="table"] label.field > span { margin-bottom: 2px; font-size: .82em; }
:root[data-skin="table"] .badge { border-radius: 3px; padding: 1px 6px; font-size: .78em; }

/* Таблицы — с сеткой, полосами и шапкой как в учётной программе */
:root[data-skin="table"] .table-wrap { border: 1px solid var(--border); border-radius: 3px; background: var(--panel); }
:root[data-skin="table"] table.t { border-collapse: collapse; }
:root[data-skin="table"] table.t th, :root[data-skin="table"] table.t td { padding: 4px 8px; border: 1px solid var(--border); }
:root[data-skin="table"] table.t th { font-size: .78em; text-transform: uppercase; letter-spacing: .02em; padding-top: 5px; padding-bottom: 5px; }
:root[data-skin="table"] table.t tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--panel-2) 45%, transparent); }
:root[data-skin="table"] table.t tbody tr:hover td { background: var(--accent-soft); }
:root[data-skin="table"] table.t .btn.sm { padding: 1px 6px; }
:root[data-skin="table"] table.t.pd th, :root[data-skin="table"] table.t.pd td { padding: 3px 4px; }
:root[data-skin="table"] table.t.bp th, :root[data-skin="table"] table.t.bp td { padding: 3px 4px; }

/* Окна */
:root[data-skin="table"] .modal { border-radius: 6px; }
:root[data-skin="table"] .modal-head { padding: 10px 14px; }
:root[data-skin="table"] .modal-body { padding: 12px 14px; }
:root[data-skin="table"] .modal-foot { padding: 8px 14px; gap: 6px; }
:root[data-skin="table"] .modal-bg { padding: 24px 12px; }

/* ---------- Путеводитель ---------- */
.guide-toc { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.guide-toc a { padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; color: var(--text); font-size: .92em; }
.guide-toc a:hover { border-color: var(--accent); color: var(--accent); }
.guide-h { margin: 22px 0 10px; }
h3.guide-h { color: var(--muted); font-size: 1em; text-transform: uppercase; letter-spacing: .04em; }
.guide-item { margin-bottom: 10px; scroll-margin-top: 70px; }
.guide-item > summary { cursor: pointer; display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; list-style: none; position: relative; padding-right: 24px; }
.guide-item > summary::-webkit-details-marker { display: none; }
.guide-item > summary::after { content: '▾'; position: absolute; right: 0; top: 2px; color: var(--muted); transition: transform .15s; }
.guide-item[open] > summary::after { transform: rotate(180deg); }
.guide-item[open] > summary { margin-bottom: 10px; }
.guide-ico { font-size: 1.3em; }
.guide-who { flex-basis: 100%; padding-left: 2.1em; }
.guide-off > summary b { color: var(--muted); }
.guide-sub { font-weight: 600; margin: 12px 0 6px; }
.guide-steps { margin: 0; padding-left: 22px; line-height: 1.55; }
.guide-steps li { margin-bottom: 6px; }
.guide-tabs { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 6px 14px; margin: 0; }
.guide-tabs dt { font-weight: 600; }
.guide-tabs dd { margin: 0; }
.guide-link { font-weight: 600; }
@media (max-width: 640px) { .guide-tabs { grid-template-columns: 1fr; } .guide-tabs dd { margin-bottom: 6px; } .guide-who { padding-left: 0; } }

/* ---------- Знания ИИ-помощника: таблица правил, похожие строки ---------- */
.ai-send-col { display: flex; flex-direction: column; gap: 6px; }
.ai-know td { vertical-align: top; }
.ai-know textarea { width: 100%; resize: vertical; }
:root .ai-know tbody tr.ai-dup:nth-child(n) td, :root[data-skin] table.t.ai-know tbody tr.ai-dup:nth-child(n) td { background: color-mix(in srgb, var(--dup) 9%, transparent); }
.ai-know tr.ai-dup td:first-child { box-shadow: inset 4px 0 0 var(--dup); font-weight: 600; color: var(--dup); }
.ai-dup-note { margin-top: 4px; color: var(--warn); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.ai-dup-act { display: inline-flex; gap: 6px; }
.guide-howto { border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; margin: 6px 0; background: var(--panel); }
.guide-howto > summary { cursor: pointer; font-weight: 600; }
.guide-howto[open] > summary { margin-bottom: 6px; }

/* Ширина столбцов / высота строк в финансах */
.col-rs { position: absolute; top: 0; right: -3px; width: 7px; height: 100%; cursor: col-resize; z-index: 4; }
.col-rs:hover { background: var(--accent); opacity: .5; }
.row-rs { position: absolute; left: 0; right: 0; bottom: -3px; height: 6px; cursor: row-resize; z-index: 4; }
.row-rs:hover { background: var(--accent); opacity: .5; }
table.linked th { position: relative; }
@media print { .col-rs, .row-rs { display: none; } }


/* Печать: шаблоны, окно реквизитов, готовый документ */
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; }
@media (max-width: 760px) { .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); } }
.pr-cat { margin: 18px 0 8px; font-size: 1em; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pr-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.pr-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; text-align: left; cursor: pointer; font: inherit; color: var(--text); transition: border-color .15s, transform .15s; }
.pr-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.pr-card > span:last-child { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pr-card-ico { font-size: 30px; line-height: 1; }
.pr-card-name { font-weight: 600; word-break: break-word; }
.pr-sources { padding: 12px 14px; margin-bottom: 12px; background: var(--panel-2); }
.pr-sources-title { font-weight: 600; margin-bottom: 8px; }
.pr-group { border: 1px solid var(--border); border-radius: 10px; padding: 6px 12px 2px; margin: 0 0 10px; }
.pr-group legend { padding: 0 6px; font-weight: 600; color: var(--muted); }
.pr-group textarea { min-height: 38px; }
.pr-crm { display: inline-block; font-size: .7em; font-weight: 700; padding: 1px 5px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); vertical-align: middle; }
.pr-crm[hidden] { display: none; }
.modal.pr-doc { max-width: 1180px; }
.pr-hint { margin-bottom: 8px; }
.pr-frame { display: block; width: 100%; height: 70vh; border: 1px solid var(--border); border-radius: 8px; background: #e9e9ec; }
.pr-attach { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin: 6px 0 10px; }
.pr-help { margin-bottom: 12px; padding: 10px 14px; }
.pr-help summary { cursor: pointer; font-weight: 600; }
.pr-help ol { margin: 10px 0; padding-left: 20px; }
.pr-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 6px; }
.pr-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0; }
@media (max-width: 760px) { .pr-frame { height: 62vh; } }

/* Библиотека: темы-папки, файлы, уроки */
.lib-folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.lib-folder { display: flex; align-items: center; gap: 12px; padding: 14px 16px; color: var(--text); text-decoration: none; transition: border-color .15s; }
.lib-folder:hover { border-color: var(--accent); }
.lib-folder-ico { font-size: 30px; line-height: 1; }
.lib-folder-name { font-weight: 600; word-break: break-word; }
.lib-ico { font-size: 1.15em; }
.lib-files td { vertical-align: middle; }
.lib-actions { white-space: nowrap; text-align: right; }
.lib-actions .btn { margin-left: 4px; }
.lib-move { width: auto; max-width: 150px; margin-left: 4px; padding: 3px 6px; font-size: .85em; }
.lib-pdf { width: 100%; height: 70vh; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.lib-img { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto; border-radius: 8px; }
.lib-pick { max-height: 50vh; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.lib-pick-folder { display: flex; flex-direction: column; gap: 4px; }
.lesson-name { font-size: 1.15em; font-weight: 700; margin-bottom: 12px; padding: 8px 12px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--border); }
.lesson-val { padding: 8px 0; font-weight: 600; }
.lesson-mats { display: flex; flex-direction: column; gap: 4px; }
.lesson-mat { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 4px; }
.lesson-mat .spacer { flex: 1; }
.lesson-mat a { word-break: break-word; }
.lesson-ack { margin-top: 14px; padding: 10px 12px; border: 1px dashed var(--accent); border-radius: 8px; font-size: 1.05em; }
.lesson-ack.done { border-style: solid; border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: color-mix(in srgb, var(--ok) 8%, transparent); }
@media (max-width: 900px) { .lib-actions { white-space: normal; } .lesson-mat { flex-wrap: wrap; } }
.lib-scope { flex: none; } .lib-scope button { white-space: nowrap; }
.lesson-topic-row { display: flex; gap: 6px; align-items: center; } .lesson-topic-row select { flex: 1; min-width: 0; width: auto; }
table.t.bp .c-hours { width: 64px; min-width: 58px; }
table.t.bp .c-baseGuests { width: 64px; min-width: 58px; } table.t.bp .c-extraGuest { width: 84px; min-width: 76px; }
h3.bp-title { margin: 14px 0 6px; } h3.bp-title:first-of-type { margin-top: 8px; }
