/* ============================================================
   CRM «Технотрейд» — основная таблица стилей
   ============================================================ */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --violet: #8b5cf6;
  --sky: #0ea5e9;
  --green: #10b981;
  --amber: #f59e0b;
  --red: #ef4444;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --card-shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .07);
  --radius: 16px;
  --grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);

  /* Семантические токены (переопределяются в тёмной теме) */
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-soft: #f1f5f9;
  --row-hover: #f8fafc;
  --sky-soft: #f0f9ff;
  --chart-grid: #f1f5f9;
  --chart-tick: #64748b;
  --input-bg: #ffffff;
}

[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #141d31;
  --surface-2: #1b2740;
  --text: #e6edf7;
  --text-muted: #94a3b8;
  --border: #26324a;
  --border-soft: #1e293b;
  --row-hover: #1b2740;
  --sky-soft: rgba(14, 165, 233, .14);
  --chart-grid: #243049;
  --chart-tick: #94a3b8;
  --input-bg: #1b2740;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--slate-100);
  color: var(--slate-900);
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: var(--primary); }

/* ---------- Каркас приложения ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 256px; flex-shrink: 0;
  background: linear-gradient(180deg, #0f172a 0%, #131c33 100%);
  color: #cbd5e1;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}

.sidebar .brand {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 22px 18px;
  border-bottom: 1px solid rgba(148, 163, 184, .12);
}
.brand-logo {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 19px;
  box-shadow: 0 4px 14px rgba(99, 102, 241, .45);
}
.brand-name { font-weight: 700; font-size: 16.5px; color: #fff; letter-spacing: .2px; }
.brand-sub { font-size: 11px; color: var(--slate-400); margin-top: 1px; }

.nav-section { padding: 16px 14px 8px; }
.nav-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.2px;
  color: #64748b; padding: 0 10px 8px;
}
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10.5px 12px; margin-bottom: 3px;
  border-radius: 10px; color: #b6c2d6; font-weight: 500;
  transition: all .18s;
}
.nav-link i { font-size: 17px; width: 20px; text-align: center; opacity: .85; }
.nav-link:hover { background: rgba(99, 102, 241, .14); color: #fff; }
.nav-link.active {
  background: var(--grad); color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, .4);
}

.sidebar-user {
  margin-top: auto; padding: 16px 18px;
  border-top: 1px solid rgba(148, 163, 184, .12);
  display: flex; align-items: center; gap: 11px;
}
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 13px; flex-shrink: 0;
}
.sidebar-user .u-name { color: #fff; font-weight: 600; font-size: 13.5px; }
.sidebar-user .u-role { color: var(--slate-400); font-size: 11.5px; }
.logout-btn { margin-left: auto; color: var(--slate-400); font-size: 17px; }
.logout-btn:hover { color: #fff; }

.main-content { flex: 1; padding: 28px 34px; max-width: 1480px; }

/* ---------- Заголовок страницы ---------- */
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.page-title { font-size: 23px; font-weight: 700; letter-spacing: -.3px; }
.page-sub { color: var(--slate-500); font-size: 13.5px; margin-top: 3px; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9.5px 18px; border-radius: 11px;
  font-weight: 600; font-size: 13.5px; cursor: pointer;
  border: none; font-family: inherit; transition: all .18s;
}
.btn-primary {
  background: var(--grad); color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, .35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(99, 102, 241, .45); }
.btn-light {
  background: #fff; color: var(--slate-700);
  border: 1px solid var(--slate-200);
}
.btn-light:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: #fef2f2; color: var(--red); border: 1px solid #fecaca; }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 9px; }

/* ---------- Карточки ---------- */
.card {
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--card-shadow); padding: 22px;
  border: 1px solid rgba(226, 232, 240, .8);
}
.card-title { font-size: 15.5px; font-weight: 700; margin-bottom: 16px; }

