/* Theme 17: Kaca Patri (Stained Glass) — Orbitlux 5-Page Dashboard
 * Cohesive with Login Page: static stained-glass mosaic frames, deep obsidian panels,
 * molten gold + sapphire + ruby accents, animated page/card entrances & glints.
 * NO topbar avatar, NO Chatbot FAB, collapsible sidebar, fit-to-size Pengaturan blocks.
 */

body.is-dashboard {
  overflow: hidden;
}

.kp-dash-root {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  gap: 14px;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  overflow: hidden;
  color: var(--kp-text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.48;
}

.kp-dash-root[hidden] {
  display: none;
}

/* Stained-Glass Framed Panel (compact 6px ruby-sapphire-gold mosaic + black lead) */
.kp-panel {
  position: relative;
  padding: 5px;
  border-radius: 13px;
  background:
    repeating-linear-gradient(90deg, rgba(6, 8, 16, 0.94) 0 2px, transparent 2px 20px),
    repeating-linear-gradient(0deg, rgba(6, 8, 16, 0.94) 0 2px, transparent 2px 20px),
    linear-gradient(
      132deg,
      #b91c3a 0%,
      #eab308 18%,
      #1d4ed8 36%,
      #991b1b 54%,
      #f59e0b 72%,
      #2563eb 88%,
      #e11d48 100%
    );
  border: 2px solid var(--kp-lead);
  box-shadow:
    0 14px 36px rgba(0, 0, 0, 0.62),
    0 0 22px rgba(242, 196, 94, 0.14);
  overflow: hidden;
}

/* Travelling glass surface shimmer on panels (static panel, moving light glint) */
.kp-panel::after {
  content: "";
  position: absolute;
  inset: -40%;
  background: linear-gradient(
    115deg,
    transparent 44%,
    rgba(255, 245, 198, 0.24) 50%,
    transparent 56%
  );
  transform: translateX(-75%);
  animation: panelGlint 10.5s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes panelGlint {
  0%, 70% {
    transform: translateX(-75%);
    opacity: 0;
  }
  80% {
    opacity: 0.9;
  }
  96%, 100% {
    transform: translateX(75%);
    opacity: 0;
  }
}

body.is-light-paused .kp-panel::after {
  animation-play-state: paused !important;
}

.kp-panel-inner {
  position: relative;
  z-index: 2;
  height: 100%;
  background:
    radial-gradient(ellipse 90% 42% at 50% 0%, rgba(37, 99, 235, 0.14), transparent 72%),
    rgba(8, 12, 26, 0.985);
  border: 1px solid var(--kp-border-gold);
  border-radius: 9px;
  padding: 13px 15px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ── SIDEBAR ──────────────────────────────────────────────────────────────── */
.kp-dash-backdrop {
  display: none;
}

.kp-dash-sidebar {
  width: 236px;
  flex-shrink: 0;
  z-index: 30;
  margin-left: 0;
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
  transition:
    margin-left 260ms var(--ease-out),
    transform 260ms var(--ease-out),
    opacity 200ms ease,
    visibility 0s linear 0s;
}

.kp-dash-sidebar .kp-panel-inner {
  padding: 14px 12px 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.kp-dash-root.is-sidebar-hidden {
  gap: 0;
}

.kp-dash-root.is-sidebar-hidden .kp-dash-sidebar {
  margin-left: -236px;
  transform: translateX(-18px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    margin-left 260ms var(--ease-out),
    transform 260ms var(--ease-out),
    opacity 180ms ease,
    visibility 0s linear 260ms;
}

.kp-dash-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 14px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(235, 186, 86, 0.24);
}

.kp-dash-brand-name {
  font-family: "Outfit", "Inter", sans-serif;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.1;
  background: linear-gradient(180deg, #fff4c6 0%, #f5c660 60%, #d6932a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.kp-dash-brand-sub {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--kp-text-muted);
  margin-top: 2px;
}

.kp-dash-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kp-dash-nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: rgba(18, 25, 48, 0.55);
  color: var(--kp-text-soft);
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms var(--ease-out), box-shadow 160ms ease;
}

.kp-dash-nav-btn:hover {
  background: rgba(34, 48, 86, 0.72);
  border-color: rgba(235, 186, 86, 0.4);
  color: var(--kp-gold-bright);
  transform: translateX(2px);
}

.kp-dash-nav-btn.is-active {
  background: linear-gradient(180deg, rgba(242, 196, 94, 0.94) 0%, rgba(196, 128, 30, 0.96) 100%);
  color: var(--kp-on-gold);
  border-color: #fde68a;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(242, 184, 75, 0.34);
}

.kp-dash-nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.kp-dash-sidebar-spacer {
  flex: 1;
  min-height: 14px;
}

.kp-dash-user-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  background: rgba(16, 23, 44, 0.88);
  border: 1px solid var(--kp-border-subtle);
  border-radius: 10px;
}

.kp-dash-avatar {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-family: "Outfit", "Inter", sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: var(--kp-on-gold);
  background: linear-gradient(135deg, #ffe69a, #d98c24);
  border: 1px solid #fff3c4;
}

.kp-dash-avatar-lg {
  width: 48px;
  height: 48px;
  font-size: 17px;
  border-radius: 12px;
}

.kp-dash-user-meta {
  min-width: 0;
  flex: 1;
}

.kp-dash-user-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--kp-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kp-dash-user-email {
  font-size: 11px;
  color: var(--kp-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kp-dash-icon-btn {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: rgba(25, 34, 64, 0.72);
  color: var(--kp-gold);
  border: 1px solid var(--kp-border-subtle);
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.kp-dash-icon-btn:hover {
  background: rgba(185, 28, 58, 0.45);
  border-color: var(--kp-ruby-glow);
  color: #ffffff;
}

/* ── MAIN AREA & TOPBAR (NO AVATAR IN TOPBAR!) ────────────────────────────── */
.kp-dash-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.kp-dash-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: kpPageEnter 300ms var(--ease-out) both;
}

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

.kp-dash-topbar .kp-panel-inner {
  padding: 11px 16px;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.kp-dash-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.kp-dash-menu-btn {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: rgba(19, 28, 54, 0.9);
  color: var(--kp-gold-bright);
  border: 1px solid var(--kp-border-gold);
  border-radius: 9px;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, transform 150ms var(--ease-out);
}

.kp-dash-menu-btn:hover {
  background: rgba(34, 48, 86, 0.95);
  border-color: var(--kp-gold-bright);
  transform: scale(1.03);
}

.kp-dash-menu-arrow {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 220ms var(--ease-out);
}

.kp-dash-root.is-sidebar-hidden .kp-dash-menu-arrow {
  transform: rotate(180deg);
}

.kp-dash-title {
  margin: 0;
  font-family: "Outfit", "Inter", sans-serif;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--kp-gold-bright);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-wrap: balance;
}

.kp-dash-subtitle {
  display: block;
  font-size: 12px;
  color: var(--kp-text-muted);
}

.kp-dash-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* Native Selects (explicit dark bg/color for Windows dark mode compliance) */
.kp-dash-select,
.kp-dash-input {
  height: 36px;
  padding: 0 11px;
  background-color: #121a32;
  color: #f8fafc;
  border: 1px solid rgba(235, 186, 86, 0.44);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.kp-dash-select option {
  background-color: #0e1428;
  color: #f8fafc;
}

.kp-dash-select:hover,
.kp-dash-input:hover {
  border-color: var(--kp-gold-bright);
}

.kp-dash-select:focus,
.kp-dash-input:focus {
  outline: none;
  border-color: var(--kp-gold-bright);
  box-shadow: 0 0 0 3px rgba(242, 196, 94, 0.22);
}

.kp-dash-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 2px;
}

/* Badges */
.kp-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.kp-badge-gold {
  background: rgba(242, 196, 94, 0.18);
  color: var(--kp-gold-bright);
  border: 1px solid rgba(242, 196, 94, 0.5);
}

.kp-badge-blue {
  background: rgba(37, 99, 235, 0.24);
  color: #93c5fd;
  border: 1px solid rgba(96, 165, 250, 0.45);
}

/* Buttons */
.kp-dash-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1.5px solid #fde68a;
  background: linear-gradient(180deg, #f8cf6a 0%, #d89226 100%);
  color: var(--kp-on-gold);
  font-family: "Outfit", "Inter", sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 150ms var(--ease-out), filter 150ms ease, box-shadow 150ms ease;
}

.kp-dash-btn:hover:not(:disabled) {
  filter: brightness(1.07);
  box-shadow: 0 4px 18px rgba(242, 184, 75, 0.38);
  transform: translateY(-1px);
}

.kp-dash-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.kp-dash-btn:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.kp-dash-btn-ghost {
  background: rgba(18, 26, 50, 0.88);
  color: var(--kp-gold-bright);
  border: 1px solid var(--kp-border-gold);
}

.kp-dash-btn-ghost:hover:not(:disabled) {
  background: rgba(30, 42, 78, 0.96);
  box-shadow: 0 0 16px rgba(242, 196, 94, 0.22);
}

/* ── KPI GRID (STAGGERED ENTRANCE) ────────────────────────────────────────── */
.kp-dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.kp-dash-kpi {
  animation: kpCardReveal 340ms var(--ease-out) both;
}

.kp-dash-kpi:nth-child(2) { animation-delay: 50ms; }
.kp-dash-kpi:nth-child(3) { animation-delay: 100ms; }
.kp-dash-kpi:nth-child(4) { animation-delay: 150ms; }

@keyframes kpCardReveal {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.kp-dash-kpi .kp-panel-inner {
  padding: 13px 15px;
  gap: 4px;
}

.kp-kpi-accent {
  width: 34px;
  height: 3px;
  border-radius: 999px;
  margin-bottom: 4px;
}

.kp-kpi-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--kp-text-soft);
}

.kp-kpi-val {
  font-family: "Outfit", "Inter", sans-serif;
  font-size: 21px;
  font-weight: 800;
  color: var(--kp-text);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.kp-kpi-delta {
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.kp-kpi-delta.is-up {
  color: #4ade80;
}

.kp-kpi-delta.is-down {
  color: #fb7185;
}

/* ── MAIN DASHBOARD 2-COLUMN GRID (MAP + TOP 5) ───────────────────────────── */
.kp-dash-grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 12px;
}

.kp-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.kp-panel-head h2 {
  margin: 0;
  font-family: "Outfit", "Inter", sans-serif;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--kp-gold-bright);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.kp-panel-head p {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--kp-text-muted);
}

/* Choropleth Map */
.kp-map-box {
  position: relative;
  flex: 1;
  min-height: 210px;
  border-radius: 9px;
  background: radial-gradient(ellipse 80% 70% at 50% 50%, rgba(22, 34, 68, 0.72), rgba(6, 9, 20, 0.94));
  border: 1px solid rgba(235, 186, 86, 0.22);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kp-map-tools {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 4;
  display: flex;
  gap: 5px;
}

.kp-map-btn {
  height: 28px;
  min-width: 28px;
  padding: 0 8px;
  background: rgba(9, 13, 27, 0.9);
  color: var(--kp-gold-bright);
  border: 1px solid var(--kp-border-gold);
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.kp-map-btn:hover {
  background: rgba(34, 48, 86, 0.96);
  border-color: #fff3c4;
}

.kp-map-svg {
  width: 100%;
  height: 100%;
  max-height: 270px;
  display: block;
}

.kp-prov {
  cursor: pointer;
  transition: fill-opacity 140ms ease, stroke-width 140ms ease, filter 140ms ease;
}

.kp-prov:hover {
  fill-opacity: 1;
  filter: drop-shadow(0 0 8px rgba(242, 196, 94, 0.72));
}

.kp-prov.is-selected {
  filter: drop-shadow(0 0 10px rgba(255, 230, 154, 0.85));
}

.kp-map-legend {
  position: absolute;
  left: 10px;
  bottom: 9px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 9px;
  border-radius: 7px;
  background: rgba(7, 10, 22, 0.86);
  border: 1px solid rgba(235, 186, 86, 0.25);
  font-size: 11px;
  color: var(--kp-text-soft);
}

.kp-legend-bar {
  width: 72px;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, #1b316e 0%, #2563eb 36%, #c81e4a 68%, #ffe69a 100%);
}

.kp-map-foot {
  margin-top: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--kp-text-soft);
}

.kp-map-foot strong {
  color: var(--kp-gold-bright);
}

/* Tooltips */
.kp-tooltip {
  position: absolute;
  z-index: 20;
  pointer-events: none;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(6, 9, 20, 0.96);
  border: 1px solid var(--kp-border-gold);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  font-size: 12px;
  color: var(--kp-text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.kp-tooltip[hidden] {
  display: none;
}

/* Top 5 Glowing Amber Bars */
.kp-top5 {
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex: 1;
  justify-content: center;
}

.kp-top5-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border-radius: 9px;
  background: rgba(16, 23, 44, 0.72);
  border: 1px solid rgba(235, 186, 86, 0.2);
  color: var(--kp-text);
  text-align: left;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, transform 150ms var(--ease-out);
}

.kp-top5-row:hover {
  background: rgba(28, 39, 72, 0.88);
  border-color: var(--kp-border-gold);
  transform: translateX(2px);
}

.kp-top5-row.is-selected {
  background: rgba(37, 99, 235, 0.22);
  border-color: var(--kp-gold-bright);
  box-shadow: 0 0 16px rgba(242, 196, 94, 0.22);
}

.kp-rank {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: rgba(242, 196, 94, 0.16);
  border: 1px solid rgba(242, 196, 94, 0.45);
  color: var(--kp-gold-bright);
  font-family: "Outfit", "Inter", sans-serif;
  font-size: 12px;
  font-weight: 800;
}

.kp-top5-mid {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.kp-top5-name {
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kp-top5-track {
  height: 7px;
  border-radius: 999px;
  background: rgba(30, 41, 72, 0.9);
  overflow: hidden;
}

.kp-top5-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #b8731b 0%, #f2c45e 70%, #fff4c6 100%);
  box-shadow: 0 0 10px rgba(242, 196, 94, 0.55);
}

.kp-top5-val {
  font-size: 12px;
  font-weight: 700;
  color: var(--kp-gold-bright);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Trend Chart */
.kp-legend-row {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--kp-text-soft);
}

.kp-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.kp-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.kp-trend-wrap {
  position: relative;
  width: 100%;
}

.kp-trend-svg {
  width: 100%;
  height: auto;
  max-height: 185px;
  display: block;
}

.kp-source {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--kp-text-muted);
}

/* ── PAGE 2: FORECASTING (HONEST 501) ─────────────────────────────────────── */
.kp-forecast-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 12px;
}

.kp-form-col {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.kp-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--kp-text-soft);
}

.kp-notice {
  padding: 13px 14px;
  border-radius: 9px;
  background: rgba(20, 30, 58, 0.85);
  border: 1px solid rgba(96, 165, 250, 0.35);
  font-size: 13px;
  line-height: 1.55;
  color: var(--kp-text-soft);
}

.kp-notice-warn {
  background: rgba(138, 22, 46, 0.32);
  border-color: rgba(251, 113, 133, 0.56);
  color: #ffe4e8;
}

.kp-empty-box {
  padding: 26px 16px;
  border-radius: 9px;
  border: 1px dashed rgba(235, 186, 86, 0.35);
  background: rgba(15, 22, 42, 0.55);
  text-align: center;
  color: var(--kp-text-muted);
  font-size: 13px;
}

.kp-forecast-result {
  margin-bottom: 12px;
}

/* ── PAGE 3: CHATBOT AI (HONEST FASE 3) ───────────────────────────────────── */
.kp-chat-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
}

.kp-chat-box {
  flex: 1;
  min-height: 0;
}

.kp-chat-box .kp-panel-inner {
  gap: 12px;
}

.kp-chat-msgs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}

.kp-chat-msg {
  max-width: 78%;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.55;
  animation: kpCardReveal 240ms var(--ease-out) both;
}

.kp-chat-msg.is-assistant {
  align-self: flex-start;
  background: rgba(22, 33, 66, 0.9);
  border: 1px solid rgba(235, 186, 86, 0.34);
  color: var(--kp-text);
}

.kp-chat-msg.is-user {
  align-self: flex-end;
  background: linear-gradient(180deg, rgba(242, 196, 94, 0.95), rgba(196, 128, 30, 0.95));
  color: var(--kp-on-gold);
  font-weight: 600;
}

.kp-chat-typing {
  align-self: flex-start;
  font-size: 12px;
  color: var(--kp-gold-bright);
  padding: 4px 8px;
}

.kp-chat-bar {
  display: flex;
  gap: 9px;
}

.kp-chat-bar .kp-dash-input {
  flex: 1;
  height: 38px;
}

/* ── PAGE 4: DATA EXPLORER (442 ROWS) ─────────────────────────────────────── */
.kp-data-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kp-filter-bar .kp-panel-inner {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 14px;
  padding: 12px 15px;
}

.kp-table-panel {
  flex: 1;
  min-height: 0;
}

.kp-table-panel .kp-panel-inner {
  padding: 0;
  overflow: hidden;
}

.kp-table-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.kp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.kp-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #0d152b;
  color: var(--kp-gold-bright);
  text-align: left;
  padding: 11px 14px;
  font-family: "Outfit", "Inter", sans-serif;
  font-size: 12px;
  font-weight: 700;
  border-bottom: 1.5px solid var(--kp-border-gold);
  white-space: nowrap;
}

.kp-table tbody tr {
  border-bottom: 1px solid rgba(235, 186, 86, 0.12);
  content-visibility: auto;
  contain-intrinsic-size: 38px;
  transition: background-color 120ms ease;
}

.kp-table tbody tr:hover {
  background: rgba(37, 99, 235, 0.16);
}

.kp-table td {
  padding: 9px 14px;
  white-space: nowrap;
}

.kp-table td.is-muted {
  color: var(--kp-text-muted);
}

.kp-table td.is-sky {
  color: #93c5fd;
  font-weight: 600;
}

.kp-table td.is-gold {
  color: var(--kp-gold-bright);
  font-weight: 700;
}

/* ── PAGE 5: PENGATURAN (FIT-TO-SIZE BALANCED GRID) ───────────────────────── */
.kp-settings-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.kp-profile-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.kp-profile-name {
  font-family: "Outfit", "Inter", sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--kp-text);
}

.kp-profile-email {
  font-size: 12.5px;
  color: var(--kp-text-muted);
}

.kp-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.kp-info-box {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(16, 23, 44, 0.78);
  border: 1px solid rgba(235, 186, 86, 0.22);
}

.kp-info-label {
  font-size: 11px;
  color: var(--kp-text-muted);
  margin-bottom: 2px;
}

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

.kp-err {
  margin: 0;
  font-size: 12.5px;
  color: #ff859d;
  font-weight: 600;
}

.kp-ok {
  margin: 0;
  font-size: 12.5px;
  color: #4ade80;
  font-weight: 600;
}

/* ── RESPONSIVE ───────────────────────────────────────────────────────────── */
@media (max-width: 1120px) {
  .kp-dash-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kp-dash-grid-2,
  .kp-forecast-grid,
  .kp-settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .kp-dash-root {
    padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
    gap: 0;
  }

  .kp-dash-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 28;
    background: rgba(4, 6, 14, 0.72);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
  }

  .kp-dash-root.is-nav-open .kp-dash-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .kp-dash-sidebar {
    position: fixed;
    top: 10px;
    bottom: 10px;
    left: 10px;
    width: min(260px, calc(100vw - 44px));
    margin-left: 0 !important;
    transform: translateX(-115%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  .kp-dash-root.is-nav-open .kp-dash-sidebar {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
}

@media (max-width: 560px) {
  .kp-dash-kpi-grid {
    grid-template-columns: 1fr;
  }

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

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .kp-panel::after,
  .kp-dash-page,
  .kp-dash-kpi,
  .kp-chat-msg {
    animation: none !important;
  }

  .kp-dash-sidebar,
  .kp-dash-nav-btn,
  .kp-dash-btn,
  .kp-top5-row,
  .kp-dash-menu-arrow {
    transition-duration: 0.01ms !important;
  }
}
