/* ============================================================
   HELM — AI Manager Console
   Design tokens + base styles
   ============================================================ */

:root {
  /* Neutrals — slightly warm slate */
  --bg:           #FAFAF9;
  --bg-elev:     #FFFFFF;
  --bg-muted:    #F4F4F2;
  --bg-hover:    #F1F1EF;
  --bg-active:   #E9E9E6;

  --border:      #E7E5E1;
  --border-strong:#D6D3CE;
  --border-focus:#0F172A;

  --text:        #0A0A0A;
  --text-soft:   #3F3F3F;
  --text-muted:  #6B6B6B;
  --text-faint:  #9A9A95;
  --text-inverse:#FAFAF9;

  /* Accent — slate/near-black, Vercel-style minimal */
  --accent:      #0F172A;
  --accent-hover:#1E2536;
  --accent-soft: #F4F4F2;

  /* Status */
  --ok-fg:       #15803D;
  --ok-bg:       #EAF7EF;
  --ok-border:   #BFE3CC;

  --warn-fg:     #A16207;
  --warn-bg:     #FBF6E7;
  --warn-border: #ECDDA1;

  --high-fg:     #C2410C;
  --high-bg:     #FBEFE6;
  --high-border: #F1C9A8;

  --crit-fg:     #B91C1C;
  --crit-bg:     #FBEAEA;
  --crit-border: #EFC3C3;

  --off-fg:      #6B6B6B;
  --off-bg:      #F1F1EF;
  --off-border:  #D6D3CE;

  --info-fg:     #1E40AF;
  --info-bg:     #EAF0FB;
  --info-border: #BFD0EF;

  /* Brand + sidebar shell (see shell.css) */
  --brand:        #5b5bf0;
  --brand-strong: #4f46e5;
  --brand-soft:   #eef0ff;
  --brand-border: #d6d8fb;
  --side-bg:      #0c1322;
  --side-bg-2:    #0a0f1c;
  --side-line:    rgba(255,255,255,0.07);
  --side-text:    #aeb9cc;
  --side-text-dim:#6b7689;
  --side-text-hi: #f2f5fa;
  --side-hover:   rgba(255,255,255,0.05);
  --side-active:  rgba(122,124,240,0.16);
  --side-w: 256px;
  --side-w-collapsed: 72px;

  /* Type */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Sizing */
  --radius-sm: 4px;
  --radius:    6px;
  --radius-lg: 8px;
  --radius-xl: 12px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 0 0 1px rgba(15, 23, 42, 0.04);
  --shadow:    0 4px 12px rgba(15, 23, 42, 0.06), 0 0 0 1px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(15, 23, 42, 0.06);

  --nav-h: 60px;
  --container: 1320px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01';
}

#root { min-height: 100vh; }

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ---------------------- Layout ----------------------- */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: row;
  align-items: stretch;
}

.topnav {
  height: var(--nav-h);
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.topnav-inner {
  max-width: var(--container);
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 22px; height: 22px;
  background: var(--accent);
  border-radius: 5px;
  display: grid; place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0;
}
.brand-sep {
  color: var(--text-faint);
  font-weight: 400;
  margin: 0 2px;
}
.nav-list {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 8px;
  flex: 1;
}
.nav-item {
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text-soft);
  border-radius: 6px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-weight: 500;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active {
  background: var(--bg-muted);
  color: var(--text);
}
.nav-item-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.nav-more-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 160px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  z-index: 60;
  padding: 4px;
}
.nav-more-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  font-size: 13px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-soft);
}
.nav-more-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-more-item.active { background: var(--bg-muted); color: var(--text); font-weight: 600; }
.data-loading-bar {
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.topnav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  margin-left: auto;
}

/* Язык — тот же select, что кабинет в brand (height 28) */
.topnav-right .lang-select {
  width: auto;
  min-width: 118px;
  max-width: 140px;
  height: 28px;
  padding-left: 10px;
  padding-right: 30px;
  font-size: 13px;
  font-weight: 500;
  background-color: var(--bg-muted);
  border-color: var(--border);
  color: var(--text-soft);
}
.topnav-right .lang-select:hover:not(:disabled) {
  background-color: var(--bg-hover);
  color: var(--text);
}
.topnav-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  flex-shrink: 0;
}

.lang-select--login {
  min-width: 132px;
  height: 34px;
  background-color: var(--bg-elev);
}

.role-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-soft);
  font-weight: 500;
}
.role-dot {
  width: 6px; height: 6px; border-radius: 999px; background: var(--ok-fg);
}
.role-dot.viewer { background: var(--text-faint); }
.role-dot.manager { background: var(--info-fg); }

/* ---------------------- Page ----------------------- */
.page {
  max-width: var(--container);
  margin: 0 auto;
  padding: 28px 24px 64px;
}
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.page-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text);
}
.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}
.page-actions {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}

/* ---------------------- Buttons ----------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  height: 32px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
  white-space: nowrap;
  line-height: 1;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-elev);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-soft);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text); }

.btn-danger {
  background: #fff;
  color: var(--crit-fg);
  border-color: var(--crit-border);
}
.btn-danger:hover:not(:disabled) { background: var(--crit-bg); }

.btn-danger-solid {
  background: var(--crit-fg);
  color: #fff;
  border-color: var(--crit-fg);
}
.btn-danger-solid:hover:not(:disabled) { background: #991B1B; border-color: #991B1B; }

.btn-sm { height: 26px; padding: 0 8px; font-size: 12px; gap: 4px; }
.btn-lg { height: 38px; padding: 0 16px; font-size: 14px; }
.btn-icon { padding: 0; width: 32px; }
.btn-icon.btn-sm { width: 26px; }

/* ---------------------- Inputs ----------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.field-suffix {
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 400;
}
.field-help {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}
.field-error {
  font-size: 12px;
  color: var(--crit-fg);
  display: flex; align-items: center; gap: 4px;
}

.input-wrap { position: relative; display: flex; align-items: center; }
.input, .textarea, .select {
  width: 100%;
  height: 34px;
  padding: 0 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  transition: border-color .12s, box-shadow .12s, background .12s;
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:hover:not(:disabled), .select:hover:not(:disabled), .textarea:hover:not(:disabled) {
  border-color: var(--text-faint);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}
.input:disabled, .select:disabled, .textarea:disabled {
  background: var(--bg-muted);
  color: var(--text-muted);
  cursor: not-allowed;
}
.input.has-error, .textarea.has-error, .select.has-error {
  border-color: var(--crit-fg);
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.08);
}
.input.has-suffix { padding-right: 44px; }
.input-suffix {
  position: absolute;
  right: 10px;
  font-size: 12px;
  color: var(--text-faint);
  pointer-events: none;
  font-family: var(--font-mono);
}
.input-prefix {
  position: absolute;
  left: 10px;
  font-size: 13px;
  color: var(--text-faint);
  pointer-events: none;
}
.input.has-prefix { padding-left: 32px; }

.textarea { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; min-height: 80px; }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%236B6B6B' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

/* ---------------------- Toggle ----------------------- */
.toggle {
  position: relative;
  display: inline-block;
  width: 30px;
  height: 18px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: #D6D3CE;
  border-radius: 999px;
  transition: background .15s;
  cursor: pointer;
}
.toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 999px;
  transition: transform .15s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.toggle input:checked + .toggle-track { background: var(--accent); }
.toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(12px); }
.toggle input:disabled + .toggle-track { opacity: 0.5; cursor: not-allowed; }

/* ---------------------- Badge ----------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid transparent;
  line-height: 1.5;
  white-space: nowrap;
}
.badge .badge-dot {
  width: 5px; height: 5px; border-radius: 999px; background: currentColor;
}
.badge-ok { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-border); }
.badge-warn { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-border); }
.badge-high { background: var(--high-bg); color: var(--high-fg); border-color: var(--high-border); }
.badge-crit { background: var(--crit-bg); color: var(--crit-fg); border-color: var(--crit-border); }
.badge-off { background: var(--off-bg); color: var(--off-fg); border-color: var(--off-border); }
.badge-info { background: var(--info-bg); color: var(--info-fg); border-color: var(--info-border); }
.badge-neutral { background: var(--bg-muted); color: var(--text-soft); border-color: var(--border); }
.badge-mono { font-family: var(--font-mono); font-size: 10.5px; }

/* ---------------------- Card ----------------------- */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
  letter-spacing: -0.005em;
}
.card-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.card-body { padding: 16px; }
.card-body.tight { padding: 12px 16px; }
.card-body.flush { padding: 0; }
.card-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------------------- Table ----------------------- */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elev);
  overflow: hidden;
}
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
}
.table-toolbar-left { display: flex; gap: 8px; align-items: center; flex: 1; }
.table-toolbar-right { display: flex; gap: 8px; align-items: center; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  text-align: left;
  font-weight: 500;
  font-size: 11.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 16px;
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .08s; }
.table tbody tr:hover { background: var(--bg-muted); }
.table .col-actions { text-align: right; }
.table .col-narrow { width: 1%; white-space: nowrap; }
.cell-mono { font-family: var(--font-mono); font-size: 12px; color: var(--text-soft); }
.cell-muted { color: var(--text-muted); font-size: 12px; }
.cell-strong { font-weight: 500; }

