:root {
  --bg: #07111f;
  --panel: #0f172a;
  --panel-2: #172554;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #22d3ee;
  --accent-2: #38bdf8;
  --border: rgba(148, 163, 184, 0.18);
  --danger: #f87171;
  --success: #34d399;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Segoe UI, Arial, sans-serif;
  background: linear-gradient(180deg, #020617 0%, #07111f 100%);
  color: var(--text);
}

/* AI Chat Assistant */
.ai-chat-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  font-family: inherit;
}

.ai-chat-fab {
  border: 1px solid rgba(34, 211, 238, 0.45);
  border-radius: 999px;
  padding: 12px 16px;
  color: #04111f;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.38);
}

.ai-chat-panel {
  position: absolute;
  right: 0;
  bottom: 58px;
  width: min(420px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 96px));
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.98);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.58);
}

.ai-chat-panel.open { display: flex; }

.ai-chat-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(23, 37, 84, 0.85);
}

.ai-chat-header strong { display: block; }
.ai-chat-header small { color: var(--muted); }

.ai-chat-close {
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
}

.ai-chat-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 12px 0;
}

.ai-chat-quick button {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  font-size: 12px;
}

.ai-chat-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  overflow-y: auto;
}

.ai-chat-message {
  max-width: 88%;
  white-space: pre-wrap;
  line-height: 1.45;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13px;
}

.ai-chat-message.assistant {
  align-self: flex-start;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border);
}

.ai-chat-message.user {
  align-self: flex-end;
  color: #03111f;
  background: var(--accent);
}

.ai-chat-message.loading { color: var(--muted); }
.ai-chat-message.error { border-color: rgba(248, 113, 113, 0.55); color: #fecaca; }

.ai-chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
}

.ai-chat-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  color: var(--text);
  background: rgba(2, 6, 23, 0.75);
  outline: none;
}

.ai-chat-input:focus { border-color: var(--accent); }

.ai-chat-send {
  border: 0;
  border-radius: 12px;
  padding: 0 14px;
  color: #03111f;
  background: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

.ai-chat-send:disabled { opacity: 0.6; cursor: wait; }

.page-header,
.container {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
}

.page-header {
  padding: 32px 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
}

.subtitle { color: var(--muted); max-width: 760px; }

.subtitle a {
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
}

.subtitle a:hover {
  text-decoration: underline;
}

.top-nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.nav-link {
  color: #ffffff;
  text-decoration: none;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.75);
  white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, 0.08);
}

/* ── Grouped Nav Dropdown ──────────────────────────────────────────── */
.nav-group {
  position: relative;
}

.nav-group-trigger {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.nav-group-arrow {
  font-size: 10px;
  opacity: 0.7;
  transition: transform 0.2s;
}

.nav-group:hover .nav-group-arrow {
  transform: rotate(180deg);
}

.nav-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 12px;
  min-width: 200px;
  padding: 6px;
  z-index: 200;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
}

.nav-group:hover .nav-dropdown {
  display: block;
}

.nav-dropdown-item {
  display: block;
  color: var(--text);
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13px;
  white-space: nowrap;
  transition: background 0.15s;
}

.nav-dropdown-item:hover {
  background: rgba(255,255,255,0.07);
  color: var(--accent);
}

.nav-dropdown-item.active {
  background: rgba(34,211,238,0.12);
  color: var(--accent);
  font-weight: 600;
}

