/* ============================================================
   Lex CRM — design system
   Направление: modern-minimal (Linear / Vercel)
   Светлая тема. Единый акцент — индиго. Одна декоративная деталь —
   мягкий градиент на primary-кнопке.
   ============================================================ */

:root {
  /* Ядро */
  --bg: oklch(0.982 0.003 250);
  --surface: oklch(0.999 0.001 250);
  --surface-2: oklch(0.965 0.004 250);
  --fg: oklch(0.22 0.02 262);
  --muted: oklch(0.52 0.02 262);
  --faint: oklch(0.68 0.015 262);
  --border: oklch(0.902 0.005 252);

  /* Акцент — индиго (единственный акцент системы) */
  --accent: oklch(0.50 0.17 276);
  --accent-strong: oklch(0.42 0.17 276);
  --accent-soft: oklch(0.952 0.028 276);
  --accent-hover: oklch(0.45 0.18 276);
  --accent-fg: oklch(0.99 0.004 276);
  --ring: oklch(0.50 0.17 276 / 0.32);

  /* Состояния */
  --success: oklch(0.55 0.13 156);
  --success-soft: oklch(0.952 0.038 156);
  --warning: oklch(0.66 0.15 72);
  --warning-strong: oklch(0.48 0.14 65);
  --warning-soft: oklch(0.963 0.045 85);
  --danger: oklch(0.55 0.20 26);
  --danger-soft: oklch(0.955 0.045 26);
  --info: oklch(0.58 0.12 245);
  --info-soft: oklch(0.945 0.038 248);

  /* Геометрия */
  --sidebar-w: 256px;
  --topbar-h: 60px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;

  /* Тени */
  --shadow-xs: 0 1px 2px oklch(0.22 0.02 262 / 0.04);
  --shadow-sm: 0 1px 2px oklch(0.22 0.02 262 / 0.05), 0 1px 3px oklch(0.22 0.02 262 / 0.04);
  --shadow-md: 0 6px 16px -4px oklch(0.22 0.02 262 / 0.10), 0 2px 6px -2px oklch(0.22 0.02 262 / 0.06);
  --shadow-lg: 0 20px 44px -12px oklch(0.22 0.02 262 / 0.18);

  /* Шрифты */
  --font-display: "Manrope", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0;
  color: var(--fg);
}
p { margin: 0; }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { color: var(--accent-hover); }
button { font-family: inherit; }
img, svg { display: block; max-width: 100%; }

.icon {
  width: 20px; height: 20px;
  flex: 0 0 auto;
  stroke-width: 1.8;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }

/* ---------- Кнопки ---------- */
.btn {
  --btn-bg: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
  color: var(--fg);
  background: var(--btn-bg);
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}
.btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn .icon { width: 18px; height: 18px; }

.btn-primary {
  background: linear-gradient(180deg, oklch(0.49 0.17 276), oklch(0.43 0.17 276));
  color: var(--accent-fg);
  border-color: transparent;
  box-shadow: 0 1px 2px oklch(0.22 0.02 262 / 0.18), inset 0 1px 0 oklch(1 0 0 / 0.12);
}
.btn-primary:hover {
  background: linear-gradient(180deg, oklch(0.45 0.18 276), oklch(0.39 0.18 276));
  color: var(--accent-fg);
  box-shadow: 0 3px 10px -2px oklch(0.42 0.17 276 / 0.5), inset 0 1px 0 oklch(1 0 0 / 0.12);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); box-shadow: 0 1px 2px oklch(0.22 0.02 262 / 0.18); }

.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
  color: var(--fg);
}
.btn-secondary:hover { background: var(--surface-2); border-color: oklch(0.85 0.008 252); }

.btn-ghost { color: var(--muted); background: transparent; }
.btn-ghost:hover { background: oklch(0.93 0.006 250); color: var(--fg); }

.btn-danger { background: var(--danger); color: oklch(0.99 0.004 26); }
.btn-danger:hover { background: oklch(0.49 0.20 26); color: oklch(0.99 0.004 26); }

.btn-soft { background: var(--accent-soft); color: var(--accent-strong); }
.btn-soft:hover { background: oklch(0.93 0.04 276); }

