/*
 * Демо-панель управления. Базовая тема тёмная; бренд накатывает свой скин
 * через config.js (см. boot() в app.js): data-mode переключает светлую
 * палитру, data-layout — компоновку, skin.vars — любые переменные ниже.
 */

:root {
  --bg: #0b101d;
  --bg-side: #0a0e19;
  --card: #111726;
  --card-2: #151c2e;
  --line: rgba(148, 163, 197, 0.12);
  --line-2: rgba(148, 163, 197, 0.2);
  --text: #e6eaf3;
  --text-strong: #ffffff;
  --muted: #8a93a8;
  --muted-2: #5d6579;
  --green: #2fd575;
  --amber: #f5b544;
  --red: #f2545b;
  --violet: #8b5cf6;
  --radius: 14px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --chart-grid: rgba(148, 163, 197, 0.1);
  --topbar-bg: rgba(11, 16, 29, 0.85);
  --shadow-pop: 0 18px 40px -12px rgba(0, 0, 0, 0.6);
}

/* Светлый скин: перекрывает палитру, компоненты остаются общими. */
:root[data-mode="light"] {
  --bg: #f3f5fa;
  --bg-side: #ffffff;
  --card: #ffffff;
  --card-2: #f6f7fc;
  --line: rgba(15, 23, 42, 0.09);
  --line-2: rgba(15, 23, 42, 0.18);
  --text: #16202e;
  --text-strong: #0b1220;
  --muted: #5b6472;
  --muted-2: #8a93a4;
  --chart-grid: rgba(15, 23, 42, 0.07);
  --topbar-bg: rgba(255, 255, 255, 0.85);
  --shadow-pop: 0 18px 40px -18px rgba(15, 23, 42, 0.25);
}

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

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.shell { display: flex; min-height: 100vh; }

/* ---------------- Сайдбар ---------------- */

.side {
  width: 236px;
  min-width: 236px;
  background: var(--bg-side);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.side::-webkit-scrollbar { width: 0; }

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px 16px;
}

.logo-badge {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 17px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px -6px var(--accent-glow);
}

.logo-name { font-size: 17px; font-weight: 800; letter-spacing: 0.2px; }
.logo-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.nav { padding: 6px 12px 12px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 2px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.nav-item svg { width: 18px; height: 18px; flex: none; opacity: 0.85; }

.nav-item:hover { background: rgba(148, 163, 197, 0.07); color: var(--text); }

.nav-item.active {
  background: linear-gradient(90deg, var(--accent-soft), rgba(148, 163, 197, 0.04));
  color: var(--text-strong);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

.nav-item.active svg { color: var(--accent-ic); opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 26px;
  text-align: center;
  padding: 2px 7px;
  border-radius: 20px;
}

.side-user {
  border-top: 1px solid var(--line);
  padding: 14px 16px;
  position: sticky;
  bottom: 0;
  background: var(--bg-side);
}

.side-user-row { display: flex; align-items: center; gap: 10px; }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.side-user-name { font-weight: 600; font-size: 13.5px; }
.side-user-role { font-size: 11.5px; color: var(--muted); }

.side-user-caret { margin-left: auto; color: var(--muted-2); line-height: 0; }
.side-user-caret svg { width: 15px; height: 15px; }

.side-icons { display: flex; gap: 8px; margin-top: 12px; }

.icon-btn {
  flex: 1;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(148, 163, 197, 0.05);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover { color: var(--text); border-color: var(--line-2); }
.icon-btn svg { width: 16px; height: 16px; }

/* ---------------- Топбар и контент ---------------- */

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 26px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
  z-index: 20;
}

.search {
  flex: 0 1 480px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 14px;
  color: var(--muted);
}

.search > svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.search input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font: inherit;
}

.search input::placeholder { color: var(--muted-2); }

.search kbd {
  font: 600 11px/1 inherit;
  color: var(--muted-2);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  padding: 3px 6px;
}

.topbar-spacer { flex: 1; }

.btn-accent {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: 0;
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 11px;
  cursor: pointer;
  box-shadow: 0 8px 20px -8px var(--accent-glow);
}

.btn-accent:hover { filter: brightness(1.08); }
.btn-accent svg { width: 15px; height: 15px; }

.qa-wrap { position: relative; }

.qa-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--card-2);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 6px;
  min-width: 220px;
  box-shadow: var(--shadow-pop);
  display: none;
  z-index: 30;
}

