/* =====================================================================
   LEAP 2036 — Papan Data & Interpretasi (dashboard stylesheet)

   Split out of dashboard.html on 2026-08-07 when the dashboard grew from
   a live-monitor into a full interpretation report.

   Cache note: every filename here contains "dashboard", and sw.js skips
   any path matching /dashboard/ — so none of this is ever served from the
   service-worker cache. vercel.json also sends no-store for these files.

   Contrast: all body/muted text pairs were checked against the panel
   backgrounds for WCAG AA (>= 4.5:1 for body text, >= 3:1 for large text
   and non-text indicators).
   ===================================================================== */

:root {
  --bg: #0b0f19;
  --panel: rgba(18, 24, 40, 0.92);
  --panel2: #161f36;
  --panel3: #1b2643;
  --panel-hover: #1e2a47;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.22);
  --line-accent: rgba(129, 140, 248, 0.45);
  --ink: #f1f5f9;
  /* #a8b6cc on #161f36 = 7.9:1 — comfortably AA for body text. */
  --muted: #a8b6cc;
  --muted-soft: #8b9ab3;
  --accent: #6366f1;
  --accent-bright: #a5b4fc;
  --accent2: #34d399;
  --energi: #ff8a5c;
  --uang: #ffc233;
  --mental: #34d399;
  --warn: #fbbf24;
  --danger: #fca5a5;
  --radius: 16px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  --font: ui-rounded, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--ink);
  font-family: var(--font); line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(800px 500px at 85% -10%, rgba(99, 102, 241, 0.15), transparent 60%),
    radial-gradient(800px 600px at 10% 110%, rgba(16, 185, 129, 0.12), transparent 60%),
    linear-gradient(180deg, #0b0f19 0%, #080b12 100%);
  background-attachment: fixed;
  min-height: 100vh;
  padding: 24px 16px 80px;
}

.wrap { max-width: 1180px; margin: 0 auto; }

/* --- Skip link ----------------------------------------------------- */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #fff; padding: 12px 20px;
  border-radius: 0 0 10px 0; font-weight: 800; z-index: 999;
}
.skip-link:focus { left: 0; }

/* --- Focus visibility (keyboard users) ------------------------------ */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, summary:focus-visible, th:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--accent-bright);
  outline-offset: 2px;
  border-radius: 6px;
}

