/* ============================================================
   SAPUJAGAD — Stylesheet v4.0
   Redesign: High-Readability Edition
   Optimized for clarity, strong contrast, and ease of reading
   Supports Dark Mode (default) and Light Mode
   Toggle via class .light-mode pada <html>
   ============================================================ */

/* ── GOOGLE FONTS IMPORT ──────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&family=Lora:ital,wght@0,400;0,600;1,400&display=swap');

/* ── DARK MODE (DEFAULT) ──────────────────────────────────── */
:root {
  /* ── Backgrounds — dark, layered ── */
  --bg-base:   #0e1117;
  --bg-card:   #161b26;
  --bg-raised: #1c2235;
  --bg-hover:  #222840;
  --bg-input:  #121620;

  /* ── Borders ── */
  --border-faint:  #252c42;
  --border-soft:   #2e3754;
  --border-medium: #3a4568;
  --border-strong: #4d5a80;

  /* ── Text — readable hierarchy ── */
  --text-primary:   #edf0f8;   /* main text — near-white, warm */
  --text-secondary: #b2bbd4;   /* secondary — good contrast */
  --text-muted:     #7a869e;   /* muted labels */
  --text-faint:     #4e5874;   /* very faint, decorative only */

  /* ── Accent palette ── */
  --gold:       #f0c040;       /* primary action, highlight */
  --gold-dim:   #c8960c;
  --gold-glow:  rgba(240,192,64,.16);
  --gold-text:  #f5d070;

  --teal:       #36d9bc;
  --teal-dim:   #1aa88e;
  --teal-glow:  rgba(54,217,188,.12);

  --sky:        #5fa8ff;
  --sky-glow:   rgba(95,168,255,.12);

  --coral:      #f06060;
  --coral-glow: rgba(240,96,96,.12);

  /* ── Backward-compat aliases (dipakai inline style di index.html) ── */
  --ghost: var(--text-muted);   /* alias → --text-muted */
  --line2: var(--border-soft);  /* alias → --border-soft */

  /* ── Typology color system ── */
  --M: #f07070;   /* Merah  — dominant */
  --K: #f0c040;   /* Kuning — present  */
  --P: #c8d0e8;   /* Putih  — neutral  */
  --A: #8090b8;   /* Abu    — below    */
  --H: #3a4568;   /* Hitam  — weak     */

  /* ── Fit score colors ── */
  --fit-hi2: #1ec860;   /* ≥80% very high */
  --fit-hi:  #38e07a;   /* ≥65% high */
  --fit-mid: #f5c430;   /* ≥50% medium */
  --fit-lo:  #e85050;   /* <50% low */

  /* ── Blue row (latar biru) ── */
  --lbiru-bg:     rgba(80,120,255,.07);
  --lbiru-border: rgba(80,120,255,.2);
  --lbiru-text:   #7eaaff;

  /* ── Shape ── */
  --radius:    14px;
  --radius-sm: 8px;
  --radius-xs: 5px;

  /* ── Shadows ── */
  --shadow-card: 0 4px 32px rgba(0,0,0,.35), 0 1px 4px rgba(0,0,0,.2);
  --shadow-btn:  0 2px 20px rgba(240,192,64,.28);
  --shadow-input:0 0 0 3px rgba(240,192,64,.18);

  /* ── Mode toggle ── */
  --mode-bg:    #1c2235;
  --mode-text:  #7a869e;
  --mode-hover: #edf0f8;
}

/* ── LIGHT MODE ───────────────────────────────────────────── */
html.light-mode {
  --bg-base:   #f3f5fb;
  --bg-card:   #ffffff;
  --bg-raised: #eef0f8;
  --bg-hover:  #e4e7f2;
  --bg-input:  #f8f9fd;

  --border-faint:  #dde2ee;
  --border-soft:   #c8cedf;
  --border-medium: #aab4cc;
  --border-strong: #8896b8;

  --text-primary:   #1a2040;   /* very dark — high contrast */
  --text-secondary: #3a4668;   /* secondary but still strong */
  --text-muted:     #6070a0;   /* muted but still readable */
  --text-faint:     #9aaac8;

  --gold:       #c07800;
  --gold-dim:   #a06000;
  --gold-glow:  rgba(192,120,0,.12);
  --gold-text:  #905800;

  --teal:       #0d8f76;
  --teal-dim:   #0a7460;
  --teal-glow:  rgba(13,143,118,.1);

  --sky:        #2060c8;
  --sky-glow:   rgba(32,96,200,.1);

  --coral:      #c83030;
  --coral-glow: rgba(200,48,48,.1);

  /* ── Backward-compat aliases (dipakai inline style di index.html) ── */
  --ghost: var(--text-muted);   /* alias → --text-muted */
  --line2: var(--border-soft);  /* alias → --border-soft */

  --M: #c82020;
  --K: #c07800;
  --P: #5a6888;
  --A: #8090b8;
  --H: #b0bccc;

  --fit-hi2: #166534;
  --fit-hi:  #15803d;
  --fit-mid: #a16207;
  --fit-lo:  #b91c1c;

  --lbiru-bg:     rgba(40,90,220,.07);
  --lbiru-border: rgba(40,90,220,.2);
  --lbiru-text:   #2855c8;

  --shadow-card: 0 2px 20px rgba(30,50,120,.08), 0 1px 4px rgba(30,50,120,.06);
  --shadow-btn:  0 2px 16px rgba(192,120,0,.24);
  --shadow-input:0 0 0 3px rgba(192,120,0,.14);

  --mode-bg:    #eef0f8;
  --mode-text:  #6070a0;
  --mode-hover: #1a2040;
}

/* ── RESET ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 15px; }
body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.65;
  font-size: 0.9375rem;   /* 15px — more readable for 55+ */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.3s ease, color 0.3s ease;
}