.qa-menu.open { display: block; }

.qa-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.qa-menu button:hover { background: rgba(148, 163, 197, 0.08); }
.qa-menu svg { width: 15px; height: 15px; color: var(--accent-ic); }

.content { padding: 24px 26px 40px; flex: 1; }

.page-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.page-title { font-size: 24px; font-weight: 800; letter-spacing: 0.2px; }
.page-sub { color: var(--muted); margin-top: 4px; font-size: 13px; }

.date-chip {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 9px 14px;
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
}

.date-chip svg { width: 15px; height: 15px; color: var(--muted); }

/* ---------------- Сетка дашборда ---------------- */

.dash { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; }
.dash-main { min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.dash-rail { display: flex; flex-direction: column; gap: 18px; }

.kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.kpi { position: relative; }

.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.kpi-label { color: var(--muted); font-size: 12.5px; }

.kpi-ic {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.kpi-ic svg { width: 17px; height: 17px; }

.kpi-val {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.3px;
  margin-top: 9px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.kpi-delta { font-size: 12px; font-weight: 700; }
.kpi-delta.up { color: var(--green); }
.kpi-delta.down { color: var(--red); }

.kpi-foot { color: var(--muted-2); font-size: 12px; margin-top: 7px; }

/* ---------------- Редактирование (карандаш) ---------------- */

.editable { position: relative; }

.pencil {
  border: 0;
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
  padding: 2px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.15s;
  vertical-align: middle;
  line-height: 0;
}

.pencil svg { width: 12px; height: 12px; }

.editable:hover .pencil, .card:hover .kpi-pencil { opacity: 0.45; }
.pencil:hover { opacity: 1 !important; color: var(--text); background: rgba(148, 163, 197, 0.12); }

.edit-box { display: inline-flex; align-items: center; gap: 6px; }

.edit-box input {
  width: 110px;
  background: var(--bg);
  border: 1px solid var(--accent-line);
  border-radius: 8px;
  color: var(--text);
  font: 700 14px/1.2 inherit;
  padding: 5px 8px;
  outline: none;
}

.edit-ok, .edit-reset {
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font: 600 11px/1 inherit;
  padding: 6px 8px;
}

.edit-ok { background: var(--accent); color: #fff; }
.edit-reset { background: rgba(148, 163, 197, 0.12); color: var(--muted); }
.edit-reset:hover { color: var(--text); }

.edited-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--amber);
  vertical-align: super;
  margin-left: 2px;
  opacity: 0.8;
}

/* Редактирование точек графика */

.chart-wrap { position: relative; }
.chart-dot { cursor: pointer; }

.chart-edit {
  position: absolute;
  z-index: 30;
  background: var(--card-2);
  border: 1px solid var(--line-2);
  border-radius: 11px;
  padding: 8px 10px;
  box-shadow: var(--shadow-pop);
}

.chart-edit-label { font-size: 11px; color: var(--muted); margin-bottom: 6px; }

/* Редактирование текстов уведомлений */

.etext { display: inline; }
.etext .ev { display: inline; }

.notif .pencil { padding: 1px; }
.notif .pencil svg { width: 11px; height: 11px; }
.notif:hover .pencil { opacity: 0.45; }

.edit-box.text input { width: 210px; font-weight: 500; }

/* ---------------- Карточки-виджеты ---------------- */

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.card-title { font-size: 15px; font-weight: 700; }
.card-link {
  margin-left: auto;
  background: none;
  border: 0;
  color: var(--accent-ic);
  font: 600 12.5px inherit;
  cursor: pointer;
}
.card-link:hover { text-decoration: underline; }

.chart-big-val { font-size: 22px; font-weight: 800; display: flex; align-items: baseline; gap: 8px; }

.select {
  margin-left: auto;
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 9px;
  font: 500 12.5px inherit;
  padding: 7px 10px;
  cursor: pointer;
  outline: none;
}

.chart-wrap { width: 100%; overflow: hidden; }
.chart-wrap svg { display: block; width: 100%; height: auto; }

.split { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 18px; }

.donut-flex { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.donut-flex svg { flex: none; }

.legend { width: 100%; min-width: 0; display: flex; flex-direction: column; gap: 9px; }

.legend-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.legend-name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-pct { margin-left: auto; color: var(--muted); flex: none; }
.legend-val { font-weight: 600; flex: none; min-width: 70px; text-align: right; }

.legend-total {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  margin-top: 6px;
  padding-top: 10px;
  font-size: 13px;
}
.legend-total b { font-size: 14px; }

/* ---------------- Таблицы ---------------- */

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; white-space: nowrap; }

th {
  text-align: left;
  color: var(--muted-2);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  vertical-align: middle;
}

tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(148, 163, 197, 0.035); }

.order-id { color: var(--accent-ic); font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.order-id svg { width: 12px; height: 12px; opacity: 0.7; }

.prod-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }

.prod-tile {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 800;
  color: #fff;
}

.prod-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 20px;
  padding: 4px 10px;
}