/* ---------------------- KPI ----------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.kpi {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kpi-label {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kpi-value {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  font-feature-settings: 'tnum';
}
.kpi-meta { font-size: 12px; color: var(--text-muted); }
.kpi-meta strong { color: var(--text); font-weight: 500; }
.kpi.kpi-warn { border-color: var(--warn-border); background: linear-gradient(180deg, #FBF6E7 0%, #fff 60%); }
.kpi.kpi-crit { border-color: var(--crit-border); background: linear-gradient(180deg, #FBEAEA 0%, #fff 60%); }
.card-body .finance-kpi-grid { margin-bottom: 0; }
.card-body .finance-kpi-grid .kpi { margin: 0; }

/* ---------------------- Sections / grids ----------------------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2-7-5 { display: grid; grid-template-columns: 7fr 5fr; gap: 16px; }
/* ---------------------- Dashboard (Обзор) ----------------------- */
.dash-page { padding-top: 20px; }
.dash-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}
.dash-head .page-title { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; }
.dash-head-meta {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.dash-head-account {
  font-weight: 600;
  color: var(--text-soft);
}
.dash-head-dot { color: var(--text-faint); }

.dash-meta-warn { color: var(--warn-fg); font-weight: 500; }

.dash-pulse {
  background: linear-gradient(135deg, #fafbfc 0%, #fff 48%, #f6f8fb 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  padding: 22px 26px 18px;
  margin-bottom: 18px;
}
.dash-pulse-top {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 24px;
  align-items: end;
}
@media (max-width: 960px) {
  .dash-pulse-top { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .dash-pulse-top { grid-template-columns: 1fr; gap: 20px; }
}
.dash-pulse-margin-val {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--ok-fg);
}
.dash-pulse-margin--neg .dash-pulse-margin-val { color: var(--high-fg); }
.dash-pulse-margin--muted .dash-pulse-margin-val { color: var(--text-muted); }
.dash-pulse-margin-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}
.dash-margin-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 5px 10px;
  border-radius: var(--radius-md);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
}
.dash-margin-chip span { flex: 1; min-width: 0; }
.dash-margin-chip--warn {
  background: var(--warn-bg);
  color: var(--warn-fg);
  border: 1px solid color-mix(in srgb, var(--warn-fg) 22%, transparent);
}
.dash-margin-chip--info {
  background: var(--info-bg, #eef4ff);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.dash-margin-chip-link {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: inherit;
  font-size: 11px;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
}
.dash-margin-chip-link:hover { opacity: 0.85; }

.dash-trends {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  padding: 18px 22px 16px;
  margin-bottom: 18px;
}
.dash-trends-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}
.dash-trends-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}
.dash-trends-compare {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}
.dash-trends-legend {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
}
.dash-trends-legend-item::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 5px;
  vertical-align: middle;
}
.dash-trends-legend-rev::before { background: #748ffc; }
.dash-trends-legend-drr::before { background: #f59f00; }
.dash-trends-hint {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--text-faint);
}
.dash-trends--interactive { padding-bottom: 14px; }
.dash-trend-detail {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #f8f9fc 0%, #fff 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 13px;
}
.dash-trend-detail-date {
  font-weight: 700;
  color: var(--text);
  margin-right: 4px;
}
.dash-trend-detail-metric { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.dash-trend-detail-rev { color: #4263eb; font-weight: 700; }
.dash-trend-detail-drr { font-weight: 600; }
.dash-trend-detail-sep { color: var(--text-faint); }
.dash-trend-svg-wrap {
  position: relative;
  width: 100%;
}
.dash-trend-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.dash-trend-grid {
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 4 4;
  opacity: 0.7;
}
.dash-trend-axis {
  font-size: 9px;
  fill: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.dash-trend-target {
  stroke: #fab005;
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
  opacity: 0.75;
}
.dash-trend-area {
  fill: color-mix(in srgb, #748ffc 18%, transparent);
}
.dash-trend-line {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dash-trend-line--rev { stroke: #5c7cfa; }
.dash-trend-line--drr { stroke: #f59f00; stroke-width: 2; stroke-dasharray: none; }
.dash-trend-dot { transition: r 0.15s ease; }
.dash-trend-dot--rev { fill: #5c7cfa; stroke: #fff; stroke-width: 2; }
.dash-trend-dot--drr { fill: #f59f00; stroke: #fff; stroke-width: 1.5; }
.dash-trend-point--active .dash-trend-dot--rev { filter: drop-shadow(0 1px 3px rgba(92, 124, 250, 0.45)); }
.dash-trend-cursor {
  stroke: color-mix(in srgb, #748ffc 35%, transparent);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  pointer-events: none;
}
.dash-trend-hitlayer {
  position: absolute;
  inset: 0;
  display: flex;
}
.dash-trend-hit {
  position: absolute;
  top: 0;
  bottom: 0;
  border: none;
  background: transparent;
  cursor: crosshair;
  padding: 0;
}
.dash-trend-hit:hover,
.dash-trend-hit--active,
.dash-trend-hit:focus-visible {
  background: color-mix(in srgb, #748ffc 8%, transparent);
  outline: none;
}
.dash-trend-labels {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin-top: 6px;
  padding: 0 48px 0 52px;
}
.dash-trend-label {
  flex: 1;
  min-width: 0;
  font-size: 10px;
  color: var(--text-faint);
  text-align: center;
  white-space: nowrap;
  transition: color 0.15s ease, font-weight 0.15s ease;
}
.dash-trend-label--active {
  color: #4263eb;
  font-weight: 700;
}
.dash-trend-chart {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  height: 120px;
}
.dash-trend-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}
.dash-trend-bars {
  flex: 1;
  width: 100%;
  max-width: 48px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
}
.dash-trend-bar {
  width: 45%;
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height 0.3s ease;
}
.dash-trend-bar--rev {
  background: linear-gradient(180deg, #748ffc, #5c7cfa);
}
.dash-trend-bar--drr {
  background: linear-gradient(180deg, #ffd43b, #f59f00);
  opacity: 0.85;
}
.dash-trend-label {
  margin-top: 6px;
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}
.dash-pulse-kicker {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.dash-pulse-value {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.dash-pulse-sub {
  margin-top: 8px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.4;
}
.dash-pulse-sep { margin: 0 6px; color: var(--text-faint); }
.dash-pulse-drr-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  margin-bottom: 10px;
}
.dash-pulse-drr-val {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.dash-pulse-drr--over .dash-pulse-drr-val { color: var(--high-fg); }
.dash-pulse-drr-target {
  font-size: 13px;
  color: var(--text-muted);
}
.dash-drr-track {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: var(--bg-muted);
  overflow: hidden;
}
.dash-drr-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ok-fg), #3d9a6a);
  transition: width 0.35s ease;
}
.dash-pulse-drr--over .dash-drr-fill {
  background: linear-gradient(90deg, var(--warn-fg), var(--high-fg));
}
.dash-drr-marker {
  position: absolute;
  top: -2px;
  width: 3px;
  height: 12px;
  margin-left: -2px;
  background: var(--high-fg);
  border-radius: 2px;
}
.dash-insights {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dash-insight {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  line-height: 1.45;
}
.dash-insight--warn {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--warn-fg);
}
.dash-insight--ok {
  background: var(--ok-bg);
  border: 1px solid var(--ok-border);
  color: var(--ok-fg);
}
.dash-insight--neutral {
  background: var(--bg-muted);
  border: 1px solid var(--border);
  color: var(--text-soft);
}
.dash-insight-btn {
  flex-shrink: 0;
  border: 0;
  background: rgba(255,255,255,0.7);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: inherit;
}
.dash-insight-btn:hover { background: #fff; }
.dash-pulse-foot {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  align-items: center;
}
.dash-pulse-foot-label {
  font-weight: 600;
  color: var(--text-soft);
  margin-right: 2px;
}

.dash-main {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 1024px) {
  .dash-main { grid-template-columns: 1fr; }
}

.dash-panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.dash-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.dash-panel-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.dash-panel-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}
.dash-panel-badges { display: flex; gap: 6px; flex-shrink: 0; }
.dash-panel--compact { padding: 16px 18px; }
.dash-panel--compact .dash-panel-title { font-size: 14px; }
.dash-panel--compact .dash-panel-sub { margin-bottom: 12px; }

.dash-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}
.dash-empty svg { color: var(--ok-fg); margin-bottom: 12px; opacity: 0.7; }
.dash-empty-title { font-size: 15px; font-weight: 600; color: var(--text); }
.dash-empty-desc { font-size: 13px; margin-top: 6px; max-width: 280px; margin-left: auto; margin-right: auto; }

.dash-priority-count {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--high-bg);
  color: var(--high-fg);
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.dash-priority-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.dash-priority-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}
.dash-priority-row:last-child { border-bottom: 0; }
.dash-priority-row:hover { background: var(--bg-muted); }
.dash-priority-body { flex: 1; min-width: 0; }
.dash-priority-title {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dash-priority-n {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-muted);
  padding: 2px 8px;
  border-radius: 999px;
}
.dash-priority-preview {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-priority-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.dash-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dash-side-empty {
  font-size: 13px;
  color: var(--text-muted);
  margin: 8px 0 0;
}
.dash-leaders { padding: 16px 18px; }
.dash-leaders--ads { margin-top: 0; }
.dash-leader-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}
.dash-leader-list--compact .dash-leader-item { padding: 8px 0; }
.dash-leader-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.dash-leader-item:last-child { border-bottom: 0; padding-bottom: 0; }
.dash-leader-rank {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--bg-muted), var(--bg-elev));
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.dash-leader-item:first-child .dash-leader-rank {
  background: linear-gradient(135deg, #2d6a4f, #40916c);
  border-color: transparent;
  color: #fff;
}
.dash-leader-body { flex: 1; min-width: 0; }
.dash-leader-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}
.dash-leader-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.dash-leader-share { font-weight: 600; color: var(--text-soft); }
.dash-leader-bar {
  height: 4px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--bg-muted);
  overflow: hidden;
}
.dash-leader-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #5c7cfa, #748ffc);
}

/* ---------------------- Account (Кабинет) ----------------------- */
.cab-row-muted { opacity: 0.55; }
.cab-rules-panel { margin-bottom: 14px; padding: 18px 20px; }
.cab-rules-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}
.cab-rules-body { max-width: 560px; }
.cab-rules-summary { font-size: 12px; margin: 10px 0 0; }
.cab-page-intro {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 720px;
}
.cab-threshold-grid { margin-top: 4px; }
.cab-alert-types { margin-top: 12px; }
.cab-alert-types-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
}
.cab-alert-types-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.cab-alert-types-item:last-child { border-bottom: 0; }
.cab-link-btn {
  background: none;
  border: 0;
  padding: 0;
  font-size: 13px;
  color: var(--accent);
  cursor: pointer;
  text-align: left;
}
.cab-link-btn:hover { text-decoration: underline; }
.dash-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.dash-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 1 1 220px;
  max-width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-elev);
}
.dash-action--warn {
  border-color: var(--warn-border);
  background: var(--warn-bg);
}
.dash-action--info {
  border-color: var(--border);
  background: var(--bg-muted);
}
.dash-action-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.dash-action-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.35;
}
.dash-action-cmd {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text);
  background: rgba(0, 0, 0, 0.06);
  border-radius: 4px;
}
.dash-action--warn .dash-action-cmd {
  background: rgba(0, 0, 0, 0.08);
}
.cab-main {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 1024px) {
  .cab-main { grid-template-columns: 1fr; }
}
.cab-panel { padding: 18px 20px; }
.cab-panel .dash-panel-title { margin: 0; }
.cab-panel .dash-panel-sub { margin: 4px 0 0; }
.cab-onboard-panel { margin-bottom: 16px; }
.cab-onboard-list {
  list-style: none;
  margin: 0;
  padding: 12px 20px 16px;
}
.cab-onboard-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 14px;
  color: var(--text-soft);
}
.cab-onboard-list li.done { color: var(--text); }
.cab-onboard-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  background: var(--bg-muted);
  color: var(--text-muted);
  flex-shrink: 0;
}
.cab-onboard-list li.done .cab-onboard-icon {
  background: var(--ok-bg);
  color: var(--ok-fg);
  border: 1px solid var(--ok-border);
}
.cab-onboard-hint {
  margin: 0;
  padding: 0 20px 16px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}
