/* Дизайн-набор «Бенто» АО «ЗСП»: токены светлой и тёмной темы и общие компоненты (docs/UI.md §1–3, §9).
   Одна разметка — две темы: тема задаётся атрибутом <html data-theme="light|dark"> (ui/theme.js).
   Корневой класс приложения — .zsp на <body>. Экраны приложений — в их собственных CSS. */

/* ---------- Токены: светлая тема ---------- */
.zsp {
  --bg: #eceef2; --surface: #fff; --surface-2: #f2f3f6; --text: #141821; --muted: #5f6877; --border: #e3e6eb;
  --primary: #2f5bea; --primary-ink: #fff; --primary-soft: #e7edfe; --accent: var(--primary);
  --success: #15803d; --success-ink: #fff; --danger: #c62828;
  --st-new: #2563eb; --st-work: #b7791f; --st-pause: #7c6f9b; --st-wait: #0e9384; --st-done: #16a34a; --st-reject: #dc2626;
  --ch-1: #2f5bea; --ch-2: #0e9384;
  --font: 'Golos Text', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; --font-display: var(--font);
  --font-mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --radius: 22px; --radius-sm: 14px; --radius-lg: 28px; --shadow: 0 12px 40px rgba(16, 24, 40, .14);
  --nav-bg: var(--surface); --nav-text: var(--text); --nav-muted: var(--muted); --nav-active-bg: #141821; --nav-active-text: #fff;
  --badge-bg: #ff5b3a; --badge-ink: #fff;
  --h: 38px; --duo-dark: #10223d; --duo-light: #cfe0ff; --bars: var(--bg);
  --sheet-bg: var(--bg); --field: var(--surface); --field-border: var(--border);
  --skel: #e2e5ea; --skel-hi: #eef0f3;
  color-scheme: light;
}
/* ---------- Токены: тёмная тема ---------- */
[data-theme="dark"] .zsp {
  color-scheme: dark;
  --bg: #0e1014; --surface: #171a20; --surface-2: #1f232b; --text: #eceff4; --muted: #9298a5; --border: #282d36;
  --primary: #8ea6ff; --primary-ink: #0b1020; --primary-soft: rgba(142,166,255,.14);
  --success: #2f9e5f; --success-ink: #05150b; --danger: #ff6b6b;
  --st-new: #6ea8ff; --st-work: #f2a93b; --st-pause: #a99bd8; --st-wait: #34d3be; --st-done: #5ad08a; --st-reject: #ff7a7a;
  --nav-bg: #171a20; --nav-text: #eceff4; --nav-muted: #9298a5; --nav-active-bg: #eceff4; --nav-active-text: #0e1014;
  --badge-bg: #ff7a59; --badge-ink: #1a0b05;
  --sheet-bg: #111317; --field: #0b0d10; --field-border: #353b46;
  --shadow: 0 20px 60px rgba(0,0,0,.55); --ch-1: #8ea6ff; --ch-2: #34d3be;
  --skel: #1f232b; --skel-hi: #2a2f39;
}
/* плавная смена темы (только в момент переключения; ui/theme.js ставит класс на 300 мс) */
.theme-anim .zsp, .theme-anim .zsp * { transition: background-color .2s, color .2s, border-color .2s, box-shadow .2s, fill .2s !important; }
@media (prefers-reduced-motion: reduce) { .theme-anim .zsp, .theme-anim .zsp * { transition: none !important; } }