.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.pill.done { color: var(--green); background: rgba(47, 213, 117, 0.1); }
.pill.processing { color: var(--amber); background: rgba(245, 181, 68, 0.1); }
.pill.cancelled { color: var(--red); background: rgba(242, 84, 91, 0.1); }
.pill.new { color: var(--accent-ic); background: var(--accent-soft); }
.pill.active { color: var(--green); background: rgba(47, 213, 117, 0.1); }
.pill.idle { color: var(--muted); background: rgba(148, 163, 197, 0.1); }

.muted { color: var(--muted); }
.small { font-size: 12px; }

.table-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 14px;
}

.pager { margin-left: auto; display: flex; gap: 6px; }

.pager button {
  min-width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  border-radius: 9px;
  font: 600 12.5px inherit;
  cursor: pointer;
  padding: 0 10px;
}

.pager button:disabled { opacity: 0.35; cursor: default; }
.pager button.cur { background: var(--accent); border-color: transparent; }

.btn-ghost {
  display: block;
  margin: 14px auto 0;
  background: var(--card-2);
  border: 1px solid var(--line-2);
  color: var(--text);
  font: 600 13px inherit;
  border-radius: 10px;
  padding: 10px 18px;
  cursor: pointer;
}

.btn-ghost:hover { border-color: var(--accent-line); color: var(--text-strong); }

/* ---------------- Правая колонка ---------------- */