/* Subtle background texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 30% 0%, rgba(240,192,64,.05) 0%, transparent 60%),
    radial-gradient(ellipse 50% 60% at 80% 80%, rgba(54,217,188,.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}
.page { position: relative; z-index: 1; max-width: 1280px; margin: 0 auto; padding: 0 28px 100px; }

/* ── TOPBAR ───────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0 32px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 48px;
}
.logo { display: flex; align-items: center; gap: 0; }
.logo-img {
  height: 118px;
  width: auto;
  display: block;
  flex-shrink: 0;
  object-fit: contain;
}
.logo-icon { display: none; }
.logo-mark { display: none; }
.logo-sub  { display: none; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: var(--text-muted);
  border: 1px solid var(--border-medium);
  padding: 6px 14px;
  border-radius: 20px;
  letter-spacing: 0.05em;
  background: var(--bg-raised);
}
.topbar-version {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  color: var(--text-faint);
  background: var(--bg-raised);
  border: 1px solid var(--border-faint);
  padding: 5px 11px;
  border-radius: 20px;
}

/* ── MODE TOGGLE ──────────────────────────────────────────── */
.mode-toggle {
  background: var(--mode-bg);
  border: 1px solid var(--border-medium);
  border-radius: 20px;
  color: var(--mode-text);
  padding: 7px 16px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 0.73rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.mode-toggle:hover {
  border-color: var(--border-strong);
  color: var(--mode-hover);
  background: var(--bg-hover);
}
.mode-toggle .mode-icon { font-size: 0.95rem; line-height: 1; }
.mode-toggle .mode-label { font-size: 0.7rem; }

/* ── BRAND SLOGAN ─────────────────────────────────────────── */
.brand-slogan {
  display: flex;
  align-items: center;
  padding-left: 1.2rem;
  margin-left: 1rem;
  border-left: 1px solid var(--border-soft);
  align-self: center;
}
.slogan-text {
  font-family: 'Lora', 'Georgia', serif;
  font-style: italic;
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  line-height: 1.4;
  white-space: nowrap;
  user-select: none;
}
html.light-mode .slogan-text { color: var(--text-secondary); }
html.light-mode .logo-img {
  filter: drop-shadow(0 2px 10px rgba(0,0,0,.18))
          drop-shadow(0 1px 4px rgba(0,0,0,.12));
}

/* ── INPUT SECTION ────────────────────────────────────────── */
.input-section {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 0;
  margin-bottom: 52px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.input-header {
  padding: 30px 36px 26px;
  background: linear-gradient(180deg, var(--bg-raised) 0%, var(--bg-card) 100%);
  border-bottom: 1px solid var(--border-faint);
}
.input-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.input-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text-primary);
  margin-bottom: 5px;
  letter-spacing: -0.01em;
}
.input-desc {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── METHOD TABS ──────────────────────────────────────────── */
.method-tabs {
  display: flex;
  gap: 0;
  align-self: flex-start;
  background: var(--bg-base);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 4px;
}
.mtab {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 8px 20px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.mtab.active {
  background: var(--bg-raised);
  color: var(--text-primary);
  box-shadow: 0 1px 6px rgba(0,0,0,.2);
}
.mtab:hover:not(.active) { color: var(--text-secondary); }
.method-pane { display: none; }
.method-pane.active { display: block; }
.paste-pane { padding: 26px 36px 30px; }

.score-box {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  padding: 16px 20px;
  resize: vertical;
  min-height: 82px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  line-height: 1.9;
}
.score-box:focus {
  border-color: var(--gold);
  box-shadow: var(--shadow-input);
}
.score-box::placeholder {
  color: var(--text-faint);
  font-size: 0.82rem;
}

/* ── TYPOLOGY GRID ────────────────────────────────────────── */
.typology-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 5px;
  margin-top: 16px;
}
.ty-chip {
  background: var(--bg-raised);
  border: 1px solid var(--border-faint);
  border-radius: var(--radius-xs);
  padding: 5px 9px;
  font-family: 'JetBrains Mono', monospace;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  transition: border-color 0.15s;
}
.ty-num  { color: var(--text-faint); font-size: 0.62rem; flex-shrink: 0; }
.ty-name { color: var(--text-muted); font-size: 0.65rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── PDF PANE ─────────────────────────────────────────────── */
.pdf-pane { padding: 26px 36px 30px; }
.pdf-drop {
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 48px 36px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.pdf-drop:hover, .pdf-drop.drag {
  border-color: var(--teal);
  background: var(--teal-glow);
}
.drop-icon { font-size: 2.4rem; display: block; margin-bottom: 14px; }
.pdf-drop p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 5px;
}
.pdf-drop small { color: var(--text-muted); font-size: 0.76rem; }
#pdf-file { display: none; }
#pdf-status {
  margin-top: 14px;
  font-size: 0.82rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-secondary);
  min-height: 22px;
}

/* ── PDF CONFIRM CARD ─────────────────────────────────────── */
.pdf-confirm {
  margin-top: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--teal);
  border-radius: var(--radius-sm);
  padding: 14px 18px 16px;
  animation: pfcFadeIn .25s ease;
}
@keyframes pfcFadeIn {
  from { opacity:0; transform:translateY(-6px); }
  to   { opacity:1; transform:translateY(0); }
}

