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

:root {
  /* ── Background & Surface ── */
  --bg: #F6F7FB;
  --bg-gradient: linear-gradient(135deg, #EEF2FF 0%, #F6F7FB 40%, #FDF2F8 100%);
  --surface: #FFFFFF;
  --surface2: #F1F3F9;
  --surface3: #E8EBF4;
  --border: rgba(99, 102, 241, 0.10);
  --border-mid: rgba(99, 102, 241, 0.22);

  /* ── Text ── */
  --text-primary: #1E1B4B;
  --text-secondary: #4B5563;
  --text-muted: #9CA3AF;

  /* ── Brand: Indigo / Violet ── */
  --brand: #6366F1;
  --brand-dark: #4F46E5;
  --brand-light: #EEF2FF;
  --brand-text: #4338CA;

  /* ── Semantic: Green ── */
  --green: #059669;
  --green-light: #ECFDF5;
  --green-mid: rgba(5, 150, 105, 0.12);
  --green-dark: #047857;
  --green-text: #065F46;

  /* ── Semantic: Blue ── */
  --blue: #2563EB;
  --blue-light: #EFF6FF;
  --blue-mid: rgba(37, 99, 235, 0.12);
  --blue-dark: #1D4ED8;
  --blue-text: #1E40AF;

  /* ── Semantic: Red ── */
  --red: #DC2626;
  --red-light: #FEF2F2;
  --red-mid: rgba(220, 38, 38, 0.12);
  --red-dark: #B91C1C;
  --red-text: #991B1B;

  /* ── Semantic: Amber ── */
  --amber: #D97706;
  --amber-light: #FFFBEB;
  --amber-mid: rgba(217, 119, 6, 0.12);
  --amber-dark: #B45309;
  --amber-text: #92400E;

  /* ── Radii & Spacing ── */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --sidebar-w: 72px;

  /* ── Shadows ── */
  --shadow-sm: 0 1px 3px rgba(99, 102, 241, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(99, 102, 241, 0.10), 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 40px rgba(99, 102, 241, 0.14), 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 20px 48px rgba(99, 102, 241, 0.18), 0 8px 20px rgba(0, 0, 0, 0.07);
}

/* ──────────────────────────────────── BASE ── */
html {
  height: 100%;
}

body {
  font-family: 'DM Sans', 'Inter', sans-serif;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100%;
  position: relative;
}

/* ══════════════════════════════════════════════════════
   LANDING PAGE
══════════════════════════════════════════════════════ */
.landing-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #F8FAFC 0%, #E2E8F0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  overflow-y: auto;
}

.landing-overlay::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 30%, rgba(99, 102, 241, 0.08) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 80% 70%, rgba(168, 85, 247, 0.05) 0%, transparent 70%);
  pointer-events: none;
}

.landing-wrap {
  position: relative;
  z-index: 1;
  max-width: 860px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
  text-align: center;
  animation: fadeSlideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Logo */
.landing-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.landing-logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #6366F1, #A855F7);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.25);
}

.landing-logo-text {
  font-size: 22px;
  font-weight: 700;
  color: #1E293B;
  letter-spacing: -0.5px;
}

.landing-demo-badge {
  font-size: 10px;
  font-weight: 700;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  color: #4F46E5;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-left: 4px;
}

/* Hero text */
.landing-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.landing-eyebrow {
  font-size: 11px;
  font-weight: 700;
  color: #4F46E5;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.landing-title {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 700;
  color: #0F172A;
  line-height: 1.2;
  letter-spacing: -1px;
}

