/* ============================================================
   Beauty Salon Dashboard — Editorial/Luxury style
   Typography: Fraunces (display serif) + Manrope (body sans)
   Palette: deep emerald + champagne gold + warm cream
   ============================================================ */

:root {
  --bg: #f6f1e8;
  --bg-elev: #fbf8f2;
  --bg-soft: #f0e9db;
  --bg-hover: #f3ede0;
  --border: #e6ddc9;
  --border-strong: #d4c8af;
  --text: #1a1612;
  --text-muted: #6e665b;
  --text-dim: #a89f92;

  --brand: #0f3d2e;
  --brand-2: #1e5b42;
  --brand-soft: #d9e8df;
  --accent: #b8864f;
  --accent-2: #c89b5a;
  --accent-soft: #f1e3c9;

  --ok: #2d8659;
  --ok-soft: #d3e8dc;
  --warn: #a66a1a;
  --warn-soft: #f2e3c8;
  --bad: #9a2f2d;
  --bad-soft: #efd7d4;
  --info: #1e5b74;
  --info-soft: #d5e3ea;

  --shadow-sm: 0 1px 0 rgba(26, 22, 18, 0.04);
  --shadow-md: 0 2px 8px rgba(26, 22, 18, 0.06);
  --shadow-lg: 0 10px 32px rgba(26, 22, 18, 0.1);

  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 10px;
  --radius-xl: 14px;

  --sidebar-w: 232px;
  --sidebar-w-collapsed: 64px;
  --topbar-h: 68px;

  --font-display: "Fraunces", "Playfair Display", Georgia, serif;
  --font-sans: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --chart-grid: rgba(26, 22, 18, 0.06);
  --chart-axis: #a89f92;
  --chart-text: #55503f;
}

:root[data-theme="dark"] {
  --bg: #141110;
  --bg-elev: #1d1916;
  --bg-soft: #28231e;
  --bg-hover: #2f2a23;
  --border: #352f27;
  --border-strong: #4c4236;
  --text: #f4ece0;
  --text-muted: #b3a992;
  --text-dim: #7a7060;

  --brand: #5fa88a;
  --brand-2: #7ec0a4;
  --brand-soft: rgba(95, 168, 138, 0.14);
  --accent: #d4a574;
  --accent-2: #e3bc92;
  --accent-soft: rgba(212, 165, 116, 0.14);

  --ok: #7ec0a4;
  --ok-soft: rgba(126, 192, 164, 0.14);
  --warn: #e0b173;
  --warn-soft: rgba(224, 177, 115, 0.14);
  --bad: #d98075;
  --bad-soft: rgba(217, 128, 117, 0.14);
  --info: #87b8cc;
  --info-soft: rgba(135, 184, 204, 0.14);

  --shadow-sm: 0 1px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 2px 10px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 50px rgba(0, 0, 0, 0.6);

  --chart-grid: rgba(244, 236, 224, 0.08);
  --chart-axis: #7a7060;
  --chart-text: #b3a992;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
  font-feature-settings: "ss01", "cv11";
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; color: inherit; }

.display {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.015em;
  font-optical-sizing: auto;
}

/* ============ App layout ============ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.2s ease;
}
.app.sidebar-collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

/* ============ Sidebar ============ */
.sidebar {
  background: var(--brand);
  color: #e8dcc5;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  border-right: 1px solid var(--brand);
}
:root[data-theme="dark"] .sidebar {
  background: #0d0b09;
  border-right: 1px solid #1f1b17;
}