.pfc-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.pfc-icon {
  font-size: 1.1rem;
  color: var(--teal);
  margin-top: 1px;
  flex-shrink: 0;
}
.pfc-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pfc-label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--teal);
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.pfc-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pfc-noname { color: var(--text-muted); font-style: italic; font-weight: 400; }
.pfc-file {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Score chips row */
.pfc-scores {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.pfc-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  border-radius: 5px;
  padding: 3px 5px;
  border: 1px solid transparent;
  min-width: 36px;
  cursor: default;
}
.pfc-ty {
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-family: 'Plus Jakarta Sans', sans-serif;
  line-height: 1.2;
  opacity: .85;
}
.pfc-sc {
  font-size: 0.68rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.3;
}
/* Warna chip sesuai warna typology */
.pfc-M { background:rgba(240,112,112,.15); color:var(--M); border-color:rgba(240,112,112,.3); }
.pfc-K { background:rgba(240,192,64,.13);  color:var(--K); border-color:rgba(240,192,64,.28); }
.pfc-P { background:rgba(200,208,232,.08); color:var(--text-secondary); border-color:rgba(200,208,232,.18); }
.pfc-A { background:rgba(128,144,184,.1);  color:var(--A); border-color:rgba(128,144,184,.22); }
.pfc-H { background:rgba(58,69,104,.18);   color:var(--text-muted); border-color:var(--border-soft); }

html.light-mode .pfc-M { background:rgba(200,32,32,.09);  border-color:rgba(200,32,32,.22); }
html.light-mode .pfc-K { background:rgba(192,120,0,.09);  border-color:rgba(192,120,0,.22); }
html.light-mode .pfc-P { background:rgba(90,104,136,.08); border-color:rgba(90,104,136,.2); }
html.light-mode .pfc-A { background:rgba(100,116,160,.1); border-color:rgba(100,116,160,.22); }
html.light-mode .pfc-H { background:rgba(176,188,204,.15);border-color:var(--border-soft); }

@media (max-width: 600px) {
  .pfc-chip { min-width: 32px; padding: 3px 4px; }
  .pfc-ty   { font-size: 0.5rem; }
  .pfc-sc   { font-size: 0.62rem; }
  .pfc-name { font-size: 0.9rem; }
}

/* ── INPUT FOOTER ─────────────────────────────────────────── */
.input-footer {
  padding: 20px 36px;
  background: var(--bg-raised);
  border-top: 1px solid var(--border-faint);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.err-box {
  background: rgba(240,96,96,.1);
  border: 1px solid rgba(240,96,96,.3);
  border-radius: var(--radius-xs);
  padding: 11px 16px;
  color: #f9a8a8;
  font-size: 0.84rem;
  flex: 1;
  display: none;
  line-height: 1.5;
}
.err-box.on { display: block; }

.btn-run {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dim) 100%);
  color: #0d0f14;
  border: none;
  padding: 14px 40px;
  border-radius: 10px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: opacity 0.2s, box-shadow 0.2s, transform 0.1s;
  box-shadow: var(--shadow-btn);
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-run:hover   { opacity: 0.92; box-shadow: 0 4px 28px rgba(240,192,64,.5); }
.btn-run:active  { transform: scale(0.98); }
.btn-run:disabled { opacity: 0.35; cursor: not-allowed; box-shadow: none; }

.spinner {
  width: 15px; height: 15px;
  border: 2px solid rgba(0,0,0,.2);
  border-top-color: #0d0f14;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}
.btn-run.loading .spinner   { display: block; }
.btn-run.loading .btn-label { opacity: 0.6; }
@keyframes spin { to { transform: rotate(360deg); } }

.run-hint {
  font-size: 0.76rem;
  color: var(--text-faint);
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.5;
}

/* ── RESULTS ──────────────────────────────────────────────── */
#results { display: none; }
#results.on { display: block; animation: fadeUp 0.4s ease; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── RIASEC CARD ──────────────────────────────────────────── */
.riasec-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  margin-bottom: 36px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.riasec-card-top {
  padding: 28px 32px;
  display: flex;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, var(--bg-raised) 0%, var(--bg-card) 60%);
  border-bottom: 1px solid var(--border-faint);
}
.rcode {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 2.9rem;
  letter-spacing: 0.1em;
  line-height: 1;
}
.rc0 { color: var(--gold); }
.rc1 { color: var(--teal); }
.rc2 { color: var(--sky); }
.rcn { color: var(--text-faint); }

.rbar-div {
  width: 1px;
  height: 54px;
  background: var(--border-soft);
  align-self: center;
  flex-shrink: 0;
}
.rdims { display: flex; gap: 7px; flex-wrap: wrap; }
.rdim {
  background: var(--bg-input);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 9px 16px;
  text-align: center;
  min-width: 66px;
  transition: border-color 0.2s;
}
.rdim.hi {
  border-color: rgba(54,217,188,.45);
  background: var(--teal-glow);
}
.rdim .dl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  margin-bottom: 3px;
  text-transform: uppercase;
}
.rdim .dv {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--text-secondary);
}
.rdim.hi .dv { color: var(--teal); }

.riasec-meta {
  padding: 13px 32px;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.76rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  background: var(--bg-raised);
}

/* ── OUTPUT TABS ──────────────────────────────────────────── */
.out-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border-soft);
  margin-bottom: 26px;
  overflow-x: auto;
  scrollbar-width: none;
}
.out-tabs::-webkit-scrollbar { display: none; }

.otab {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 14px 22px;
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
  display: flex;
  align-items: center;
  gap: 9px;
}
.otab:hover { color: var(--text-secondary); }
.otab.active { color: var(--gold); border-bottom-color: var(--gold); }

.tab-pill {
  background: var(--bg-raised);
  color: var(--text-muted);
  font-size: 0.65rem;
  padding: 2px 9px;
  border-radius: 12px;
  font-family: 'JetBrains Mono', monospace;
}
.otab.active .tab-pill {
  background: var(--gold-glow);
  color: var(--gold-text);
}