/* Global search */
.nav-search {
  position: relative;
  margin-left: auto;
}
.nav-search-input {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(148,163,184,0.18);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  padding: 5px 10px;
  width: 200px;
  outline: none;
  transition: border-color 0.15s, width 0.2s;
}
.nav-search-input:focus {
  border-color: var(--accent);
  width: 260px;
}
.nav-search-input::placeholder { color: var(--muted); }
.nav-search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 300px;
  background: var(--card);
  border: 1px solid rgba(148,163,184,0.15);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 300;
  overflow: hidden;
  max-height: 420px;
  overflow-y: auto;
}
.nav-search-group {
  padding: 6px 12px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-top: 1px solid rgba(255,255,255,0.05);
}
.nav-search-group:first-child { border-top: none; }
.nav-search-item {
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
  gap: 2px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.1s;
}
.nav-search-item:hover, .nav-search-item.active {
  background: rgba(34,211,238,0.1);
  color: var(--accent);
}
.nav-search-label { font-size: 13px; }
.nav-search-meta { font-size: 11px; color: var(--muted); }
.nav-search-item.active .nav-search-meta { color: inherit; opacity: 0.7; }
.nav-search-empty {
  padding: 16px 12px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

input, select, button {
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 10px 12px;
}

button {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #082f49;
  font-weight: 700;
  cursor: pointer;
}

.secondary-button {
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
}

.btn-export {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.btn-export:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.sp-group-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-detail {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.btn-detail:hover {
  background: var(--accent);
  color: #fff;
}

.pd-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 100;
  max-height: 320px;
  overflow-y: auto;
}
.pd-dropdown-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.pd-dropdown-item:last-child { border-bottom: none; }
.pd-dropdown-item:hover { background: rgba(99,102,241,0.1); }
.pd-dropdown-item.pd-dropdown-empty { cursor: default; color: var(--muted); grid-template-columns: 1fr; }
.pd-dropdown-sku { font-family: monospace; color: var(--muted); font-size: 12px; }
.pd-dropdown-name { color: var(--text); }
.pd-dropdown-stock { color: var(--muted); font-size: 11px; }

.active-filter-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto 12px;
}

.filter-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 12px;
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.35);
  color: var(--accent);
  font-size: 13px;
  line-height: 1;
}

.filter-badge .filter-badge-label {
  color: var(--muted);
  font-size: 12px;
}

.filter-badge strong {
  font-weight: 600;
  color: var(--text);
}

.filter-badge-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.18);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s;
}

.filter-badge-close:hover {
  background: rgba(248, 113, 113, 0.25);
  color: var(--danger);
}

.status-card,
.card,
.panel {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

.status-card {
  padding: 14px 16px;
  margin-bottom: 18px;
  color: var(--success);
}

.status-card.error { color: var(--danger); }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
}

.card {
  min-width: 0;
  min-height: 132px;
  padding: 18px;
  overflow: hidden;
}

.card h3 { color: var(--muted); font-size: 14px; margin-bottom: 10px; }

.card strong {
  display: block;
  max-width: 100%;
  font-size: clamp(18px, 2.2vw, 24px);
  line-height: 1.15;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Angka KPI tampil PENUH (tanpa singkatan) — izinkan wrap rapi untuk nominal panjang */
.card strong.kpi-full, .kpi-grid .card strong {
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: none;
}
@media (max-width: 1400px) {
  .kpi-grid .card strong { font-size: clamp(15px, 1.8vw, 22px); }
}

.comparison-line {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.delta-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(148, 163, 184, 0.12);
  color: var(--muted);
}

.delta-badge.up {
  background: rgba(52, 211, 153, 0.12);
  color: var(--success);
}

.delta-badge.down {
  background: rgba(248, 113, 113, 0.12);
  color: var(--danger);
}

.comparison-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.muted-placeholder {
  color: var(--muted);
  font-size: 13px;
  padding: 12px 0;
}

.heatmap-wrap {
  overflow-x: auto;
  margin-top: 12px;
}

.heatmap-table {
  border-collapse: collapse;
  font-size: 12px;
  min-width: 100%;
}

.heatmap-table th,
.heatmap-table td {
  border: 1px solid rgba(148, 163, 184, 0.1);
  padding: 6px 10px;
  text-align: center;
  white-space: nowrap;
}

.heatmap-table th {
  background: rgba(15, 23, 42, 0.95);
  color: var(--muted);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}

.heatmap-table td.heatmap-label {
  text-align: left;
  font-weight: 600;
  color: var(--text);
  background: rgba(15, 23, 42, 0.95);
  position: sticky;
  left: 0;
  z-index: 2;
}

.heatmap-table td.heatmap-label.header-corner {
  z-index: 3;
}

.heatmap-table td.heatmap-cell {
  color: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  cursor: default;
  transition: filter 0.1s;
}

.heatmap-table td.heatmap-cell:hover {
  filter: brightness(1.3);
  outline: 1px solid rgba(255, 255, 255, 0.3);
}

.heatmap-table td.heatmap-empty {
  color: var(--muted);
  background: rgba(15, 23, 42, 0.4);
}

.cohort-table td:nth-child(2) {
  text-align: right;
  color: var(--muted);
  font-size: 11px;
  min-width: 52px;
}

.cohort-table th:nth-child(2) {
  text-align: right;
  min-width: 52px;
}

.owner-summary {
  border-color: rgba(34, 211, 238, 0.28);
  background:
    radial-gradient(circle at top left, rgba(34, 211, 238, 0.12), transparent 34%),
    rgba(15, 23, 42, 0.92);
}

.summary-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 14px 0 0;
  list-style: none;
}