/* ---------- KPI ---------- */
.kpi-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 18px; margin-bottom: 22px;
}
.kpi {
  background: #fff; border-radius: var(--radius); padding: 20px 22px;
  box-shadow: var(--card-shadow); border: 1px solid rgba(226, 232, 240, .8);
  display: flex; align-items: center; gap: 16px;
  position: relative; overflow: hidden;
}
.kpi::after {
  content: ''; position: absolute; right: -30px; top: -30px;
  width: 110px; height: 110px; border-radius: 50%;
  background: currentColor; opacity: .055;
}
.kpi-icon {
  width: 50px; height: 50px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #fff;
}
.kpi-value { font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.kpi-label { color: var(--slate-500); font-size: 12.5px; font-weight: 500; }

.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; margin-bottom: 22px; }
.grid-2-even { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 22px; }

/* ---------- Таблицы ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th {
  text-align: left; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .8px; color: var(--slate-500);
  padding: 10px 14px; border-bottom: 2px solid var(--slate-100);
}
table.data td {
  padding: 13px 14px; border-bottom: 1px solid var(--slate-100);
  font-size: 13.5px; vertical-align: middle;
}
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .15s; }
table.data tbody tr:hover { background: var(--slate-50); }

/* ---------- Бейджи ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge-indigo { background: #eef2ff; color: #4f46e5; }
.badge-violet { background: #f5f3ff; color: #7c3aed; }
.badge-sky    { background: #f0f9ff; color: #0284c7; }
.badge-green  { background: #ecfdf5; color: #059669; }
.badge-amber  { background: #fffbeb; color: #d97706; }
.badge-red    { background: #fef2f2; color: #dc2626; }
.badge-slate  { background: var(--slate-100); color: var(--slate-500); }

/* ---------- Формы ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--slate-700); margin-bottom: 6px;
}
.form-control {
  width: 100%; padding: 10px 14px; border-radius: 11px;
  border: 1.5px solid var(--slate-200); font-family: inherit;
  font-size: 13.5px; background: #fff; color: var(--slate-900);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .14);
}
textarea.form-control { resize: vertical; min-height: 90px; }

/* ---------- Flash-сообщения ---------- */
.flash-stack { position: fixed; top: 20px; right: 24px; z-index: 1000; width: 340px; }
.flash {
  padding: 13px 18px; border-radius: 12px; margin-bottom: 10px;
  font-size: 13.5px; font-weight: 500; color: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .18);
  animation: slideIn .3s ease;
}
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.flash-success { background: var(--green); }
.flash-danger { background: var(--red); }
.flash-info { background: var(--sky); }
.flash-warning { background: var(--amber); }

/* ---------- Канбан ---------- */
.kanban {
  display: grid; grid-template-columns: repeat(5, minmax(218px, 1fr));
  gap: 14px; align-items: start;
}
.kanban-col {
  background: rgba(226, 232, 240, .45); border-radius: 14px;
  padding: 12px; min-height: 320px;
}
.kanban-col.drag-over { background: #e0e7ff; outline: 2px dashed var(--primary); }
.kanban-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 2px 6px 10px;
}
.kanban-head .k-title { font-weight: 700; font-size: 13px; }
.kanban-head .k-count {
  background: #fff; border-radius: 999px; font-size: 11.5px;
  padding: 2px 9px; font-weight: 600; color: var(--slate-500);
}
.kanban-total { font-size: 11.5px; color: var(--slate-500); padding: 0 6px 10px; font-weight: 500; }
.deal-card {
  background: #fff; border-radius: 12px; padding: 13px 14px;
  margin-bottom: 10px; cursor: grab;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
  border: 1px solid rgba(226, 232, 240, .9);
  border-left: 3px solid var(--primary);
  transition: box-shadow .15s, transform .15s;
}
.deal-card:hover { box-shadow: 0 6px 18px rgba(15, 23, 42, .12); transform: translateY(-1px); }
.deal-card.dragging { opacity: .5; }
.deal-card .d-title { font-weight: 600; font-size: 13px; margin-bottom: 5px; }
.deal-card .d-client { color: var(--slate-500); font-size: 12px; margin-bottom: 8px; }
.deal-card .d-foot { display: flex; align-items: center; justify-content: space-between; }
.deal-card .d-amount { font-weight: 700; font-size: 13px; color: var(--primary-dark); }