.sb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-h);
  padding: 0 18px;
  border-bottom: 1px solid rgba(232, 220, 197, 0.12);
  gap: 10px;
}
.sb-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
}
.sb-brand-mark {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  display: grid;
  place-items: center;
  color: var(--brand);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  flex-shrink: 0;
  font-style: italic;
}
.sb-brand-name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 17px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #f5ead2;
}
.sb-brand-sub {
  font-size: 10.5px;
  color: rgba(232, 220, 197, 0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-top: 1px;
}
.sb-collapse {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 6px;
  color: rgba(232, 220, 197, 0.5);
  transition: all 0.15s;
}
.sb-collapse:hover { background: rgba(232, 220, 197, 0.08); color: #f5ead2; }
.sb-collapse svg { width: 14px; height: 14px; transition: transform 0.2s; }
.app.sidebar-collapsed .sb-collapse svg { transform: rotate(180deg); }

.sb-nav {
  flex: 1;
  overflow-y: auto;
  padding: 18px 12px 12px;
}
.sb-nav::-webkit-scrollbar { width: 4px; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(232, 220, 197, 0.1); border-radius: 2px; }

.sb-group-title {
  font-size: 10px;
  font-weight: 600;
  color: rgba(232, 220, 197, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  padding: 14px 14px 8px;
  font-family: var(--font-sans);
}
.sb-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-radius: var(--radius);
  color: rgba(232, 220, 197, 0.75);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 1px;
  transition: all 0.15s;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}
.sb-link:hover { background: rgba(232, 220, 197, 0.08); color: #f5ead2; }
.sb-link.active {
  background: var(--accent);
  color: var(--brand);
  font-weight: 600;
}
.sb-link svg { width: 16px; height: 16px; flex-shrink: 0; stroke-width: 1.8; }
.sb-link-label { overflow: hidden; text-overflow: ellipsis; }
.app.sidebar-collapsed .sb-link-label,
.app.sidebar-collapsed .sb-brand > div:not(.sb-brand-mark),
.app.sidebar-collapsed .sb-group-title { display: none; }
.app.sidebar-collapsed .sb-link { justify-content: center; padding: 10px; }

.sb-foot {
  padding: 16px 18px;
  border-top: 1px solid rgba(232, 220, 197, 0.12);
  font-size: 11px;
  color: rgba(232, 220, 197, 0.55);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sb-foot a { color: var(--accent-2); font-weight: 600; }
.app.sidebar-collapsed .sb-foot { display: none; }

/* ============ Main area ============ */
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ============ Topbar ============ */
.topbar {
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
}
.tb-row-1 {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 24px;
  min-height: var(--topbar-h);
}
.tb-row-2 {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px 12px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  row-gap: 6px;
}
.tb-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}
.tb-title small {
  display: block;
  font-family: var(--font-sans);
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 1px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.tb-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.tb-filters .popover-wrap { flex-shrink: 0; }
.tb-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  transition: all 0.15s;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font-sans);
}
.filter-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--bg-elev); }
:root[data-theme="dark"] .filter-btn:hover { color: var(--brand); border-color: var(--brand); }
.filter-btn svg { width: 13px; height: 13px; color: var(--text-muted); }
.filter-btn:hover svg { color: var(--brand); }

.icon-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--text-muted);
  transition: all 0.15s;
  border: 1px solid transparent;
  position: relative;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; }

:root[data-theme="light"] #themeToggle .icon-moon { display: none; }
:root[data-theme="dark"]  #themeToggle .icon-sun  { display: none; }

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 14px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
}
.user-chip .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: var(--bg-elev);
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-display);
}
.user-chip .nm { font-size: 13px; font-weight: 600; letter-spacing: -0.005em; }
.user-chip .rl { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; }

/* ============ Content ============ */
.page {
  padding: 28px 24px 40px;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-header h1 {
  font-family: var(--font-display);
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  font-weight: 500;
  font-optical-sizing: auto;
}
.page-header h1 em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}
.page-header .ph-desc {
  color: var(--text-muted);
  font-size: 13.5px;
  max-width: 720px;
  line-height: 1.55;
}
.page-header .ph-actions { display: flex; align-items: center; gap: 8px; }

/* Section separator */
.section-title {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: -0.01em;
  font-weight: 500;
  margin: 32px 0 14px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.section-title small {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

/* ============ Cards ============ */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 22px 20px;
  position: relative;
}
.card.tight { padding: 16px; }
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1.3;
}
.card-title small {
  display: block;
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 3px;
  letter-spacing: 0;
  text-transform: none;
}
.card-actions { display: flex; gap: 6px; align-items: center; }
.card-sub { color: var(--text-muted); font-size: 12px; }

/* Grid helpers */
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1400px) {
  .grid.cols-6 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1100px) {
  .grid.cols-5 { grid-template-columns: repeat(3, 1fr); }
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .grid.cols-3, .grid.cols-4, .grid.cols-5, .grid.cols-6 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-2 { grid-template-columns: 1fr; }
  .span-2, .span-3, .span-4 { grid-column: span 2; }
}
@media (max-width: 560px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .grid.cols-5, .grid.cols-6 { grid-template-columns: 1fr; }
  .span-2, .span-3, .span-4 { grid-column: span 1; }
}
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }

/* ============ KPI cards (horizontal, editorial style) ============ */
.kpi {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
}
.kpi-label {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.13em;
}
.kpi-value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.05;
  margin: 6px 0 2px;
}
.kpi-value .unit {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-muted);
  margin-left: 4px;
  font-weight: 500;
  letter-spacing: 0;
}
.kpi-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
}
.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11.5px;
  font-weight: 600;
}
.kpi-trend.up { color: var(--ok); }
.kpi-trend.down { color: var(--bad); }
.kpi-trend.flat { color: var(--text-muted); }
.kpi-trend svg { width: 9px; height: 9px; }

.kpi-spark {
  height: 32px;
  margin-top: 8px;
  margin-left: -4px;
  margin-right: -4px;
}

/* ============ Tables ============ */
.tbl-wrap {
  overflow-x: auto;
  margin: 0 -22px -20px;
  padding: 0 22px 20px;
}
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tbl th {
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
  position: sticky;
  top: 0;
  white-space: nowrap;
  font-family: var(--font-sans);
}
.tbl td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: var(--bg-hover); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.center, .tbl th.center { text-align: center; }
.tbl .muted { color: var(--text-muted); }
.tbl .bold { font-weight: 600; }
.tbl .numeric {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 14px;
}
.tbl tfoot td {
  font-weight: 600;
  background: var(--bg-soft);
  border-top: 1px solid var(--border-strong);
}

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.badge::before {
  content: "";
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor;
}
.badge.neutral { background: var(--bg-soft); color: var(--text-muted); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.plain::before { display: none; }

/* Progress bar */
.bar {
  height: 6px;
  background: var(--bg-soft);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  border-radius: 999px;
  transition: width 0.3s ease;
}
.bar-fill.ok { background: linear-gradient(90deg, #2d8659, #4fa77b); }
.bar-fill.warn { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.bar-fill.bad { background: linear-gradient(90deg, #9a2f2d, #c44b47); }

/* ============ Chart containers ============ */
.chart {
  width: 100%;
  height: 300px;
}
.chart.sm { height: 220px; }
.chart.md { height: 300px; }
.chart.lg { height: 380px; }
.chart.xl { height: 480px; }

/* ============ Funnel stages ============ */
.funnel-stage {
  display: grid;
  grid-template-columns: 220px 1fr 180px;
  align-items: center;
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.funnel-stage:last-child { border-bottom: 0; }
.funnel-stage .fs-name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: -0.005em;
}
.funnel-stage .fs-name small {
  display: block;
  font-family: var(--font-sans);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.funnel-stage .fs-bar {
  height: 30px;
  background: var(--bg-soft);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}
.funnel-stage .fs-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  color: #f5ead2;
  font-size: 12px;
  font-weight: 600;
  min-width: 72px;
  letter-spacing: 0.02em;
}
.funnel-stage .fs-stats {
  display: flex;
  gap: 18px;
  justify-content: flex-end;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.funnel-stage .fs-stats b {
  color: var(--text);
  font-weight: 500;
  font-family: var(--font-display);
  font-size: 15px;
  display: block;
  letter-spacing: 0;
  text-transform: none;
  margin-top: 3px;
}

@media (max-width: 700px) {
  .funnel-stage { grid-template-columns: 1fr; gap: 6px; }
  .funnel-stage .fs-stats { justify-content: flex-start; }
}

/* ============ List with score ============ */
.list-row {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.list-row:last-child { border-bottom: 0; }
.list-row .rank {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg-soft);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  color: var(--text-muted);
  font-family: var(--font-display);
}
.list-row.top-1 .rank { background: linear-gradient(135deg, #e8c076, var(--accent)); color: var(--brand); }
.list-row.top-2 .rank { background: linear-gradient(135deg, #d4c8af, #a89f92); color: var(--text); }
.list-row.top-3 .rank { background: linear-gradient(135deg, #d8a87c, #b8864f); color: #fff; }
.list-row .name { font-weight: 600; letter-spacing: -0.005em; }
.list-row .sub { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.list-row .val {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 16px;
  text-align: right;
  letter-spacing: -0.01em;
}
.list-row .val small {
  display: block;
  font-family: var(--font-sans);
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ============ Alerts ============ */
.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-bottom: 10px;
  background: var(--bg-elev);
}
.alert-item:last-child { margin-bottom: 0; }
.alert-item .alert-ico {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  flex-shrink: 0;
  font-size: 16px;
}
.alert-item.sev-critical {
  background: color-mix(in srgb, var(--bad) 5%, var(--bg-elev));
  border-color: color-mix(in srgb, var(--bad) 25%, var(--border));
}
.alert-item.sev-critical .alert-ico { background: var(--bad-soft); color: var(--bad); }
.alert-item.sev-warning {
  background: color-mix(in srgb, var(--accent) 5%, var(--bg-elev));
  border-color: color-mix(in srgb, var(--accent) 25%, var(--border));
}
.alert-item.sev-warning .alert-ico { background: var(--warn-soft); color: var(--warn); }
.alert-item.sev-info .alert-ico { background: var(--info-soft); color: var(--info); }
.alert-item.sev-info { background: color-mix(in srgb, var(--info) 4%, var(--bg-elev)); }
.alert-item .alert-body { flex: 1; min-width: 0; }
.alert-item .alert-title {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 500;
  margin-bottom: 3px;
  letter-spacing: -0.005em;
}
.alert-item .alert-msg { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }
.alert-item .alert-meta {
  font-size: 10.5px;
  color: var(--text-dim);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ============ Utility ============ */
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-4 { margin-top: 16px; }
.mt-3 { margin-top: 12px; }
.mt-2 { margin-top: 8px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 18px; }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-ok { color: var(--ok); }
.text-warn { color: var(--warn); }
.text-bad { color: var(--bad); }
.text-brand { color: var(--brand); }
.text-accent { color: var(--accent); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.bold { font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.serif { font-family: var(--font-display); font-weight: 500; letter-spacing: -0.01em; }

/* ============ Inputs ============ */
.input, .select {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 12.5px;
  transition: all 0.15s;
  outline: none;
  min-width: 0;
  font-family: var(--font-sans);
}
.input:focus, .select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent);
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
}
.search input { border: 0; outline: 0; background: transparent; color: var(--text); font-size: 12.5px; flex: 1; min-width: 120px; }
.search svg { width: 13px; height: 13px; color: var(--text-muted); }

/* ============ Tabs ============ */
.tabs {
  display: inline-flex;
  padding: 3px;
  background: var(--bg-soft);
  border-radius: 999px;
  gap: 2px;
}
.tabs button {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  transition: all 0.15s;
  font-family: var(--font-sans);
  letter-spacing: 0.01em;
}
.tabs button.active {
  background: var(--brand);
  color: #f5ead2;
}

/* ============ Map placeholder ============ */
.map-stub {
  width: 100%;
  height: 360px;
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 40%, var(--accent-soft), transparent 50%),
    linear-gradient(135deg, var(--bg-soft) 0%, var(--bg-hover) 100%);
  border: 1px solid var(--border);
}
.map-stub .map-dot {
  position: absolute;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid var(--bg-elev);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--brand) 18%, transparent);
  transform: translate(-50%, -50%);
  cursor: pointer;
  transition: transform 0.2s;
}
.map-stub .map-dot:hover { transform: translate(-50%, -50%) scale(1.3); }
.map-stub .map-label {
  position: absolute;
  transform: translate(10px, -50%);
  background: var(--bg-elev);
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  font-family: var(--font-display);
  font-weight: 500;
}
.map-stub::after {
  content: "Казахстан · схема расположения";
  position: absolute;
  bottom: 14px; right: 16px;
  font-size: 10.5px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* ============ Avatar ============ */
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  font-family: var(--font-display);
}
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar.lg { width: 44px; height: 44px; font-size: 14px; }

/* ============ Dropdown menu ============ */
.menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 100;
  display: none;
}
.menu.open { display: block; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 12.5px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.1s;
}
.menu-item:hover { background: var(--bg-soft); }
.menu-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.menu-item .check { margin-left: auto; opacity: 0; }
.menu-item.active .check { opacity: 1; }

.popover-wrap { position: relative; }

/* Mobile */
@media (max-width: 900px) {
  .app { grid-template-columns: 0 1fr; }
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    width: var(--sidebar-w);
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.2s;
  }
  .app.mobile-sidebar-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .app.sidebar-collapsed { grid-template-columns: 0 1fr; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* Decorative divider */
.divider-ornament {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--accent);
}
.divider-ornament::before,
.divider-ornament::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.divider-ornament span {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Mini KPI cell */
.mini-kpi {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  background: var(--bg-soft);
  border-radius: var(--radius);
}
.mini-kpi .mk-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
}
.mini-kpi .mk-value {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.mini-kpi .mk-delta {
  font-size: 11px;
  color: var(--text-muted);
}