.summary-item {
  position: relative;
  min-height: 44px;
  padding: 12px 14px 12px 42px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.28);
  color: #dbeafe;
  font-size: 14px;
  line-height: 1.5;
}

.summary-item::before {
  content: '✓';
  position: absolute;
  top: 12px;
  left: 14px;
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.15);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

.summary-item.empty::before {
  content: '!';
  background: rgba(248, 113, 113, 0.12);
  color: var(--danger);
}

.quadrant-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.quadrant-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 108px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.quadrant-badge.quadrant-star {
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.14);
  color: #bbf7d0;
}

.quadrant-badge.quadrant-traffic {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.14);
  color: #bae6fd;
}

.quadrant-badge.quadrant-hidden {
  border-color: rgba(250, 204, 21, 0.35);
  background: rgba(250, 204, 21, 0.13);
  color: #fef08a;
}

.quadrant-badge.quadrant-problem {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.13);
  color: #fecaca;
}

.product-quadrant-table td:nth-child(3),
.product-quadrant-table td:nth-child(8) {
  min-width: 220px;
  white-space: normal;
}

.mini-panel-title {
  margin: 0 0 10px;
  color: #dbeafe;
  font-size: 14px;
}

.dead-stock-table td:nth-child(2),
.dead-stock-table td:nth-child(7),
.rfm-table td:nth-child(2),
.rfm-table td:nth-child(7) {
  min-width: 220px;
  white-space: normal;
}

.segment-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 118px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.segment-badge.segment-champion {
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.14);
  color: #bbf7d0;
}

.segment-badge.segment-loyal {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.14);
  color: #bae6fd;
}

.segment-badge.segment-potential {
  border-color: rgba(250, 204, 21, 0.35);
  background: rgba(250, 204, 21, 0.13);
  color: #fef08a;
}

.segment-badge.segment-dormant-high {
  border-color: rgba(251, 146, 60, 0.38);
  background: rgba(251, 146, 60, 0.13);
  color: #fed7aa;
}

.segment-badge.segment-risk {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.13);
  color: #fecaca;
}

.segment-badge.segment-regular {
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
}

.action-board-table td:nth-child(2),
.action-board-table td:nth-child(5),
.action-board-table td:nth-child(6) {
  min-width: 220px;
  white-space: normal;
}

.action-badge,
.risk-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.action-badge.action-promo {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.14);
  color: #bae6fd;
}

.action-badge.action-restock {
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.14);
  color: #bbf7d0;
}

.action-badge.action-review {
  border-color: rgba(250, 204, 21, 0.35);
  background: rgba(250, 204, 21, 0.13);
  color: #fef08a;
}

.risk-badge.risk-low {
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.14);
  color: #bbf7d0;
}

.risk-badge.risk-medium {
  border-color: rgba(250, 204, 21, 0.35);
  background: rgba(250, 204, 21, 0.13);
  color: #fef08a;
}

.risk-badge.risk-high {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.13);
  color: #fecaca;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.single-chart-grid {
  grid-template-columns: 1fr;
}