.opane { display: none; }
.opane.active { display: block; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── TOOLBAR ──────────────────────────────────────────────── */
.ptoolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.srch {
  background: var(--bg-card);
  border: 1.5px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 9px 14px;
  font-size: 0.875rem;    /* bigger for 55+ */
  outline: none;
  width: 220px;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.srch:focus {
  border-color: var(--gold);
  box-shadow: var(--shadow-input);
}
.srch::placeholder { color: var(--text-faint); }

.fsel {
  background: var(--bg-card);
  border: 1.5px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 9px 12px;
  font-size: 0.875rem;
  outline: none;
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: border-color 0.2s;
}
.fsel:focus { border-color: var(--gold); }

.tbtn {
  background: var(--bg-raised);
  border: 1.5px solid var(--border-soft);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  padding: 9px 16px;
  font-size: 0.78rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.03em;
}
.tbtn.on {
  background: var(--gold-glow);
  border-color: var(--gold);
  color: var(--gold-text);
}
.tbtn:hover:not(.on) {
  color: var(--text-secondary);
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.btn-export {
  background: var(--bg-raised);
  border: 1.5px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--teal);
  padding: 9px 18px;
  font-size: 0.78rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.btn-export:hover {
  background: var(--teal-glow);
  border-color: var(--teal);
}

.tspacer { flex: 1; }
.rcount {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.sc-info-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  margin-bottom: 14px;
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.sc-badge {
  display: inline-block;
  background: rgba(54,217,188,.12);
  border: 1px solid rgba(54,217,188,.28);
  color: var(--teal);
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}
.sc-sep {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
  margin: 0 1px;
  user-select: none;
}

/* ── LATAR BIRU LEGEND ────────────────────────────────────── */
.lbiru-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  margin-bottom: 14px;
  background: var(--lbiru-bg);
  border: 1px solid var(--lbiru-border);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--lbiru-text);
  line-height: 1.5;
}
.lb-sw {
  width: 11px; height: 11px;
  border-radius: 3px;
  background: rgba(80,120,255,.22);
  border: 1px solid rgba(80,120,255,.38);
  flex-shrink: 0;
}

/* ── TABLE ────────────────────────────────────────────────── */
.tbl-wrap {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  overflow-x: auto;
  margin-bottom: 16px;
}

.dtbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;   /* 14px — readable */
}

.dtbl thead th {
  background: var(--bg-raised);
  padding: 12px 16px;
  text-align: left;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1.5px solid var(--border-soft);
  white-space: nowrap;
}

.dtbl tbody tr {
  border-bottom: 1px solid var(--border-faint);
  transition: background 0.12s;
}
.dtbl tbody tr:last-child { border-bottom: none; }

.dtbl tbody tr.row-lbiru td    { background: var(--lbiru-bg); }
.dtbl tbody tr.row-lbiru:hover td { background: rgba(80,120,255,.12); }
.dtbl tbody tr.row-normal:hover td { background: var(--bg-hover); }
.dtbl tbody tr.row-lbiru .td-nama { color: var(--text-muted); }
.dtbl tbody tr.row-lbiru .td-kode { color: var(--lbiru-text); }

.lbiru-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(80,120,255,.14);
  border: 1px solid rgba(80,120,255,.28);
  color: var(--lbiru-text);
  font-size: 0.6rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.06em;
  margin-left: 8px;
  vertical-align: middle;
}

.dtbl td {
  padding: 11px 16px;
  vertical-align: middle;
}

.td-no   {
  color: var(--text-faint);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  width: 40px;
}
.td-nama {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.875rem;
}
.td-dept {
  color: var(--text-muted);
  font-size: 0.8rem;
}
.td-kode {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 0.84rem;
  color: var(--teal);
  letter-spacing: 0.08em;
}
.fdot {
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--sky);
  margin-left: 6px;
  vertical-align: middle;
}

/* ── FIT SCORE BAR ────────────────────────────────────────── */
.fit-cell  { min-width: 140px; }
.fit-row   { display: flex; align-items: center; gap: 9px; }
.fit-track {
  flex: 1;
  height: 5px;
  background: var(--bg-raised);
  border-radius: 3px;
  overflow: hidden;
  min-width: 58px;
}
.fit-fill  { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.fit-num   {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  min-width: 46px;
  text-align: right;
  font-weight: 600;
}

.chi2  { color: var(--fit-hi2); } .chi2-fill { background: var(--fit-hi2); }
.chi   { color: var(--fit-hi);  } .chi-fill  { background: var(--fit-hi);  }
.cmid  { color: var(--fit-mid); } .cmid-fill { background: var(--fit-mid); }
.clo   { color: var(--fit-lo);  } .clo-fill  { background: var(--fit-lo);  }

/* ── PAGER ────────────────────────────────────────────────── */
.pager {
  display: flex;
  gap: 5px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.pbtn {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  color: var(--text-secondary);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  transition: all 0.15s;
  min-width: 40px;
  text-align: center;
}
.pbtn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background: var(--bg-hover);
}
.pbtn.cur {
  background: var(--gold);
  border-color: var(--gold);
  color: #0d0f14;
  font-weight: 700;
}

/* ── LEADERSHIP SECTION ───────────────────────────────────── */
.lt-lbl {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.lt-lbl::before {
  content: '';
  width: 18px;
  height: 2.5px;
  background: var(--gold);
  border-radius: 2px;
  display: inline-block;
}

.lt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 8px;
  margin-bottom: 36px;
}
.lt-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 13px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: border-color 0.2s, background 0.2s;
}
.lt-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

/* ── LEADERSHIP TYPOLOGY TOOLTIP ─────────────────────────── */
.lt-name {
  position: relative;
  cursor: default;
}

/* Tooltip bubble */
.lt-tip {
  /* Hidden by default — shown via JS adding .lt-tip-visible */
  visibility: hidden;
  opacity: 0;
  pointer-events: none;

  /* JS sets top/left; position:fixed escapes overflow clipping */
  position: fixed;
  z-index: 9999;

  /* Reset warisan dari parent (col-hdr punya writing-mode & text-transform) */
  writing-mode: horizontal-tb;
  transform: none !important;
  text-transform: none;

  /* Box */
  width: 260px;
  background: var(--bg-raised);
  border: 1px solid var(--border-medium);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 8px 28px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.04);

  /* Text */
  font-size: 0.78rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.6;
  text-align: left;
  white-space: normal;

  /* Smooth transition */
  transition: opacity 0.15s ease;
}

.lt-tip.lt-tip-visible {
  visibility: visible;
  opacity: 1;
  pointer-events: none;
}

.lt-tip-name {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold-text);
  margin-bottom: 7px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

/* Arrow / caret pointing down */
.lt-tip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: var(--border-medium);
}
.lt-tip::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--bg-raised);
  z-index: 1;
}

/* lt-card tooltip show/hide: dikelola JS */