.landing-title span {
  background: linear-gradient(90deg, #4F46E5, #9333EA);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.landing-desc {
  font-size: 15px;
  color: #475569;
  max-width: 560px;
  line-height: 1.7;
}

.landing-desc strong {
  color: #1E293B;
}

/* 3 Steps */
.landing-steps {
  display: flex;
  align-items: stretch;
  gap: 0;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}

.lstep {
  flex: 1;
  min-width: 180px;
  max-width: 220px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 22px 18px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  position: relative;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.lstep:hover {
  background: #F8FAFC;
  transform: translateY(-4px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
}

.lstep-num {
  font-size: 10px;
  font-weight: 700;
  color: #94A3B8;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.lstep-icon {
  width: 48px;
  height: 48px;
  background: rgba(99, 102, 241, 0.08);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #4F46E5;
}

.lstep-title {
  font-size: 14px;
  font-weight: 700;
  color: #0F172A;
}

.lstep-desc {
  font-size: 12px;
  color: #64748B;
  line-height: 1.55;
  text-align: center;
}

.lstep-arrow {
  font-size: 20px;
  color: #CBD5E1;
  padding: 0 8px;
  flex-shrink: 0;
  align-self: center;
}

/* Stats row */
.landing-stats {
  display: flex;
  align-items: center;
  gap: 0;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 32px 0;
  width: 100%;
  flex-wrap: wrap;
  justify-content: center;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.lstat {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  padding: 0 10px;
}

.lstat-val {
  font-size: 36px;
  font-weight: 700;
  color: #0F172A;
  font-family: 'DM Mono', monospace;
  letter-spacing: -1px;
}

.lstat-val span {
  font-size: 22px;
  opacity: 0.7;
}

.lstat-label {
  font-size: 13px;
  color: #64748B;
  margin-top: 6px;
  font-weight: 500;
}

.lstat-div {
  width: 1px;
  height: 60px;
  background: #E2E8F0;
}

/* CTA */
.landing-cta {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #6366F1, #A855F7);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 16px 36px;
  font-size: 16px;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
  letter-spacing: -0.2px;
}

.landing-cta:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 14px 32px rgba(99, 102, 241, 0.45);
}

.landing-cta i {
  font-size: 18px;
  transition: transform 0.2s;
}

.landing-cta:hover i {
  transform: translateX(4px);
}

.landing-footnote {
  font-size: 11px;
  color: #94A3B8;
  letter-spacing: 0.02em;
}

/* ══════════════════════════════════════════════════════
   APP SHELL
══════════════════════════════════════════════════════ */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ──────────────────────────────────── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-mid);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0 22px;
  gap: 4px;
  flex-shrink: 0;
  z-index: 10;
  box-shadow: 2px 0 24px rgba(99, 102, 241, 0.07);
}

.sb-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--brand) 0%, #A855F7 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 19px;
  margin-bottom: 22px;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.40);
}

.sb-nav {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  width: 100%;
  padding: 0 10px;
}

.sb-item {
  width: 100%;
  min-height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, transform 0.18s;
  position: relative;
  border: none;
  background: transparent;
  gap: 2px;
  padding: 6px 4px;
}

.sb-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-family: 'DM Sans', sans-serif;
  line-height: 1;
}

.sb-item:hover {
  background: var(--brand-light);
  color: var(--brand);
  transform: scale(1.04);
}

.sb-item.active {
  background: linear-gradient(135deg, var(--brand-light), rgba(168, 85, 247, 0.10));
  color: var(--brand);
}

.sb-item.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  background: linear-gradient(180deg, var(--brand), #A855F7);
  border-radius: 0 4px 4px 0;
}

.sb-divider {
  width: 36px;
  height: 1px;
  background: var(--border-mid);
  margin: 8px auto;
}

.sb-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 0 10px;
}

/* ──────────────────────────────────── MAIN ── */
.main {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ──────────────────────────────────── TOPBAR ── */
.topbar {
  background: rgba(255, 255, 255, 0.80);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-mid);
  padding: 13px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 9;
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.07);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-brand .dot {
  color: var(--brand);
  font-size: 20px;
  filter: drop-shadow(0 2px 6px rgba(99, 102, 241, 0.4));
}

.topbar-brand h1 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.4px;
}