.chart-card {
  position: relative;
  min-height: 320px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(2, 6, 23, 0.28);
}

.chart-card h3 {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
}

.chart-canvas-wrap {
  position: relative;
  height: 260px;
}

.wide-chart-card .chart-canvas-wrap {
  height: 340px;
}

.chart-card.is-empty::after {
  content: 'Belum ada data untuk grafik ini.';
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.grid-three {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.brief-period-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto 16px;
  padding: 14px 20px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(34, 211, 238, 0.28);
  border-radius: 14px;
}

.brief-period-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.brief-period-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.brief-period-item strong {
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
}

.brief-period-divider {
  color: rgba(148, 163, 184, 0.4);
  font-size: 16px;
  padding: 0 4px;
}

.detail-panels {
  grid-template-columns: 1fr;
}

.compact-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin: 12px 0 14px;
}

.compact-grid .card {
  min-height: 96px;
  padding: 14px;
}

.small-button {
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
}

.expand-row td {
  background: rgba(2, 6, 23, 0.32);
  white-space: normal;
}

.compact-detail-grid {
  margin-top: 0;
  align-items: start;
}

.compact-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--text);
}

.compact-list li {
  margin-bottom: 8px;
  line-height: 1.45;
}

.compact-list small {
  color: var(--muted);
}

.panel { margin-top: 16px; padding: 18px; }

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-header span { color: var(--muted); font-size: 14px; }

.info-badge {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #1e293b;
  color: #bfdbfe;
  border: 1px solid rgba(191, 219, 254, 0.35);
  font-size: 12px;
  font-weight: 700;
}

.inline-hint-title,
.th-hint-wrap,
.filter-label-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.card h3.inline-hint-title {
  display: flex;
  justify-content: space-between;
}

.filter-action-hint {
  align-self: end;
  margin-left: -6px;
  margin-bottom: 8px;
}

.th-hint-wrap {
  white-space: nowrap;
}

.hint-popover {
  position: absolute;
  z-index: 1000;
  width: min(320px, calc(100vw - 24px));
  padding: 14px 14px 12px;
  border: 1px solid rgba(191, 219, 254, 0.35);
  border-radius: 14px;
  background: #020617;
  color: var(--text);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
}

.hint-popover p {
  margin: 0 26px 10px 0;
  color: #dbeafe;
  font-size: 14px;
  line-height: 1.45;
}

.hint-popover a {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.hint-popover a:hover { text-decoration: underline; }

.hint-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.95);
  color: #ffffff;
}

.dictionary-intro {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.dictionary-intro p { margin: 0; }

.table-wrap {
  max-width: 100%;
  overflow: auto;
  border-radius: 14px;
}

.scroll-table-wrap {
  max-height: 390px;
  border: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.22);
}

table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
}

.wide-table {
  min-width: 860px;
}

th, td {
  padding: 10px 9px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--muted);
  background: #0f172a;
}

tbody tr:nth-child(even) td {
  background: rgba(148, 163, 184, 0.035);
}

td {
  white-space: nowrap;
}

td:first-child {
  white-space: normal;
  min-width: 120px;
}

.scroll-table-wrap table {
  min-width: 0;
}

.scroll-table-wrap th,
.scroll-table-wrap td {
  padding: 9px 8px;
  font-size: 13px;
}

.table-wrap::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 999px;
}

.table-wrap::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.55);
}

@media (max-width: 900px) {
  .grid-two { grid-template-columns: 1fr; }
  .grid-three { grid-template-columns: 1fr; }
}

/* ── Loading Spinner Overlay ────────────────────────────────────────── */
.si-loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 23, 0.72);
  border-radius: inherit;
  z-index: 10;
  backdrop-filter: blur(2px);
}

.si-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(34, 211, 238, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: si-spin 0.7s linear infinite;
}

@keyframes si-spin { to { transform: rotate(360deg); } }

/* Skeleton shimmer for cards */
.si-skeleton {
  position: relative;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.06);
  border-radius: 8px;
  min-height: 20px;
}

