/* Общий дизайн сайта: цвета (светлая и тёмная тема), шапка, каркас кабинета и админки (.cab), компоненты, окна, вход, главная (.land).
   Компоненты действуют внутри .cab, .ui (любой блок, например главная), .fade (окно dialog()) и .form (карточка входа и регистрации) —
   страницы без этих классов выглядят по-старому (common.css). Цвета — только через токены --c-*; свои стили проекта — в index.css */

:root {
  --c-page: #f3f5f9;
  --c-card: #fff;
  --c-card2: #f5f7fb;
  --c-line: #e4e9f1;
  --c-line2: #cdd5e1;
  --c-text: #172033;
  --c-muted: #6b7689;
  --c-accent: #3767e8;
  --c-accent2: #2b55c8;
  --c-accent-soft: #e9efff;
  --c-btn: #3767e8;        /* заливка кнопок и плашек с белым текстом — отдельно от --c-accent (ссылки, активный пункт меню) */
  --c-btn2: #2b55c8;       /* то же при наведении */
  --c-violet: #8b5cf6;
  --c-ok: #16a34a;
  --c-ok-soft: #e6f6ec;
  --c-ok-btn: #16a34a;
  --c-warn: #c27803;
  --c-warn-soft: #fdf3e1;
  --c-bad: #dc2626;
  --c-bad-soft: #fdecec;
  --c-input: #fff;
  --c-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px rgba(16, 24, 40, .06);
  --c-shadow-lg: 0 2px 6px rgba(16, 24, 40, .05), 0 24px 60px rgba(16, 24, 40, .12);
  --c-radius: 16px;
  --c-chat: #f3f5f9;
}
[data-theme="dark"] {
  --c-page: #1b1f25;
  --c-card: #262b33;
  --c-card2: #2d333c;
  --c-line: #353c47;
  --c-line2: #48515e;
  --c-text: #e7eaf0;
  --c-muted: #98a2b3;
  --c-accent: #96c1ff;
  --c-accent2: #87a5ff;
  --c-accent-soft: rgba(109, 146, 255, .15);
  --c-btn: #4c72ec;
  --c-btn2: #5f82f0;
  --c-violet: #a78bfa;
  --c-ok: #4ade80;
  --c-ok-soft: rgba(74, 222, 128, .12);
  --c-ok-btn: #1f9d4f;
  --c-warn: #fbbf24;
  --c-warn-soft: rgba(251, 191, 36, .12);
  --c-bad: #f87171;
  --c-bad-soft: rgba(248, 113, 113, .13);
  --c-input: #1f242b;
  --c-shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 6px 20px rgba(0, 0, 0, .18);
  --c-shadow-lg: 0 2px 6px rgba(0, 0, 0, .3), 0 24px 60px rgba(0, 0, 0, .35);
  --c-chat: #181d25;
}

body { background: var(--c-page); color: var(--c-text); }
main { background: transparent; }
.hint { color: var(--c-muted); font-size: 12px; margin: 2px 0 8px; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: #ef4141; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }

/* ===== Шапка сайта: прилипает к верху, при прокрутке становится ниже (body.scrolled ставит _Layout) ===== */
/* common.css даёт html и body height: 100% — тогда шапка прилипает только в пределах первого экрана. Высота body — по содержимому
   (кроме входа, где форма по центру экрана, и чата, у которого своя высота) */
body:not(.chat-page):not(:has(.center-items > .panel.form)) { height: auto; min-height: 100%; }
header.site-head { position: sticky; top: 0; z-index: 900; height: 60px; padding: 0 24px; display: flex; align-items: center; gap: 14px; color: var(--c-text); transition: height .2s, box-shadow .2s;
  background: color-mix(in srgb, var(--c-card) 86%, transparent); border-bottom: 1px solid var(--c-line); backdrop-filter: blur(10px); }
.site-head a { color: var(--c-text); }
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 750; letter-spacing: -.01em; }
.brand-mark { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-size: 14px;
  background: linear-gradient(135deg, var(--c-btn), var(--c-violet)); box-shadow: 0 4px 12px color-mix(in srgb, var(--c-btn) 35%, transparent); transition: width .2s, height .2s; }