.topbar-brand span {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 6px;
  font-weight: 400;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tb-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--surface2);
  border: 1px solid var(--border-mid);
  border-radius: 20px;
  padding: 5px 13px;
  font-weight: 500;
}

.tb-chip i {
  font-size: 14px;
  color: var(--brand);
}

/* Demo badge in topbar */
.demo-badge-top {
  font-size: 10px;
  font-weight: 700;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.10), rgba(168, 85, 247, 0.10));
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: var(--brand-text);
  padding: 4px 11px;
  border-radius: 20px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-tabs {
  display: flex;
  gap: 2px;
  background: var(--surface2);
  border: 1px solid var(--border-mid);
  border-radius: 22px;
  padding: 3px;
}

.nav-tab {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 5px 15px;
  border-radius: 20px;
  cursor: pointer;
  border: none;
  background: transparent;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}

.nav-tab.active {
  background: var(--surface);
  color: var(--brand-text);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

/* Avatar button */
.avatar-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #A855F7);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(99, 102, 241, 0.35);
  border: none;
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s;
  font-family: 'DM Sans', sans-serif;
}

.avatar-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.50);
}

/* ──────────────────────────────────── CONTENT ── */
.content {
  padding: 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

/* ──────────────────────────────────── PAGES ── */
.page {
  display: none;
  flex-direction: column;
  gap: 14px;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page.active {
  display: flex;
  animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
/* ──────────────────────────────────── SECTION HEADER ── */
.section-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 2px;
}

.section-eyebrow {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  opacity: 0.75;
}

.section-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  margin-top: 4px;
}

.section-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ──────────────────────────────────── CONTEXT BANNERS ── */
.ctx-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid transparent;
}

.ctx-banner i {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 2px;
}

.ctx-banner strong {
  font-weight: 600;
}

.ctx-blue {
  background: #EFF6FF;
  border-color: rgba(37, 99, 235, 0.18);
  color: #1E40AF;
}

.ctx-blue i {
  color: #2563EB;
}

.ctx-purple {
  background: var(--brand-light);
  border-color: rgba(99, 102, 241, 0.20);
  color: var(--brand-text);
}

.ctx-purple i {
  color: var(--brand);
}

.ctx-green {
  background: #ECFDF5;
  border-color: rgba(5, 150, 105, 0.18);
  color: #065F46;
}

.ctx-green i {
  color: #059669;
}

/* ──────────────────────────────────── KPI ROW ── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px 14px;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s;
  box-shadow: var(--shadow-sm);
}

.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  opacity: 0.05;
  transform: translate(20px, -20px);
}

.kpi-card.kc-green::before {
  background: var(--green);
}

.kpi-card.kc-blue::before {
  background: var(--blue);
}

.kpi-card.kc-amber::before {
  background: var(--amber);
}

.kpi-card.kc-red::before {
  background: var(--red);
}

.kpi-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.kpi-card.kc-green::after {
  background: linear-gradient(90deg, var(--green), #34D399);
}

.kpi-card.kc-blue::after {
  background: linear-gradient(90deg, var(--blue), #60A5FA);
}

.kpi-card.kc-amber::after {
  background: linear-gradient(90deg, var(--amber), #FCD34D);
}

.kpi-card.kc-red::after {
  background: linear-gradient(90deg, var(--red), #F87171);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.kpi-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.kpi-icon.ig {
  background: var(--green-light);
  color: var(--green);
}

.kpi-icon.ib {
  background: var(--blue-light);
  color: var(--blue);
}

.kpi-icon.ia {
  background: var(--amber-light);
  color: var(--amber);
}

.kpi-icon.ir {
  background: var(--red-light);
  color: var(--red);
}

.kpi-badge-sm {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
}

.badge-g {
  background: var(--green-light);
  color: var(--green-text);
}

.badge-b {
  background: var(--blue-light);
  color: var(--blue-text);
}

.badge-a {
  background: var(--amber-light);
  color: var(--amber-text);
}

.badge-r {
  background: var(--red-light);
  color: var(--red-dark);
}

.kpi-val {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.6px;
  line-height: 1;
}

.kpi-val span {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
}

.kpi-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 5px;
  font-weight: 500;
}

/* ──────────────────────────────────── GRID LAYOUTS ── */
.grid-3-2 {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 14px;
  align-items: stretch;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: stretch;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  align-items: stretch;
}