/* ── LIGHT MODE overrides ─────────────────────────────────── */
html.light-mode .lt-tip {
  background: #ffffff;
  border-color: #d1d5e0;
  box-shadow: 0 8px 28px rgba(0,0,0,.14), 0 0 0 1px rgba(0,0,0,.04);
  color: #374151;
}
html.light-mode .lt-tip::after { border-top-color: #d1d5e0; }
html.light-mode .lt-tip::before { border-top-color: #ffffff; }
@media (max-width: 768px) {
  html.light-mode .lt-tip::after { border-top-color: transparent; border-bottom-color: #d1d5e0; }
  html.light-mode .lt-tip::before { border-top-color: transparent; border-bottom-color: #ffffff; }
}
.lt-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.lt-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 5px;
  white-space: nowrap;
}

/* ── BADGE COLORS (Typology) ──────────────────────────────── */
.b-M { background: rgba(240,112,112,.15); color: var(--M); border: 1px solid rgba(240,112,112,.3); }
.b-K { background: rgba(240,192,64,.15);  color: var(--K); border: 1px solid rgba(240,192,64,.3); }
.b-P { background: rgba(200,208,232,.08); color: var(--P); border: 1px solid rgba(200,208,232,.2); }
.b-A { background: rgba(128,144,184,.12); color: var(--A); border: 1px solid rgba(128,144,184,.25); }
.b-H { background: rgba(58,69,104,.2);   color: var(--text-muted); border: 1px solid var(--border-soft); }

html.light-mode .b-M { background: rgba(200,32,32,.09);  color: var(--M); border: 1px solid rgba(200,32,32,.25); }
html.light-mode .b-K { background: rgba(192,120,0,.1);   color: var(--K); border: 1px solid rgba(192,120,0,.28); }
html.light-mode .b-P { background: rgba(90,104,136,.1);  color: var(--P); border: 1px solid rgba(90,104,136,.25); }
html.light-mode .b-A { background: rgba(128,144,184,.12);color: var(--A); border: 1px solid rgba(128,144,184,.25); }
html.light-mode .b-H { background: rgba(176,188,204,.2); color: var(--text-muted); border: 1px solid var(--border-soft); }

/* ── MATRIX ───────────────────────────────────────────────── */
.matrix-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  margin-bottom: 14px;
  display: flex;
  justify-content: center;
}
.mtrx { border-collapse: collapse; font-size: 0.78rem; }
.mtrx th, .mtrx td { border: 1px solid var(--border-faint); padding: 0; }
.mtrx th.corner {
  background: var(--bg-raised);
  border-color: var(--border-soft);
  width: 122px;
}
.mtrx th.col-hdr {
  background: var(--bg-raised);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  padding: 13px 8px 9px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 0.63rem;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
  text-transform: uppercase;
  min-height: 96px;
  vertical-align: bottom;
}
.mtrx th.row-hdr {
  background: var(--bg-raised);
  text-align: right;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 0.67rem;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  padding: 8px 14px 8px 18px;
  white-space: nowrap;
  text-transform: uppercase;
  width: 122px;
}
.mtrx td.mc {
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 0.8rem;
  width: 36px;
  height: 36px;
  cursor: default;
  transition: opacity 0.15s;
}
.mtrx td.mc:hover { opacity: 0.72; }

/* ── 17 ROLE DOMAINS TAB ─────────────────────────────────── */
.rd-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  display: flex;
  justify-content: center;
}

.rd-tbl {
  border-collapse: collapse;
  width: auto;           /* Tidak full-width — compact mengikuti konten */
  min-width: 520px;
  font-size: 0.82rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

/* Header row */
.rd-th {
  background: var(--bg-raised);
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 8px 12px;
  border-bottom: 2px solid var(--border-soft);
  white-space: nowrap;
}
.rd-th-cluster { width: 130px; text-align: left; }
.rd-th-domain  { width: 150px; text-align: left; }
.rd-th-comp    { width: 180px; text-align: left; color: var(--text-muted); }
.rd-th-num     { width: 72px; text-align: center; }

/* Cluster cell — merged, bold */
.rd-cluster {
  background: var(--bg-raised);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding: 0 12px;
  vertical-align: middle;
  text-align: center;
  border-right: 2px solid var(--border-soft);
  white-space: nowrap;
}

/* Domain name cell */
.rd-domain {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-primary);
  padding: 7px 12px;
  border-bottom: 1px solid var(--border-faint);
  white-space: nowrap;
}

/* Typology komponen cell */
.rd-comp {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border-faint);
  white-space: nowrap;
}

/* Numeric cells — ADJ dan Rank */
.rd-num {
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border-faint);
  white-space: nowrap;
}

/* Warna domain cell sesuai threshold Q (diterapkan ke td.rd-domain) */
.rd-row.rd-M .rd-domain { border-left: 3px solid var(--M); color: var(--M); }
.rd-row.rd-K .rd-domain { border-left: 3px solid var(--K); color: var(--K); }
.rd-row.rd-P .rd-domain { border-left: 3px solid var(--border-soft); }
.rd-row.rd-A .rd-domain { border-left: 3px solid var(--A); color: var(--A); }
.rd-row.rd-H .rd-domain { border-left: 3px solid var(--border-faint); color: var(--text-muted); }

/* ADJ — warna lembut sesuai threshold */
.rd-row.rd-M .rd-adj { color: var(--M); }
.rd-row.rd-K .rd-adj { color: var(--K); }
.rd-row.rd-P .rd-adj { color: var(--text-secondary); }
.rd-row.rd-A .rd-adj { color: var(--A); }
.rd-row.rd-H .rd-adj { color: var(--text-muted); }

/* Rank — gold */
.rd-rank { color: var(--gold-text); font-weight: 800; font-size: 0.85rem; }

/* Row highlight background halus untuk M dan K */
.rd-row.rd-M { background: rgba(240,112,112,.04); }
.rd-row.rd-K { background: rgba(240,192,64,.04); }
.rd-row.rd-A { background: rgba(80,100,160,.04); }
.rd-row.rd-H { background: rgba(40,50,80,.06); }

/* Row hover */
.rd-row:hover .rd-domain,
.rd-row:hover .rd-comp,
.rd-row:hover .rd-num { background: var(--teal-glow); }
.rd-row:hover .rd-cluster { background: var(--bg-raised); }