.site-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.site-nav > a, .site-drop > a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; font-size: 13.5px; color: var(--c-text); transition: background .15s, color .15s; }
.site-nav > a:hover, .site-drop > a:hover { background: var(--c-card2); }
.site-nav > a i, .site-drop > a i { color: var(--c-muted); font-size: 13px; }
.site-nav > a.site-cta { background: var(--c-btn); color: #fff; margin-left: 4px; }
.site-nav > a.site-cta:hover { background: var(--c-btn2); }
.site-nav > a.site-cta i { color: #fff; }
.site-user .avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--c-card2); }
.site-drop { position: relative; }
.site-drop > div { position: absolute; right: 0; top: calc(100% + 6px); min-width: 150px; padding: 6px; border-radius: 12px; background: var(--c-card); border: 1px solid var(--c-line); box-shadow: var(--c-shadow-lg); display: none; }
.site-drop:hover > div, .site-drop.open > div { display: block; }
.site-drop > div::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }  /* мост для наведения между пунктом и меню */
.site-drop > div a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--c-text); }
.site-drop > div a:hover { background: var(--c-card2); }
.theme-btn, .site-burger { width: 36px; height: 36px; margin: 0 0 0 4px; padding: 0; border-radius: 10px; border: 1px solid var(--c-line); background: var(--c-card2); color: var(--c-muted);
  box-shadow: none; display: inline-grid; place-items: center; font-size: 15px; line-height: 1; cursor: pointer; transition: color .15s, border-color .15s; }
.theme-btn:hover, .site-burger:hover { color: var(--c-text); border-color: var(--c-line2); }
.theme-btn .fa-sun, [data-theme="dark"] .theme-btn .fa-moon { display: none; }
[data-theme="dark"] .theme-btn .fa-sun { display: inline; color: #fbbf24; }
.site-burger { display: none; margin-left: auto; }
body.scrolled header.site-head { height: 48px; box-shadow: var(--c-shadow); }
body.scrolled .brand { font-size: 15.5px; }
body.scrolled .brand-mark { width: 26px; height: 26px; font-size: 12px; border-radius: 8px; }
body.scrolled .site-nav > a, body.scrolled .site-drop > a { padding-top: 6px; padding-bottom: 6px; }
body.scrolled :is(.theme-btn, .site-burger) { width: 32px; height: 32px; }

/* ===== Каркас кабинета и админки: меню слева, содержимое справа ===== */
.cab { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 22px; align-items: start; }
.cab-menu { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 6px; padding: 14px 12px; background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--c-radius); box-shadow: var(--c-shadow); }
.cab-user { display: flex; align-items: center; gap: 10px; padding: 4px 6px 14px; margin-bottom: 4px; border-bottom: 1px solid var(--c-line); }
.cab-user .avatar, .cab-mark { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex: none; background: var(--c-card2); }
.cab-mark { border-radius: 12px; display: grid; place-items: center; color: #fff; font-size: 16px; background: linear-gradient(135deg, var(--c-btn), var(--c-violet)); }
.cab-user-text { min-width: 0; display: flex; flex-direction: column; }
.cab-user-text b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cab-user-text span { font-size: 12px; color: var(--c-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cab-nav { display: flex; flex-direction: column; gap: 2px; }
.cab-nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: var(--c-text); font-weight: 500; transition: background .15s, color .15s; }
.cab-nav a i { width: 18px; text-align: center; color: var(--c-muted); font-size: 14px; transition: color .15s; }
.cab-nav a:hover { background: var(--c-card2); }
.cab-nav a.active { background: var(--c-accent-soft); color: var(--c-accent); font-weight: 600; }
.cab-nav a.active i { color: var(--c-accent); }
.cab-nav a .badge { margin-left: auto; }
.cab-nav-foot { margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--c-line); }
.cab-nav-foot a { color: var(--c-muted); }
.cab-sub { display: flex; gap: 9px; align-items: flex-start; margin-top: 8px; padding: 10px 12px; border-radius: 12px; font-size: 12px; line-height: 1.4; background: var(--c-card2); color: var(--c-muted); }
.cab-sub i { margin-top: 2px; }
.cab-sub.ok i { color: var(--c-warn); }
.cab-sub.bad { background: var(--c-bad-soft); color: var(--c-bad); }
.cab-body { min-width: 0; }
.cab-head { margin: 2px 2px 16px; }
.cab-head h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; color: var(--c-text); }
.cab-head p { margin-top: 3px; color: var(--c-muted); }

/* ===== Компоненты (внутри .cab, .ui, .fade, .form) ===== */
:is(.cab, .ui, .fade, .form) { color: var(--c-text); font-size: 13.5px; }
:is(.cab, .ui, .fade, .form) .green { color: var(--c-ok); }
:is(.cab, .ui, .fade, .form) .red { color: var(--c-bad); }
:is(.cab, .ui, .fade, .form) .yellow { color: var(--c-warn); }
:is(.cab, .ui, .fade, .form) .gray { color: var(--c-muted); }
:is(.cab, .ui, .fade, .form) a { color: var(--c-accent); }
:is(.cab, .ui) code { font-size: 12px; padding: 1px 5px; border-radius: 5px; background: var(--c-card2); border: 1px solid var(--c-line); }
:is(.cab, .ui) pre { padding: 12px 14px; border-radius: 12px; background: var(--c-card2); border: 1px solid var(--c-line); font-size: 12.5px; }
:is(.cab, .ui) pre:empty { display: none; }