.si-skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.08), transparent);
  animation: si-shimmer 1.5s infinite;
}

@keyframes si-shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* ── Toast Notification ─────────────────────────────────────────────── */
.si-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.si-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  animation: si-toast-in 0.3s ease-out;
  max-width: 380px;
}

.si-toast.si-toast-exit {
  animation: si-toast-out 0.25s ease-in forwards;
}

.si-toast-success { border-color: rgba(52, 211, 153, 0.45); }
.si-toast-success .si-toast-icon { color: var(--success); }

.si-toast-error { border-color: rgba(248, 113, 113, 0.45); }
.si-toast-error .si-toast-icon { color: var(--danger); }

.si-toast-info { border-color: rgba(34, 211, 238, 0.45); }
.si-toast-info .si-toast-icon { color: var(--accent); }

.si-toast-icon { font-size: 16px; flex-shrink: 0; }

.si-toast-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 0 0 0 8px;
  flex-shrink: 0;
}

.si-toast-close:hover { color: var(--text); }

@keyframes si-toast-in {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes si-toast-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(16px) scale(0.96); }
}

/* ── Sticky Filter Bar ──────────────────────────────────────────────── */
.sticky-filter-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(180deg, #020617 0%, #020617 88%, transparent 100%);
  padding: 12px 0 16px;
  margin-bottom: 4px;
}

/* ── Breadcrumb Navigation ──────────────────────────────────────────── */
.si-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.si-breadcrumb a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.si-breadcrumb a:hover { text-decoration: underline; }

.si-breadcrumb .bc-sep {
  color: rgba(148, 163, 184, 0.4);
  font-size: 11px;
}

.si-breadcrumb .bc-current {
  color: var(--text);
  font-weight: 600;
}

/* ── Active Nav Highlight ───────────────────────────────────────────── */
.nav-link.active {
  background: rgba(34, 211, 238, 0.15);
  border-color: rgba(34, 211, 238, 0.4);
  color: var(--accent);
  font-weight: 700;
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.1);
}

/* ── KPI Flash Highlight ────────────────────────────────────────────── */
.card.si-flash {
  animation: si-flash 0.8s ease-out;
}

@keyframes si-flash {
  0% { border-color: rgba(34, 211, 238, 0.7); box-shadow: 0 0 20px rgba(34, 211, 238, 0.2); }
  100% { border-color: var(--border); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22); }
}

/* ── Compact Number Tooltip ─────────────────────────────────────────── */
.si-num {
  cursor: help;
  border-bottom: 1px dotted rgba(148, 163, 184, 0.3);
}

/* ── Status Card Hidden (replaced by toast) ─────────────────────────── */
.status-card.si-hidden {
  display: none;
}

/* ── Print Button ─────────────────────────────────────────────────────── */
.btn-print {
  white-space: nowrap;
}

/* ── Product Quadrant Hint ───────────────────────────────────────────── */
.quadrant-hint-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

@media (max-width: 900px) {
  .quadrant-hint-grid { grid-template-columns: repeat(2, 1fr); }
}

.quadrant-hint {
  padding: 10px 12px;
  border-radius: 8px;
  border-left: 4px solid transparent;
}

.quadrant-hint strong {
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
}