/* Separator antar cluster */
/* Separator antar cluster — border bawah row terakhir + border atas row pertama berikutnya */
.rd-tbl tbody tr:nth-child(3) td,
.rd-tbl tbody tr:nth-child(5) td,
.rd-tbl tbody tr:nth-child(7) td,
.rd-tbl tbody tr:nth-child(9) td,
.rd-tbl tbody tr:nth-child(10) td,
.rd-tbl tbody tr:nth-child(14) td,
.rd-tbl tbody tr:nth-child(16) td {
  border-bottom: 3px solid #4a5278 !important;
}
.rd-tbl tbody tr:nth-child(4) td,
.rd-tbl tbody tr:nth-child(6) td,
.rd-tbl tbody tr:nth-child(8) td,
.rd-tbl tbody tr:nth-child(10) td,
.rd-tbl tbody tr:nth-child(11) td,
.rd-tbl tbody tr:nth-child(15) td,
.rd-tbl tbody tr:nth-child(17) td {
  border-top: 3px solid #4a5278 !important;
}
html.light-mode .rd-tbl tbody tr:nth-child(3) td,
html.light-mode .rd-tbl tbody tr:nth-child(5) td,
html.light-mode .rd-tbl tbody tr:nth-child(7) td,
html.light-mode .rd-tbl tbody tr:nth-child(9) td,
html.light-mode .rd-tbl tbody tr:nth-child(10) td,
html.light-mode .rd-tbl tbody tr:nth-child(14) td,
html.light-mode .rd-tbl tbody tr:nth-child(16) td {
  border-bottom: 3px solid #8892b0 !important;
}
html.light-mode .rd-tbl tbody tr:nth-child(4) td,
html.light-mode .rd-tbl tbody tr:nth-child(6) td,
html.light-mode .rd-tbl tbody tr:nth-child(8) td,
html.light-mode .rd-tbl tbody tr:nth-child(10) td,
html.light-mode .rd-tbl tbody tr:nth-child(11) td,
html.light-mode .rd-tbl tbody tr:nth-child(15) td,
html.light-mode .rd-tbl tbody tr:nth-child(17) td {
  border-top: 3px solid #8892b0 !important;
}