.cab-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-muted);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.cab-playbook {
  width: 100%;
  margin-top: 14px;
  resize: vertical;
  min-height: 120px;
  font-size: 14px;
  line-height: 1.5;
}
.cab-channel-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}
.cab-channel-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.cab-channel-item:last-child { border-bottom: 0; }
.cab-cabinet-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}
.cab-cabinet-list li {
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  margin-bottom: 4px;
}
.cab-cabinet-list li.active {
  background: var(--bg-muted);
  border-color: var(--border);
}
.cab-cabinet-name { font-size: 14px; font-weight: 600; }
.cab-cabinet-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  font-size: 12px;
}
.cab-link-btn {
  background: none;
  border: 0;
  padding: 0;
  font-size: 13px;
  color: var(--info-fg);
  cursor: pointer;
  text-align: left;
}
.cab-link-btn:hover { text-decoration: underline; }
.cab-modal { width: 520px; }
.cab-wizard-steps {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.cab-wizard-steps span {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-muted);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.cab-wizard-steps span.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.cab-checklist {
  margin: 0;
  padding-left: 20px;
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.55;
}
.cab-admin-details {
  margin-top: 12px;
  font-size: 13px;
}
.cab-admin-details summary {
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 500;
}
.cab-pre {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--bg-muted);
  border-radius: var(--radius);
  font-size: 11px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }

/* ---------------------- Mono blocks ----------------------- */
.mono-block {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  background: #0A0A0A;
  color: #E8E8E5;
  padding: 16px;
  border-radius: var(--radius);
  white-space: pre;
  overflow: auto;
  max-height: 360px;
}
.mono-block.light {
  background: var(--bg-muted);
  color: var(--text);
  border: 1px solid var(--border);
}
.mono-block .mono-key { color: #8FB4FF; }
.mono-block .mono-ok { color: #6FCF97; }
.mono-block .mono-warn { color: #E2C062; }
.mono-block .mono-crit { color: #E08383; }
.mono-block .mono-muted { color: #8A8A85; }

/* ---------------------- Modal / Drawer ----------------------- */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.32);
  backdrop-filter: blur(2px);
  z-index: 90;
  animation: fadeIn .15s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px) scale(0.99); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }

.modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-elev);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  width: 480px;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  animation: slideUp .18s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal.modal-lg { width: 600px; }
.modal-header {
  padding: 18px 20px 12px;
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px;
}
.modal-title { font-size: 16px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.modal-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.modal-close {
  background: transparent; border: 0; padding: 4px; cursor: pointer;
  color: var(--text-muted); border-radius: 4px;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text); }
.modal-body { padding: 4px 20px 20px; overflow-y: auto; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: var(--bg-muted);
  border-bottom-left-radius: var(--radius-xl);
  border-bottom-right-radius: var(--radius-xl);
}
.modal-footer-right { display: flex; gap: 8px; }

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 560px;
  max-width: calc(100vw - 80px);
  background: var(--bg-elev);
  z-index: 100;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideInRight .22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.drawer-header {
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.drawer-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.drawer-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: var(--bg-muted);
}

/* ---------------------- Toast ----------------------- */
.toast-stack {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: #0A0A0A;
  color: #FAFAF9;
  padding: 12px 14px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 280px;
  max-width: 380px;
  animation: slideUp .2s cubic-bezier(0.2, 0.8, 0.2, 1);
  font-size: 13px;
}
.toast-icon {
  width: 16px; height: 16px;
  margin-top: 1px;
  flex-shrink: 0;
}
.toast-icon.ok { color: #6FCF97; }
.toast-icon.err { color: #E08383; }
.toast-icon.warn { color: #E2C062; }
.toast-content { flex: 1; }
.toast-title { font-weight: 500; }
.toast-desc { color: #B5B5B0; font-size: 12px; margin-top: 2px; }

/* ---------------------- Alert ----------------------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-muted);
  font-size: 13px;
}
.alert-icon { flex-shrink: 0; margin-top: 1px; }
.alert-title { font-weight: 500; }
.alert-desc { color: var(--text-muted); margin-top: 2px; font-size: 12.5px; }
.alert-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-fg); }
.alert-warn .alert-desc { color: #7A4E08; }
.alert-crit { background: var(--crit-bg); border-color: var(--crit-border); color: var(--crit-fg); }
.alert-crit .alert-desc { color: #8B1A1A; }
.alert-info { background: var(--info-bg); border-color: var(--info-border); color: var(--info-fg); }
.alert-info .alert-desc { color: #1E3A8A; }

/* ---------------------- Chips ----------------------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  min-height: 34px;
  align-items: center;
}
.chips:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 4px 2px 8px;
  font-size: 12px;
  color: var(--text);
}
.chip-remove {
  width: 14px; height: 14px;
  display: grid; place-items: center;
  background: transparent;
  border: 0;
  color: var(--text-muted);
  border-radius: 3px;
  cursor: pointer;
}
.chip-remove:hover { background: var(--border); color: var(--text); }
.chip-input {
  border: 0;
  outline: none;
  background: transparent;
  flex: 1;
  min-width: 80px;
  font-size: 13px;
  color: var(--text);
  height: 22px;
}
.chip-static {
  display: inline-flex;
  align-items: center;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 7px;
  font-size: 12px;
  color: var(--text-soft);
}

/* ---------------------- Hour chips picker ----------------------- */
.hour-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
  padding: 8px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.hour-chip {
  height: 26px;
  display: grid;
  place-items: center;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-soft);
  cursor: pointer;
  transition: all .1s;
}
.hour-chip:hover { border-color: var(--border-strong); }
.hour-chip.selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ---------------------- Empty / loading ----------------------- */
.empty-state {
  padding: 48px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.empty-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  color: var(--text-faint);
  margin-bottom: 4px;
}
.empty-title { font-weight: 500; color: var(--text); }
.empty-desc { color: var(--text-muted); font-size: 13px; max-width: 340px; }

.read-only-banner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--warn-fg);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

/* ---------------------- Login page ----------------------- */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  background:
    radial-gradient(800px 400px at 50% -10%, rgba(15,23,42,0.04), transparent 60%),
    var(--bg);
}
.login-lang {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 2;
}
@media (min-width: 480px) {
  .login-lang {
    right: max(24px, calc(50% - 214px));
  }
}
.login-card {
  width: 380px;
  max-width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow);
}
.login-brand {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 24px;
}
.login-brand .brand-mark { width: 28px; height: 28px; font-size: 12px; border-radius: 7px; }
.login-title { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.login-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.login-foot {
  margin-top: 18px;
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}

/* ---------------------- Tabs (UI kit-ish) ----------------------- */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.tab {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  font-weight: 500;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* ---------------------- Section header ----------------------- */
.section-h {
  font-size: 11.5px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin: 8px 0 8px;
}

/* ---------------------- Divider ----------------------- */
.hr { border: 0; height: 1px; background: var(--border); margin: 16px 0; }

/* ---------------------- Spinner ----------------------- */
.spinner {
  width: 14px; height: 14px;
  border: 1.5px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------- Misc ----------------------- */
.kbd {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--text-soft);
}

.link {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--border-strong);
  cursor: pointer;
}
.link:hover { text-decoration-color: var(--text); }

.dot {
  width: 6px; height: 6px; border-radius: 999px; display: inline-block;
}
.dot.ok { background: var(--ok-fg); }
.dot.warn { background: var(--warn-fg); }
.dot.crit { background: var(--crit-fg); }
.dot.off { background: var(--text-faint); }

/* Severity badge variants used in tables */
.sev { font-family: var(--font-sans); font-weight: 500; font-size: 11px; }

/* Danger zone */
.danger-zone {
  border: 1px solid var(--crit-border);
  background: var(--crit-bg);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
}
.danger-zone .title { font-weight: 500; color: var(--crit-fg); }
.danger-zone .desc { font-size: 12.5px; color: #8B1A1A; margin-top: 2px; }

/* Search input row */
.search-input {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='none' stroke='%239A9A95' stroke-width='1.5' stroke-linecap='round'><circle cx='6' cy='6' r='4.5'/><path d='M9.5 9.5l3 3'/></svg>");
  background-repeat: no-repeat;
  background-position: 10px center;
  padding-left: 32px;
}

/* Subtle dotted divider for log lines */
.log-line { display: block; }
.log-line .ts { color: var(--text-faint); }
.log-line.err { color: #E08383; }
.log-line.warn { color: #E2C062; }
.log-line.ok { color: #6FCF97; }

/* Skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--bg-muted) 0%, var(--bg-hover) 50%, var(--bg-muted) 100%);
  background-size: 200% 100%;
  animation: skel 1.4s ease-in-out infinite;
  border-radius: 4px;
}
@keyframes skel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Competitors — seller dashboard (cp-*) */
.cp-page { max-width: var(--container); }
.cp-pulse { margin-bottom: 14px; }
.cp-pulse-top { grid-template-columns: 1.4fr 1fr 1fr !important; }
.cp-val-warn { color: var(--high-fg) !important; }
.cp-val-bad { color: var(--crit-fg); }
.cp-alerts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.cp-alert {
  display: grid;
  grid-template-columns: minmax(120px, 0.35fr) 1fr auto;
  gap: 12px;
  align-items: center;
  text-align: left;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s;
}
.cp-alert:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.cp-alert--crit { border-left: 3px solid var(--crit-fg); background: var(--crit-bg); }
.cp-alert--warn { border-left: 3px solid var(--warn-fg); background: var(--warn-bg); }
.cp-alert-name { font-weight: 600; font-size: 13px; }
.cp-alert-text { font-size: 13px; color: var(--text-soft); }
.cp-alert-metric { font-size: 12px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.cp-layout { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
@media (max-width: 960px) { .cp-layout { grid-template-columns: 1fr; } }
.cp-sidebar { padding: 0; overflow: hidden; position: sticky; top: calc(var(--nav-h) + 12px); }
.cp-sidebar .dash-panel-head { padding: 16px 16px 8px; }
.cp-sku-list { display: flex; flex-direction: column; max-height: 420px; overflow-y: auto; }
.cp-sku-row {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  transition: background .12s;
}
.cp-sku-row:hover { background: var(--bg-hover); }
.cp-sku-row--active { background: var(--bg-muted); box-shadow: inset 3px 0 0 var(--accent); }
.cp-sku-row--crit.cp-sku-row--active { box-shadow: inset 3px 0 0 var(--crit-fg); }
.cp-sku-row--warn.cp-sku-row--active { box-shadow: inset 3px 0 0 var(--warn-fg); }
.cp-sku-row-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.cp-sku-row-name { font-weight: 600; font-size: 13px; line-height: 1.35; margin-bottom: 4px; }
.cp-sku-row-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 11px; color: var(--text-muted); align-items: center; }
.cp-sku-orders { font-size: 11px; font-weight: 600; color: var(--text-soft); }
.cp-link-btn { width: 100%; padding: 10px 16px; border: 0; border-top: 1px solid var(--border); background: transparent; font-size: 12px; color: var(--text-muted); cursor: pointer; text-align: left; }
.cp-settings { padding: 12px 16px 16px; border-top: 1px solid var(--border); }
.cp-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.cp-verdict {
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  padding: 18px 20px;
  background: var(--bg-elev);
  box-shadow: var(--shadow-sm);
}
.cp-verdict--warn { border-color: var(--warn-border); background: linear-gradient(135deg, var(--warn-bg) 0%, var(--bg-elev) 55%); }
.cp-verdict--crit { border-color: var(--crit-border); background: linear-gradient(135deg, var(--crit-bg) 0%, var(--bg-elev) 55%); }
.cp-verdict--ok { border-color: var(--ok-border); }
.cp-verdict-title { margin: 0 0 8px; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.3; }
.cp-verdict-sub { margin: 0 0 14px; font-size: 14px; color: var(--text-soft); line-height: 1.45; }
.cp-drivers { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.cp-driver { padding: 10px 12px; border-radius: var(--radius); background: var(--bg-muted); border: 1px solid var(--border); }
.cp-driver--crit { border-color: var(--crit-border); }
.cp-driver--warn { border-color: var(--warn-border); }
.cp-driver-label { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-bottom: 4px; }
.cp-driver-value { display: block; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cp-driver-hint { display: block; font-size: 11px; color: var(--text-muted); margin-top: 4px; line-height: 1.35; }
.cp-decision { border-left: 4px solid var(--accent); }
.cp-decision--ok { border-left-color: var(--ok-fg); background: linear-gradient(90deg, var(--ok-bg) 0%, var(--bg-elev) 40%); }
.cp-decision--crit { border-left-color: var(--crit-fg); background: linear-gradient(90deg, var(--crit-bg) 0%, var(--bg-elev) 40%); }
.cp-decision--warn { border-left-color: var(--warn-fg); }
.cp-decision-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 6px; }
.cp-decision-title { margin: 0 0 8px; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.cp-decision-body { margin: 0 0 14px; font-size: 14px; line-height: 1.5; color: var(--text-soft); }
.cp-decision-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 12px; }
.cp-decision-grid div { padding: 10px 12px; background: var(--bg-muted); border-radius: var(--radius); }
.cp-decision-grid span { display: block; font-size: 10px; color: var(--text-muted); text-transform: uppercase; margin-bottom: 4px; }
.cp-decision-grid strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.cp-decision-move { margin: 0; font-size: 13px; padding-top: 10px; border-top: 1px solid var(--border); }
.cp-metrics-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
@media (max-width: 1100px) { .cp-metrics-row { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { .cp-metrics-row { grid-template-columns: repeat(2, 1fr); } }
.cp-metric { padding: 12px 14px !important; margin: 0 !important; }
.cp-metric-label { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-bottom: 6px; }
.cp-metric-value { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.cp-metric-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.cp-charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 800px) { .cp-charts-row { grid-template-columns: 1fr; } }
.cp-chart-legend { display: flex; gap: 12px; font-size: 11px; color: var(--text-muted); margin-bottom: 8px; }
.cp-chart-legend-item { display: inline-flex; align-items: center; gap: 5px; }
.cp-chart-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.cp-line--us { stroke: #748ffc; }
.cp-line--rival { stroke: #fa5252; }
.cp-line--med { stroke: #adb5bd; stroke-dasharray: 4 3; }
.cp-chart-dot.cp-line--us { background: #748ffc; }
.cp-chart-dot.cp-line--rival { background: #fa5252; }
.cp-chart-dot.cp-line--med { background: #adb5bd; }
.cp-chart-svg { width: 100%; height: auto; display: block; }
.cp-chart-label { font-size: 9px; fill: var(--text-faint); }
.cp-delta { font-weight: 600; font-variant-numeric: tabular-nums; }
.cp-delta--good { color: var(--ok-fg); }
.cp-delta--bad { color: var(--crit-fg); }
.cp-delta--muted { color: var(--text-muted); }
.cp-table td { vertical-align: top; }
.cp-why { max-width: 220px; font-size: 12px; line-height: 1.4; color: var(--text-soft); }
.cp-row-pinned { background: color-mix(in srgb, var(--warn-bg) 40%, transparent); }
.cp-row-hot { background: color-mix(in srgb, var(--crit-bg) 35%, transparent); }
.cp-row-us { background: color-mix(in srgb, var(--info-bg) 50%, transparent); font-weight: 500; }
.cp-pos-bad { color: var(--crit-fg); font-weight: 700; }
.cp-share-bar { height: 6px; background: var(--bg-muted); border-radius: 999px; overflow: hidden; margin-bottom: 4px; max-width: 120px; }
.cp-share-bar div { height: 100%; background: var(--accent); border-radius: 999px; }
.cp-split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .cp-split { grid-template-columns: 1fr; } }
.cp-feed { list-style: none; padding: 0; margin: 0; }
.cp-feed-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.cp-feed-item:last-child { border-bottom: 0; }
.cp-feed-date { display: block; font-size: 11px; color: var(--text-faint); margin-bottom: 2px; }
.cp-feed-item p { margin: 4px 0 0; font-size: 13px; color: var(--text-soft); line-height: 1.4; }
.cp-feed-item--crit strong { color: var(--crit-fg); }
.cp-feed-item--warn strong { color: var(--warn-fg); }
.cp-actions { list-style: none; padding: 0; margin: 0; counter-reset: cpstep; }
.cp-action { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.cp-action:last-child { border-bottom: 0; }
.cp-action-num {
  flex-shrink: 0;
  width: 24px; height: 24px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: grid; place-items: center;
}
.cp-action--high .cp-action-num { background: var(--crit-fg); }
.cp-action p { margin: 4px 0 0; font-size: 13px; color: var(--text-soft); line-height: 1.4; }
.cp-niche-bar { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; font-size: 13px; padding: 14px 18px !important; }

/* Why they win / we lag */
.cp-why { padding: 20px 22px !important; }
.cp-why-head { align-items: flex-start; margin-bottom: 18px; }
.cp-why-ratio { text-align: right; flex-shrink: 0; }
.cp-why-ratio-val { display: block; font-size: 28px; font-weight: 800; letter-spacing: -0.03em; color: var(--crit-fg); line-height: 1; }
.cp-why-ratio-sub { font-size: 11px; color: var(--text-muted); max-width: 120px; display: block; margin-top: 4px; }
.cp-why-hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 12px; margin-bottom: 18px; }
@media (max-width: 720px) { .cp-why-hero { grid-template-columns: 1fr; } }
.cp-why-rival-card, .cp-why-us-card {
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.cp-why-rival-card { background: linear-gradient(135deg, color-mix(in srgb, var(--crit-bg) 55%, var(--bg-elev)) 0%, var(--bg-elev) 100%); border-color: var(--crit-border); }
.cp-why-us-card { background: var(--bg-muted); }
.cp-why-card-kicker { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 6px; }
.cp-why-card-name { display: block; font-size: 16px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 4px; }
.cp-why-card-brand { font-size: 12px; color: var(--text-muted); }
.cp-why-card-headline { margin: 10px 0 0; font-size: 14px; line-height: 1.45; color: var(--text-soft); }
.cp-why-us-stats { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 10px; font-size: 12px; color: var(--text-muted); font-weight: 600; }
.cp-why-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
@media (max-width: 720px) { .cp-why-cols { grid-template-columns: 1fr; } }
.cp-why-col { padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border); }
.cp-why-col h3 { margin: 0 0 10px; font-size: 13px; font-weight: 700; }
.cp-why-col ul { margin: 0; padding-left: 18px; }
.cp-why-col li { font-size: 13px; line-height: 1.45; color: var(--text-soft); margin-bottom: 8px; }
.cp-why-col--win { background: color-mix(in srgb, var(--ok-bg) 35%, var(--bg-elev)); border-color: var(--ok-border); }
.cp-why-col--win h3 { color: var(--ok-fg); }
.cp-why-col--lag { background: color-mix(in srgb, var(--warn-bg) 35%, var(--bg-elev)); border-color: var(--warn-border); }
.cp-why-col--lag h3 { color: var(--warn-fg); }
.cp-funnel { padding-top: 4px; margin-bottom: 20px; border-top: 1px solid var(--border); }
.cp-funnel-title, .cp-gaps-title, .cp-faq-title { margin: 16px 0 4px; font-size: 15px; font-weight: 700; }
.cp-funnel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
@media (max-width: 640px) { .cp-funnel-grid { grid-template-columns: 1fr; } }
.cp-funnel-col { padding: 14px; border-radius: var(--radius); border: 1px solid var(--border); }
.cp-funnel-col--us { background: var(--bg-muted); }
.cp-funnel-col--leader { background: color-mix(in srgb, var(--crit-bg) 30%, var(--bg-elev)); border-color: var(--crit-border); }
.cp-funnel-tag { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 10px; }
.cp-funnel-metric { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 5px 0; border-bottom: 1px dashed var(--border); }
.cp-funnel-metric:last-child { border-bottom: 0; }
.cp-funnel-metric span { color: var(--text-muted); }
.cp-funnel-metric strong { font-variant-numeric: tabular-nums; }
.cp-funnel-plain { margin: 12px 0 0; font-size: 13px; line-height: 1.5; color: var(--text-soft); padding: 12px 14px; background: var(--bg-muted); border-radius: var(--radius); border-left: 3px solid var(--accent); }
.cp-gaps { border-top: 1px solid var(--border); padding-top: 4px; }
.cp-gaps-list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.cp-gap { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); }
.cp-gap--hot { border-color: var(--crit-border); background: color-mix(in srgb, var(--crit-bg) 25%, var(--bg-elev)); }
.cp-gap-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.cp-gap-label { font-weight: 700; font-size: 14px; }
.cp-gap-scores { font-size: 12px; font-weight: 700; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.cp-gap-bars { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 10px; }
@media (max-width: 640px) { .cp-gap-bars { grid-template-columns: 1fr; } }
.cp-gap-bar-col { min-width: 0; }
.cp-gap-bar-tag { display: block; font-size: 10px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; }
.cp-gap-bar-track { height: 8px; background: var(--bg-muted); border-radius: 999px; overflow: hidden; margin-bottom: 4px; }
.cp-gap-bar { height: 100%; border-radius: 999px; transition: width .3s ease; }
.cp-gap-bar--us { background: #748ffc; }
.cp-gap-bar--rival { background: #fa5252; }
.cp-gap-bar-note { display: block; font-size: 11px; color: var(--text-muted); line-height: 1.35; }
.cp-gap-plain { margin: 0 0 6px; font-size: 13px; line-height: 1.45; color: var(--text-soft); }
.cp-gap-fix { margin: 0; font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.cp-faq { border-top: 1px solid var(--border); margin-top: 8px; }
.cp-faq-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.cp-faq-item { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-muted); overflow: hidden; }
.cp-faq-item summary { padding: 12px 14px; font-size: 13px; font-weight: 600; cursor: pointer; list-style: none; }
.cp-faq-item summary::-webkit-details-marker { display: none; }
.cp-faq-item summary::after { content: '+'; float: right; color: var(--text-muted); font-weight: 400; }
.cp-faq-item[open] summary::after { content: '−'; }
.cp-faq-item p { margin: 0; padding: 0 14px 12px; font-size: 13px; line-height: 1.45; color: var(--text-soft); border-top: 1px solid var(--border); padding-top: 10px; }
.cp-agent-pre {
  margin: 12px 0 0;
  padding: 14px 16px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 280px;
  overflow: auto;
  color: var(--text-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.cp-agent-queries { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.cp-agent-queries-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.cp-agent-query-chip {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  color: var(--text-soft);
  line-height: 1.3;
}
.cp-verdict { padding: 18px 20px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--bg-elev); }
.cp-page .dash-panel { padding: 16px 18px; }
.cp-page .dash-panel-head { margin-bottom: 12px; }

/* Playbook-first layout */
.cp-page--playbook .cp-role-line { margin: 8px 0 0; font-size: 13px; color: var(--text-soft); max-width: 52ch; line-height: 1.45; }
.cp-diagnosis { margin: 0 0 14px; padding: 12px 16px; border-radius: var(--radius); border: 1px solid var(--border); font-size: 15px; font-weight: 600; line-height: 1.4; }
.cp-diagnosis--warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-fg); }
.cp-diagnosis--crit { background: var(--crit-bg); border-color: var(--crit-border); color: var(--crit-fg); }
.cp-diagnosis--ok { background: var(--ok-bg); border-color: var(--ok-border); }
.cp-primary { border-left: 4px solid var(--accent); padding: 20px 22px !important; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, var(--bg-elev)) 0%, var(--bg-elev) 60%); }
.cp-primary-badge { font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.cp-primary-title { margin: 0 0 10px; font-size: 22px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.25; }
.cp-primary-do { margin: 0 0 12px; font-size: 16px; line-height: 1.5; color: var(--text); }
.cp-primary-meta { display: flex; flex-wrap: wrap; gap: 12px 20px; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 14px; }
.cp-primary-because, .cp-primary-not { margin: 0 0 8px; font-size: 13px; line-height: 1.45; color: var(--text-soft); }
.cp-primary-not { padding-top: 10px; border-top: 1px dashed var(--border); color: var(--crit-fg); }
.cp-section-title { margin: 0 0 4px; font-size: 15px; font-weight: 700; }
.cp-section-sub { margin: 0 0 12px; font-size: 13px; color: var(--text-muted); }
.cp-decision-grid-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
@media (max-width: 960px) { .cp-decision-grid-cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .cp-decision-grid-cards { grid-template-columns: 1fr; } }
.cp-dec-card { padding: 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-elev); min-height: 120px; }
.cp-dec-card--ok { border-top: 3px solid var(--ok-fg); }
.cp-dec-card--crit { border-top: 3px solid var(--crit-fg); }
.cp-dec-card--warn { border-top: 3px solid var(--warn-fg); }
.cp-dec-card-area { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 6px; }
.cp-dec-card-title { display: block; font-size: 16px; margin-bottom: 8px; }
.cp-dec-card-do { margin: 0 0 6px; font-size: 12px; line-height: 1.4; color: var(--text-soft); }
.cp-dec-card-dont { margin: 0; font-size: 11px; color: var(--text-muted); line-height: 1.35; }
.cp-week-list { list-style: none; padding: 0; margin: 0; }
.cp-week-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.cp-week-item:last-child { border-bottom: 0; }
.cp-week-num { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 13px; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; }
.cp-week-item p { margin: 4px 0 0; font-size: 12px; color: var(--text-muted); }
.cp-watch-ignore { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 800px) { .cp-watch-ignore { grid-template-columns: 1fr; } }
.cp-watch-list, .cp-ignore-list { margin: 0; padding-left: 0; list-style: none; }
.cp-watch-list li, .cp-ignore-list li { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; line-height: 1.4; }
.cp-watch-list li:last-child, .cp-ignore-list li:last-child { border-bottom: 0; }
.cp-watch-list span { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.cp-watch-then { color: var(--accent) !important; font-weight: 600; }
.cp-ignore-list li { color: var(--text-soft); }
.cp-attention-list { display: flex; flex-direction: column; gap: 12px; }
.cp-attention-row { padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-muted); }
.cp-attention-vs { font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .04em; }
.cp-attention-cols { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 10px; }
@media (max-width: 720px) { .cp-attention-cols { grid-template-columns: 1fr; } }
.cp-attention-cols span { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--text-faint); margin-bottom: 4px; }
.cp-attention-cols p { margin: 0; font-size: 13px; line-height: 1.4; color: var(--text-soft); }
.cp-attention-do p { color: var(--text); font-weight: 500; }
.cp-signals-list { list-style: none; padding: 0; margin: 0; }
.cp-signals-list li { padding: 12px 0; border-bottom: 1px solid var(--border); }
.cp-signals-list li:last-child { border-bottom: 0; }
.cp-signals-date { display: block; font-size: 11px; color: var(--text-faint); margin-bottom: 2px; }
.cp-signals-list p { margin: 4px 0 0; font-size: 13px; color: var(--text-soft); }
.cp-agent-queries-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 0; }
.cp-details { margin-top: 8px; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 4px 16px 16px; background: var(--bg-muted); }
.cp-details summary { cursor: pointer; font-weight: 600; font-size: 13px; padding: 12px 0; color: var(--text-muted); list-style: none; }
.cp-details summary::-webkit-details-marker { display: none; }
.cp-details-note { font-size: 12px; color: var(--text-muted); margin: 0 0 12px; }
.cp-details-block { margin-bottom: 12px; font-size: 13px; line-height: 1.45; }
.cp-details-block h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); }
.cp-details-block ul { margin: 0; padding-left: 18px; }
.text-crit { color: var(--crit-fg); }
.text-ok { color: var(--ok-fg); }
.section-title { font-size: 16px; font-weight: 600; margin: 0 0 4px; }
.section-sub { font-size: 13px; color: var(--text-muted); margin: 0 0 8px; }

.ai-chat-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1200;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--accent, #2563eb);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.ai-chat-panel {
  position: fixed;
  right: 24px;
  bottom: 88px;
  z-index: 1200;
  width: min(420px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  background: var(--bg, #fff);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 16px 48px rgba(0,0,0,.15);
}
.ai-chat-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.ai-chat-close {
  margin-left: auto;
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
}
.ai-chat-body {
  flex: 1;
  overflow: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ai-chat-msg {
  font-size: 13px;
  line-height: 1.45;
  padding: 10px 12px;
  border-radius: 10px;
  white-space: pre-wrap;
}
.ai-chat-msg--user {
  align-self: flex-end;
  background: var(--accent-soft, #eff6ff);
  max-width: 92%;
}
.ai-chat-msg--bot {
  align-self: flex-start;
  background: var(--bg-muted);
  max-width: 96%;
}
.ai-chat-foot {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.boot-splash {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--bg);
}
.boot-splash-mark {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: #fff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.boot-splash-title { font-size: 20px; font-weight: 700; color: var(--text); }
.boot-splash-sub { font-size: 14px; color: var(--text-muted); }