/* ──────────────────────────────────── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.22s, transform 0.22s;
  display: flex;
  flex-direction: column;
}

.card:hover {
  box-shadow: 0 12px 24px rgba(99, 102, 241, 0.12);
  transform: translateY(-3px);
  border-color: rgba(99, 102, 241, 0.25);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.card-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ──────────────────────────────────── TAB GROUP ── */
.tab-group {
  display: flex;
  gap: 4px;
}

.tg-btn {
  font-size: 11px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-mid);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s;
}

.tg-btn.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.30);
}

/* ──────────────────────────────────── CLUSTER PILLS ── */
.cluster-pills {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  justify-content: space-around;
}

.cpill {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cp-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cp-label {
  font-size: 13px;
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
  font-weight: 500;
}

.cp-bar-wrap {
  flex: 1.5;
  height: 7px;
  background: var(--surface2);
  border-radius: 6px;
  overflow: hidden;
}

.cp-bar {
  height: 100%;
  border-radius: 6px;
  transition: width 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

.cp-pct {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 30px;
  text-align: right;
  font-family: 'DM Mono', monospace;
}

/* ──────────────────────────────────── CO2 MINI CARDS ── */
.co2-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
}

.co2-mini {
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  text-align: center;
  border: 1px solid transparent;
  transition: transform 0.18s;
}

.co2-mini:hover {
  transform: scale(1.03);
}

.co2-mini .cm-label {
  font-size: 10px;
  font-weight: 700;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.co2-mini .cm-val {
  font-size: 16px;
  font-weight: 700;
}

.co2-mini .cm-unit {
  font-size: 10px;
  margin-top: 2px;
  opacity: 0.75;
}

/* ──────────────────────────────────── REC CARDS ── */
.rec-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.rec-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  background: var(--surface);
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.rec-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-mid);
}

.border-prio-critical { border-left: 4px solid var(--red); }
.border-prio-high { border-left: 4px solid var(--amber); }
.border-prio-medium { border-left: 4px solid var(--green); }

.rc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.rc-cluster {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 20px;
}

.rc-prio {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 20px;
}

.prio-critical {
  background: var(--red-light);
  color: var(--red-dark);
}

.prio-high {
  background: var(--amber-light);
  color: var(--amber-text);
}

.prio-medium {
  background: var(--green-light);
  color: var(--green-text);
}

.rc-rule {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.rc-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.rc-gap {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.rc-gap-val {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 600;
}

/* ──────────────────────────────────── RULE BARS ── */
.rule-bar-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.rb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background 0.2s, transform 0.2s;
  margin-left: -8px;
  margin-right: -8px;
}

.rb-item:hover {
  background: var(--surface2);
  transform: translateX(3px);
}

.rb-label {
  font-size: 13px;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  font-weight: 600;
}

.rb-track {
  flex: 1.5;
  height: 7px;
  background: var(--surface2);
  border-radius: 6px;
  overflow: hidden;
}

.rb-fill {
  height: 100%;
  border-radius: 6px;
}

.rb-count {
  font-size: 11px;
  font-weight: 700;
  font-family: 'DM Mono', monospace;
  color: var(--text-primary);
  min-width: 30px;
  text-align: right;
}

/* ──────────────────────────────────── SEGMENT CARDS ── */
.seg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.seg-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  background: var(--surface);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.22s;
}

.seg-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 16px 32px rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.3);
}