/* --- Header --------------------------------------------------------- */
.dash-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: 16px; margin-bottom: 24px; padding-bottom: 20px;
  border-bottom: 1.5px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand-logo {
  background: linear-gradient(135deg, var(--accent), #933cf8);
  color: #fff; font-weight: 900; font-size: 14px; letter-spacing: 0.18em;
  padding: 8px 16px; border-radius: 999px; box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
  white-space: nowrap;
}
.title { font-size: 25px; font-weight: 900; margin: 0; letter-spacing: -0.02em; line-height: 1.25; }
.sub { color: var(--muted); font-size: 13.5px; margin: 3px 0 0; }

/* --- Cards ---------------------------------------------------------- */
.card {
  background: var(--panel);
  backdrop-filter: blur(16px);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 24px; margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

.card-title {
  font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); font-weight: 800; margin: 0 0 16px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}

/* Section headings inside the report */
.sec-h {
  font-size: 20px; font-weight: 900; margin: 0 0 6px;
  letter-spacing: -0.01em; line-height: 1.3;
}
.sec-lead {
  color: var(--muted); font-size: 14.5px; margin: 0 0 20px; max-width: 78ch;
}
.sub-h {
  font-size: 15px; font-weight: 800; margin: 26px 0 10px;
  color: var(--accent-bright); letter-spacing: 0.01em;
}
.sub-h:first-of-type { margin-top: 0; }

.prose { max-width: 78ch; }
.prose p { margin: 0 0 14px; font-size: 14.5px; color: #dbe3ef; }
.prose p:last-child { margin-bottom: 0; }
.prose strong { color: #fff; font-weight: 800; }
.prose ul, .prose ol { margin: 0 0 14px; padding-left: 22px; }
.prose li { margin-bottom: 8px; font-size: 14.5px; color: #dbe3ef; }
.prose em { color: var(--accent-bright); font-style: italic; }

/* --- Pills & badges ------------------------------------------------- */
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 14px; font-size: 12px;
  color: var(--muted); font-weight: 700;
}
.pill.live { border-color: rgba(52, 211, 153, 0.45); color: #6ee7b7; background: rgba(16, 185, 129, 0.12); }
.pill.warn { border-color: rgba(251, 191, 36, 0.45); color: var(--warn); background: rgba(251, 191, 36, 0.1); }
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #34d399;
  box-shadow: 0 0 8px #34d399; animation: pulse 2s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.85); } }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* --- Form controls -------------------------------------------------- */
input[type=text], input[type=password], select {
  background: var(--panel2); border: 1.5px solid var(--line-strong); color: var(--ink);
  border-radius: 10px; padding: 10px 14px; font-family: inherit; font-size: 14px;
  transition: border-color 0.15s ease;
}
input::placeholder { color: var(--muted-soft); }
input:focus, select:focus { outline: none; border-color: var(--accent-bright); }

button {
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  color: #fff; border: 0; border-radius: 10px;
  padding: 10px 18px; font-weight: 800; font-family: inherit; font-size: 13px;
  cursor: pointer; transition: filter 0.15s ease, transform 0.15s ease;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}
button:hover { filter: brightness(1.1); transform: translateY(-1px); }
button:active { transform: translateY(0); }
button[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }
button.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line-strong); box-shadow: none; }
button.ghost:hover { background: rgba(255, 255, 255, 0.06); }
button.link {
  background: none; box-shadow: none; color: var(--accent-bright);
  text-decoration: underline; padding: 4px 2px; font-size: 13.5px;
}
button.link:hover { transform: none; color: #c7d2fe; }

/* --- Metric tiles --------------------------------------------------- */
.metrics-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.tile {
  background: var(--panel2); border: 1.5px solid var(--line);
  border-radius: 14px; padding: 16px 18px; text-align: center;
}
.tile-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; }
.tile-val { font-size: 28px; font-weight: 900; margin-top: 4px; font-family: var(--mono); color: #fff; line-height: 1.2; }
.tile-sub { font-size: 12px; color: var(--accent-bright); font-weight: 700; margin-top: 2px; }

/* --- Scope banner (shown when a filter narrows every figure) --------- */
.scope-banner {
  background: rgba(251, 191, 36, 0.12);
  border: 1.5px solid rgba(251, 191, 36, 0.4);
  border-radius: 12px; padding: 12px 16px; margin-bottom: 18px;
  font-size: 13.5px; color: #fde68a; font-weight: 700;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}

/* --- Data tables ---------------------------------------------------- */
.tbl-wrap {
  overflow-x: auto; border: 1.5px solid var(--line); border-radius: 12px;
  -webkit-overflow-scrolling: touch;
}
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
table.wide { min-width: 900px; }
caption {
  text-align: left; padding: 12px 14px; font-size: 12.5px;
  color: var(--muted); font-weight: 700; background: var(--panel3);
  border-bottom: 1.5px solid var(--line);
}
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); }
thead th {
  background: #1a2440; color: #cbd5e1;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em;
  font-weight: 800; vertical-align: bottom;
}
tbody th {
  font-weight: 800; color: var(--ink); font-size: 13.5px;
  background: rgba(255, 255, 255, 0.02);
}
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
tbody tr:hover td, tbody tr:hover th { background: rgba(99, 102, 241, 0.08); }
td.num, th.num { text-align: right; font-family: var(--mono); font-weight: 700; white-space: nowrap; }
tfoot td, tfoot th {
  background: var(--panel3); font-weight: 800; border-top: 1.5px solid var(--line-strong);
}
.t-hint { font-weight: 600; color: var(--muted); font-size: 12px; display: block; margin-top: 2px; }

/* Sortable headers in the raw-data table only */
table.sortable thead th { cursor: pointer; user-select: none; }
table.sortable thead th:hover { color: #fff; }
table.sortable thead th .arr { color: var(--accent-bright); margin-left: 4px; }

/* Sticky header for the long raw table */
table.sticky-head thead th { position: sticky; top: 0; z-index: 2; }

/* --- Distribution bars (rendered inside real table cells) ----------- */
.bar-cell { min-width: 190px; width: 42%; }
.bar-track {
  background: var(--panel3); border-radius: 999px; height: 20px;
  overflow: hidden; border: 1px solid var(--line); position: relative;
}
.bar-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  min-width: 3px;
}
/* Zero-count rows get a visible "empty" marker, not just an invisible bar. */
.bar-fill.zero { background: repeating-linear-gradient(45deg, #3f4a68, #3f4a68 5px, #2a3450 5px, #2a3450 10px); }

.bar-fill[data-p="Pelari Tanpa Rem"]     { background: linear-gradient(90deg, #ff8a5c, #ff6b8a); }
.bar-fill[data-p="Sukses-tapi-Tumbang"]  { background: linear-gradient(90deg, #fbbf24, #f87171); }
.bar-fill[data-p="Bijak yang Tenang"]    { background: linear-gradient(90deg, #34d399, #22d3ee); }
.bar-fill[data-p="Mekar Belakangan"]     { background: linear-gradient(90deg, #a78bfa, #f472b6); }
.bar-fill[data-p="Pemberontak Kreatif"]  { background: linear-gradient(90deg, #60a5fa, #a78bfa); }
.bar-fill[data-p="Pembangun Seimbang"]   { background: linear-gradient(90deg, #34d399, #a3e635); }
.bar-fill[data-p="Penjelajah Reflektif"] { background: linear-gradient(90deg, #38bdf8, #818cf8); }

.badge-profil {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 800; background: rgba(129, 140, 248, 0.18);
  border: 1px solid rgba(129, 140, 248, 0.4); color: #c7d2fe; white-space: nowrap;
}

/* Directional deltas */
.delta-up   { color: #6ee7b7; font-weight: 800; }
.delta-down { color: var(--danger); font-weight: 800; }
.delta-flat { color: var(--muted); font-weight: 800; }

/* --- Profile explainer cards ---------------------------------------- */
.profile-grid { display: grid; gap: 16px; }
.profile-card {
  background: var(--panel2); border: 1.5px solid var(--line);
  border-radius: 14px; padding: 20px; border-left: 5px solid var(--accent);
}
.profile-card.is-zero { border-left-color: var(--warn); background: rgba(251, 191, 36, 0.06); }
.profile-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; flex-wrap: wrap; margin-bottom: 4px;
}
.profile-name { font-size: 17px; font-weight: 900; margin: 0; }
.profile-en { font-size: 12.5px; color: var(--muted); font-weight: 600; font-style: italic; }
.profile-count {
  font-family: var(--mono); font-size: 15px; font-weight: 900;
  color: var(--accent-bright); white-space: nowrap; text-align: right;
}
.profile-count small { display: block; font-size: 11px; color: var(--muted); font-family: var(--font); font-weight: 700; }
.rule-box {
  background: rgba(0, 0, 0, 0.28); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 14px; margin: 12px 0;
  font-family: var(--mono); font-size: 12.5px; color: #c7d2fe; line-height: 1.7;
  overflow-x: auto;
}
.field { margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--muted); font-weight: 800; margin-bottom: 3px;
}
.field-body { font-size: 14px; color: #dbe3ef; }
.field.healthy { background: rgba(52, 211, 153, 0.08); border-left: 3px solid var(--accent2); padding: 10px 14px; border-radius: 0 8px 8px 0; }
.field.healthy .field-label { color: #6ee7b7; }

/* --- Per-session blocks --------------------------------------------- */
.session-card {
  background: var(--panel2); border: 1.5px solid var(--line);
  border-radius: 14px; padding: 20px; margin-bottom: 16px;
}
.session-card.empty { opacity: 0.6; }
.session-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; flex-wrap: wrap; margin-bottom: 4px;
  border-bottom: 1px solid var(--line); padding-bottom: 12px;
}
.session-code {
  font-family: var(--mono); font-weight: 900; font-size: 13px;
  background: rgba(129, 140, 248, 0.18); border: 1px solid rgba(129, 140, 248, 0.4);
  color: #c7d2fe; padding: 3px 10px; border-radius: 8px;
}
.session-name { font-size: 16.5px; font-weight: 900; margin: 0; }
.session-meta { font-size: 12.5px; color: var(--muted); }
.mini-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px; margin: 16px 0;
}
.mini {
  background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; text-align: center;
}
.mini-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 800; }
.mini-val { font-size: 20px; font-weight: 900; font-family: var(--mono); margin-top: 2px; line-height: 1.2; }
.mini-sub { font-size: 11px; color: var(--muted); font-weight: 600; }

.takeaway {
  background: rgba(99, 102, 241, 0.1); border-left: 3px solid var(--accent-bright);
  padding: 12px 16px; border-radius: 0 8px 8px 0; margin-top: 14px;
  font-size: 14px; color: #dbe3ef;
}
.takeaway strong { color: #fff; }

/* --- Callouts ------------------------------------------------------- */
.callout {
  border-radius: 12px; padding: 16px 18px; margin: 16px 0;
  border: 1.5px solid var(--line); background: var(--panel2); font-size: 14px;
}
.callout p { margin: 0 0 10px; }
.callout p:last-child { margin-bottom: 0; }
.callout-title { font-weight: 900; font-size: 14.5px; margin-bottom: 8px; display: block; }
.callout.warn { background: rgba(251, 191, 36, 0.09); border-color: rgba(251, 191, 36, 0.4); }
.callout.warn .callout-title { color: var(--warn); }
.callout.danger { background: rgba(248, 113, 113, 0.09); border-color: rgba(248, 113, 113, 0.4); }
.callout.danger .callout-title { color: var(--danger); }
.callout.good { background: rgba(52, 211, 153, 0.09); border-color: rgba(52, 211, 153, 0.4); }
.callout.good .callout-title { color: #6ee7b7; }
.callout.info { background: rgba(99, 102, 241, 0.1); border-color: var(--line-accent); }
.callout.info .callout-title { color: var(--accent-bright); }

/* --- Details / disclosure ------------------------------------------- */
details.acc {
  border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--panel2); margin-bottom: 12px; overflow: hidden;
}
details.acc > summary {
  cursor: pointer; padding: 14px 18px; font-weight: 800; font-size: 14.5px;
  list-style: none; display: flex; align-items: center; gap: 10px;
}
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::before {
  content: '▸'; color: var(--accent-bright); font-size: 13px; transition: transform 0.15s ease;
}
details.acc[open] > summary::before { transform: rotate(90deg); }
details.acc > summary:hover { background: rgba(255, 255, 255, 0.04); }
details.acc .acc-body { padding: 0 18px 18px; border-top: 1px solid var(--line); padding-top: 14px; }

/* --- Attribution ---------------------------------------------------- */
.attrib {
  border-top: 1.5px solid var(--line); margin-top: 32px; padding-top: 24px;
  font-size: 13.5px; color: var(--muted); text-align: center;
}
.attrib strong { color: var(--ink); }
.attrib .name { font-size: 16px; font-weight: 900; color: #fff; display: block; margin-bottom: 4px; }

/* --- Gate ----------------------------------------------------------- */
.gate-box { max-width: 460px; margin: 40px auto 24px; text-align: center; padding: 32px 24px; }
.gate-icon { font-size: 40px; margin-bottom: 12px; }

.err { color: #fca5a5; font-size: 13.5px; margin-top: 10px; font-weight: 700; }
.hidden { display: none !important; }

/* Visually hidden but available to screen readers */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* --- Table of contents ---------------------------------------------- */
.toc { display: flex; flex-wrap: wrap; gap: 8px; }
.toc a {
  font-size: 12.5px; font-weight: 700; color: var(--accent-bright);
  background: var(--panel2); border: 1px solid var(--line);
  padding: 6px 13px; border-radius: 999px; text-decoration: none;
}
.toc a:hover { background: var(--panel-hover); color: #fff; border-color: var(--line-accent); }

/* --- Responsive ----------------------------------------------------- */
@media (max-width: 720px) {
  body { padding: 16px 12px 60px; }
  .card { padding: 18px 16px; }
  .title { font-size: 21px; }
  .sec-h { font-size: 18px; }
  .tile-val { font-size: 24px; }
  .profile-card, .session-card { padding: 16px 14px; }
  .metrics-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  th, td { padding: 9px 11px; }
  .bar-cell { min-width: 120px; }
  /* The raw table's sticky header fights small viewports — release it. */
  table.sticky-head thead th { position: static; }
}

@media print {
  body { background: #fff; color: #000; padding: 0; }
  .card { box-shadow: none; border-color: #ccc; background: #fff; }
  button, .toc, #gate { display: none !important; }
}
