/* =========================================================
   ZYOPS — дизайн-система. Все цвета/радиусы/тени — токены ниже.
   Чтобы перекрасить портал, достаточно поменять :root.
   ========================================================= */
:root {
  --brand: #4f46e5; --brand-2: #06b6d4; --brand-ink: #fff; --brand-soft: #eef2ff;
  --bg: #f6f7fb; --surface: #ffffff; --surface-2: #f8fafc; --line: #e5e7eb; --line-2: #eef0f4;
  --ink: #0f172a; --ink-2: #334155; --muted: #64748b; --faint: #94a3b8;
  --ok: #16a34a; --ok-soft: #dcfce7; --warn: #d97706; --warn-soft: #fef3c7; --err: #dc2626; --err-soft: #fee2e2;
  --radius: 14px; --radius-sm: 10px; --radius-lg: 20px;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 4px 16px rgba(15,23,42,.06);
  --shadow-lg: 0 10px 40px rgba(15,23,42,.14);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --top-h: 60px;
  color-scheme: light;
}
:root { --row-mix: 65%; }
/* Тёмная тема: включается атрибутом <html data-theme="dark"> (переключатель в меню, по умолчанию — тёмная) */
:root[data-theme="dark"] {
  --brand-soft: #1e1b4b; --bg: #0b1020; --surface: #121a2e; --surface-2: #0f172a; --line: #24304a; --line-2: #1b253b;
  --ink: #e5e7eb; --ink-2: #cbd5e1; --muted: #94a3b8; --faint: #64748b;
  --ok-soft: #052e16; --warn-soft: #3b2a05; --err-soft: #3f0d0d;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
  --row-mix: 16%; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
body.no-scroll { overflow: hidden; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 28px; font-weight: 800; } h2 { font-size: 21px; font-weight: 700; } h3 { font-size: 17px; font-weight: 650; }
p { margin: 0 0 1em; }
img { max-width: 100%; }
.ic { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.nowrap { white-space: nowrap; } .grow { flex: 1; min-width: 0; } .center { text-align: center; }
.hide { display: none !important; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-end { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.stack > * + * { margin-top: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- верхняя панель ---------- */
.topbar { position: sticky; top: 0; z-index: 50; height: var(--top-h); display: flex; align-items: center; gap: 14px; padding: 0 20px;
  background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: saturate(1.6) blur(14px); border-bottom: 1px solid var(--line); }
.topbar.transparent { background: transparent; border-color: transparent; backdrop-filter: none; position: absolute; left: 0; right: 0; }
.topbar.transparent .nav a, .topbar.transparent .brand, .topbar.transparent .lang-btn { color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--ink); font-size: 16px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; }
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav a, .nav button.link { color: var(--ink-2); padding: 8px 12px; border-radius: 10px; font-weight: 500; display: inline-flex; gap: 6px; align-items: center; background: none; border: 0; font: inherit; cursor: pointer; }
.nav a:hover, .nav button.link:hover { background: color-mix(in srgb, var(--brand) 10%, transparent); text-decoration: none; }
.nav a.active { color: var(--brand); }
.nav .btn { margin-left: 4px; }
.lang-btn { font-weight: 700; font-size: 13px; letter-spacing: .04em; }
.topbar .burger { display: none; margin-left: auto; }
@media (max-width: 760px) {
  .topbar { padding: 0 12px; }
  .topbar .burger { display: inline-flex; }
  .nav { display: none; position: absolute; top: var(--top-h); right: 8px; left: 8px; flex-direction: column; align-items: stretch; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow-lg); }
  .nav.open { display: flex; }
  .topbar.transparent .nav a, .topbar.transparent .nav .lang-btn { color: var(--ink-2); }
  .nav .btn { margin: 4px 0 0; justify-content: center; }
}

/* ---------- контейнеры и карточки ---------- */
.container { max-width: 1160px; margin: 0 auto; padding: 28px 20px 60px; }
.container-sm { max-width: 460px; }
.container-md { max-width: 820px; }
@media (max-width: 760px) { .container { padding: 18px 12px 48px; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card + .card { margin-top: 18px; }
.card-h { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.card-h h2, .card-h h3 { margin: 0; }
.card-h .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 760px) { .card { padding: 16px; border-radius: 12px; } }
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- кнопки ---------- */
.btn { --c: var(--brand); display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 11px; border: 1px solid transparent;
  font: 600 14px/1 var(--font); cursor: pointer; text-decoration: none !important; transition: background .15s, box-shadow .15s, transform .05s, opacity .15s; white-space: nowrap; user-select: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: var(--brand-ink); box-shadow: 0 2px 10px color-mix(in srgb, var(--brand) 35%, transparent); }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 88%, #000); }
.btn-ghost { background: var(--surface); color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--brand) 30%, var(--line)); }
.btn-soft { background: var(--brand-soft); color: var(--brand); }
.btn-soft:hover { background: color-mix(in srgb, var(--brand) 18%, var(--surface)); }
.btn-danger { background: var(--err); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--err); border-color: color-mix(in srgb, var(--err) 35%, transparent); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 13px; }
.btn-block { width: 100%; }
.btn-icon { width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.btn-icon:hover { background: var(--surface-2); color: var(--ink); }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-color: #fff #fff transparent transparent; animation: spin .7s linear infinite; }
.btn-ghost.is-busy::after, .btn-soft.is-busy::after { border-color: var(--brand) var(--brand) transparent transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- формы ---------- */
.fg { margin-bottom: 14px; position: relative; }
.fg > label, .label { display: block; font-weight: 600; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.fg .req::after { content: ' *'; color: var(--err); }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.input, select.input, textarea.input { width: 100%; height: 42px; padding: 0 13px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 15px var(--font); outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 110px; padding: 11px 13px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent); }
.input.is-invalid { border-color: var(--err); box-shadow: 0 0 0 4px color-mix(in srgb, var(--err) 12%, transparent); }
.input.is-valid { border-color: var(--ok); }
.input-sm { height: 34px; font-size: 14px; border-radius: 9px; padding: 0 10px; }
.field-err { color: var(--err); font-size: 12.5px; margin-top: 5px; }
.field-ok { color: var(--ok); font-size: 12.5px; margin-top: 5px; }
.input-group { display: flex; align-items: stretch; }
.input-group .addon { display: flex; align-items: center; padding: 0 12px; background: var(--surface-2); border: 1px solid var(--line); border-right: 0; border-radius: 11px 0 0 11px; color: var(--muted); font-size: 14px; white-space: nowrap; }
.input-group .input { border-radius: 0 11px 11px 0; }
.input-group .btn { border-radius: 0 11px 11px 0; height: 42px; }
.input-group .input:not(:last-child) { border-radius: 11px 0 0 11px; }
.pass-wrap { position: relative; }
.pass-wrap .btn-icon { position: absolute; right: 4px; top: 4px; }
input[type=color] { width: 44px; height: 38px; padding: 2px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
input[type=range] { width: 100%; accent-color: var(--brand); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; margin: 0; }
/* переключатель */
.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; padding: 10px 0; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .tr { flex: none; width: 42px; height: 24px; border-radius: 99px; background: var(--line); position: relative; transition: background .2s; margin-top: 1px; }
.switch .tr::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + .tr { background: var(--brand); }
.switch input:checked + .tr::after { transform: translateX(18px); }
.switch input:disabled + .tr { opacity: .5; }
.switch input:focus-visible + .tr { box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 20%, transparent); }
.switch b { display: block; font-weight: 600; font-size: 14px; }
.switch span.d { display: block; font-size: 12.5px; color: var(--muted); }
/* сегментированный выбор */
.seg { display: grid; gap: 8px; }
.seg label { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; cursor: pointer; transition: border-color .15s, background .15s; }
.seg label:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.seg input { margin-top: 3px; accent-color: var(--brand); }
.seg label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }

/* ---------- бейджи ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-err { background: var(--err-soft); color: var(--err); border-color: transparent; }
.badge-brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.badge .ic { width: 13px; height: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; border: 1px solid rgba(0,0,0,.08); color: #1f2937; white-space: nowrap; }
.prio { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.lock-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--warn); background: var(--warn-soft); padding: 1px 7px; border-radius: 6px; }
.lock-tag .ic { width: 12px; height: 12px; }

/* ---------- таблицы ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: filter .1s; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { filter: brightness(.97); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .t-subject { font-weight: 600; color: var(--ink); min-width: 200px; max-width: 380px; }
.table .t-subject a { color: inherit; }
/* на мобильных таблица не «рассыпается»: столбец «Тема» закреплён, остальное прокручивается ПОД ним.
   Фон закреплённой ячейки задан явно и непрозрачно — иначе соседние столбцы просвечивают сквозь неё. */
.table .sticky { position: sticky; left: 0; z-index: 2; background: var(--surface); box-shadow: 1px 0 0 var(--line), 6px 0 8px -6px rgba(15,23,42,.18); }
.table thead .sticky { background: var(--surface-2); z-index: 3; }
.table tbody tr.t-row .sticky { background: color-mix(in srgb, var(--row, #fff) var(--row-mix), var(--surface)); }
.t-num { color: var(--muted); font-weight: 500; margin-right: 2px; }
.table tbody tr { background: var(--surface); }
@media (max-width: 760px) {
  .table th, .table td { padding: 10px 10px; }
  .table .t-subject { min-width: 150px; max-width: 46vw; }
}
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty .ic { width: 40px; height: 40px; color: var(--faint); margin-bottom: 10px; }

/* ---------- фильтры и пагинатор ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .input { width: auto; }
.toolbar .search { flex: 1; min-width: 180px; max-width: 320px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: 500 13.5px var(--font); cursor: pointer; user-select: none; }
.chip:has(input:checked), .chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.chip input { display: none; }
.pager { display: flex; align-items: center; gap: 6px; justify-content: space-between; flex-wrap: wrap; margin-top: 14px; }
.pager .pages { display: flex; gap: 4px; flex-wrap: wrap; }
.pager button { min-width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: 600 13px var(--font); cursor: pointer; padding: 0 8px; }
.pager button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.pager button:disabled { opacity: .4; cursor: default; }

/* ---------- лендинг ---------- */
.hero { position: relative; min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; overflow: hidden; color: #fff;
  background: radial-gradient(1200px 600px at 10% -10%, #7c3aed 0%, transparent 60%), radial-gradient(900px 600px at 110% 10%, #06b6d4 0%, transparent 55%),
              radial-gradient(800px 700px at 50% 120%, #2563eb 0%, transparent 60%), #0b1026; }
.hero::before { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 48px 48px; mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%); }
.blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; animation: float 18s ease-in-out infinite; }
.blob.b1 { width: 420px; height: 420px; background: #a855f7; top: 10%; left: -120px; }
.blob.b2 { width: 360px; height: 360px; background: #22d3ee; bottom: -80px; right: -60px; animation-delay: -6s; }
.blob.b3 { width: 260px; height: 260px; background: #6366f1; top: 40%; left: 55%; animation-delay: -12s; }
@keyframes float { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(40px, -30px) scale(1.08); } 66% { transform: translate(-30px, 30px) scale(.95); } }
@media (prefers-reduced-motion: reduce) { .blob { animation: none; } }
.hero-inner { position: relative; z-index: 3; /* выше .features, чтобы выпадающий список поиска был поверх карточек */ flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 110px 20px 60px; }
.hero h1 { font-size: clamp(34px, 6vw, 64px); font-weight: 800; letter-spacing: -.03em; margin-bottom: 16px;
  background: linear-gradient(180deg, #fff 30%, #c7d2fe); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lead { font-size: clamp(15px, 2vw, 19px); max-width: 640px; color: #cbd5e1; margin-bottom: 34px; }
.hero-search { position: relative; width: 100%; max-width: 620px; }
.hero-search > .ic { position: absolute; left: 18px; top: 18px; width: 22px; height: 22px; color: #64748b; }
.hero-search input { width: 100%; height: 58px; border-radius: 16px; border: 1px solid rgba(255,255,255,.25); padding: 0 20px 0 52px; font: 17px var(--font);
  background: rgba(255,255,255,.96); color: #0f172a; outline: none; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.hero-search input:focus { box-shadow: 0 20px 60px rgba(0,0,0,.35), 0 0 0 5px rgba(99,102,241,.45); }
.search-res { position: absolute; top: 66px; left: 0; right: 0; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); text-align: left; overflow: hidden; z-index: 5; max-height: 60vh; overflow-y: auto; }
.search-res a { display: flex; gap: 12px; align-items: center; padding: 12px 16px; color: inherit; border-bottom: 1px solid var(--line-2); }
.search-res a:hover, .search-res a.kb { background: var(--brand-soft); text-decoration: none; }
.search-res .nf { padding: 16px; color: var(--muted); }
.c-ava { width: 40px; height: 40px; border-radius: 11px; flex: none; display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); overflow: hidden; }
.c-ava img { width: 100%; height: 100%; object-fit: cover; }
.hero-cta { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; justify-content: center; }
.hero-cta .btn-ghost { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.25); }
.hero-cta .btn-ghost:hover { background: rgba(255,255,255,.18); }
.features { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; max-width: 1100px; margin: 0 auto; padding: 0 20px 50px; width: 100%; }
.feature { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); border-radius: 16px; padding: 18px; backdrop-filter: blur(8px); text-align: left; }
.feature .ic { width: 26px; height: 26px; color: #a5b4fc; margin-bottom: 10px; }
.feature b { display: block; margin-bottom: 4px; }
.feature span { font-size: 13.5px; color: #cbd5e1; }
@media (max-width: 900px) { .features { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .features { grid-template-columns: 1fr; } .hero-inner { padding-top: 90px; } }
.footer { text-align: center; padding: 24px; color: var(--muted); font-size: 13px; }
.hero .footer { color: #94a3b8; position: relative; z-index: 1; }

/* ---------- страницы авторизации ---------- */
.auth-page { min-height: calc(100vh - var(--top-h)); display: flex; align-items: center; justify-content: center; padding: 30px 14px;
  background: radial-gradient(800px 400px at 0% 0%, color-mix(in srgb, var(--brand) 14%, transparent), transparent), radial-gradient(700px 400px at 100% 100%, color-mix(in srgb, var(--brand-2) 14%, transparent), transparent); }
.auth-card { width: 100%; max-width: 430px; }
.auth-card h1 { font-size: 24px; }
.success-box { text-align: center; padding: 10px 0; }
.success-box .big { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.success-box .big .ic { width: 32px; height: 32px; }

/* ---------- страница компании ---------- */
.c-page { min-height: calc(100vh - var(--top-h)); background: var(--c-bg, var(--bg)); }
.c-header { position: relative; color: var(--c-head-text, #fff); background: linear-gradient(135deg, var(--c-head, #4f46e5), var(--c-head2, #06b6d4)); background-size: cover; background-position: center; }
.c-header.has-img::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.15), rgba(0,0,0,.55)); }
.c-header-in { position: relative; max-width: 1160px; margin: 0 auto; padding: 34px 20px; min-height: var(--c-head-h, 200px); display: flex; align-items: flex-end; gap: 20px; }
.c-header.center .c-header-in { flex-direction: column; align-items: center; justify-content: flex-end; text-align: center; }
.c-logo { width: 92px; height: 92px; border-radius: 22px; background: rgba(255,255,255,.95); box-shadow: 0 10px 30px rgba(0,0,0,.2); flex: none; overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 36px; font-weight: 800; color: var(--c-accent, var(--brand)); }
.c-logo img { width: 100%; height: 100%; object-fit: contain; }
.c-title { font-size: var(--c-title, 34px); font-weight: 800; margin: 0 0 6px; letter-spacing: -.02em; text-shadow: 0 2px 12px rgba(0,0,0,.15); }
.c-desc { opacity: .92; max-width: 720px; margin: 0; }
.c-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.c-header.center .c-badges { justify-content: center; }
.c-badges .badge { background: rgba(255,255,255,.18); color: inherit; border-color: rgba(255,255,255,.3); backdrop-filter: blur(6px); }
.c-header .admin-link { position: absolute; top: 14px; right: 16px; }
.c-header .admin-link .btn { background: rgba(255,255,255,.18); color: inherit; border-color: rgba(255,255,255,.35); backdrop-filter: blur(6px); }
.c-welcome { font-size: 16px; color: var(--ink-2); }
.c-page .btn-primary { --brand: var(--c-accent, #4f46e5); }
@media (max-width: 760px) { .c-header-in { padding: 24px 14px; gap: 14px; } .c-logo { width: 68px; height: 68px; border-radius: 16px; font-size: 26px; } .c-title { font-size: min(var(--c-title, 34px), 26px); } }
.c-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
@media (max-width: 960px) { .c-layout { grid-template-columns: minmax(0, 1fr); } }

/* ---------- панель управления компании ---------- */
.cp { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 22px; align-items: start; }
.cp-nav { position: sticky; top: calc(var(--top-h) + 16px); display: flex; flex-direction: column; gap: 2px; }
.cp-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 11px; color: var(--ink-2); font-weight: 500; }
.cp-nav a:hover { background: var(--surface); text-decoration: none; }
.cp-nav a.on { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); font-weight: 600; }
.cp-nav .cnt { margin-left: auto; background: var(--err); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; }
@media (max-width: 900px) {
  .cp { grid-template-columns: minmax(0, 1fr); }
  .cp-nav { position: static; flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 4px; scrollbar-width: none; }
  .cp-nav a { white-space: nowrap; background: var(--surface); border: 1px solid var(--line); padding: 8px 12px; }
  .cp-nav a.on { border-color: var(--brand); }
}
.kv { display: grid; grid-template-columns: 200px 1fr; gap: 10px 18px; }
.kv dt { color: var(--muted); font-size: 13.5px; }
.kv dd { margin: 0; font-weight: 500; word-break: break-word; }
@media (max-width: 600px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 10px; } }
.section-t { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin: 22px 0 10px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat b { display: block; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.stat span { font-size: 13px; color: var(--muted); }
@media (max-width: 760px) { .stat-grid { grid-template-columns: 1fr 1fr; } }
.matrix td:not(:first-child), .matrix th:not(:first-child) { text-align: center; width: 90px; }
.drag-row { cursor: grab; }
.drag-row.dragging { opacity: .4; }
.drag-handle { color: var(--faint); cursor: grab; }
.color-dot { width: 26px; height: 26px; border-radius: 8px; border: 1px solid rgba(0,0,0,.12); cursor: pointer; padding: 0; overflow: hidden; }
.color-dot input { opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.design-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
@media (max-width: 960px) { .design-grid { grid-template-columns: minmax(0, 1fr); } }
.preview-box { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; position: sticky; top: calc(var(--top-h) + 16px); }
.preview-box .c-header-in { min-height: calc(var(--c-head-h, 200px) * .7); padding: 20px; }
.preview-box .c-title { font-size: calc(var(--c-title, 34px) * .75); }
.preview-box .c-logo { width: 64px; height: 64px; font-size: 26px; border-radius: 16px; }
.img-slot { display: flex; align-items: center; gap: 12px; }
.img-slot .thumb { width: 64px; height: 64px; border-radius: 12px; border: 1px dashed var(--line); display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--surface-2); color: var(--faint); }
.img-slot .thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- заявка: чат ---------- */
.ticket-head { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 18px; }
.ticket-head h1 { font-size: 24px; margin: 0; flex: 1; min-width: 240px; }
.ticket-head .num { color: var(--muted); font-weight: 600; }
.t-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
@media (max-width: 960px) { .t-layout { grid-template-columns: minmax(0, 1fr); } .t-side { order: -1; } }
.chat { display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 10px; max-width: 86%; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg .ava { width: 34px; height: 34px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff; background: #94a3b8; }
.msg.admin .ava { background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: 10px 14px; box-shadow: var(--shadow); min-width: 120px; position: relative; }
.msg.me .bubble { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 25%, transparent); border-radius: 16px 16px 4px 16px; }
.bubble .meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 4px; flex-wrap: wrap; }
.bubble .meta b { color: var(--ink-2); font-weight: 600; }
.bubble .body { white-space: normal; word-break: break-word; overflow-wrap: anywhere; }
.bubble .tools { position: absolute; top: 4px; right: 4px; display: none; gap: 2px; background: var(--surface); border-radius: 8px; box-shadow: var(--shadow); }
.bubble:hover .tools, .bubble:focus-within .tools { display: flex; }
@media (hover: none) { .bubble .tools { display: flex; position: static; box-shadow: none; background: none; justify-content: flex-end; margin-top: 4px; } }
.bubble .tools .btn-icon { width: 28px; height: 28px; }
.bubble.deleted { opacity: .6; font-style: italic; }
.sys-event { align-self: center; font-size: 12.5px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 4px 12px; display: inline-flex; gap: 6px; align-items: center; }
@media (max-width: 600px) { .msg { max-width: 100%; } .msg .ava { display: none; } }
.att-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.att { display: inline-flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; color: var(--ink-2); max-width: 100%; }
.att:hover { text-decoration: none; border-color: var(--brand); }
.att .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.att-img { display: block; width: 140px; height: 100px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.att-img img { width: 100%; height: 100%; object-fit: cover; }
.composer { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-top: 18px; box-shadow: var(--shadow); }
.composer textarea { border: 0; box-shadow: none !important; padding: 6px; min-height: 70px; background: transparent; }
.composer .bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--line-2); padding-top: 10px; margin-top: 6px; }
.locked-note { display: flex; gap: 10px; align-items: center; padding: 14px 16px; background: var(--surface-2); border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); margin-top: 18px; }
/* загрузки с прогрессом */
.uploads { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.upl { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-size: 13px; }
.upl .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upl .bar-p { width: 110px; height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; flex: none; }
.upl .bar-p i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .15s; }
.upl.done .bar-p { display: none; }
.upl.err { border-color: var(--err); color: var(--err); }
.upl .check { font-size: 12.5px; }
@media (max-width: 520px) { .upl { flex-wrap: wrap; } .upl .bar-p { width: 100%; order: 5; } }
.clip-btn { color: var(--muted); }
.clip-btn:hover { color: var(--brand); }
.values { display: grid; gap: 10px; }
.values .v label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.values .v div { font-weight: 500; word-break: break-word; }

/* ---------- модальные окна и тосты ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(15,23,42,.5); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 16px; opacity: 0; transition: opacity .2s; }
.modal-wrap.show { opacity: 1; }
.modal { position: relative; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 480px; max-height: calc(100vh - 32px); overflow-y: auto; transform: translateY(10px) scale(.98); transition: transform .2s; }
.modal-wide { max-width: 720px; }
.modal-wrap.show .modal { transform: none; }
.modal-body { padding: 24px; }
.modal-x { position: absolute; top: 12px; right: 12px; }
@media (max-width: 520px) { .modal-wrap { align-items: flex-end; padding: 0; } .modal { border-radius: 20px 20px 0 0; max-height: 92vh; } }
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); max-width: 440px; }
.toast { background: #0f172a; color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 14px; opacity: 0; transform: translateY(10px); transition: all .25s; pointer-events: auto; max-width: 100%; }
.toast.show { opacity: 1; transform: none; }
.toast-err { background: var(--err); }
.toast-ok::before { content: '✓  '; color: #4ade80; font-weight: 700; }

/* ---------- скелетон загрузки ---------- */
.skel { background: linear-gradient(90deg, var(--line-2), var(--line), var(--line-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 10px; height: 16px; }
@keyframes sk { to { background-position: -200% 0; } }
.loading-page { display: flex; justify-content: center; padding: 80px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; }

.faq details { border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; background: var(--surface); margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
.faq summary::after { content: '+'; color: var(--brand); font-weight: 700; font-size: 18px; line-height: 1; }
.faq details[open] summary::after { content: '–'; }
.faq details p { margin: 10px 0 0; color: var(--ink-2); }
.copyline { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 6px 6px 12px; font-family: ui-monospace, monospace; font-size: 13px; }
.copyline span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert { padding: 12px 16px; border-radius: 12px; display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.alert .ic { margin-top: 2px; }
.alert-info { background: var(--brand-soft); color: var(--ink-2); }
.alert-warn { background: var(--warn-soft); color: var(--ink-2); }
.alert-err { background: var(--err-soft); color: var(--ink-2); }

/* цвет строки заявки = цвет статуса (в тёмной теме — слабее) */
.table tbody tr.t-row { background: color-mix(in srgb, var(--row, #fff) var(--row-mix), var(--surface)); }
.table tbody tr.t-row td:first-child { box-shadow: inset 4px 0 0 color-mix(in srgb, var(--row, #fff) 100%, #000 18%), 1px 0 0 var(--line), 6px 0 8px -6px rgba(15,23,42,.18); }
.m-only { display: none; }
@media (max-width: 760px) { .m-only { display: inline; } }

.fg > label.btn { display: inline-flex; margin-bottom: 0; color: var(--ink-2); font-size: 13px; }
html, body { overflow-x: hidden; }
@media (hover: none) { .kbd-hint { visibility: hidden; } }

/* капча */
.captcha { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.captcha img { width: 170px; height: 56px; border-radius: 10px; border: 1px solid var(--line); background: #f1f5f9; flex: none; }
.captcha .input { flex: 1; min-width: 120px; letter-spacing: .25em; font-weight: 600; }
/* звёзды оценки */
.stars { display: inline-flex; gap: 4px; }
.stars button { background: none; border: 0; padding: 2px; cursor: pointer; font-size: 30px; line-height: 1; color: var(--line); transition: transform .1s, color .1s; }
.stars button.on { color: #f59e0b; }
.stars button:hover { transform: scale(1.15); }
.stars-static { color: #f59e0b; letter-spacing: 1px; white-space: nowrap; }
.stars-static .off { color: var(--line); }
/* меню шаблонов в композере */
.tpl-menu { position: relative; }
.tpl-menu .list { position: absolute; bottom: 40px; left: 0; z-index: 20; width: min(340px, 80vw); max-height: 300px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; }
.tpl-menu .list button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--ink); font: 14px var(--font); }
.tpl-menu .list button:hover { background: var(--brand-soft); }
.tpl-menu .list small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- длинные слова без пробелов ----------
   В заголовках, ячейках и карточках длинное сплошное слово обрезается «…» и не вылезает за рамки;
   в тексте сообщений — переносится (текст важен целиком). */
.trunc { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.clamp-1, .clamp-2, .clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; word-break: break-word; }
.clamp-1 { -webkit-line-clamp: 1; } .clamp-2 { -webkit-line-clamp: 2; } .clamp-3 { -webkit-line-clamp: 3; }
.table td { max-width: 280px; overflow-wrap: break-word; } /* обычные слова не рвём; сплошные длинные — только в t-subject */
.table .t-subject a { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; word-break: break-word; }
.c-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.c-desc { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; overflow-wrap: anywhere; }
.c-header-in .grow, .page-head > div, .card-h h2, .card-h h3 { min-width: 0; }
.page-head h1, #cname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.ticket-head h1 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; overflow-wrap: anywhere; min-width: 0; }
@media (max-width: 760px) { .ticket-head h1 { flex-basis: 100%; font-size: 20px; } }
.bubble, .bubble .body, .c-welcome, .values .v div, .kv dd, .alert, .search-res a, .toast { overflow-wrap: anywhere; min-width: 0; }
.msg { min-width: 0; } .msg .bubble { min-width: 0; max-width: 100%; }
.search-res b, .search-res .small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .nm { max-width: min(220px, 50vw); }
.status-pill, .prio, .badge { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }

/* выбор статуса и важности прямо в форме ответа */
.composer-opts { display: flex; gap: 8px; flex-wrap: wrap; padding: 8px 6px 0; }
.composer-opts select { width: auto; max-width: 100%; flex: 1 1 200px; }

/* каталог компаний */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.cat-card { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); color: var(--ink); min-width: 0; transition: border-color .15s, transform .15s; }
.cat-card:hover { text-decoration: none; border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); transform: translateY(-1px); }
.cat-card .grow { display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 520px) { .cat-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- темы: главная страница в светлой теме ---------- */
:root[data-theme="dark"] .hero-search input { background: var(--surface); color: var(--ink); border-color: var(--line); }
:root[data-theme="dark"] .c-page { background: var(--bg); } /* светлый фон, выбранный владельцем, в тёмной теме не применяем */
:root[data-theme="light"] .hero { color: var(--ink);
  background: radial-gradient(1200px 600px at 10% -10%, #ddd6fe 0%, transparent 60%), radial-gradient(900px 600px at 110% 10%, #a5f3fc 0%, transparent 55%),
              radial-gradient(800px 700px at 50% 120%, #bfdbfe 0%, transparent 60%), #f6f7fb; }
:root[data-theme="light"] .hero::before { background-image: linear-gradient(rgba(15,23,42,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(15,23,42,.05) 1px, transparent 1px); }
:root[data-theme="light"] .blob { opacity: .28; }
:root[data-theme="light"] .hero h1 { background: linear-gradient(180deg, #0f172a 30%, #4f46e5); -webkit-background-clip: text; background-clip: text; }
:root[data-theme="light"] .hero .lead, :root[data-theme="light"] .feature span { color: var(--ink-2); }
:root[data-theme="light"] .hero .footer { color: var(--muted); }
:root[data-theme="light"] .feature { background: rgba(255,255,255,.7); border-color: var(--line); box-shadow: var(--shadow); }
:root[data-theme="light"] .feature .ic { color: var(--brand); }
:root[data-theme="light"] .hero-cta .btn-ghost { background: rgba(255,255,255,.75); color: var(--ink-2); border-color: var(--line); }
:root[data-theme="light"] .topbar.transparent .nav a, :root[data-theme="light"] .topbar.transparent .brand,
:root[data-theme="light"] .topbar.transparent .lang-btn, :root[data-theme="light"] .topbar.transparent .nav button.link { color: var(--ink); }
.topbar.transparent .nav button.link { color: #fff; }
@media (max-width: 760px) { .topbar.transparent .nav button.link { color: var(--ink-2); } }
.theme-btn .ic { width: 18px; height: 18px; }

/* ---------- мобильная вёрстка: шапки страниц ----------
   Любой flex-ряд с текстом должен уметь сжиматься (min-width: 0), иначе длинное название растягивает
   страницу и телефон уменьшает масштаб — сайт выглядит как десктоп «в миниатюре». */
.page-head { min-width: 0; }
.ph-main { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1 1 auto; }
.ph-title { min-width: 0; flex: 1; }
.ph-title h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) {
  .page-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .page-head .actions { margin-left: 0; }
  .page-head h1 { font-size: 22px; }
  /* кнопка «Панель управления» в шапке компании — в потоке, а не поверх названия */
  .c-header .admin-link { position: static; padding: 12px 14px 0; display: flex; justify-content: flex-end; }
  .c-header-in { min-height: 0; }
  .c-header .c-title { -webkit-line-clamp: 3; }
}
.page-head > * { max-width: 100%; min-width: 0; }
.ph-main { width: 100%; }
@media (max-width: 760px) { .grid-colors { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; } .grid-colors .fg:last-child { grid-column: 1 / -1; } }