.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-sm .icon { width: 15px; height: 15px; }
.btn-lg { height: 48px; padding: 0 24px; font-size: 15px; border-radius: 14px; }

.btn-icon {
  width: 36px; height: 36px; padding: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
}
.btn-icon:hover { background: var(--surface-2); color: var(--fg); }

/* ---------- Badges / Pill ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.badge-neutral { background: var(--surface-2); color: var(--muted); }
.badge-accent { background: var(--accent-soft); color: var(--accent-strong); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning-strong); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }

/* ---------- Карточки ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 15px; font-weight: 700; }
.card-head .sub { font-size: 12.5px; color: var(--faint); margin-top: 2px; }
.card-body { padding: 20px; }
.card-body.pad0 { padding: 0; }

/* ---------- Формы ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.input, .select, .textarea {
  height: 40px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 96px; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .select:hover, .textarea:hover { border-color: oklch(0.82 0.01 252); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.search {
  position: relative;
  display: flex;
  align-items: center;
}
.search .icon {
  position: absolute;
  left: 12px;
  color: var(--faint);
  pointer-events: none;
}
.search .input { padding-left: 38px; }

/* ---------- Таблицы ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data thead th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface);
}
table.data tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data tbody tr { transition: background .12s ease; }
table.data tbody tr:hover { background: oklch(0.975 0.006 250); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data td.num, table.data th.num {
  font-variant-numeric: tabular-nums;
}

.row-main { font-weight: 600; color: var(--fg); }
.row-sub { font-size: 12.5px; color: var(--faint); margin-top: 1px; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  top: 0; bottom: 0; left: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: transform .25s ease;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  height: var(--topbar-h);
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--accent-fg);
  background: linear-gradient(160deg, oklch(0.56 0.18 276), oklch(0.44 0.17 276));
  box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.18);
}
.brand-mark .icon { width: 18px; height: 18px; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 15.5px; letter-spacing: -0.02em; color: var(--fg); }
.brand-name span { color: var(--accent-strong); }
.brand, .land-nav > a { color: inherit; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 12px 20px; }
.nav-group { margin-bottom: 18px; }
.nav-group-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--faint);
  padding: 0 10px;
  margin-bottom: 5px;
}
/* Примечание: селектор ограничен сайдбаром, чтобы не задеть Bootstrap .nav-item */
.sidebar-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 38px;
  padding: 0 10px;
  margin: 1px 0;
  border-radius: 9px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .14s ease, color .14s ease;
  position: relative;
}
.sidebar-nav .nav-item .icon { width: 18px; height: 18px; color: var(--faint); transition: color .14s ease; }
.sidebar-nav .nav-item:hover { background: oklch(0.96 0.005 250); color: var(--fg); }
.sidebar-nav .nav-item:hover .icon { color: var(--muted); }
.sidebar-nav .nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}
.sidebar-nav .nav-item.active .icon { color: var(--accent-strong); }
.sidebar-nav .nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 1px 7px;
  font-variant-numeric: tabular-nums;
}
.sidebar-foot {
  padding: 12px;
  border-top: 1px solid var(--border);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 11px;
}
.user-chip:hover { background: oklch(0.96 0.005 250); }
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: var(--accent-fg);
  background: linear-gradient(150deg, oklch(0.55 0.17 276), oklch(0.42 0.16 262));
  flex: 0 0 auto;
}
.user-chip .name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.user-chip .role { font-size: 11.5px; color: var(--faint); }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: oklch(0.999 0.001 250 / 0.85);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  z-index: 30;
}
.burger { display: none; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--faint); }
.crumbs .sep { color: var(--border); }
.crumbs .current { color: var(--fg); font-weight: 600; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.top-search { width: 260px; }
.top-search .input { height: 36px; background: oklch(0.965 0.004 250); border-color: transparent; }
.top-search .input:focus { background: var(--surface); border-color: var(--accent); }

.icon-btn {
  position: relative;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .14s ease, color .14s ease;
}
.icon-btn:hover { background: oklch(0.96 0.005 250); color: var(--fg); }
.icon-btn .ping {
  position: absolute;
  top: 7px; right: 7px;
  min-width: 15px; height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  display: grid; place-items: center;
  border: 2px solid var(--surface);
}

.content { flex: 1; padding: 28px 32px 48px; width: 100%; max-width: 1280px; margin: 0 auto; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.page-head .actions { display: flex; gap: 10px; }

.overlay {
  position: fixed;
  inset: 0;
  background: oklch(0.2 0.02 262 / 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 35;
}

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; }
.kpi-label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.kpi-ico {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.kpi-ico.warn { background: var(--warning-soft); color: var(--warning-strong); }
.kpi-ico.ok { background: var(--success-soft); color: var(--success); }
.kpi-ico.info { background: var(--info-soft); color: var(--info); }
.kpi-ico .icon { width: 17px; height: 17px; }
.kpi-value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.kpi-foot { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--faint); }
.kpi-foot .trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; font-size: 11.5px; }
.kpi-foot .trend.up { color: var(--success); }
.kpi-foot .trend.down { color: var(--danger); }
.kpi-foot .trend .icon { width: 12px; height: 12px; }

/* ---------- Layout helpers ---------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2-1 { grid-template-columns: 2fr 1fr; }
.stack { display: flex; flex-direction: column; gap: 16px; }
/* Примечание: .lex-row, не .row — иначе ломается сетка Bootstrap в остальных шаблонах */
.lex-row { display: flex; gap: 12px; align-items: center; }
.between { justify-content: space-between; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-8 { margin-top: 8px; }
.mb-16 { margin-bottom: 16px; }

/* Детали (read-only поля) */
.dl {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
}
.dv { font-size: 14px; font-weight: 600; color: var(--fg); margin-top: 3px; }
.dv a { color: var(--accent-strong); }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px 24px; }
.checklist { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; }
.checklist + .checklist { border-top: 1px solid var(--border); }
.checklist .box {
  width: 18px; height: 18px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  flex: 0 0 auto;
  margin-top: 1px;
  display: grid; place-items: center;
  color: var(--accent-fg);
}
.checklist.done .box { background: var(--accent); border-color: var(--accent); }
.checklist .box .icon { width: 11px; height: 11px; }
.checklist .ct { font-size: 13.5px; font-weight: 500; }
.checklist.done .ct { color: var(--faint); text-decoration: line-through; }
.checklist .cs { font-size: 12px; color: var(--faint); margin-top: 1px; }

.section-title { font-size: 15px; font-weight: 700; }
.section-link { font-size: 13px; font-weight: 600; color: var(--accent-strong); }
.section-link:hover { color: var(--accent-hover); }

/* ---------- Donut chart ---------- */
.donut {
  --size: 168px;
  --thickness: 22px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  position: relative;
  flex: 0 0 auto;
}
.donut::after {
  content: "";
  position: absolute;
  inset: var(--thickness);
  border-radius: 50%;
  background: var(--surface);
}
.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  z-index: 1;
}
.donut-center .n { font-family: var(--font-display); font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.donut-center .l { font-size: 11.5px; color: var(--faint); margin-top: 3px; }

.legend { display: flex; flex-direction: column; gap: 10px; }
.legend-row { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.legend-row .sw { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; }
.legend-row .lbl { color: var(--muted); flex: 1; }
.legend-row .val { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Bar chart ---------- */
.bars { display: flex; flex-direction: column; gap: 14px; }
.bar-row { display: grid; grid-template-columns: 92px 1fr 34px; align-items: center; gap: 12px; }
.bar-row .bl { font-size: 12.5px; color: var(--muted); }
.bar-row .track { height: 8px; border-radius: 999px; background: oklch(0.945 0.006 250); overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 999px; }
.bar-row .bv { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- List rows ---------- */
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: oklch(0.975 0.006 250); }
.list-row .ico {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--surface-2);
  color: var(--muted);
  flex: 0 0 auto;
}
.list-row .ico.accent { background: var(--accent-soft); color: var(--accent-strong); }
.list-row .ico .icon { width: 17px; height: 17px; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .t { font-size: 13.5px; font-weight: 600; color: var(--fg); }
.list-row .s { font-size: 12px; color: var(--faint); margin-top: 1px; }
.list-row .side { text-align: right; font-size: 12px; color: var(--faint); flex: 0 0 auto; }
.list-row .side .b { font-size: 13px; font-weight: 700; color: var(--fg); font-variant-numeric: tabular-nums; }

/* ---------- Timeline ---------- */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 14px; position: relative; padding-bottom: 22px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: "";
  position: absolute;
  left: 15px; top: 30px; bottom: 0;
  width: 1px;
  background: var(--border);
}
.tl-item:last-child::before { display: none; }
.tl-dot {
  width: 31px; height: 31px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent-strong);
  flex: 0 0 auto;
  z-index: 1;
}
.tl-dot .icon { width: 15px; height: 15px; }
.tl-body { flex: 1; padding-top: 1px; }
.tl-title { font-size: 13.5px; font-weight: 600; }
.tl-desc { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.tl-time { font-size: 11.5px; color: var(--faint); margin-top: 4px; }

/* ---------- Filter bar ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  padding: 16px 20px;
}
.filter-bar .field { min-width: 150px; flex: 1 1 150px; }
.filter-bar .field.search-field { flex: 2 1 240px; }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; }
/* Примечание: скрытие только для lex-dropdown, Bootstrap .dropdown-menu не трогаем */
.dropdown:has([data-dropdown-toggle]) .dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .14s ease, transform .14s ease, visibility .14s;
  z-index: 50;
  display: block;
}
.dropdown.open:has([data-dropdown-toggle]) .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--fg);
  cursor: pointer;
}
.dropdown-item:hover { background: oklch(0.96 0.005 250); }
.dropdown-item .icon { width: 16px; height: 16px; color: var(--faint); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger .icon { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border); margin: 5px 0; }
.dropdown-head { padding: 8px 10px; font-size: 12px; color: var(--faint); font-weight: 600; }

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  padding: 0 4px;
}
.tab {
  position: relative;
  padding: 12px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: color .14s ease;
}
.tab:hover { color: var(--fg); }
.tab.active { color: var(--accent-strong); }
.tab.active::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