/* ---------- Основа ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* тонкие полосы прокрутки (Firefox; в Chrome стандартные свойства тоже поддержаны), цвет — полупрозрачный, подходит обеим темам */
* { scrollbar-width: thin; scrollbar-color: rgba(128,134,148,.45) transparent; }
[data-theme="dark"] { color-scheme: dark; }
body.zsp { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
/* сброс — с нулевой специфичностью (:where), чтобы классы компонентов всегда его перекрывали */
:where(.zsp) :where(h1, h2, h3, h4) { margin: 0; font-family: var(--font-display); font-weight: 600; line-height: 1.2; letter-spacing: -.01em; }
:where(.zsp) h1 { font-size: clamp(24px, 3vw, 32px); font-weight: 800; letter-spacing: -.03em; }
:where(.zsp) :where(p) { margin: 0; }
:where(.zsp) :where(a) { color: inherit; text-decoration: none; }
:where(.zsp) :where(button, input, textarea, select) { font: inherit; color: inherit; }
:where(.zsp) :where(button) { cursor: pointer; background: none; border: 0; padding: 0; }
:where(.zsp) :where(button:disabled) { cursor: default; }
:where(.zsp) :where(img) { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.ic { width: 20px; height: 20px; flex: none; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; }
.num .no { font-style: normal; letter-spacing: 0; }
.eyebrow { font-size: 12.5px; letter-spacing: .04em; color: var(--muted); margin-bottom: 6px; }
.link { color: var(--primary); display: inline-flex; align-items: center; gap: 4px; font-weight: 500; }
.link .ic { width: 16px; height: 16px; }
.link:hover { text-decoration: underline; }
.zsp :focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* поля и выпадающие списки подсвечиваются рамкой (ниже) — второй контур не нужен */
.zsp :is(input, textarea, select, .dd-btn):focus-visible { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.pre { white-space: pre-line; overflow-wrap: anywhere; }

/* ---------- Кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--h); padding: 0 16px; border-radius: 999px;
  font-weight: 600; font-size: 14.5px; white-space: nowrap; transition: transform .15s, background .2s, box-shadow .2s, border-color .2s, opacity .2s; border: 1px solid transparent; }
.btn .ic { width: 18px; height: 18px; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; transform: none; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-success { background: var(--success); color: var(--success-ink); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
[data-theme="dark"] .btn-ghost { border-color: #353b46; }
[data-theme="dark"] .btn-ghost:hover:not(:disabled) { background: #232831; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 15.5px; }
.btn-sm { height: 32px; padding: 0 14px; font-size: 13.5px; }
.btn-block { width: 100%; }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--primary-ink) transparent var(--primary-ink) transparent; animation: spin .8s linear infinite; }
.btn-ghost.is-busy::after { border-color: var(--text) transparent var(--text) transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { width: var(--h); height: var(--h); display: inline-grid; place-items: center; border-radius: 999px; color: var(--muted); position: relative; flex: none; transition: background .2s, color .2s; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn-primary { background: var(--primary); color: var(--primary-ink); }
.icon-btn-primary:hover { background: var(--primary); color: var(--primary-ink); filter: brightness(1.08); }
.badge { font-style: normal; font-size: 11.5px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-grid; place-items: center; background: var(--primary-soft); color: var(--primary); }

/* переключатель темы: солнце в тёмной теме, луна — в светлой */
.theme-btn .ic-sun { display: none; }
[data-theme="dark"] .theme-btn .ic-sun { display: block; }
[data-theme="dark"] .theme-btn .ic-moon { display: none; }
.theme-btn .ic { transition: transform .4s cubic-bezier(.2,.8,.2,1); }
.theme-btn:hover .ic { transform: rotate(-18deg); }

/* ---------- Поля ---------- */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span, .field-l { font-size: 13.5px; font-weight: 600; }
.field input, .field textarea, .search input { width: 100%; min-height: var(--h); padding: 8px 12px; border: 1px solid var(--field-border); border-radius: var(--radius-sm); background: var(--field); outline: none; transition: border-color .2s, box-shadow .2s; }
.field textarea { resize: vertical; min-height: 84px; }
.field input:focus, .field textarea:focus, .search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 10%, transparent); }
.field input:disabled { background: var(--surface-2); color: var(--muted); border-color: var(--border); cursor: not-allowed; opacity: .8; }
[data-theme="dark"] .field input:disabled { background: #14171c; border-color: #262b34; }
.field input:disabled::placeholder { color: color-mix(in srgb, var(--muted) 60%, transparent); }
.field.has-err input, .field.has-err textarea, .has-err > .dd .dd-btn { border-color: var(--danger); }
.req { color: var(--danger); font-style: normal; }
.opt { font-weight: 400; font-size: 13px; color: var(--muted); margin-left: 4px; }
.err { color: var(--danger); font-size: 13px; font-style: normal; display: block; }
.hint { font-size: 12.5px; color: var(--muted); }
.check { display: inline-flex; align-items: flex-start; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--primary); flex: none; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.search { position: relative; display: flex; align-items: center; min-width: 220px; }
.search .ic { position: absolute; left: 11px; width: 18px; color: var(--muted); }
.search input { padding-left: 36px; border-radius: 999px; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); gap: 2px; }
.seg button, .seg a { height: calc(var(--h) - 8px); padding: 0 12px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.seg button.is-on, .seg a.is-on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); font-weight: 600; }
.seg em { font-style: normal; font-size: 11.5px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
[data-theme="dark"] .seg { background: #13161b; }
[data-theme="dark"] .seg button.is-on, [data-theme="dark"] .seg a.is-on { background: #2a2f39; box-shadow: none; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.av { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-size: 13px; font-weight: 700; flex: none; }
[data-theme="dark"] .av { background: rgba(142,166,255,.16); color: #b9c8ff; }

/* чипы-варианты */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-opt { min-height: var(--h); padding: 6px 14px; border-radius: 19px; border: 1px solid var(--field-border); background: var(--field); font-size: 14px; font-weight: 500; line-height: 1.3; text-align: left; transition: all .15s; }
.chip-opt:hover { border-color: var(--primary); }
.chip-opt.is-on { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.chip-opt .ic { width: 16px; height: 16px; display: inline-block; vertical-align: -3px; margin-right: 4px; }

/* переключатель */
.switch { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; position: relative; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { width: 38px; height: 22px; border-radius: 11px; background: var(--border); position: relative; transition: background .2s; flex: none; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--primary); } .switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
[data-theme="dark"] .switch span { background: #3a404b; }

/* выпадающий список с поиском (собственный, не select) */
.dd { position: relative; flex: 1; min-width: 0; }
.dd-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: var(--h); padding: 6px 12px; text-align: left; color: var(--muted);
  border: 1px solid var(--field-border); border-radius: var(--radius-sm); background: var(--field); transition: border-color .2s, box-shadow .2s; }
.dd-v { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.dd.has-val .dd-btn { color: var(--text); font-weight: 500; }
.dd-btn .ic { width: 18px; height: 18px; color: var(--muted); transition: transform .2s; }
.dd.is-open .dd-btn, .dd-btn:focus-visible { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 10%, transparent); }
.dd.is-open .dd-btn .ic { transform: rotate(180deg); }
.dd-pop { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 8; padding: 8px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--field-border); box-shadow: var(--shadow); }
[data-theme="dark"] .dd-pop { background: #1b1f26; border-color: #3a404b; }
.dd-list { list-style: none; margin: 8px 0 0; padding: 0; max-height: 232px; overflow: auto; display: grid; gap: 2px; }
.dd-list li { padding: 9px 10px; border-radius: 10px; cursor: pointer; font-size: 14.5px; display: flex; gap: 8px; align-items: flex-start; }
.dd-list li:hover, .dd-list li.is-hl { background: var(--surface-2); }
.dd-list li.is-on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.dd-list li .ic { width: 16px; height: 16px; margin-top: 2px; opacity: 0; }
.dd-list li.is-on .ic { opacity: 1; }
.dd-empty { padding: 12px 10px 6px; color: var(--muted); font-size: 13.5px; }

/* ---------- Статусы: цвет + подпись ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 2px 10px; border-radius: 13px; font-size: 12.5px; font-weight: 600; line-height: 1.25;
  --c: var(--muted); background: color-mix(in srgb, var(--c) 13%, transparent); color: color-mix(in srgb, var(--c) 70%, var(--text)); }
.chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); flex: none; }
.st-new { --c: var(--st-new); } .st-work { --c: var(--st-work); } .st-pause { --c: var(--st-pause); }
.st-wait { --c: var(--st-wait); } .st-done { --c: var(--st-done); } .st-reject { --c: var(--st-reject); }
.tag { font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 6px; text-transform: uppercase; letter-spacing: .03em; }
.tag-urgent { background: var(--danger); color: #fff; }
[data-theme="dark"] .tag-urgent { color: #1a0505; }

/* ---------- Цвета блоков услуг (подложка --bb, значок --bf) ---------- */
.b-ic { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: var(--bb, var(--primary-soft)); color: var(--bf, var(--primary)); flex: none; }
.b-ic .ic { width: 22px; height: 22px; }
[data-b="pass"] { --bb: #e8efff; --bf: #2f5bea; } [data-b="parking"] { --bb: #e9f7ff; --bf: #0284c7; }
[data-b="cleaning"] { --bb: #e6faf5; --bf: #0f9488; } [data-b="waste"] { --bb: #eef8e3; --bf: #4d7c0f; }
[data-b="repair"] { --bb: #fff0e6; --bf: #e05a12; } [data-b="extra_works"] { --bb: #f3edff; --bf: #7c3aed; }
[data-b="forklift"] { --bb: #fff7d6; --bf: #a16207; } [data-b="work_permit"] { --bb: #ffeaf3; --bf: #db2777; }
[data-b="off_hours"] { --bb: #ecebff; --bf: #4f46e5; } [data-b="work_approval"] { --bb: #e8f4ff; --bf: #1d6fb8; }
[data-b="lease"] { --bb: #f1f2f4; --bf: #374151; } [data-b="documents"] { --bb: #fdf2e9; --bf: #b45309; }
[data-b="feedback"] { --bb: #fde9ec; --bf: #e11d48; } [data-b="telecom"] { --bb: #e5f8fb; --bf: #0e7490; }
[data-b="oneoff"] { --bb: #e6f7ee; --bf: #15803d; } [data-b="inbox"] { --bb: #f1f2f4; --bf: #475467; }
[data-theme="dark"] [data-b="pass"] { --bb: rgba(110,140,255,.14); --bf: #9db4ff; } [data-theme="dark"] [data-b="parking"] { --bb: rgba(56,170,240,.14); --bf: #7cc8f5; }
[data-theme="dark"] [data-b="cleaning"] { --bb: rgba(45,200,180,.13); --bf: #5ed9c6; } [data-theme="dark"] [data-b="waste"] { --bb: rgba(130,190,60,.13); --bf: #a6d46a; }
[data-theme="dark"] [data-b="repair"] { --bb: rgba(255,130,60,.14); --bf: #ffa772; } [data-theme="dark"] [data-b="extra_works"] { --bb: rgba(160,110,255,.15); --bf: #bfa0ff; }
[data-theme="dark"] [data-b="forklift"] { --bb: rgba(230,180,40,.13); --bf: #f0c75a; } [data-theme="dark"] [data-b="work_permit"] { --bb: rgba(240,90,160,.14); --bf: #f592c2; }
[data-theme="dark"] [data-b="off_hours"] { --bb: rgba(120,110,255,.15); --bf: #a9a2ff; } [data-theme="dark"] [data-b="work_approval"] { --bb: rgba(70,150,230,.14); --bf: #8cc0f2; }
[data-theme="dark"] [data-b="lease"] { --bb: rgba(255,255,255,.07); --bf: #c9ced8; } [data-theme="dark"] [data-b="documents"] { --bb: rgba(220,140,50,.14); --bf: #f0b26a; }
[data-theme="dark"] [data-b="feedback"] { --bb: rgba(240,80,110,.14); --bf: #f88aa0; } [data-theme="dark"] [data-b="telecom"] { --bb: rgba(40,180,200,.14); --bf: #6fd2e2; }
[data-theme="dark"] [data-b="oneoff"] { --bb: rgba(60,200,120,.14); --bf: #6fdc9c; } [data-theme="dark"] [data-b="inbox"] { --bb: rgba(255,255,255,.07); --bf: #c9ced8; }

/* ---------- Логотип: круг и 2 × 4 полосы, сборка при открытии страницы ---------- */
.logo { width: 36px; height: 36px; flex: none; color: var(--logo, currentColor); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-text { display: grid; line-height: 1.15; }
.brand-text b { font-family: var(--font-display); font-size: 15px; letter-spacing: .01em; }
.brand-text small { font-size: 12px; color: var(--nav-muted, var(--muted)); }
.logo-anim .logo-t rect, .logo-anim .logo-b rect { animation: lgT 1.1s cubic-bezier(.2,.8,.2,1) both; }
.logo-anim .logo-b rect { animation-name: lgB; }
.logo-anim rect:nth-child(2) { animation-delay: .08s; } .logo-anim rect:nth-child(3) { animation-delay: .16s; } .logo-anim rect:nth-child(4) { animation-delay: .24s; }
.logo-anim .logo-ring { stroke-dasharray: 280; animation: lgR 1.4s ease-out both; }
@keyframes lgT { from { transform: translateY(-62px); } }
@keyframes lgB { from { transform: translateY(62px); } }
@keyframes lgR { from { stroke-dashoffset: 280; } }

/* ---------- Фото: слайд-шоу с диагональной шторкой ---------- */
.ph { position: absolute; inset: 0; overflow: hidden; background: var(--duo-dark); }
.ph-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ph-slide { position: absolute; inset: 0; z-index: 0; }
.ph-slide.is-under { z-index: 1; }
.ph-slide.is-in { z-index: 2; animation: wipe 1.4s cubic-bezier(.7,0,.2,1) both; }
/* Увеличение идёт и пока кадр уходит под следующий (is-under): то же имя анимации не перезапускается, рывка к исходному размеру нет */
.ph-slide.is-in .ph-img, .ph-slide.is-under .ph-img { animation: kb 14s ease-out both; }
@keyframes wipe { from { clip-path: polygon(0 0, 0 0, -40% 100%, -40% 100%); } to { clip-path: polygon(0 0, 140% 0, 100% 100%, -40% 100%); } }
@keyframes kb { from { transform: scale(1.02); } to { transform: scale(1.14) translate(-2%, -1.5%); } }
@media (prefers-reduced-motion: reduce) { .ph *, .logo * { animation: none !important; } }

/* ---------- Оболочка: плавающая шапка-«таблетка» ---------- */
.shell { min-height: 100vh; display: flow-root; }   /* flow-root: верхний отступ шапки не «вытекает» наружу и не даёт лишней прокрутки */
.nav { display: flex; align-items: center; gap: 12px; background: var(--nav-bg); color: var(--nav-text);
  position: sticky; top: 12px; z-index: 20; height: 64px; padding: 0 clamp(16px, 2.4vw, 24px); margin: 12px auto 0; width: min(1320px, calc(100% - 24px));
  border-radius: 22px; box-shadow: 0 4px 18px rgba(20,24,33,.06); }
[data-theme="dark"] .nav { box-shadow: 0 0 0 1px #232831, 0 8px 30px rgba(0,0,0,.35); }
.nav-links { display: flex; gap: 4px; margin-left: 24px; }
.nav-link { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 14px; border-radius: 999px; color: var(--nav-muted); font-weight: 500; font-size: 14.5px; transition: background .2s, color .2s; white-space: nowrap; }
.nav-link:hover { color: var(--nav-text); background: color-mix(in srgb, var(--nav-text) 6%, transparent); }
.nav-link.is-active { background: var(--nav-active-bg); color: var(--nav-active-text); font-weight: 600; }
.nav-link em { font-style: normal; font-size: 11.5px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-grid; place-items: center; background: var(--badge-bg); color: var(--badge-ink); }
.nav-link em.soon { background: transparent; color: var(--nav-muted); font-weight: 500; }
[data-theme="dark"] .nav-link.is-active em { background: #0e1014; color: #eceff4; }
.nav-new { margin-left: auto; }
.nav-tools { display: flex; align-items: center; gap: 4px; }
.nav-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.nav-user .icon-btn { color: var(--nav-muted); }
.tabbar { display: none; }
.main { padding: 24px clamp(12px, 3vw, 32px) clamp(24px, 4vw, 40px); max-width: 1320px; margin: 0 auto; width: 100%; }

/* ---------- Карточки, страницы ---------- */
.page { display: grid; gap: 20px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.card { background: var(--surface); border-radius: var(--radius); padding: 20px; }
.card-h { font-size: 16px; margin-bottom: 14px; }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.sec-h { font-size: 20px; font-weight: 700; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin: 0; }
.facts dt { font-size: 12.5px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.empty { padding: 32px; text-align: center; color: var(--muted); }

/* ---------- Порции длинного списка (portal/js/pager.js; UI.md §1 «Длинные списки») ---------- */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 4px 4px; }
.pager-sum { font-size: 13px; font-variant-numeric: tabular-nums; }
.pager-pages { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.pager-btn { min-width: 36px; height: 36px; padding: 0 10px; border: 0; border-radius: 10px; background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; font-variant-numeric: tabular-nums; cursor: pointer; display: inline-grid; place-items: center; transition: background .15s, box-shadow .15s; }
.pager-btn:hover:not(:disabled):not(.is-on) { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--primary) 40%, transparent); }
.pager-btn.is-on { background: var(--primary); color: var(--primary-ink); font-weight: 600; cursor: default; }
.pager-btn:disabled { opacity: .35; cursor: default; }
.pager-btn .ic { width: 16px; height: 16px; }
.pager-prev { display: inline-flex; transform: scaleX(-1); }
.pager-gap { min-width: 20px; text-align: center; color: var(--muted); }
.pager-phone { flex-direction: column; justify-content: center; gap: 6px; }
.pager-more { width: 100%; }
.note { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--primary-soft); font-size: 14px; }
.note .ic { color: var(--primary); }
.rule, .warn { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--st-work) 12%, transparent); font-size: 13.5px; }
.rule .ic, .warn .ic { color: var(--st-work); }
[data-theme="dark"] .rule, [data-theme="dark"] .warn { background: rgba(242,169,59,.1); border: 1px solid rgba(242,169,59,.25); }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 14px;
  background: color-mix(in srgb, var(--danger) 10%, transparent); color: color-mix(in srgb, var(--danger) 70%, var(--text)); }
.alert .ic { color: var(--danger); }

/* ---------- Лента событий ---------- */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.timeline li { position: relative; padding: 0 0 18px 24px; display: grid; gap: 2px; }
.timeline li::before { content: ''; position: absolute; left: 4px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); }
.timeline li::after { content: ''; position: absolute; left: 8px; top: 18px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline li:last-child::before { background: var(--primary); }
.timeline time { font-size: 12.5px; color: var(--muted); }
.timeline p { font-size: 14px; color: var(--muted); }

/* ---------- Шторка (боковая панель) ---------- */
#sheet { position: fixed; inset: 0; z-index: 60; }
.sheet-back { position: absolute; inset: 0; background: rgba(10,14,22,.45); opacity: 0; transition: opacity .25s; }
.sheet { position: absolute; right: 0; top: 0; bottom: 0; width: min(600px, 100%); background: var(--sheet-bg); box-shadow: var(--shadow); display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .32s cubic-bezier(.2,.8,.2,1); }
.sheet-wide .sheet { width: min(860px, 100%); }
#sheet.open .sheet-back { opacity: 1; } #sheet.open .sheet { transform: none; }
.sheet-h { display: flex; gap: 14px; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border); background: var(--surface); }
.sheet-h > div { flex: 1; min-width: 0; } .sheet-h h2 { font-size: 20px; } .sheet-h .eyebrow { margin-bottom: 2px; }
.sheet-ic { width: 46px; height: 46px; }
.sheet-body { flex: 1; overflow: auto; padding: 20px; display: grid; gap: 16px; align-content: start; overscroll-behavior: contain; }
.sheet-f { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface); }
[data-theme="dark"] .sheet-h, [data-theme="dark"] .sheet-f { background: #15181d; border-color: #262b34; }
@media (prefers-reduced-motion: reduce) { .sheet, .sheet-back { transition: none; } }

/* ---------- Уведомление внизу ---------- */
#toast { position: fixed; left: 50%; bottom: 28px; z-index: 80; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; display: flex; gap: 10px; align-items: center;
  padding: 12px 18px; border-radius: 14px; background: #111827; color: #fff; font-size: 14.5px; box-shadow: var(--shadow); transition: all .3s; max-width: calc(100% - 32px); }
#toast .ic { color: #4ade80; } #toast.is-err .ic { color: #ff8a8a; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
[data-theme="dark"] #toast { background: #232831; border: 1px solid #353b46; }

/* ---------- Просмотр картинок (ui/viewer.js) ---------- */
#viewer { --vw-a: 1; position: fixed; inset: 0; z-index: 70; display: grid; grid-template-rows: auto minmax(0, 1fr); color: #fff;
  background: rgba(8, 10, 14, calc(.94 * var(--vw-a))); touch-action: none; overscroll-behavior: contain; user-select: none; }
.vw-bar { display: flex; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 12px 10px 18px; opacity: var(--vw-a); }
.vw-n { flex: none; font-size: 13px; color: rgba(255,255,255,.7); font-variant-numeric: tabular-nums; }
.vw-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#viewer .icon-btn { width: 42px; height: 42px; color: #fff; background: rgba(255,255,255,.12); }
#viewer .icon-btn:hover { background: rgba(255,255,255,.22); }
.vw-stage { position: relative; overflow: hidden; cursor: zoom-in; }
#viewer.is-zoomed .vw-stage { cursor: grab; }
.vw-img { position: absolute; inset: 0 12px calc(12px + env(safe-area-inset-bottom)); margin: auto; max-width: calc(100% - 24px); max-height: calc(100% - 12px - env(safe-area-inset-bottom));
  border-radius: 6px; transform-origin: center; will-change: transform; -webkit-user-drag: none; transition: opacity .2s; }
#viewer.vw-anim .vw-img { transition: transform .22s ease, opacity .2s; }
#viewer.is-loading .vw-img { opacity: .35; }
.vw-nav { position: absolute; top: 50%; width: 48px; height: 48px; margin-top: -24px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.12); color: #fff; transition: background .2s; }
.vw-nav:hover { background: rgba(255,255,255,.24); }
.vw-nav .ic { width: 24px; height: 24px; }
.vw-prev { left: 18px; } .vw-next { right: 18px; }
.vw-nav[hidden] { display: none; }
@media (hover: none) { .vw-nav { display: none; } }   /* на телефоне листают свайпом */
@media (prefers-reduced-motion: reduce) { #viewer.vw-anim .vw-img { transition: none; } }

/* ---------- Скелетоны и ошибка загрузки ---------- */
.skel { display: block; border-radius: 12px; background: linear-gradient(90deg, var(--skel) 25%, var(--skel-hi) 50%, var(--skel) 75%); background-size: 300% 100%; animation: skel 1.4s ease-in-out infinite; }
@keyframes skel { from { background-position: 100% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }
.load-err { display: grid; justify-items: center; gap: 12px; padding: 40px 20px; text-align: center; background: var(--surface); border-radius: var(--radius); }
.load-err .ic { width: 32px; height: 32px; color: var(--muted); }

/* ---------- Адаптив ---------- */
@media (max-width: 860px) {
  .nav { top: 0; margin: 0; width: 100%; border-radius: 0; height: 60px; padding: 0 12px; }
  .nav .nav-links, .nav .nav-new { display: none !important; }
  .nav-tools { margin-left: auto; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--nav-bg); border-top: 1px solid var(--border); padding: 6px 6px calc(8px + env(safe-area-inset-bottom)); }
  .tabbar .nav-link { flex: 1; flex-direction: column; height: auto; gap: 2px; padding: 6px 2px; font-size: 11px; position: relative; border-radius: 14px; }
  .tabbar .nav-link em { position: absolute; top: 2px; left: calc(50% + 6px); margin: 0; min-width: 18px; height: 18px; font-size: 10.5px; }
  .tabbar .nav-link em.soon { display: none; }
  .tabbar .nav-new-tab { color: var(--primary); }
  #toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
}

/* Фото пользователя поверх инициалов (apps/portal/js/avatars.js); нет файла — инициалы остаются */
.av, .kav { position: relative; overflow: hidden; }
.av-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.av-xl { width: 72px; height: 72px; font-size: 24px; }
/* «Контакты»: данные слева, фото справа (кнопка под кругом); на узком экране фото — сверху по центру */
.contacts { display: flex; gap: 24px; align-items: flex-start; }
.contacts-main { flex: 1; min-width: 0; }
.av-edit { flex: none; display: flex; flex-direction: column; align-items: center; gap: 8px; width: 132px; }
.av-del { background: none; border: 0; padding: 0; font: inherit; font-size: 12.5px; color: var(--muted); cursor: pointer; text-decoration: underline; }
.av-del:hover { color: var(--text); }
.av-del[hidden] { display: none; }
@media (max-width: 560px) {
  .contacts { flex-direction: column-reverse; align-items: stretch; gap: 12px; }
  .av-edit { width: auto; }
}