.notif { display: flex; gap: 11px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.notif:last-child { border-bottom: 0; padding-bottom: 2px; }

.notif-ic {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notif-ic svg { width: 15px; height: 15px; }

.notif-ic.danger { color: var(--red); background: rgba(242, 84, 91, 0.12); }
.notif-ic.warn { color: var(--amber); background: rgba(245, 181, 68, 0.12); }
.notif-ic.info { color: var(--accent-ic); background: var(--accent-soft); }
.notif-ic.ok { color: var(--green); background: rgba(47, 213, 117, 0.12); }

.notif-title { font-weight: 600; font-size: 13px; }
.notif-text { color: var(--muted); font-size: 12px; margin-top: 2px; line-height: 1.45; }
.notif-time { color: var(--muted-2); font-size: 11px; margin-top: 4px; }

.stock-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; }

.stock-ic {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
}

.stock-name { font-size: 12.5px; color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.stock-bar { flex: 0 0 84px; height: 4px; border-radius: 3px; background: rgba(148, 163, 197, 0.12); overflow: hidden; }
.stock-bar i { display: block; height: 100%; border-radius: 3px; }

.stock-val { font-weight: 700; font-size: 13px; min-width: 46px; text-align: right; }

.qa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.qa-card {
  border: 1px solid var(--line);
  background: var(--card-2);
  border-radius: 12px;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font: 500 12px inherit;
  cursor: pointer;
  text-align: center;
}

.qa-card:hover { border-color: var(--accent-line); background: var(--accent-soft); }

.qa-card .qa-ic {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qa-card svg { width: 16px; height: 16px; }

/* ---------------- Страницы разделов ---------------- */

.stat-chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-chips.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.chip-label { color: var(--muted); font-size: 12px; }
.chip-val { font-size: 20px; font-weight: 800; margin-top: 6px; }

.type-tabs { display: flex; gap: 8px; margin-bottom: 8px; }

.type-tabs button {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--muted);
  font: 600 13px inherit;
  border-radius: 11px;
  padding: 10px 16px;
  cursor: pointer;
}

.type-tabs button svg { width: 15px; height: 15px; }
.type-tabs button.cur { background: var(--accent-soft); border-color: var(--accent-line); color: var(--text-strong); }

.type-tabs .tab-count {
  background: rgba(148, 163, 197, 0.12);
  border-radius: 20px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--muted);
}

.type-tabs button.cur .tab-count { background: var(--accent); color: #fff; }

.type-sub { color: var(--muted-2); font-size: 12px; margin-bottom: 14px; line-height: 1.5; }

.kz-pill {
  display: inline-block;
  margin-left: 6px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.4px;
  color: var(--violet);
  background: rgba(139, 92, 246, 0.14);
  border-radius: 6px;
  padding: 2px 5px;
  vertical-align: middle;
}

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; align-items: center; }

.filters .search { flex: 0 1 340px; padding: 8px 12px; }

.chips { display: flex; gap: 6px; }

.chips button {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font: 500 12.5px inherit;
  border-radius: 20px;
  padding: 7px 13px;
  cursor: pointer;
}

.chips button.cur { background: var(--accent-soft); border-color: var(--accent-line); color: var(--text-strong); }

/* ---------------- Плейсхолдер ---------------- */

.placeholder {
  min-height: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  padding: 40px;
}

.ph-ic {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--accent-ic);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ph-ic svg { width: 28px; height: 28px; }

.ph-title { font-size: 19px; font-weight: 800; }
.ph-text { color: var(--muted); max-width: 440px; line-height: 1.55; }

.ph-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--amber);
  background: rgba(245, 181, 68, 0.1);
  border-radius: 20px;
  padding: 5px 12px;
}

/* ---------------- Выписка (модалка) ---------------- */

.btn-export { padding: 8px 14px; margin-left: auto; }
.btn-export svg { width: 15px; height: 15px; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 16, 0.66);
  backdrop-filter: blur(3px);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal {
  width: 460px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--card-2);
  border: 1px solid var(--line-2);
  border-radius: 16px;
  padding: 20px 22px;
  box-shadow: var(--shadow-pop);
}

.modal-title { font-size: 17px; font-weight: 800; }
.modal-sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

.modal-row { margin-top: 14px; }
.modal-row > label { display: block; color: var(--muted); font-size: 12px; }
.modal-row label input { margin-top: 6px; }
.modal-row .chips { margin-top: 6px; }
.modal-row.two { display: flex; gap: 10px; }
.modal-row.two label { flex: 1; }

.modal input[type="date"], .modal input[type="text"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: 9px;
  color: var(--text);
  font: inherit;
  padding: 8px 10px;
  outline: none;
  color-scheme: dark;
}

.modal input:focus { border-color: var(--accent-line); }

.modal-hint { color: var(--muted-2); font-size: 11.5px; margin-top: 6px; }

.modal-note {
  margin-top: 14px;
  padding: 10px 12px;
  border-left: 3px solid var(--amber);
  background: rgba(245, 181, 68, 0.07);
  color: var(--muted);
  font-size: 12px;
  border-radius: 8px;
  line-height: 1.5;
}

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.modal-actions .btn-ghost { margin: 0; }

/* ---------------- Тосты ---------------- */