/* Light mode */
html.light-mode .rd-cluster { background: #f1f3f8; border-right-color: #d1d5e0; }
html.light-mode .rd-th      { background: #f1f3f8; }
html.light-mode .rd-row.rd-M { background: rgba(200,32,32,.05); }
html.light-mode .rd-row.rd-K { background: rgba(180,120,0,.05); }
html.light-mode .rd-row.rd-A { background: rgba(80,100,160,.05); }
html.light-mode .rd-row.rd-H { background: rgba(140,150,170,.06); }

@media (max-width: 768px) {
  .rd-th-comp, .rd-comp { display: none; }
  .rd-th-num  { width: 56px; }
  .rd-num     { font-size: 0.72rem; padding: 7px 6px; }
  .rd-domain  { font-size: 0.75rem; padding: 7px 10px; }
  .rd-cluster { font-size: 0.58rem; padding: 0 8px; }
}

/* ── MATRIX TOOLTIP ───────────────────────────────────────── */

/* Host: semua th/td yang punya tooltip */
.mtrx-tip-host {
  position: relative;
  cursor: default;
}

/* Shared tooltip element untuk matrix headers — hidup di luar tabel */
.mtrx-shared-tip {
  width: 230px;
  /* Panah kiri — menunjuk ke host di sebelah kiri */
}
.mtrx-shared-tip::after {
  top: 50%;
  right: 100%;
  left: auto;
  bottom: auto;
  transform: translateY(-50%);
  border-top-color: transparent;
  border-bottom-color: transparent;
  border-left-color: transparent;
  border-right-color: var(--border-medium);
}
.mtrx-shared-tip::before {
  top: 50%;
  right: 100%;
  left: auto;
  bottom: auto;
  transform: translateY(-50%);
  border-top-color: transparent;
  border-bottom-color: transparent;
  border-left-color: transparent;
  border-right-color: var(--bg-raised);
  z-index: 1;
  right: calc(100% - 1px);
}
html.light-mode .mtrx-shared-tip::after  { border-right-color: #d1d5e0; }
html.light-mode .mtrx-shared-tip::before { border-right-color: #ffffff; }

/* Override ukuran & posisi default .lt-tip untuk konteks matrix */

/* Tooltip di col-hdr (header kolom vertikal) — muncul ke kanan */
.mtrx-col-tip {
  position: fixed !important;
  width: 230px;
  bottom: auto;
}
/* Hover trigger dikelola JS — class .mtrx-tip-visible ditambah/dihapus JS */
.mtrx-col-tip.mtrx-tip-visible {
  opacity: 1;
  visibility: visible;
}
/* Panah kiri (arah ke header) */
.mtrx-col-tip::after,
.mtrx-col-tip::before {
  top: 50%;
  left: auto;
  right: 100%;
  bottom: auto;
  transform: translateY(-50%);
  border-top-color: transparent;
}
.mtrx-col-tip::after {
  border-right-color: var(--border-medium);
  border-top-color: transparent;
  border-bottom-color: transparent;
  border-left-color: transparent;
}
.mtrx-col-tip::before {
  border-right-color: var(--bg-raised);
  border-top-color: transparent;
  border-bottom-color: transparent;
  border-left-color: transparent;
  z-index: 1;
  right: calc(100% - 1px);
}

/* Tooltip di row-hdr (header baris) — muncul ke kanan seperti col */
.mtrx-row-tip {
  position: fixed !important;
  width: 230px;
  bottom: auto;
}
.mtrx-row-tip.mtrx-tip-visible {
  opacity: 1;
  visibility: visible;
}
/* Panah kiri (menunjuk ke header baris di sebelah kiri tooltip) */
.mtrx-row-tip::after,
.mtrx-row-tip::before {
  top: 50%;
  right: 100%;
  left: auto;
  bottom: auto;
  transform: translateY(-50%);
  border-top-color: transparent;
  border-bottom-color: transparent;
  border-left-color: transparent;
}
.mtrx-row-tip::after {
  border-right-color: var(--border-medium);
}
.mtrx-row-tip::before {
  border-right-color: var(--bg-raised);
  z-index: 1;
  right: calc(100% - 1px);
}

/* Tooltip di sel mc — muncul di atas, lebih lebar (dual panel) */
/* Panah bawah default sudah benar dari .lt-tip::after/.lt-tip::before */


/* z-index: tooltip matrix harus di atas header sticky */
.mtrx-col-tip,
.mtrx-row-tip { z-index: 9999; }

/* Tooltip matrix: karena matrix-wrap overflow:auto mengclip,
   kita pakai JS (mtrxTip) untuk posisioning fixed saat hover */

/* ── Light mode ────────────────────────────────────────────── */
html.light-mode .mtrx-col-tip::after { border-right-color: #d1d5e0; }
html.light-mode .mtrx-col-tip::before { border-right-color: #ffffff; }
html.light-mode .mtrx-row-tip::after { border-right-color: #d1d5e0; border-left-color: transparent; }
html.light-mode .mtrx-row-tip::before { border-right-color: #ffffff; border-left-color: transparent; }

/* ── Mobile/Tablet: semua tooltip matrix muncul di atas ──── */
@media (max-width: 900px) {
  /* JS atur left/bottom — CSS hanya override lebar & layout */
  .mtrx-col-tip,
  .mtrx-row-tip { width: 210px; }

  /* Arrow bawah (tooltip muncul di atas host pada mobile) */
  .mtrx-col-tip::after,
  .mtrx-col-tip::before,
  .mtrx-row-tip::after,
  .mtrx-row-tip::before {
    top: 100%; left: 50%; right: auto; bottom: auto;
    transform: translateX(-50%);
    border-right-color: transparent;
    border-left-color: transparent;
    border-bottom-color: transparent;
  }
  .mtrx-col-tip::after,
  .mtrx-row-tip::after  { border-top-color: var(--border-medium); }
  .mtrx-col-tip::before,
  .mtrx-row-tip::before { border-top-color: var(--bg-raised); z-index:1; }

  /* Visible state: no transform override — JS handles position */
  /* JS handles all positioning — no transform override needed */

  /* Sel tooltip: stack vertikal */

  html.light-mode .mtrx-col-tip::after,
  html.light-mode .mtrx-row-tip::after  { border-top-color: #d1d5e0; }
  html.light-mode .mtrx-col-tip::before,
  html.light-mode .mtrx-row-tip::before { border-top-color: #ffffff; }
}

/* Matrix value colors — strong contrast in both modes */
.v8 { background: #7f1d1d; color: #fecaca; }
.v7 { background: #78350f; color: #fde68a; }
.v6 { background: #1e3a5f; color: #bfdbfe; }
.v5 { background: #1e3535; color: #99f6e4; }
.v4 { background: #1f2937; color: #9ca3af; }
.v3 { background: #161d28; color: #6b7280; }
.v2 { background: #0e1520; color: #374151; }
.v1, .v0 { background: var(--bg-base); color: var(--border-medium); }

html.light-mode .v8 { background: #fee2e2; color: #991b1b; }
html.light-mode .v7 { background: #fef3c7; color: #92400e; }
html.light-mode .v6 { background: #dbeafe; color: #1e40af; }
html.light-mode .v5 { background: #d1fae5; color: #065f46; }
html.light-mode .v4 { background: #e5e7eb; color: #4b5563; }
html.light-mode .v3 { background: #f3f4f6; color: #9ca3af; }
html.light-mode .v2 { background: #f9fafb; color: #d1d5db; }
html.light-mode .v1, html.light-mode .v0 { background: #ffffff; color: #e5e7eb; }

.matrix-legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 12px 0 40px;
}
.leg { display: flex; align-items: center; gap: 7px; }
.lsw { width: 14px; height: 14px; border-radius: 3px; flex-shrink: 0; }

/* ── SECTION DIVIDER ──────────────────────────────────────── */
.section-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 32px 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-faint);
}

/* ── SCROLLBAR ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-medium); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ── FOCUS RING (accessibility) ───────────────────────────── */
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — Mobile First
   Breakpoints: 768px (tablet), 480px (phone), 360px (small)
   ═══════════════════════════════════════════════════════════ */

/* ── TABLET (≤768px) ──────────────────────────────────────── */
@media (max-width: 768px) {
  html { font-size: 14px; }
  .page { padding: 0 16px 80px; }

  /* Topbar */
  .topbar { flex-wrap: wrap; gap: 14px; padding: 20px 0 24px; margin-bottom: 32px; }
  .topbar-right { gap: 7px; }
  .logo-img { height: 86px; }
  .brand-slogan { display: none; }

  /* Input section */
  .input-header { padding: 22px 20px 18px; }
  .input-header-top { flex-direction: column; gap: 12px; }
  .paste-pane, .pdf-pane { padding: 20px 20px 24px; }
  .input-footer { padding: 16px 20px; gap: 12px; }
  .score-box { font-size: 0.82rem; }

  /* Typology chips */
  .typology-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 4px; }

  /* RIASEC card */
  .riasec-card-top { padding: 20px 22px; gap: 20px; }
  .rcode { font-size: 2.2rem; }
  .rdim { padding: 7px 12px; min-width: 58px; }
  .rdim .dv { font-size: 1.2rem; }
  .riasec-meta { padding: 10px 22px; gap: 16px; font-size: 0.72rem; }

  /* Tabs */
  .otab { padding: 11px 14px; font-size: 0.76rem; }

  /* Toolbar */
  .ptoolbar { gap: 6px; }
  .srch { width: 100%; flex-basis: 100%; order: -1; }
  .fsel { font-size: 0.8rem; }

  /* Table */
  .dtbl { font-size: 0.82rem; }
  .dtbl td { padding: 9px 12px; }
  .dtbl thead th { padding: 10px 12px; }

  /* Leadership */
  .lt-grid { grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 6px; }
}

/* ── PHONE (≤480px) ───────────────────────────────────────── */
@media (max-width: 480px) {
  html { font-size: 14px; }
  .page { padding: 0 12px 70px; }

  /* Topbar — compact */
  .topbar { padding: 16px 0 20px; margin-bottom: 24px; }
  .logo-img { height: 72px; }
  .topbar-badge { display: none; }
  .topbar-version { display: none; }
  .topbar-right { gap: 6px; }
  .mode-toggle { padding: 6px 12px; font-size: 0.68rem; }
  .mode-toggle .mode-label { display: none; }   /* hanya tampilkan icon */

  /* Input section */
  .input-header { padding: 18px 16px 14px; }
  .input-title { font-size: 0.95rem; }
  .input-desc { font-size: 0.78rem; }
  .paste-pane, .pdf-pane { padding: 16px 16px 20px; }
  .input-footer { padding: 13px 16px; flex-wrap: wrap; gap: 10px; }
  .score-box { font-size: 0.8rem; padding: 13px 15px; min-height: 72px; }
  .run-hint { display: none; }   /* hemat ruang di HP kecil */
  .btn-run { padding: 12px 28px; font-size: 0.85rem; width: 100%; justify-content: center; }
  .typology-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 3px; margin-top: 12px; }
  .ty-chip { padding: 4px 7px; }
  .ty-name { font-size: 0.6rem; }

  /* Method tabs */
  .method-tabs { width: 100%; }
  .mtab { flex: 1; text-align: center; padding: 8px 10px; font-size: 0.72rem; }

  /* RIASEC card */
  .riasec-card-top {
    padding: 16px 16px;
    gap: 14px;
    flex-direction: column;
    align-items: flex-start;
  }
  .rbar-div { display: none; }
  .rcode { font-size: 2.4rem; letter-spacing: 0.12em; }
  .rdims { gap: 5px; flex-wrap: wrap; }
  .rdim { padding: 6px 10px; min-width: 50px; }
  .rdim .dv { font-size: 1.1rem; }
  .rdim .dl { font-size: 0.58rem; }
  .riasec-meta { padding: 10px 16px; gap: 12px; font-size: 0.68rem; flex-wrap: wrap; }

  /* Tabs — scroll horizontal */
  .out-tabs { margin-bottom: 18px; gap: 0; }
  .otab { padding: 10px 12px; font-size: 0.72rem; letter-spacing: 0.01em; }
  .tab-pill { padding: 1px 6px; font-size: 0.58rem; }

  /* Toolbar — stack */
  .ptoolbar { flex-direction: column; align-items: stretch; gap: 6px; }
  .srch { width: 100%; font-size: 0.875rem; }
  .fsel { font-size: 0.82rem; }
  .tbtn { font-size: 0.75rem; text-align: center; }
  .btn-export { justify-content: center; }

  /* KUNCI: Tabel di HP — sembunyikan kolom tidak esensial */
  /* Kolom "Kategori" tersembunyi — sudah ada filter dropdown */
  .dtbl .col-kat,
  .dtbl thead th.col-kat { display: none; }

  .dtbl { font-size: 0.82rem; }
  .dtbl td { padding: 9px 10px; }
  .dtbl thead th { padding: 9px 10px; font-size: 0.62rem; }
  .td-nama { font-size: 0.84rem; }
  .td-dept { font-size: 0.74rem; }

  /* Fit bar lebih ramping */
  .fit-track { min-width: 40px; height: 4px; }
  .fit-num { font-size: 0.74rem; min-width: 38px; }

  /* Pager */
  .pbtn { padding: 6px 11px; font-size: 0.72rem; }

  /* Leadership grid — 1 atau 2 kolom */
  .lt-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 5px; }
  .lt-card { padding: 10px 14px; }
  .lt-name { font-size: 0.78rem; }
  .lt-badge { font-size: 0.66rem; padding: 3px 8px; }

  /* PDF drop */
  .pdf-drop { padding: 32px 20px; }
  .drop-icon { font-size: 2rem; margin-bottom: 10px; }
  .pdf-drop p { font-size: 0.85rem; }

  /* Matrix — biarkan scroll horizontal, pastikan wrapper tidak memotong */
  .matrix-wrap { border-radius: 10px; }
  .mtrx th.col-hdr { font-size: 0.56rem; padding: 10px 5px 6px; min-height: 78px; }
  .mtrx th.row-hdr { font-size: 0.6rem; padding: 6px 10px 6px 12px; width: 100px; }
  .mtrx td.mc { width: 30px; height: 30px; font-size: 0.72rem; }
  .matrix-legend { gap: 12px; font-size: 0.68rem; padding: 10px 0 28px; }
  .lsw { width: 12px; height: 12px; }

  /* Lbiru legend */
  .lbiru-legend { font-size: 0.72rem; padding: 9px 13px; }
}

/* ── SMALL PHONE (≤360px) ─────────────────────────────────── */
@media (max-width: 360px) {
  html { font-size: 13px; }
  .page { padding: 0 10px 60px; }

  .rcode { font-size: 2rem; }
  .rdim { padding: 5px 8px; min-width: 44px; }
  .rdim .dv { font-size: 1rem; }

  .otab { padding: 9px 10px; font-size: 0.7rem; }

  .dtbl { font-size: 0.78rem; }
  .dtbl td { padding: 8px 9px; }
  .td-nama { font-size: 0.8rem; }

  .btn-run { font-size: 0.82rem; padding: 11px 22px; }

  /* Sembunyikan nomor urut kolom # di tabel — muat 1 kolom lebih */
  .td-no, .dtbl thead th:first-child { display: none; }
}

/* ── TOUCH DEVICE — tap target lebih besar ────────────────── */
@media (hover: none) and (pointer: coarse) {
  .pbtn   { min-height: 40px; padding: 8px 14px; }
  .tbtn   { min-height: 40px; }
  .btn-export { min-height: 40px; }
  .mtab   { min-height: 38px; }
  .otab   { min-height: 44px; }
  .fsel   { min-height: 40px; }
  .srch   { min-height: 44px; padding: 11px 14px; }

  /* Hapus hover state yang tidak berlaku di touch */
  .dtbl tbody tr.row-normal:hover td { background: transparent; }
  .dtbl tbody tr.row-lbiru:hover td  { background: var(--lbiru-bg); }
  .lt-card:hover { border-color: var(--border-soft); background: var(--bg-card); }
}