:is(.cab, .ui) #form { width: 100%; margin: 0; }   /* common.css на телефоне сужает .panel и #form до 90%; не auto: у вкладок #form — inline-block и растягивался бы по самой широкой таблице */
:is(.cab, .ui, .fade) .panel { width: auto; margin: 0 0 18px; padding: 18px 20px; background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--c-radius); box-shadow: var(--c-shadow); }
:is(.cab, .ui, .fade, .form) .panel > h1, .panel.form > h1 { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 650; color: var(--c-text); margin-bottom: 12px; }
:is(.cab, .ui, .fade) .panel > h1 > i { width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: 8px; background: var(--c-accent-soft); color: var(--c-accent); font-size: 13px; flex: none; }
:is(.cab, .ui, .fade) .panel > h1 > .h-side { margin-left: auto; font-size: 12.5px; font-weight: 500; }
:is(.cab, .ui, .fade) .panel p { color: var(--c-muted); line-height: 1.5; }
:is(.cab, .ui) .flex:has(> .panel) { gap: 18px; }
:is(.cab, .ui) .flex > .panel { margin-bottom: 18px; }
:is(.cab, .ui, .fade, .form) .hint { color: var(--c-muted); font-size: 12.5px; line-height: 1.45; }

/* Чипы состояния: точка + текст */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--c-card2); color: var(--c-muted); white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.ok { background: var(--c-ok-soft); color: var(--c-ok); }
.chip.warn { background: var(--c-warn-soft); color: var(--c-warn); }
.chip.bad { background: var(--c-bad-soft); color: var(--c-bad); }
.chip.info { background: var(--c-accent-soft); color: var(--c-accent); }
.chip.plain::before { display: none; }

/* Плитки показателей: .tiles (авто), .tiles.kpi (6 в ряд), .tiles.c4 (4 в ряд), .tiles.small (в строку) */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 14px; background: var(--c-card2); border: 1px solid transparent; color: var(--c-text); transition: border-color .15s, transform .15s; }
:is(.cab, .ui) a.tile { color: var(--c-text); }
a.tile:hover { border-color: var(--c-line2); transform: translateY(-1px); }
.tile > i { position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: var(--c-card); color: var(--c-accent); font-size: 13px; }
.tile span { display: block; color: var(--c-muted); font-size: 12px; padding-right: 34px; }
.tile b { display: block; font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile small { color: var(--c-muted); font-size: 11.5px; }
.tile.hl { background: var(--c-warn-soft); }
.tile.hl > i { color: var(--c-warn); }
.tiles.kpi { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 18px; }
.tiles.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; }
.panel > .tiles.c4:last-child, .panel > .tiles.kpi:last-child { margin-bottom: 0; }
.tiles.small .tile { padding: 10px 14px; flex-direction: row; align-items: center; gap: 10px; }
.tiles.small .tile > i { position: static; flex: none; }
.tiles.small .tile span { padding-right: 0; }
.tiles.small .tile b { font-size: 17px; margin-left: auto; }

/* Главная карточка страницы: значок состояния, заголовок, кнопки. .hero.on — «работает» (пульсирует) */
.hero { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
:is(.cab, .ui) .panel > .hero { overflow: visible; }   /* common.css даёт .panel > div overflow: auto — пульсирующее кольцо вокруг значка включало и выключало прокрутку, и блок дёргался по ширине */
.hero-dot { width: 48px; height: 48px; flex: none; border-radius: 14px; display: grid; place-items: center; font-size: 20px; background: var(--c-card2); color: var(--c-muted); }
.hero.on .hero-dot { background: var(--c-ok-soft); color: var(--c-ok); position: relative; }
.hero.on .hero-dot::after { content: ""; position: absolute; inset: -4px; border-radius: 17px; border: 2px solid var(--c-ok); opacity: 0; animation: ui-pulse 2.4s ease-out infinite; }
@keyframes ui-pulse { 0% { opacity: .5; transform: scale(.92); } 100% { opacity: 0; transform: scale(1.12); } }
.hero-text { flex: 1; min-width: 200px; }
.hero-text b { display: block; font-size: 18px; font-weight: 700; }
.hero-text span { color: var(--c-muted); }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--c-line); }
.hero-chips .lbl { color: var(--c-muted); font-size: 12px; margin-right: 2px; }
.hero-chips > div { display: inline-flex; align-items: center; gap: 6px; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; }
.dash-grid > .panel { margin-bottom: 18px; }