/* ---------- Прогресс ---------- */
.progress { height: 7px; background: var(--slate-100); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 999px; background: var(--grad); }

/* ---------- Комментарии ---------- */
.comment { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--slate-100); }
.comment:last-child { border-bottom: none; }
.comment-body { flex: 1; }
.comment-meta { font-size: 12px; color: var(--slate-500); margin-bottom: 3px; }
.comment-meta b { color: var(--slate-900); }

/* ---------- Списки на дашборде ---------- */
.feed-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--slate-100);
}
.feed-item:last-child { border-bottom: none; }
.feed-icon {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.feed-title { font-weight: 600; font-size: 13px; }
.feed-sub { color: var(--slate-500); font-size: 12px; }
.feed-right { margin-left: auto; text-align: right; }

/* ---------- Фильтры ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.filters .form-control { width: auto; min-width: 170px; }

/* ---------- Пустое состояние ---------- */
.empty {
  text-align: center; padding: 48px 20px; color: var(--slate-400);
}
.empty i { font-size: 42px; display: block; margin-bottom: 10px; opacity: .5; }

/* ============================================================
   ЛЕНДИНГ
   ============================================================ */
.landing {
  background: #090d1a; color: #e2e8f0; min-height: 100vh;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  overflow-x: hidden;
}
.landing-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 7vw; position: relative; z-index: 5;
}
.landing-nav .nav-links { display: flex; gap: 32px; }
.landing-nav .nav-links a { color: #94a3b8; font-weight: 500; font-size: 14px; transition: color .15s; }
.landing-nav .nav-links a:hover { color: #fff; }

.hero {
  position: relative; text-align: center;
  padding: 90px 7vw 110px;
}
.hero-blob {
  position: absolute; border-radius: 50%; filter: blur(110px); opacity: .4; pointer-events: none;
}
.blob-1 { width: 480px; height: 480px; background: #6366f1; top: -120px; left: 8vw; }
.blob-2 { width: 420px; height: 420px; background: #a855f7; top: 60px; right: 6vw; opacity: .3; }
.blob-3 { width: 300px; height: 300px; background: #0ea5e9; bottom: -80px; left: 42vw; opacity: .25; }

.hero-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(99, 102, 241, .12); border: 1px solid rgba(99, 102, 241, .35);
  color: #a5b4fc; border-radius: 999px; padding: 7px 18px;
  font-size: 13px; font-weight: 500; margin-bottom: 28px;
  position: relative; z-index: 2;
}
.hero h1 {
  font-size: clamp(34px, 5vw, 58px); font-weight: 800; color: #fff;
  letter-spacing: -1.5px; line-height: 1.12; max-width: 880px;
  margin: 0 auto 22px; position: relative; z-index: 2;
}
.hero h1 .grad-text {
  background: linear-gradient(90deg, #818cf8, #c084fc, #38bdf8);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p {
  color: #94a3b8; font-size: 17px; max-width: 640px;
  margin: 0 auto 38px; line-height: 1.65; position: relative; z-index: 2;
}
.hero-actions { display: flex; gap: 14px; justify-content: center; position: relative; z-index: 2; }
.btn-hero {
  padding: 14px 32px; border-radius: 14px; font-size: 15px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 10px;
}
.btn-hero.primary {
  background: var(--grad); color: #fff;
  box-shadow: 0 10px 32px rgba(99, 102, 241, .45);
  transition: transform .18s, box-shadow .18s;
}
.btn-hero.primary:hover { transform: translateY(-2px); box-shadow: 0 14px 40px rgba(99, 102, 241, .55); }
.btn-hero.ghost {
  background: rgba(255, 255, 255, .05); color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, .25);
}
.btn-hero.ghost:hover { background: rgba(255, 255, 255, .1); }

.hero-stats {
  display: flex; gap: 56px; justify-content: center; margin-top: 72px;
  position: relative; z-index: 2; flex-wrap: wrap;
}
.hero-stat .hs-value {
  font-size: 34px; font-weight: 800; color: #fff; letter-spacing: -1px;
}
.hero-stat .hs-value span { color: #818cf8; }
.hero-stat .hs-label { color: #64748b; font-size: 13px; margin-top: 4px; }

.section { padding: 80px 7vw; position: relative; }
.section-head { text-align: center; max-width: 620px; margin: 0 auto 54px; }
.section-head h2 { font-size: 34px; font-weight: 800; color: #fff; letter-spacing: -1px; margin-bottom: 14px; }
.section-head p { color: #94a3b8; font-size: 15.5px; line-height: 1.65; }

.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.feature-card {
  background: rgba(30, 41, 59, .5); border: 1px solid rgba(148, 163, 184, .14);
  border-radius: 20px; padding: 30px 28px;
  transition: transform .2s, border-color .2s;
}
.feature-card:hover { transform: translateY(-4px); border-color: rgba(99, 102, 241, .5); }
.feature-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 23px; color: #fff; margin-bottom: 20px;
}
.feature-card h3 { color: #fff; font-size: 17px; font-weight: 700; margin-bottom: 10px; }
.feature-card p { color: #94a3b8; font-size: 13.5px; line-height: 1.65; }

.roles-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.role-card {
  background: linear-gradient(160deg, rgba(30, 41, 59, .7), rgba(15, 23, 42, .8));
  border: 1px solid rgba(148, 163, 184, .14); border-radius: 20px;
  padding: 30px 28px; text-align: center;
}
.role-card .avatar { width: 64px; height: 64px; font-size: 22px; margin: 0 auto 18px; }
.role-card h3 { color: #fff; font-size: 16.5px; margin-bottom: 10px; }
.role-card p { color: #94a3b8; font-size: 13px; line-height: 1.6; }

.cta-band {
  margin: 0 7vw 80px; border-radius: 28px; text-align: center;
  padding: 64px 40px; position: relative; overflow: hidden;
  background: var(--grad);
}
.cta-band h2 { color: #fff; font-size: 30px; font-weight: 800; letter-spacing: -.8px; margin-bottom: 14px; }
.cta-band p { color: rgba(255, 255, 255, .85); margin-bottom: 30px; font-size: 15px; }
.cta-band .btn-hero { background: #fff; color: var(--primary-dark); }

.landing-footer {
  border-top: 1px solid rgba(148, 163, 184, .12);
  padding: 28px 7vw; display: flex; justify-content: space-between;
  color: #64748b; font-size: 13px; flex-wrap: wrap; gap: 10px;
}

/* ============================================================
   СТРАНИЦА ВХОДА
   ============================================================ */
.login-page {
  min-height: 100vh; display: flex;
  background: #090d1a;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
}
.login-side {
  flex: 1; position: relative; overflow: hidden;
  background: var(--grad);
  display: flex; flex-direction: column; justify-content: center;
  padding: 60px; color: #fff;
}
.login-side::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(255,255,255,.18), transparent 45%),
              radial-gradient(circle at 15% 85%, rgba(255,255,255,.1), transparent 40%);
}
.login-side h2 { font-size: 32px; font-weight: 800; letter-spacing: -.8px; margin: 22px 0 16px; position: relative; }
.login-side p { font-size: 15px; line-height: 1.7; opacity: .9; max-width: 420px; position: relative; }
.login-side ul { list-style: none; margin-top: 28px; position: relative; }
.login-side li { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-size: 14px; }
.login-side li i { font-size: 18px; }

.login-form-wrap {
  width: 520px; flex-shrink: 0; background: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.login-box { width: 100%; max-width: 380px; }
.login-box h1 { font-size: 24px; font-weight: 800; letter-spacing: -.5px; margin-bottom: 6px; }
.login-box .sub { color: var(--slate-500); font-size: 13.5px; margin-bottom: 28px; }

.quick-login { margin-top: 26px; }
.quick-divider {
  display: flex; align-items: center; gap: 14px;
  color: var(--slate-400); font-size: 12px; margin-bottom: 14px;
}
.quick-divider::before, .quick-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--slate-200);
}
.quick-btn {
  display: flex; align-items: center; gap: 13px; width: 100%;
  padding: 11px 14px; margin-bottom: 10px;
  border-radius: 12px; border: 1.5px solid var(--slate-200);
  background: #fff; cursor: pointer; font-family: inherit;
  text-align: left; transition: all .16s;
}
.quick-btn:hover { border-color: var(--primary); background: #fafaff; transform: translateX(2px); }
.quick-btn .q-icon {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 17px;
}
.quick-btn .q-label { font-weight: 600; font-size: 13.5px; color: var(--slate-900); }
.quick-btn .q-sub { font-size: 11.5px; color: var(--slate-400); }
.quick-btn .bi-arrow-right { margin-left: auto; color: var(--slate-400); }

@media (max-width: 980px) {
  .login-side { display: none; }
  .login-form-wrap { width: 100%; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-2-even, .features-grid, .roles-grid { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: 1fr; }
}

/* ============================================================
   ПЕРЕКЛЮЧАТЕЛЬ ТЕМЫ
   ============================================================ */
.theme-toggle {
  margin: 0 14px 4px; padding: 10px 12px;
  display: flex; align-items: center; gap: 10px;
  background: rgba(148, 163, 184, .1); color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, .16); border-radius: 10px;
  font-family: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
  transition: background .16s;
}
.theme-toggle:hover { background: rgba(99, 102, 241, .2); color: #fff; }
.theme-toggle i { font-size: 16px; }

/* ---------- Мелкие утилиты ---------- */
.mono { font-family: 'Courier New', monospace; font-size: 12.5px; color: var(--text-muted); }
.hint { color: var(--text-muted); font-size: 12.5px; margin-top: 12px; }
.hint i { color: var(--sky); }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--surface-2); color: var(--text-muted);
  border: 1px solid var(--border);
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip-active { background: var(--grad); color: #fff; border-color: transparent; }

.check-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 14px; border-radius: 11px; cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--border);
  font-size: 13px; font-weight: 500; color: var(--text-muted);
}
.check-pill input { accent-color: var(--primary); }
.stock-input { text-align: center; }

/* ============================================================
   СТРАНИЦА ОШИБКИ
   ============================================================ */
.error-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 24px;
}
.error-box {
  background: var(--surface); border-radius: 22px; padding: 48px 44px;
  box-shadow: var(--card-shadow); text-align: center; max-width: 440px;
  border: 1px solid var(--border); position: relative;
}
.error-code {
  font-size: 92px; font-weight: 800; line-height: 1;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  color: transparent; letter-spacing: -2px;
}
.error-icon { font-size: 36px; color: var(--primary); margin: 6px 0 14px; }
.error-box h1 { font-size: 22px; color: var(--text); margin-bottom: 10px; }
.error-box p { color: var(--text-muted); font-size: 14px; margin-bottom: 26px; line-height: 1.6; }

/* ============================================================
   КАРТА ЛОЯЛЬНОСТИ КЛИЕНТА (с QR)
   ============================================================ */
.card-page { background: var(--bg); min-height: 100vh; padding: 30px 20px; }
.card-toolbar {
  display: flex; gap: 10px; justify-content: center; margin-bottom: 26px;
}
.loyalty-wrap { max-width: 540px; margin: 0 auto; }
.loyalty-card {
  background: var(--grad); border-radius: 22px; padding: 30px 32px; color: #fff;
  box-shadow: 0 20px 50px rgba(99, 102, 241, .4); position: relative; overflow: hidden;
}
.loyalty-card::before {
  content: ''; position: absolute; right: -60px; top: -60px;
  width: 220px; height: 220px; border-radius: 50%; background: rgba(255, 255, 255, .12);
}
.loyalty-top {
  display: flex; align-items: center; justify-content: space-between;
  position: relative; margin-bottom: 26px;
}
.loyalty-brand { display: flex; align-items: center; gap: 12px; }
.loyalty-brand .brand-logo { background: rgba(255, 255, 255, .2); box-shadow: none; }
.lc-name { font-weight: 700; font-size: 17px; }
.lc-sub { font-size: 12px; opacity: .85; }
.lc-segment {
  background: rgba(255, 255, 255, .2); border-radius: 999px;
  padding: 5px 14px; font-size: 12px; font-weight: 600;
}
.loyalty-body { display: flex; gap: 22px; align-items: center; position: relative; }
.loyalty-info { flex: 1; }
.lc-company { font-size: 21px; font-weight: 800; margin-bottom: 12px; line-height: 1.2; }
.lc-line { font-size: 13.5px; opacity: .92; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.lc-code {
  margin-top: 14px; font-family: 'Courier New', monospace; font-size: 18px;
  font-weight: 700; letter-spacing: 2px;
}
.loyalty-qr { background: #fff; padding: 12px; border-radius: 14px; text-align: center; }
.loyalty-qr #qrcode img { display: block; }
.lc-qr-hint { color: var(--slate-500); font-size: 10.5px; margin-top: 6px; }
.loyalty-foot {
  display: flex; justify-content: space-between; margin-top: 26px;
  font-size: 12px; opacity: .85; position: relative;
}
.loyalty-foot i { margin-right: 4px; }

@media print {
  .no-print, .card-toolbar { display: none !important; }
  .card-page { background: #fff; padding: 0; }
  .loyalty-card { box-shadow: none; }
}

/* ============================================================
   ТЁМНАЯ ТЕМА — переопределение поверхностей
   ============================================================ */
[data-theme="dark"] body { background: var(--bg); color: var(--text); }
[data-theme="dark"] .card,
[data-theme="dark"] .kpi { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .page-title,
[data-theme="dark"] .card-title,
[data-theme="dark"] .kpi-value { color: var(--text); }
[data-theme="dark"] .page-sub,
[data-theme="dark"] .kpi-label { color: var(--text-muted); }

[data-theme="dark"] table.data th { color: var(--text-muted); border-bottom-color: var(--border); }
[data-theme="dark"] table.data td { border-bottom-color: var(--border-soft); color: var(--text); }
[data-theme="dark"] table.data tbody tr:hover { background: var(--row-hover); }

[data-theme="dark"] .form-control {
  background: var(--input-bg); color: var(--text); border-color: var(--border);
}
[data-theme="dark"] .form-control:focus { border-color: var(--primary); }
[data-theme="dark"] .form-group label { color: var(--text); }

[data-theme="dark"] .btn-light {
  background: var(--surface-2); color: var(--text); border-color: var(--border);
}
[data-theme="dark"] .btn-light:hover { border-color: var(--primary); color: var(--primary); }

[data-theme="dark"] .progress { background: var(--surface-2); }
[data-theme="dark"] .feed-item,
[data-theme="dark"] .comment { border-bottom-color: var(--border-soft); }
[data-theme="dark"] .feed-sub,
[data-theme="dark"] .comment-meta { color: var(--text-muted); }
[data-theme="dark"] .feed-title,
[data-theme="dark"] .comment-meta b { color: var(--text); }

[data-theme="dark"] .kanban-col { background: rgba(148, 163, 184, .08); }
[data-theme="dark"] .deal-card { background: var(--surface-2); border-color: var(--border); }
[data-theme="dark"] .deal-card .d-title { color: var(--text); }
[data-theme="dark"] .kanban-head .k-count { background: var(--surface); color: var(--text-muted); }
[data-theme="dark"] .kanban-col.drag-over { background: rgba(99, 102, 241, .18); }

[data-theme="dark"] .filters .form-control,
[data-theme="dark"] .check-pill { background: var(--surface); }
[data-theme="dark"] .badge-slate { background: var(--surface-2); color: var(--text-muted); }
[data-theme="dark"] .empty { color: var(--text-muted); }
[data-theme="dark"] .mono { color: var(--text-muted); }