.toast-zone {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
}

.toast {
  background: var(--card-2);
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--accent);
  color: var(--text);
  border-radius: 11px;
  padding: 11px 16px;
  font-size: 13px;
  box-shadow: var(--shadow-pop);
  animation: toast-in 0.2s ease;
}

@keyframes toast-in {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* ---------------- Компоновка «верхнее меню» ---------------- */

/*
 * data-layout="topbar": сайдбар превращается в горизонтальную полосу
 * навигации над контентом. Разметка общая — меняется только CSS.
 */

:root[data-layout="topbar"] .shell { flex-direction: column; }

:root[data-layout="topbar"] .side {
  width: 100%;
  min-width: 0;
  height: auto;
  position: static;
  flex-direction: row;
  align-items: center;
  border-right: 0;
  border-bottom: 1px solid var(--line);
  padding-right: 10px;
  overflow-y: visible;
}

:root[data-layout="topbar"] .logo { padding: 10px 16px; }

:root[data-layout="topbar"] .nav {
  display: flex;
  flex: 1;
  min-width: 0;
  padding: 8px 6px;
  overflow-x: auto;
}

:root[data-layout="topbar"] .nav::-webkit-scrollbar { height: 0; }

:root[data-layout="topbar"] .nav-item {
  width: auto;
  margin: 0 1px;
  padding: 8px 12px;
  white-space: nowrap;
}

:root[data-layout="topbar"] .side-user {
  border-top: 0;
  position: static;
  padding: 8px 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
}

:root[data-layout="topbar"] .side-user-row { gap: 8px; }
:root[data-layout="topbar"] .side-user-role,
:root[data-layout="topbar"] .side-user-caret { display: none; }
:root[data-layout="topbar"] .side-icons { margin-top: 0; }
:root[data-layout="topbar"] .icon-btn { width: 34px; flex: none; }

/* ================= Брендовые варианты компоновки =================
 *
 * Панели портфеля не должны читаться как одна вёрстка с перекрашенным
 * акцентом, поэтому структура тоже брендовая: data-nav задаёт компонент
 * навигации, data-kpi/-cards/-table — подачу блоков, data-density — плотность.
 * Все варианты работают поверх ОДНОЙ разметки: JS их не знает, кроме
 * группировки пунктов у 'grouped'.
 */

/* --- Плотность --- */

:root[data-density="compact"] .content { padding: 16px 18px 28px; }
:root[data-density="compact"] .card { padding: 12px 14px; }
:root[data-density="compact"] .dash,
:root[data-density="compact"] .dash-main,
:root[data-density="compact"] .dash-rail,
:root[data-density="compact"] .split { gap: 12px; }
:root[data-density="compact"] td { padding: 7px 10px; }
:root[data-density="compact"] .page-title { font-size: 20px; }

:root[data-density="roomy"] .content { padding: 34px 38px 56px; }
:root[data-density="roomy"] .card { padding: 22px 24px; }
:root[data-density="roomy"] .dash,
:root[data-density="roomy"] .dash-main,
:root[data-density="roomy"] .dash-rail,
:root[data-density="roomy"] .split { gap: 24px; }
:root[data-density="roomy"] td { padding: 15px 14px; }
:root[data-density="roomy"] .page-title { font-size: 28px; }

:root[data-uppercase] .card-title,
:root[data-uppercase] .kpi-label,
:root[data-uppercase] .chip-label,
:root[data-uppercase] .nav-item span {
  text-transform: uppercase;
  letter-spacing: 0.7px;
  font-size: 11.5px;
}

/* --- Карточки --- */

:root[data-cards="flat"] .card {
  border: 0;
  border-top: 2px solid var(--accent-line);
  border-radius: 0;
  background: transparent;
  padding-left: 0;
  padding-right: 0;
}
:root[data-cards="flat"] .kpi-ic { display: none; }

:root[data-cards="outline"] .card {
  background: transparent;
  border: 1px solid var(--line-2);
  box-shadow: none;
}

:root[data-cards="tiles"] .card {
  border: 0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px -16px rgba(15, 23, 42, 0.4);
}

/* --- KPI --- */

/* Полоса: показатели идут строкой с разделителями, без карточек. */
:root[data-kpi="strip"] .kpis {
  display: flex;
  grid-template-columns: none;
  gap: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
:root[data-kpi="strip"] .kpis .card {
  flex: 1 1 0;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
:root[data-kpi="strip"] .kpis .card:last-child { border-right: 0; }
:root[data-kpi="strip"] .kpi-ic { display: none; }
:root[data-kpi="strip"] .kpi-val { font-size: 20px; margin-top: 6px; }
:root[data-kpi="strip"] .kpi-foot { display: none; }

/* Строки: список показателей с крупным числом справа. */
:root[data-kpi="rows"] .kpis { grid-template-columns: 1fr; gap: 0; }
:root[data-kpi="rows"] .kpis .card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 12px 0;
  background: transparent;
  box-shadow: none;
}
:root[data-kpi="rows"] .kpi-top { order: 1; }
:root[data-kpi="rows"] .kpi-val { order: 2; margin: 0; justify-content: flex-end; }
:root[data-kpi="rows"] .kpi-foot { order: 3; grid-column: 1 / -1; margin: 0; }
:root[data-kpi="rows"] .kpi-ic { display: none; }

/* Плитки: крупная иконка сверху, число под ней. */
:root[data-kpi="tiles"] .kpis .card { text-align: center; }
:root[data-kpi="tiles"] .kpi-top { flex-direction: column; align-items: center; gap: 10px; }
:root[data-kpi="tiles"] .kpi-ic { width: 44px; height: 44px; order: -1; }
:root[data-kpi="tiles"] .kpi-ic svg { width: 21px; height: 21px; }
:root[data-kpi="tiles"] .kpi-val { justify-content: center; }
:root[data-kpi="tiles"] .kpi-foot { text-align: center; }

/* --- Таблицы --- */

:root[data-table="striped"] tbody tr:nth-child(odd) td { background: var(--card-2); }
:root[data-table="striped"] td { border-bottom: 0; }

:root[data-table="grid"] th,
:root[data-table="grid"] td { border-right: 1px solid var(--line); }
:root[data-table="grid"] th:last-child,
:root[data-table="grid"] td:last-child { border-right: 0; }
:root[data-table="grid"] table { font-variant-numeric: tabular-nums; }

/* Карточный список: строки таблицы превращаются в карточки. */
:root[data-table="cards"] thead { display: none; }
:root[data-table="cards"] table,
:root[data-table="cards"] tbody,
:root[data-table="cards"] tr,
:root[data-table="cards"] td { display: block; white-space: normal; }
:root[data-table="cards"] tbody tr {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 12px;
}
:root[data-table="cards"] tbody tr td { border: 0; padding: 2px 0; }
:root[data-table="cards"] tbody tr td:nth-child(3) { grid-column: 1 / -1; }
:root[data-table="cards"] tbody tr:hover td { background: transparent; }

/* --- Навигация: рельс (узкая колонка иконок с подписями) --- */

:root[data-nav="rail"] .side { width: 88px; min-width: 88px; }
:root[data-nav="rail"] .logo { flex-direction: column; gap: 6px; padding: 16px 8px 10px; text-align: center; }
:root[data-nav="rail"] .logo-name,
:root[data-nav="rail"] .logo-sub { display: none; }
:root[data-nav="rail"] .nav { padding: 6px 6px 12px; }
:root[data-nav="rail"] .nav-item {
  flex-direction: column;
  gap: 5px;
  padding: 9px 4px;
  text-align: center;
  font-size: 10.5px;
  line-height: 1.15;
}
:root[data-nav="rail"] .nav-item span { display: block; }
:root[data-nav="rail"] .nav-badge { position: absolute; top: 4px; right: 12px; margin: 0; min-width: 18px; padding: 1px 5px; }
:root[data-nav="rail"] .nav-item { position: relative; }
:root[data-nav="rail"] .side-user { padding: 10px 8px; }
:root[data-nav="rail"] .side-user-name,
:root[data-nav="rail"] .side-user-role,
:root[data-nav="rail"] .side-user-caret { display: none; }
:root[data-nav="rail"] .side-user-row { justify-content: center; }
:root[data-nav="rail"] .side-icons { flex-direction: column; }

/* --- Навигация: сгруппированный сайдбар с заголовками секций --- */

:root[data-nav="grouped"] .nav-group { margin-bottom: 14px; }
:root[data-nav="grouped"] .nav-group-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--muted-2);
  padding: 4px 12px 6px;
}
:root[data-nav="grouped"] .nav-item { border-radius: 8px; }