/* Таблицы */
:is(.cab, .ui) table { box-shadow: none; width: 100%; border-collapse: separate; border-spacing: 0; }
:is(.cab, .ui) th { background: transparent; color: var(--c-muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 8px 12px; border: none; border-bottom: 1px solid var(--c-line); white-space: nowrap; }
:is(.cab, .ui) td { padding: 11px 12px; font-size: 13px; border: none; border-bottom: 1px solid var(--c-line); vertical-align: top; }
:is(.cab, .ui) tr, :is(.cab, .ui) tr:nth-child(2n), :is(.cab, .ui) tr:nth-child(2n+1) { background: transparent; }
:is(.cab, .ui) tr:last-child td { border-bottom: none; }
:is(.cab, .ui) table tr:hover td { background: var(--c-card2); }
:is(.cab, .ui) td .hint { margin: 3px 0 0; }
:is(.cab, .ui) table .btn, :is(.cab, .ui) table button { zoom: 1; margin: 0; padding: 4px 10px; font-size: 12px; }
:is(.cab, .ui) table input, :is(.cab, .ui) table select { zoom: 1; margin: 0; padding: 6px 10px; font-size: 13px; }
:is(.cab, .ui) td:has(> input, > select) { vertical-align: middle; padding: 8px 6px; }
:is(.cab, .ui) .table-wrap { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }
.nowrap-cell { white-space: nowrap; }

/* Подсказка при наведении: элемент с title и классом .tip — значок ⓘ после текста, курсор-вопрос */
:is(.cab, .ui, .fade) .tip { cursor: help; }
:is(.cab, .ui, .fade) .tip::after { content: "\f05a"; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: .85em; margin-left: 5px; color: var(--c-muted); opacity: .6; }
:is(.cab, .ui, .fade) .tip:hover::after { opacity: 1; }

/* Поля */
:is(.cab, .ui) details > summary { cursor: pointer; margin: 4px 0 0; list-style-position: inside; }
:is(.cab, .ui) details[open] > summary { margin-bottom: 6px; }
:is(.cab, .ui, .fade, .form) :is(input[type="text"], input[type="password"], input[type="number"], input[type="email"], input[type="url"], input[type="datetime-local"], input[type="date"], textarea, select) {
  border: 1px solid var(--c-line); border-radius: 9px; padding: 8px 12px; width: 100%; background: var(--c-input); color: var(--c-text); font-size: 13.5px; transition: border-color .15s, box-shadow .15s; }
:is(.cab, .ui, .fade, .form) :is(input, textarea, select):focus { border-color: var(--c-accent); box-shadow: 0 0 0 3px var(--c-accent-soft); }
:is(.cab, .ui, .fade, .form) :is(input, textarea):disabled { opacity: .6; }
:is(.cab, .ui, .fade, .form) textarea { line-height: 1.45; }
:is(.cab, .ui, .fade, .form) ::placeholder { color: var(--c-muted); font-style: normal; opacity: .8; }
:is(.cab, .ui) label { display: block; margin: 12px 0 5px; font-weight: 600; font-size: 12.5px; }
:is(.cab, .ui) .grid-form { grid-template-columns: minmax(150px, 38%) 1fr; gap: 8px 14px; align-items: center; }
:is(.cab, .ui) .grid-form > div > div:first-child { color: var(--c-muted); font-size: 12.5px; }
:is(.cab, .ui) .grid-form > div > div:last-child { gap: 10px; }
:is(.cab, .ui) .grid-form input[type="number"] { max-width: 110px; }
:is(.cab, .ui) .grid-form .hint { margin: 0; white-space: nowrap; }
:is(.cab, .ui) .grid-form + .hint { margin-top: 14px; }
:is(.cab, .ui, .fade) .panel input { margin: 0; }
.input-short { max-width: 240px; }
.state-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 10px; }

/* Кнопки: .btn — обычная, .btn-blue — главная, .btn-green — сохранить, .btn-red — удалить, .btn-ghost — без фона */
:is(.cab, .ui, .fade, .form) :is(.btn, button) { display: inline-flex; align-items: center; justify-content: center; gap: 7px; margin: 0; padding: 7px 14px; border-radius: 9px; border: 1px solid var(--c-line);
  background: var(--c-card2); color: var(--c-text); font-weight: 600; font-size: 13px; line-height: 18px; box-shadow: none; transition: background .15s, border-color .15s, color .15s, transform .1s; }