.seg-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.seg-card.s0::before {
  background: linear-gradient(90deg, var(--green), #34D399);
}

.seg-card.s1::before {
  background: linear-gradient(90deg, var(--blue), #60A5FA);
}

.seg-card.s2::before {
  background: linear-gradient(90deg, var(--red), #F87171);
}

.seg-card.s0 {
  background: linear-gradient(170deg, #FFFFFF 0%, #F0FDF9 100%);
}

.seg-card.s1 {
  background: linear-gradient(170deg, #FFFFFF 0%, #EFF6FF 100%);
}

.seg-card.s2 {
  background: linear-gradient(170deg, #FFFFFF 0%, #FFF1F2 100%);
}

.seg-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 11px;
  border-radius: 20px;
  margin-bottom: 11px;
}

.seg-kval {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.6px;
  color: var(--text-primary);
}

.seg-kval span {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
}

.seg-tag {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
  font-weight: 500;
}

.seg-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.seg-chip {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 20px;
  background: rgba(99, 102, 241, 0.07);
  color: var(--brand-text);
  font-weight: 500;
  border: 1px solid rgba(99, 102, 241, 0.12);
}

.seg-bar-wrap {
  height: 6px;
  background: var(--surface2);
  border-radius: 6px;
  overflow: hidden;
  margin: 12px 0 6px;
}

.seg-bar {
  height: 100%;
  border-radius: 6px;
}

.seg-pct {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ──────────────────────────────────── DETAIL TABS ── */
.detail-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-mid);
  flex-wrap: wrap;
}

.dtab {
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-mid);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.18s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dtab-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dtab.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  box-shadow: 0 3px 10px rgba(99, 102, 241, 0.30);
  font-weight: 600;
}

/* separator between cluster tabs and radar tab */
.dtab-sep {
  flex: 1;
}

.dtab-radar {
  background: var(--surface2);
  border-color: var(--border-mid);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 5px 12px;
}

.dtab-radar i {
  font-size: 13px;
}

.dtab-radar:hover {
  background: var(--brand-light);
  color: var(--brand);
  border-color: rgba(99, 102, 241, 0.35);
}

.dtab-radar.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  box-shadow: 0 3px 10px rgba(99, 102, 241, 0.30);
}

/* ──────────────────────────────────── RADAR CHART ── */
.radar-wrap {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 240px;
}

/* ──────────────────────────────────── FOOTER ── */
.dash-footer {
  padding: 14px 28px;
  border-top: 1px solid var(--border-mid);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.80);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
  font-weight: 500;
}

.footer-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.ftag {
  background: var(--brand-light);
  color: var(--brand-text);
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
}

/* ══════════════════════════════════════════════════════
   MODAL
══════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 14, 46, 0.55);
  backdrop-filter: blur(6px);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  box-shadow: 0 32px 80px rgba(15, 14, 46, 0.35), 0 8px 24px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  animation: modalSlideUp 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border-mid);
  background: linear-gradient(135deg, var(--brand-light), rgba(168, 85, 247, 0.06));
}

.modal-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--brand), #A855F7);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

.modal-close {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-mid);
  background: var(--surface);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.18s;
  flex-shrink: 0;
}

.modal-close:hover {
  background: var(--red-light);
  color: var(--red);
  border-color: rgba(220, 38, 38, 0.25);
}

.modal-body {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 60vh;
  overflow-y: auto;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.65;
}

.modal-section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand-text);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 8px;
}

.modal-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mig-item {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.mig-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 3px;
}

.mig-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-tech-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.modal-tech-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--brand-light);
  color: var(--brand-text);
  border: 1px solid rgba(99, 102, 241, 0.18);
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

.modal-btn-primary {
  background: linear-gradient(135deg, var(--brand), #A855F7);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 28px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.modal-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.45);
}

/* ──────────────────────────────────── MISC ── */
canvas {
  display: block;
}

/* ──────────────────────────────────── SCROLLBAR ── */
.main::-webkit-scrollbar {
  width: 6px;
}

.main::-webkit-scrollbar-track {
  background: transparent;
}

.main::-webkit-scrollbar-thumb {
  background: var(--border-mid);
  border-radius: 4px;
}

.main::-webkit-scrollbar-thumb:hover {
  background: var(--brand-light);
}

.modal-body::-webkit-scrollbar {
  width: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: var(--border-mid);
  border-radius: 4px;
}

/* ──────────────────────────────────── ANIMATIONS ── */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.page.active {
  animation: fadeSlideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.kpi-card {
  animation: fadeSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.kpi-card:nth-child(1) {
  animation-delay: 0.05s;
}

.kpi-card:nth-child(2) {
  animation-delay: 0.10s;
}

.kpi-card:nth-child(3) {
  animation-delay: 0.15s;
}

.kpi-card:nth-child(4) {
  animation-delay: 0.20s;
}

/* ──────────────────────────────────── RESPONSIVE ── */
@media (max-width: 1024px) {
  .grid-3-2 {
    grid-template-columns: 1fr;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .seg-grid {
    grid-template-columns: 1fr 1fr;
  }

  .rec-grid {
    grid-template-columns: 1fr;
  }

  .kpi-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .landing-steps {
    flex-direction: column;
    align-items: stretch;
  }

  .lstep-arrow {
    display: none;
  }

  .lstep {
    max-width: 100%;
  }

  .landing-stats {
    padding: 16px;
    gap: 8px;
  }

  .lstat {
    padding: 0 16px;
  }

  .modal-info-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 10px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .topbar-brand h1 {
    font-size: 14px;
  }

  .nav-tabs {
    gap: 1px;
  }

  .nav-tab {
    padding: 4px 10px;
    font-size: 11px;
  }

  .tb-chip {
    display: none;
  }

  .demo-badge-top {
    display: none;
  }

  .content {
    padding: 14px 16px;
  }

  .kpi-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .kpi-val {
    font-size: 22px;
  }

  .seg-grid {
    grid-template-columns: 1fr;
  }

  .rec-grid {
    grid-template-columns: 1fr;
  }

  .grid-3-2,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .co2-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .card {
    padding: 14px;
  }

  .dash-footer {
    padding: 10px 16px;
  }

  .footer-tags {
    display: none;
  }

  .ctx-banner {
    font-size: 12px;
  }

  .grid-dash {
    grid-template-columns: 1fr;
  }

  .dash-sidebar {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .problems-grid {
    grid-template-columns: 1fr;
  }

  .grid-seg-bottom {
    grid-template-columns: 1fr;
  }

  .seg-right-col {
    flex-direction: column;
  }

  .time-stat-grid {
    grid-template-columns: 1fr;
  }

  .tsitem-ratio {
    grid-column: 1;
  }

  .priority-strip {
    flex-direction: column;
    gap: 8px;
  }

  .ps-div {
    display: none;
  }

  .dash-toprow {
    flex-direction: column;
    gap: 10px;
  }

  .ctx-inline {
    max-width: 100%;
  }
}


/* ══════════════════════════════════════════════════════
   COMPOSITION — NEW LAYOUT COMPONENTS
══════════════════════════════════════════════════════ */

/* ── Shared: top-row (header + inline banner) ── */
.dash-toprow {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.ctx-inline {
  max-width: 420px;
  font-size: 12px;
  padding: 10px 14px;
  flex-shrink: 0;
  align-self: flex-start;
}

/* ══ DASHBOARD ══ */

/* Chart (2fr) + Sidebar (1fr) */
.grid-dash {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
  align-items: stretch;
}

.dash-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Stat strip below bar chart */
.chart-stat-strip {
  display: flex;
  align-items: stretch;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  gap: 0;
}

.css-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 0 12px;
}

.css-item.css-ratio {
  background: var(--red-light);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  border: 1px solid rgba(220, 38, 38, 0.12);
  flex: 0 0 auto;
}

.css-divider {
  width: 1px;
  background: var(--border-mid);
  margin: 4px 0;
  flex-shrink: 0;
}

.css-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.css-cluster {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  text-align: center;
}

.css-val {
  font-size: 17px;
  font-weight: 700;
  font-family: 'DM Mono', monospace;
  letter-spacing: -0.5px;
  line-height: 1;
}

.css-co2 {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
}

/* Emission alert card in sidebar */
.emission-alert {
  background: linear-gradient(135deg, #FEF2F2, #FFF1F2);
  border: 1px solid rgba(220, 38, 38, 0.18);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ea-header {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--red-text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ea-header i {
  font-size: 14px;
  color: var(--red);
}

.ea-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ea-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.ea-val {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  font-weight: 700;
}

.ea-val.red {
  color: var(--red);
}

.ea-val.amber {
  color: var(--amber);
}

.ea-note {
  font-size: 11px;
  color: #B91C1C;
  padding: 8px 10px;
  background: rgba(220, 38, 38, 0.08);
  border-radius: var(--radius-xs);
  line-height: 1.45;
}

/* Problems Layout */
.problems-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.problems-bars-col {
  display: flex;
  flex-direction: column;
}

.problems-insight-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.pi-card {
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: none;
  transition: transform 0.25s, box-shadow 0.25s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

.pi-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.pi-red {
  background: linear-gradient(135deg, #FFE2E5 0%, #FFC1C8 100%);
  color: #B91C1C;
}

.pi-amber {
  background: linear-gradient(135deg, #FEF3C7 0%, #FDE047 100%);
  color: #B45309;
}

.pi-blue {
  background: linear-gradient(135deg, #E0E7FF 0%, #C7D2FE 100%);
  color: #4338CA;
}

.pi-icon {
  font-size: 18px;
  margin-bottom: 2px;
}

.pi-num {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'DM Mono', monospace;
  letter-spacing: -1px;
  line-height: 1;
}

.pi-label {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.pi-action {
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-text);
  margin-top: 4px;
}

/* ══ SEGMENTASI ══ */

/* Cluster card top row (badge + status) */
.seg-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.seg-status {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  letter-spacing: 0.04em;
}

.seg-status-ideal {
  background: #ECFDF5;
  color: #065F46;
  border: 1px solid rgba(5, 150, 105, 0.20);
}

.seg-status-warn {
  background: var(--amber-light);
  color: var(--amber-text);
  border: 1px solid rgba(217, 119, 6, 0.20);
}

.seg-status-crit {
  background: var(--red-light);
  color: var(--red-text);
  border: 1px solid rgba(220, 38, 38, 0.20);
}

/* Energy scale */
.seg-energy-scale {
  margin: 12px 0 10px;
}

.ses-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.ses-track {
  height: 8px;
  background: var(--surface2);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 4px;
}

.ses-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.ses-pct {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
  font-weight: 500;
}

/* Metrics mini grid */
.seg-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-bottom: 12px;
}

.sm-item {
  background: rgba(99, 102, 241, 0.04);
  border-radius: var(--radius-xs);
  padding: 7px 8px;
  text-align: center;
  border: 1px solid var(--border);
}

.sm-key {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 3px;
}

.sm-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'DM Mono', monospace;
}

/* Bottom grid: detail (wider) + right col */
.grid-seg-bottom {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 18px;
  align-items: start;
}

/* Right column: pie + interpretations stacked */
.seg-right-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Interpretation stack */
.seg-interp-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.seg-interp {
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  border: 1px solid transparent;
  transition: transform 0.18s;
}

.seg-interp:hover {
  transform: translateX(3px);
}

.s0-interp {
  background: #ECFDF5;
  border-color: rgba(5, 150, 105, 0.18);
}

.s1-interp {
  background: #EFF6FF;
  border-color: rgba(37, 99, 235, 0.18);
}

.s2-interp {
  background: #FEF2F2;
  border-color: rgba(220, 38, 38, 0.18);
}

.si-header {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.si-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.si-body {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ══ REKOMENDASI ══ */

/* Priority summary strip */
.priority-strip {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  padding: 16px 24px;
  gap: 0;
  box-shadow: var(--shadow-sm);
}

.ps-item {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.ps-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.ps-critical .ps-icon {
  background: var(--red-light);
  color: var(--red);
}

.ps-high .ps-icon {
  background: var(--amber-light);
  color: var(--amber);
}

.ps-medium .ps-icon {
  background: var(--green-light);
  color: var(--green);
}

.ps-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ps-count {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'DM Mono', monospace;
  letter-spacing: -0.5px;
  line-height: 1;
}

.ps-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.ps-critical .ps-label {
  color: var(--red-text);
}

.ps-high .ps-label {
  color: var(--amber-text);
}

.ps-medium .ps-label {
  color: var(--green-text);
}

.ps-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
  text-align: right;
}

.ps-div {
  width: 1px;
  height: 44px;
  background: var(--border-mid);
  margin: 0 20px;
  flex-shrink: 0;
}

.ps-total {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 20px;
  background: var(--brand-light);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(99, 102, 241, 0.18);
}

.ps-total .ps-count {
  font-size: 28px;
  color: var(--brand);
}

.ps-total .ps-label {
  color: var(--brand-text);
  font-size: 10px;
  text-align: center;
}

/* ── Dashboard sidebar: cluster record counts ── */
.cluster-record-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.cr-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: background 0.15s;
}

.cr-item:hover {
  background: var(--surface3, var(--border));
}

.cr-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cr-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cr-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.cr-desc {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 1px;
}

.cr-count {
  font-size: 16px;
  font-weight: 700;
  font-family: 'DM Mono', monospace;
  letter-spacing: -0.5px;
  white-space: nowrap;
}

.cr-count span {
  font-size: 9px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 2px;
  font-family: 'DM Sans', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cr-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 0;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}

.cr-total-val {
  font-family: 'DM Mono', monospace;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
}

/* Inline proportion bars under each cr-item */
.cr-bar-track {
  height: 4px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
  margin: -6px 0 8px;
}

.cr-bar-fill {
  height: 100%;
  border-radius: 4px;
  opacity: 0.65;
  transition: width 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Time heatmap bars ── */
.time-heatmap {
  margin-bottom: 14px;
}

.thm-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.thm-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 48px;
}

.thm-bar {
  flex: 1;
  border-radius: 3px 3px 0 0;
  transition: opacity 0.2s;
  cursor: default;
  position: relative;
}

.thm-bar:hover {
  opacity: 0.8;
}

.thm-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 9px;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
  font-weight: 500;
}

/* ── Time stat grid ── */
.time-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tsitem {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  border: 1px solid var(--border);
}

.tsitem-ratio {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--red-light);
  border-color: rgba(220, 38, 38, 0.15);
}

.tsitem-ratio .tsitem-label,
.tsitem-ratio .tsitem-sub {
  color: var(--red-text);
}

.tsitem-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.tsitem-ratio .tsitem-label {
  margin-bottom: 0;
}

.tsitem-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'DM Mono', monospace;
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.tsitem-ratio .tsitem-val {
  font-size: 18px;
  letter-spacing: -0.5px;
}

.tsitem-sub {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── PREDICT LIVE BUTTON & MODAL FORM ── */
.live-predict-btn {
  background: var(--brand);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.live-predict-btn:hover {
  background: #4F46E5;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.predict-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.predict-form label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.predict-form input, .predict-form select {
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-mid);
  background: var(--surface);
  color: var(--text-primary);
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.predict-form input:focus, .predict-form select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}