.quadrant-hint span {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.quadrant-hint-star   { background: rgba(250,204,21,0.08); border-left-color: #facc15; }
.quadrant-hint-traffic { background: rgba(56,189,248,0.08); border-left-color: #38bdf8; }
.quadrant-hint-gem    { background: rgba(52,211,153,0.08); border-left-color: #34d399; }
.quadrant-hint-problem { background: rgba(248,113,113,0.08); border-left-color: #f87171; }

/* ── Shopkeeper Filter Bar ───────────────────────────────────────────── */
.sp-shopkeeper-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 8px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
}

.sp-shopkeeper-label {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  font-weight: 500;
}

/* ── Ranking table with fixed scroll window ──────────────────────────── */
.rank-scroll-wrap {
  max-height: 360px;
  overflow-y: auto;
}

.rank-scroll-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
}

/* ── Alert / Health Status Panel ─────────────────────────────────────── */
.alert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.alert-card {
  border-radius: 8px;
  padding: 12px 14px;
  border-left: 4px solid transparent;
}

.alert-card-critical {
  background: rgba(239, 68, 68, 0.08);
  border-left-color: #ef4444;
}

.alert-card-warning {
  background: rgba(234, 179, 8, 0.08);
  border-left-color: #eab308;
}

.alert-card-healthy {
  background: rgba(34, 197, 94, 0.08);
  border-left-color: #22c55e;
}

.alert-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.alert-icon {
  font-size: 14px;
  line-height: 1;
}

.alert-area {
  font-size: 13px;
  font-weight: 600;
  flex: 1;
}

.alert-level-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.alert-level-critical {
  background: rgba(239, 68, 68, 0.18);
  color: #ef4444;
}

.alert-level-warning {
  background: rgba(234, 179, 8, 0.18);
  color: #ca8a04;
}

.alert-level-healthy {
  background: rgba(34, 197, 94, 0.18);
  color: #16a34a;
}

.alert-message {
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  margin: 0;
}

@media print {
  /* Reset background/color for print */
  *, *::before, *::after {
    color: #000 !important;
    background: #fff !important;
    box-shadow: none !important;
    border-color: #ccc !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body {
    font-size: 11pt;
  }

  /* Hide navigation, filters, buttons, status bar, scrollbars */
  .top-nav,
  .header-actions,
  .active-filter-badges,
  .status-card,
  button,
  .filter-badge-close,
  .chart-canvas-wrap,
  .chart-grid,
  .heatmap-wrap {
    display: none !important;
  }

  /* Page header — compact */
  .page-header {
    padding: 12pt 0 8pt;
    border-bottom: 1.5pt solid #000;
    margin-bottom: 12pt;
  }

  .page-header h1 {
    font-size: 18pt;
    margin: 0 0 4pt;
  }

  .eyebrow {
    font-size: 8pt;
    margin: 0;
  }

  .subtitle {
    font-size: 9pt;
    margin: 0;
  }

  /* Period banner — show prominently */
  .brief-period-banner {
    display: flex !important;
    border: 1pt solid #000 !important;
    border-radius: 4pt !important;
    padding: 8pt 12pt !important;
    margin-bottom: 10pt !important;
    gap: 24pt !important;
  }

  .brief-period-label { font-size: 8pt !important; }
  .brief-period-item strong { font-size: 11pt !important; font-weight: 700 !important; }
  .brief-period-divider { display: none !important; }

  /* Panels */
  .panel, .card {
    border: 1pt solid #ccc !important;
    border-radius: 4pt !important;
    padding: 8pt !important;
    margin-bottom: 10pt !important;
    page-break-inside: avoid;
  }

  .panel-header h2 {
    font-size: 13pt;
    margin: 0 0 4pt;
  }

  .panel-header span {
    font-size: 9pt;
    color: #555 !important;
  }

  /* KPI grid */
  .kpi-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 6pt !important;
  }

  .card {
    min-height: 0 !important;
    padding: 6pt 8pt !important;
  }

  .card h3 { font-size: 8pt !important; margin-bottom: 2pt !important; }
  .card strong { font-size: 14pt !important; }

  /* Delta badges — simplify */
  .delta-badge {
    font-size: 8pt !important;
    padding: 1pt 4pt !important;
    border-radius: 2pt !important;
    background: #eee !important;
    color: #000 !important;
  }

  .delta-badge.up { background: #d4f4e8 !important; }
  .delta-badge.down { background: #fde8e8 !important; }

  /* Tables */
  table {
    width: 100% !important;
    font-size: 9pt;
    border-collapse: collapse;
  }

  th, td {
    padding: 3pt 6pt !important;
    border: 0.5pt solid #bbb !important;
    white-space: normal !important;
  }

  th {
    background: #f0f0f0 !important;
    font-weight: 700 !important;
    position: static !important;
  }

  tbody tr:nth-child(even) td {
    background: #fafafa !important;
  }

  /* Grid layouts */
  .grid-two, .grid-three {
    grid-template-columns: 1fr 1fr !important;
    gap: 8pt !important;
  }

  /* Owner summary bullets */
  .owner-summary {
    border: 1pt solid #000 !important;
    background: #fff !important;
  }

  .summary-item {
    font-size: 10pt;
    padding: 4pt 0 !important;
  }

  /* Segment badges */
  .segment-badge {
    font-size: 8pt !important;
    padding: 1pt 4pt !important;
    border-radius: 2pt !important;
    border: 0.5pt solid #999 !important;
  }

  /* Alert cards */
  .alert-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 4pt !important;
  }

  .alert-card {
    padding: 5pt 7pt !important;
    border-left-width: 3pt !important;
    border-left-style: solid !important;
    page-break-inside: avoid;
  }

  .alert-card-critical { border-left-color: #cc0000 !important; }
  .alert-card-warning { border-left-color: #cc7700 !important; }
  .alert-card-healthy { border-left-color: #006600 !important; }

  .alert-area { font-size: 9pt !important; }
  .alert-message { font-size: 8pt !important; }
  .alert-level-badge { font-size: 7pt !important; border: 0.5pt solid #999 !important; }

  /* Avoid page break inside important sections */
  .kpi-grid, section.panel, .brief-period-banner {
    page-break-inside: avoid;
  }

  /* Page margins */
  @page {
    margin: 16mm 14mm;
    size: A4 landscape;
  }
}

/* ── Sortable Table Headers ─────────────────────────────────────────── */
thead th[data-sort-dir]:hover { background: rgba(34,211,238,0.08); }
thead th[data-sort-dir="asc"],
thead th[data-sort-dir="desc"] { color: var(--accent); }

/* ── Color Coding Cells ─────────────────────────────────────────────── */
.cell-danger  { color: #f87171 !important; font-weight: 600; }
.cell-warn    { color: #fbbf24 !important; font-weight: 600; }
.cell-good    { color: #34d399 !important; font-weight: 600; }
.cell-neutral { color: var(--muted); }

/* ── Skeleton Loading ───────────────────────────────────────────────── */
@keyframes si-shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}

.skeleton-card {
  background: linear-gradient(90deg, #0f172a 25%, #1e293b 50%, #0f172a 75%);
  background-size: 600px 100%;
  animation: si-shimmer 1.4s infinite linear;
  border-radius: 18px;
  min-height: 90px;
}

.skeleton-row {
  height: 18px;
  border-radius: 6px;
  margin: 6px 0;
  background: linear-gradient(90deg, #0f172a 25%, #1e293b 50%, #0f172a 75%);
  background-size: 600px 100%;
  animation: si-shimmer 1.4s infinite linear;
}

.kpi-grid.is-loading .card {
  pointer-events: none;
}

/* ── Universal Sticky thead ─────────────────────────────────────────── */
.table-wrap table thead th,
.rank-scroll-wrap table thead th,
.scroll-table-wrap table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel);
  box-shadow: 0 1px 0 var(--border);
}

/* ── Responsive Filter Bar ──────────────────────────────────────────── */
.filter-toggle-btn {
  display: none;
  gap: 6px;
  align-items: center;
  background: rgba(34,211,238,0.1);
  border: 1px solid rgba(34,211,238,0.25);
  border-radius: 999px;
  color: var(--accent);
  font-size: 13px;
  padding: 6px 14px;
  cursor: pointer;
}

@media (max-width: 900px) {
  .filter-toggle-btn { display: inline-flex; }

  .header-actions {
    flex-direction: column;
    align-items: flex-start;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .header-actions.filter-open {
    max-height: 1200px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ── Empty State ────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--muted);
  gap: 10px;
}

.empty-state-icon {
  font-size: 36px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 14px;
  text-align: center;
  max-width: 280px;
  line-height: 1.5;
}