/* --- Навигация: нижний плавающий док --- */

:root[data-nav="dock"] .shell { flex-direction: column; padding-bottom: 78px; }
:root[data-nav="dock"] .side {
  position: fixed;
  left: 50%;
  /* База задаёт `.side { top: 0 }` для sticky-сайдбара: без сброса пара
     top+bottom растянула бы док на всю высоту экрана. */
  top: auto;
  bottom: 14px;
  transform: translateX(-50%);
  width: auto;
  min-width: 0;
  max-width: calc(100vw - 28px);
  height: auto;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  box-shadow: var(--shadow-pop);
  z-index: 50;
  overflow-x: auto;
}
:root[data-nav="dock"] .logo { padding: 0 6px 0 4px; }
:root[data-nav="dock"] .logo > div:last-child { display: none; }
:root[data-nav="dock"] .nav { display: flex; padding: 0; flex: 0 1 auto; overflow-x: auto; }
:root[data-nav="dock"] .nav::-webkit-scrollbar { height: 0; }
:root[data-nav="dock"] .nav-item {
  width: auto;
  margin: 0 1px;
  padding: 8px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
:root[data-nav="dock"] .side-user { border: 0; padding: 0 4px; position: static; background: transparent; }
:root[data-nav="dock"] .side-user-name,
:root[data-nav="dock"] .side-user-role,
:root[data-nav="dock"] .side-user-caret,
:root[data-nav="dock"] .side-icons { display: none; }

/* --- Навигация: вкладки под hero-заголовком --- */

:root[data-nav="tabs"] .shell { flex-direction: column; }
:root[data-nav="tabs"] .side {
  width: 100%;
  min-width: 0;
  height: auto;
  position: static;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  border-right: 0;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
:root[data-nav="tabs"] .logo { padding: 0 14px 0 0; }
:root[data-nav="tabs"] .nav { display: flex; padding: 0; flex: 1; overflow-x: auto; }
:root[data-nav="tabs"] .nav::-webkit-scrollbar { height: 0; }
:root[data-nav="tabs"] .nav-item {
  width: auto;
  margin: 0;
  padding: 10px 14px;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
:root[data-nav="tabs"] .nav-item svg { display: none; }
:root[data-nav="tabs"] .nav-item.active {
  background: transparent;
  box-shadow: none;
  border-bottom-color: var(--accent);
  color: var(--text-strong);
}
:root[data-nav="tabs"] .side-user { border: 0; padding: 0; position: static; background: transparent; }
:root[data-nav="tabs"] .side-user-role,
:root[data-nav="tabs"] .side-user-caret { display: none; }
:root[data-nav="tabs"] .side-icons { margin-top: 0; }
:root[data-nav="tabs"] .icon-btn { width: 32px; flex: none; }
:root[data-nav="tabs"] .page-title { font-size: 30px; letter-spacing: -0.4px; }

/* ---------------- Адаптив ---------------- */

@media (max-width: 1460px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1240px) {
  .dash { grid-template-columns: 1fr; }
  .dash-rail { flex-direction: row; flex-wrap: wrap; }
  .dash-rail > .card { flex: 1 1 300px; }
}

@media (max-width: 980px) {
  .split { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 40; transform: translateX(-100%); transition: transform 0.2s; }
  .side.open { transform: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-chips, .stat-chips.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