:is(.cab, .ui, .fade, .form) :is(.btn, button):hover { border-color: var(--c-line2); background: var(--c-card); }
:is(.cab, .ui, .fade, .form) :is(.btn, button):disabled { opacity: .55; }
:is(.cab, .ui, .fade, .form) .btn-green, :is(.cab, .ui, .fade, .form) .btn-green:disabled:hover { background: var(--c-ok-btn); border-color: transparent; color: #fff !important; }
:is(.cab, .ui, .fade, .form) .btn-green:hover { background: var(--c-ok-btn); filter: brightness(1.07); border-color: transparent; }
:is(.cab, .ui, .fade, .form) :is(.btn-blue, .btn-primary, button.default), :is(.cab, .ui, .fade, .form) .btn-blue:disabled:hover { background: var(--c-btn); border-color: transparent; color: #fff !important; }
:is(.cab, .ui, .fade, .form) :is(.btn-blue, .btn-primary, button.default):hover { background: var(--c-btn2); border-color: transparent; }
:is(.cab, .ui, .fade, .form) .btn-red, :is(.cab, .ui, .fade, .form) .btn-red:disabled:hover { background: var(--c-bad-soft); border-color: transparent; color: var(--c-bad) !important; }
:is(.cab, .ui, .fade, .form) .btn-red:hover { background: var(--c-bad); color: #fff !important; }
:is(.cab, .ui, .fade, .form) .btn-ghost { background: transparent; border-color: transparent; color: var(--c-muted); }
:is(.cab, .ui, .fade, .form) .btn-ghost:hover { background: var(--c-card2); color: var(--c-text); }
:is(.cab, .ui) .btn-lg { padding: 12px 22px; font-size: 15px; border-radius: 12px; }
:is(.cab, .ui, .fade) .btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }

/* Галочки — аккуратные квадраты, .switch — тумблер. Разметка: label.custom-checkbox > input + span (метка) + span (текст) */
:is(.cab, .ui) .custom-checkbox { display: flex; align-items: center; gap: 10px; margin: 6px 0; font-weight: 500; font-size: 13.5px; cursor: pointer; }
:is(.cab, .ui) .custom-checkbox span:nth-of-type(1) { position: relative; flex: none; width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--c-line2); background: var(--c-input) none; transition: background .15s, border-color .15s; }
:is(.cab, .ui) .custom-checkbox input:checked + span:nth-of-type(1) { background: var(--c-btn) none; border-color: var(--c-btn); }
:is(.cab, .ui) .custom-checkbox input:checked + span:nth-of-type(1)::after { content: ""; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
:is(.cab, .ui) .custom-checkbox input:disabled + span:nth-of-type(1), :is(.cab, .ui) .custom-checkbox input:disabled + span + span { opacity: .45; cursor: default; }
:is(.cab, .ui) .custom-checkbox.switch span:nth-of-type(1) { width: 36px; height: 21px; border-radius: 21px; border: none; background: var(--c-line2); }
:is(.cab, .ui) .custom-checkbox.switch span:nth-of-type(1)::after { content: ""; position: absolute; left: 2px; top: 2px; width: 17px; height: 17px; border: none; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transform: none; transition: transform .18s; }
:is(.cab, .ui) .custom-checkbox.switch input:checked + span:nth-of-type(1) { background: var(--c-ok-btn); }
:is(.cab, .ui) .custom-checkbox.switch input:checked + span:nth-of-type(1)::after { left: 2px; top: 2px; width: 17px; height: 17px; border: none; transform: translateX(15px); }
:is(.cab, .ui) .switch + .hint { margin: 0 0 12px 46px; }

/* Вкладки — сегментами */
:is(.cab, .ui) .tabs > ul { display: flex; gap: 4px; padding: 4px; margin-bottom: 18px; border-radius: 13px; background: var(--c-card); border: 1px solid var(--c-line); box-shadow: var(--c-shadow); overflow-x: auto; scrollbar-width: none; list-style: none; }
:is(.cab, .ui) .tabs > ul::-webkit-scrollbar { display: none; }
:is(.cab, .ui) .tabs > ul:after { display: none; }
:is(.cab, .ui) .tabs > ul li { float: none; flex: 1 0 auto; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 14px; border-radius: 10px; color: var(--c-muted); font-weight: 600; white-space: nowrap; transition: background .15s, color .15s; }
:is(.cab, .ui) .tabs > ul li i { font-size: 13px; }
:is(.cab, .ui) .tabs > ul li:hover { color: var(--c-text); background: var(--c-card2); }
:is(.cab, .ui) .tabs > ul li.active, :is(.cab, .ui) .tabs ul li.active:hover { background: var(--c-accent-soft); color: var(--c-accent); border-radius: 10px; }
:is(.cab, .ui) .tabs > div { padding: 0; }

/* Кнопка «Сохранить» прилипает к низу окна, пока страница длиннее экрана */
:is(.cab, .ui) .save-bar { position: sticky; bottom: 12px; z-index: 5; display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 10px 12px; margin-top: 4px; margin-bottom: 18px; padding: 10px 12px; border-radius: 14px;
  background: color-mix(in srgb, var(--c-card) 85%, transparent); border: 1px solid var(--c-line); box-shadow: var(--c-shadow); backdrop-filter: blur(8px); }
:is(.cab, .ui) .save-bar .hint { margin: 0 auto 0 4px; }
:is(.cab, .ui) .save-bar .btn { padding: 8px 22px; }

/* Постраничная навигация (partial pagination) */
:is(.cab, .ui) .pagination { margin-top: 12px; }
:is(.cab, .ui) .pagination a { color: var(--c-text); font-weight: 600; }
:is(.cab, .ui) .pagination a:before { background: var(--c-accent-soft); }
:is(.cab, .ui) .pagination a.active { color: var(--c-accent); }

.acc-avatar { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; margin: 6px auto 14px; display: block; border: 3px solid var(--c-card2); }
:is(.cab, .ui) ::-webkit-scrollbar-thumb { background-color: var(--c-line2); }

/* ===== Окно dialog() ===== */
.fade { background: rgba(10, 14, 22, .55); backdrop-filter: blur(3px); }
.fade .panel { width: 400px; max-width: calc(100vw - 32px); margin: 0; padding: 24px; border-radius: 20px; box-shadow: var(--c-shadow-lg); }
.fade .panel > h1 { justify-content: center; font-size: 17px; }
.fade .panel .flex { margin-bottom: 10px; }
.fade .close { top: 16px; right: 16px; opacity: .5; }
[data-theme="dark"] .fade .close { filter: invert(1); }
/* Окно-форма openModal(): шире обычного окна, длинная форма прокручивается внутри */
.fade .panel.modal-box { width: 640px; max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); overflow: auto; }
.fade .panel.modal-box > h1 { justify-content: flex-start; padding-right: 28px; }

/* ===== Вход, регистрация, восстановление пароля (.center-items > .panel.form) ===== */
body:has(.center-items > .panel.form) header.site-head { display: none; }   /* на странице входа шапки нет: над формой свой логотип со ссылкой на главную */
.center-items:has(> .panel.form) { padding: 24px 0; }
.center-items > h1:has(+ .panel.form) { font-size: 26px; font-weight: 750; letter-spacing: -.02em; margin-bottom: 18px; }
.center-items > h1:has(+ .panel.form) a { color: var(--c-text) !important; display: inline-flex; align-items: center; gap: 10px; }
.center-items > h1:has(+ .panel.form) a::before { content: ""; width: 34px; height: 34px; border-radius: 11px; background: linear-gradient(135deg, var(--c-btn), var(--c-violet)); }
.panel.form, #form.panel.form { width: 410px; max-width: calc(100vw - 32px); margin: 0; padding: 28px 30px 26px; background: var(--c-card); border: 1px solid var(--c-line); border-radius: 20px; box-shadow: var(--c-shadow-lg); }
.panel.form > h1 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.panel.form > div { overflow: visible; }
.panel.form .m20 { margin: 14px 0; }
.panel.form .registration__form-capcha { margin: 14px 0 16px; }   /* капча (hCaptcha масштабируется на ширину полей в Register.cshtml) */
/* «глаз» в поле пароля: общие стили кнопок (фон при наведении, сдвиг при нажатии) его не трогают — иначе translateY(-50%) терялся и он прыгал вниз */
.panel.form button.password-toggle, .panel.form button.password-toggle:is(:hover, :active, :focus) { padding: 4px; border: none; background: none; box-shadow: none; transform: translateY(-50%); }
.panel.form .password-toggle svg { stroke: var(--c-muted); }
.panel.form a { font-weight: 600; font-size: 13px; }
.panel.form button.default, .panel.form .btn-blue { padding: 9px 22px; }

/* ===== Главная (лендинг): <div class="ui land"> ===== */
.land { max-width: 1120px; margin: 0 auto; font-size: 15px; overflow-x: clip; overflow-clip-margin: 40px; }   /* свечение за первым экраном не даёт горизонтальной прокрутки */
.land section { padding: 52px 0; }
.land-hero { position: relative; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); gap: 48px; align-items: center; padding: 36px 0 56px !important; }
.land-hero::before { content: ""; position: absolute; z-index: -1; inset: -40px -10% auto 30%; height: 520px; border-radius: 50%; filter: blur(80px); opacity: .55;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--c-accent) 45%, transparent), transparent), radial-gradient(closest-side at 70% 60%, color-mix(in srgb, var(--c-violet) 40%, transparent), transparent); }
.land-badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--c-accent-soft); color: var(--c-accent); font-size: 12.5px; font-weight: 700; }
.land-hero h1 { margin: 18px 0 16px; font-size: 48px; line-height: 1.07; font-weight: 800; letter-spacing: -.035em; }
.land-hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--c-accent), var(--c-violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.land-lead { max-width: 560px; font-size: 17px; line-height: 1.6; color: var(--c-muted); }
.land-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.land-note { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 16px; color: var(--c-muted); font-size: 13px; }
.land-note i { color: var(--c-ok); margin-right: 6px; }
.land-demo { padding: 18px; border-radius: 22px; background: var(--c-card); border: 1px solid var(--c-line); box-shadow: var(--c-shadow-lg); }
.land-demo-head { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--c-line); }
.land-demo-head b { display: block; font-size: 14px; }
.land-demo-head span { color: var(--c-muted); font-size: 12px; }
.land-msg { padding: 11px 14px; border-radius: 16px; border-bottom-left-radius: 5px; background: var(--c-card2); border: 1px solid var(--c-line); font-size: 13.5px; line-height: 1.5; }
.land-msg + .land-msg { margin-top: 10px; }
.land-msg.me { margin-left: auto; width: fit-content; max-width: 85%; border-radius: 16px; border-bottom-right-radius: 5px; background: var(--c-btn); border-color: transparent; color: #fff; }
.land-msg .draft { margin-top: 10px; padding: 10px 12px; border-radius: 12px; border: 1px dashed var(--c-line2); background: var(--c-card); }
.land-msg .bar { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.land-msg .bar span { padding: 5px 12px; border-radius: 9px; font-size: 12.5px; font-weight: 600; background: var(--c-card); border: 1px solid var(--c-line); }
.land-msg .bar span.go { background: var(--c-ok-btn); border-color: transparent; color: #fff; }
.land-h { text-align: center; margin-bottom: 30px; }
.land-h h2 { font-size: 32px; font-weight: 800; letter-spacing: -.03em; }
.land-h p { max-width: 620px; margin: 10px auto 0; color: var(--c-muted); font-size: 16px; line-height: 1.55; }
.land-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; counter-reset: step; }
.land-step { position: relative; padding: 22px 20px 20px; border-radius: 18px; background: var(--c-card); border: 1px solid var(--c-line); box-shadow: var(--c-shadow); }
.land-step::before { counter-increment: step; content: counter(step); display: grid; place-items: center; width: 32px; height: 32px; margin-bottom: 14px; border-radius: 10px; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--c-btn), var(--c-violet)); }
.land-step b, .land-card b { display: block; font-size: 15.5px; margin-bottom: 6px; }
.land-step p, .land-card p { color: var(--c-muted); font-size: 14px; line-height: 1.55; }
.land-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.land-card { padding: 22px; border-radius: 18px; background: var(--c-card); border: 1px solid var(--c-line); box-shadow: var(--c-shadow); transition: transform .15s, border-color .15s; }
.land-card:hover { transform: translateY(-2px); border-color: var(--c-line2); }
.land-card > i { width: 42px; height: 42px; display: grid; place-items: center; margin-bottom: 14px; border-radius: 12px; font-size: 17px; background: var(--c-accent-soft); color: var(--c-accent); }
.land-card.ok > i { background: var(--c-ok-soft); color: var(--c-ok); }
.land-card.warn > i { background: var(--c-warn-soft); color: var(--c-warn); }
.land-card.violet > i { background: color-mix(in srgb, var(--c-violet) 16%, transparent); color: var(--c-violet); }
.land-card .chip { margin-top: 12px; }
.land-price { max-width: 460px; margin: 0 auto; padding: 30px; border-radius: 22px; text-align: center; background: var(--c-card); border: 1px solid var(--c-line); box-shadow: var(--c-shadow-lg); }
.land-price .sum { margin: 10px 0 2px; font-size: 44px; font-weight: 800; letter-spacing: -.03em; }
.land-price .sum small { font-size: 16px; font-weight: 600; color: var(--c-muted); letter-spacing: 0; }
.land-price ul { list-style: none; margin: 20px 0 24px; text-align: left; display: flex; flex-direction: column; gap: 9px; }
.land-price li i { color: var(--c-ok); width: 22px; }
.land-faq { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.land-faq details { padding: 16px 20px; border-radius: 14px; background: var(--c-card); border: 1px solid var(--c-line); }
.land-faq summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.land-faq summary::-webkit-details-marker { display: none; }
.land-faq summary::after { content: "+"; color: var(--c-muted); font-size: 18px; line-height: 1; }
.land-faq details[open] summary::after { content: "−"; }
.land-faq details p { margin-top: 10px; color: var(--c-muted); line-height: 1.6; }
.land-final { margin: 20px 0 40px; padding: 44px 30px; border-radius: 26px; text-align: center; color: #fff; background: linear-gradient(135deg, var(--c-btn), var(--c-violet)); box-shadow: var(--c-shadow-lg); }
.land-final h2 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.land-final p { margin: 10px auto 22px; max-width: 560px; opacity: .9; font-size: 16px; }
.land-final .btn { background: #fff; color: #1e2a55 !important; border-color: transparent; }
.land-final .btn:hover { background: #fff; filter: brightness(.96); }
.site-foot { padding: 22px 24px; border-top: 1px solid var(--c-line); color: var(--c-muted); font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.site-foot a { color: var(--c-muted); }

/* ===== Адаптивность ===== */
@media screen and (max-width: 1150px) {
    .tiles.kpi { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media screen and (max-width: 960px) {
    .land-hero { grid-template-columns: 1fr; gap: 32px; }
    .land-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .land-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Планшет: меню кабинета — строкой сверху */
@media screen and (max-width: 900px) {
    .cab { display: block; }
    .cab-menu { position: static; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; padding: 6px; }
    .cab-user, .cab-sub, .cab-nav-foot { display: none; }
    .cab-nav { flex-direction: row; flex: 1; overflow-x: auto; scrollbar-width: none; }
    .cab-nav::-webkit-scrollbar { display: none; }
    .cab-nav a { white-space: nowrap; padding: 8px 12px; }
    .dash-grid { grid-template-columns: minmax(0, 1fr); }   /* не 1fr: широкая таблица в панели распирала колонку за край экрана */
}

/* Шапка: пункты — в выпадающей панели по кнопке-бургеру */
@media screen and (max-width: 760px) {
    header.site-head { padding: 0 14px; }
    .site-burger { display: inline-grid; }
    .site-nav { display: none; position: absolute; top: 64px; right: 12px; min-width: 200px; flex-direction: column; align-items: stretch; gap: 2px; padding: 8px; border-radius: 16px;
      background: var(--c-card); border: 1px solid var(--c-line); box-shadow: var(--c-shadow-lg); }
    body.nav-open .site-nav { display: flex; }
    .site-nav > a, .site-drop > a { padding: 11px 12px; }
    .site-nav > a.site-cta { margin: 4px 0 0; justify-content: center; }
    .site-drop > div { position: static; display: none; box-shadow: none; border: none; padding: 0 0 0 26px; }
    .site-drop.open > div { display: block; }
    .site-drop:hover > div { display: none; }
    .site-drop.open:hover > div { display: block; }
    .site-nav .theme-btn { width: 100%; margin: 6px 0 0; }
    .land section { padding: 36px 0; }
    .land-hero h1 { font-size: 34px; }
    .land-lead { font-size: 15.5px; }
    .land-h h2, .land-final h2 { font-size: 25px; }
    .land-grid, .land-steps { grid-template-columns: 1fr; }
    .land-final { padding: 32px 20px; border-radius: 20px; }
}

@media screen and (max-width: 480px) {
    .cab, .ui { font-size: 13px; }
    .cab-head h1 { font-size: 19px; }
    .cab-nav a { padding: 8px 10px; gap: 7px; }
    .cab-nav a:not(.active) span:not(.badge) { display: none; }   /* на телефоне у неактивных пунктов меню — только иконка */
    .cab-nav a i { font-size: 16px; }
    .cab-nav { justify-content: space-between; }
    :is(.cab, .ui, .fade) .panel { padding: 14px; border-radius: 14px; }
    .tiles, .tiles.kpi, .tiles.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .tiles.small { grid-template-columns: 1fr; }
    .tile { padding: 12px; }
    .tile b { font-size: 20px; }
    :is(.cab, .ui) .grid-form { display: grid; grid-template-columns: 1fr; gap: 2px; }
    :is(.cab, .ui) .grid-form > div > div:first-child { margin-top: 8px; }
    :is(.cab, .ui) .grid-form .hint { white-space: normal; }
    :is(.cab, .ui) .switch + .hint { margin-left: 0; }
    :is(.cab, .ui) .tabs > ul li { flex: none; }
    :is(.cab, .ui) .flex:has(> .panel) { display: block; }
    :is(.cab, .ui) .save-bar { padding: 8px; gap: 6px; }
    :is(.cab, .ui) .save-bar .btn { padding: 8px 12px; }
    .land { font-size: 14.5px; }
    .land-hero { padding-top: 16px !important; }
    .land-hero h1 { font-size: 30px; }
    .land-demo { padding: 14px; }
    .land-price { padding: 24px 18px; }
    .panel.form { padding: 22px 18px; }
}