/* ---------- Progress ---------- */
.progress { height: 6px; border-radius: 999px; background: oklch(0.945 0.006 250); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }

/* ============================================================
   LANDING
   ============================================================ */
.land { background: var(--surface); }
.land-nav {
  position: sticky;
  top: 0;
  height: 66px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 40px;
  background: oklch(0.999 0.001 250 / 0.8);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 30;
}
.land-nav .links { display: flex; gap: 6px; margin: 0 auto; }
.land-nav .links a {
  padding: 8px 13px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}
.land-nav .links a:hover { color: var(--fg); background: oklch(0.965 0.004 250); }

.land-hero {
  position: relative;
  overflow: hidden;
  padding: 84px 0 0;
  background:
    radial-gradient(1100px 520px at 50% -10%, oklch(0.96 0.025 276 / 0.55), transparent 60%),
    var(--surface);
}
.land-hero .inner { max-width: 1120px; margin: 0 auto; padding: 0 40px; text-align: center; }
.land-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.land-hero h1 {
  font-size: clamp(38px, 5.2vw, 60px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin: 22px auto 0;
  max-width: 760px;
}
.land-hero .lead {
  font-size: 17px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 620px;
  margin: 20px auto 0;
}
.land-hero .cta-row { display: flex; gap: 12px; justify-content: center; margin-top: 30px; }
.land-hero .hint { font-size: 12.5px; color: var(--faint); margin-top: 16px; }

.land-hero .shot {
  max-width: 1080px;
  margin: 60px auto 0;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  background: var(--bg);
}
.land-hero .shot-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.land-hero .shot-head .d {
  width: 11px; height: 11px; border-radius: 50%;
}
.land-hero .shot-head .url {
  margin-left: 8px;
  font-size: 12px;
  color: var(--faint);
  background: var(--surface-2);
  border-radius: 7px;
  padding: 4px 12px;
  flex: 1;
  max-width: 320px;
}

.land-section { padding: 88px 40px; }
.land-section .inner { max-width: 1120px; margin: 0 auto; }
.land-section .sec-head { max-width: 640px; margin-bottom: 44px; }
.land-section .sec-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.land-section .eyebrow {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-strong);
  margin-bottom: 12px;
}
.land-section h2 { font-size: clamp(26px, 3vw, 36px); font-weight: 800; letter-spacing: -0.025em; }
.land-section .sec-sub { font-size: 15.5px; color: var(--muted); margin-top: 12px; line-height: 1.6; }

.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px 20px;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.feature:hover { border-color: oklch(0.84 0.012 252); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.feature .f-ico {
  width: 40px; height: 40px;
  border-radius: 11px;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent-strong);
  margin-bottom: 14px;
}
.feature h3 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.feature p { font-size: 13.5px; color: var(--muted); line-height: 1.55; }

.land-band {
  background: linear-gradient(180deg, oklch(0.26 0.02 262), oklch(0.20 0.02 262));
  color: oklch(0.97 0.005 262);
}
.land-band .inner { max-width: 1120px; margin: 0 auto; padding: 72px 40px; }
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.stat .num {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: oklch(0.82 0.09 276);
}
.stat .lbl { font-size: 13.5px; color: oklch(0.78 0.01 262); margin-top: 4px; }

.ai-panel {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 40px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: linear-gradient(160deg, oklch(0.965 0.02 276), oklch(0.985 0.005 262));
  padding: 44px;
  box-shadow: var(--shadow-sm);
}
.ai-panel h3 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 12px; }
.ai-panel p { color: var(--muted); line-height: 1.65; font-size: 14.5px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg);
}
.chip .icon { width: 14px; height: 14px; color: var(--accent-strong); }
.ai-chat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.ai-chat .msg { display: flex; gap: 10px; padding: 16px; }
.ai-chat .msg.bot { background: oklch(0.97 0.006 250); }
.ai-chat .msg .bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px 14px 14px 14px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.55;
}
.ai-chat .msg.user { justify-content: flex-end; }
.ai-chat .msg.user .bubble {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: transparent;
  border-radius: 14px 4px 14px 14px;
}
.ai-chat .cite { font-size: 11.5px; color: var(--accent-strong); margin-top: 6px; font-weight: 600; }

.cta-band {
  padding: 88px 40px;
  background:
    radial-gradient(900px 400px at 50% 0%, oklch(0.94 0.03 276 / 0.6), transparent 60%),
    var(--surface);
  text-align: center;
}
.cta-band h2 { font-size: clamp(28px, 3.4vw, 40px); font-weight: 800; letter-spacing: -0.025em; }
.cta-band p { color: var(--muted); font-size: 16px; margin-top: 14px; }

.land-footer {
  border-top: 1px solid var(--border);
  padding: 40px;
}
.land-footer .inner { max-width: 1120px; margin: 0 auto; display: flex; justify-content: space-between; gap: 24px; align-items: center; flex-wrap: wrap; }
.land-footer .links { display: flex; gap: 22px; }
.land-footer .links a { font-size: 13.5px; color: var(--muted); }
.land-footer .links a:hover { color: var(--fg); }
.land-footer .copy { font-size: 13px; color: var(--faint); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3, .grid-2-1 { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .ai-panel { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main { margin-left: 0; }
  .burger { display: grid; }
  .overlay.show { opacity: 1; pointer-events: auto; }
  .top-search { display: none; }
  .content { padding: 20px 18px 40px; }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
  .land-nav .links { display: none; }
  .land-nav { padding: 0 20px; }
  .land-hero .inner, .land-section { padding-left: 20px; padding-right: 20px; }
  .land-hero .shot { margin-left: 16px; margin-right: 16px; }
}
@media (max-width: 560px) {
  .kpi-grid, .feature-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .detail-grid { grid-template-columns: 1fr; }
  .land-hero .cta-row { flex-direction: column; }
  .land-hero .cta-row .btn { width: 100%; }
}

/* ---------- Утилиты доступности ---------- */
.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;
}
::selection { background: var(--accent-soft); color: var(--accent-strong); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:focus-visible, .icon-btn:focus-visible, .sidebar-nav .nav-item:focus-visible,
.input:focus-visible, .select:focus-visible, .textarea:focus-visible,
.tab:focus-visible, .dropdown-item:focus-visible {
  outline: none;
}
.icon-btn:focus-visible { box-shadow: 0 0 0 3px var(--ring); }
