/* ============================================================
   HOSHI UI REMAKE — v1
   Prinsip: monochrome (hitam-putih-abu netral), tegas & bersih.
   - Dark: void #0a0a0a, surface #141414, border #2a2a2a
   - Light: paper #ffffff, surface #f7f7f7, border #e0e0e0
   - Aksen fungsional: red (danger), amber (warning), green (live-dot) — dipakai minim
   - Shadow: halus satu arah; TIDAK ada glow/ring berlapis
   - Radius konsisten: sm 6, md 10, lg 14
   - Buttons: solid primary (white/black), outline secondary, ghost tertiary
   ============================================================ */

:root {
  /* ── Tokens final ── */
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-solid: #171717;
  --surface-hover: #1f1f1f;
  --border: #262626;
  --border-light: #333333;
  --text-primary: #fafafa;
  --text-secondary: #d4d4d4;
  --text-muted: #8f8f8f;
  --primary: #fafafa;
  --primary-hover: #e5e5e5;
  --primary-text: #0a0a0a;
  --input-bg: #0f0f0f;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-pop: 0 8px 24px rgba(0,0,0,0.5);
}

:root {
  --tint-05: rgba(255,255,255,0.05);
  --tint-10: rgba(255,255,255,0.10);
  --tint-15: rgba(255,255,255,0.15);
  --tint-20: rgba(255,255,255,0.20);
  --tint-25: rgba(255,255,255,0.25);
  --tint-30: rgba(255,255,255,0.30);
  --tint-35: rgba(255,255,255,0.35);
  --tint-40: rgba(255,255,255,0.40);
}
body.light-theme {
  /* ═══ LIGHT-FIRST NATIVE DESIGN (slate palette) ═══ */
  --tint-05: rgba(15,23,42,0.04);
  --tint-10: rgba(15,23,42,0.08);
  --tint-15: rgba(15,23,42,0.12);
  --tint-20: rgba(15,23,42,0.16);
  --tint-25: rgba(15,23,42,0.22);
  --tint-30: rgba(15,23,42,0.28);
  --tint-35: rgba(15,23,42,0.34);
  --tint-40: rgba(15,23,42,0.40);
  --bg: #f8fafc;                    /* canvas: cool slate off-white, bukan kusam */
  --surface: #ffffff;               /* elevated: putih murni */
  --surface-solid: #ffffff;
  --surface-hover: #f1f5f9;
  --surface-raised: #ffffff;
  --border: #e2e8f0;                /* pemisah tipis kontras rendah */
  --border-light: #e2e8f0;
  --border-strong: #cbd5e1;
  --text-primary: #0f172a;          /* charcoal ink, bukan hitam pekat */
  --text-secondary: #475569;        /* slate 600, kontras >= 4.5:1 */
  --text-muted: #64748b;            /* slate 500, untuk meta/hint */
  --primary: #0f172a;               /* brand ink */
  --primary-hover: #1e293b;
  --primary-text: #ffffff;
  --input-bg: #ffffff;
  --input-bg-focus: #ffffff;
  /* semantic: satura dijaga, lightness turun utk tegas di terang */
  --green: #15803d;                 /* success 700 */
  --green-bg: #f0fdf4;              /* success 50 tint */
  --green-border: #bbf7d0;          /* success 200 */
  --red: #dc2626;                   /* danger 600 */
  --red-bg: #fef2f2;
  --red-border: #fecaca;
  --amber: #b45309;                 /* warning 700 */
  --amber-bg: #fffbeb;
  --amber-border: #fde68a;
  /* kedalaman via ambient shadow, bukan blok abu */
  --shadow-card: 0 1px 2px rgba(15,23,42,0.05), 0 1px 3px rgba(15,23,42,0.04);
  --shadow-pop: 0 8px 24px rgba(15,23,42,0.10), 0 2px 8px rgba(15,23,42,0.06);
  --shadow-ambient: 0 12px 40px rgba(15,23,42,0.08);
}

/* ── SURFACES: flat + satu border; tanpa double-stroke ── */
.surface-box, .panel-card, .mc-card {
  background: var(--surface-solid) !important;
  border: 1px solid var(--border) !important;
  box-shadow: none !important;
  border-radius: var(--radius-lg) !important;
}
/* MINIMALIS: nested = FLAT total (tanpa kotak di dalam kotak) */
.surface-box .surface-box,
.panel-card .surface-box,
.mc-card .surface-box,
.surface-box .panel-card {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}
.surface-box .surface-box .surface-box {
  background: transparent !important;
  border: none !important;
}
/* Pemisah antar blok nested: garis tipis, bukan frame */
.surface-box .surface-box + .surface-box,
.panel-card .surface-box + .surface-box {
  border-top: 1px solid var(--border) !important;
  border-left: none !important;
  border-right: none !important;
  border-bottom: none !important;
  padding-top: var(--space-lg, 14px) !important;
  margin-top: var(--space-lg, 14px) !important;
}

/* ── BUTTON SYSTEM ── */
.btn, button.btn, .btn-primary, .btn-save, .btn-secondary, .btn-cancel {
  border-radius: var(--radius-md) !important;
  font-weight: 550 !important;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease !important;
  box-shadow: none !important;
}
.btn-primary, .btn-save {
  background: var(--primary) !important;
  color: var(--primary-text) !important;
  border: 1px solid transparent !important;
}
.btn-primary:hover, .btn-save:hover {
  background: var(--primary-hover) !important;
}
.btn-primary:active, .btn-save:active {
  transform: translateY(0.5px);
}
.btn-secondary, .btn-cancel, .btn-warning-outline, .btn-danger-outline {
  background: transparent !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-light) !important;
}
.btn-secondary:hover, .btn-cancel:hover {
  background: var(--surface-hover) !important;
  border-color: var(--text-muted) !important;
}
.btn-warning-outline { color: #d97706 !important; border-color: rgba(217, 119, 6, 0.4) !important; }
.btn-warning-outline:hover { background: rgba(217, 119, 6, 0.08) !important; border-color: #d97706 !important; }
.btn-danger-outline, .btn-danger { color: var(--red, #eb5757) !important; border-color: rgba(235, 87, 87, 0.35) !important; }
.btn-danger-outline:hover, .btn-danger:hover { background: rgba(235, 87, 87, 0.08) !important; }

/* ── INPUTS ── */
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="url"], select, textarea {
  background: var(--input-bg) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md) !important;
  color: var(--text-primary) !important;
  transition: border-color 0.12s ease !important;
  box-shadow: none !important;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--text-muted) !important;
  outline: none !important;
  box-shadow: none !important;
}
input::placeholder { color: var(--text-muted) !important; }

/* ── HEADER & SIDEBAR ── */
.app-header {
  background: var(--bg) !important;
  border-bottom: 1px solid var(--border) !important;
}
.sidebar {
  background: var(--bg) !important;
  border-right: 1px solid var(--border) !important;
}
.tab {
  border-radius: var(--radius-md) !important;
  color: var(--text-secondary) !important;
}
.tab:hover {
  background: var(--surface-hover) !important;
  color: var(--text-primary) !important;
}
.tab.active {
  background: var(--surface-hover) !important;
  color: var(--text-primary) !important;
  font-weight: 600 !important;
}
.tab.active i { color: var(--text-primary) !important; }
.nav-group-title { color: var(--text-muted) !important; }

/* ── MODALS & DROPDOWN ── */
.modal-overlay { background: rgba(0, 0, 0, 0.6) !important; }
body.light-theme .modal-overlay { background: rgba(0, 0, 0, 0.35) !important; }
.modal {
  background: var(--surface-solid) !important;
  border: 1px solid var(--border-light) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-pop) !important;
}
#user-menu-dropdown {
  background: var(--surface-solid) !important;
  border: 1px solid var(--border-light) !important;
  box-shadow: var(--shadow-pop) !important;
}

/* ── TABLES ── */
table { border-collapse: collapse; }
th { color: var(--text-muted) !important; font-weight: 550 !important; border-bottom: 1px solid var(--border) !important; }
td { border-bottom: 1px solid var(--border) !important; }
tr:last-child td { border-bottom: none !important; }

/* ── PILLS / BADGES: outline kecil, bukan blok warna ── */
.ts-pill, .ts-range-pill {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-secondary) !important;
  border-radius: var(--radius-full, 999px) !important;
}
.ts-pill:hover, .ts-range-pill:hover { background: var(--surface-hover) !important; }
.ts-pill.active, .ts-range-pill.active {
  background: var(--surface-hover) !important;
  border-color: var(--text-primary) !important;
  color: var(--text-primary) !important;
  font-weight: 600 !important;
}

/* ── SWITCH ── */
.switch input:checked + .slider { background: var(--text-primary) !important; }
.switch input:checked + .slider::after { background: var(--bg) !important; }

/* ── STATUS DOTS: aktif putih (dark)/hitam (light), pulsa halus ── */
.dot.dot-active, .dot.dot-connected { background: var(--text-primary) !important; }
.dot.dot-warning { background: #d97706 !important; }
.dot.dot-error, .dot.dot-disconnected { background: var(--text-muted) !important; }

/* ── SCROLLBAR tipis netral ── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── FOCUS RING aksesibel tapi halus ── */
:focus-visible { outline: 2px solid var(--text-muted); outline-offset: 1px; }


body.light-theme .app-header { background: var(--bg) !important; border-bottom-color: var(--border) !important; }
body.light-theme .sidebar { background: var(--bg) !important; border-right-color: var(--border) !important; }
body.light-theme .tab { color: var(--text-secondary) !important; }
body.light-theme .tab.active { background: var(--surface-hover) !important; color: var(--text-primary) !important; }

/* ── LIGHT MODE HARDENING (bug fix kotak-dalam-kotak & kontras) ── */
body.light-theme .surface-box,
body.light-theme .panel-card,
body.light-theme .mc-card {
  background: #ffffff !important;
  border: 1px solid var(--border) !important;
  box-shadow: none !important;
}
/* MINIMALIS light: nested = flat transparan (tanpa tone layers) */
body.light-theme .surface-box .surface-box,
body.light-theme .panel-card .surface-box,
body.light-theme .mc-card .surface-box,
body.light-theme .surface-box .surface-box .surface-box {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}
body.light-theme .surface-box .badge,
body.light-theme .surface-box .stat-mini {
  border: none !important;
  background: transparent !important;
}
/* Semua tombol di light mode: teks kontras wajib */
body.light-theme .btn-primary,
body.light-theme .btn-save,
body.light-theme .btn-new {
  color: #ffffff !important;
}
/* Icon buttons header: konsisten putih + border */
body.light-theme .header-toggle-btn {
  background: #ffffff !important;
  border: 1px solid var(--border) !important;
  color: #3d3d3d !important;
}
/* Avatar fallback ungu -> monochrome */
#auth-user-avatar-fallback,
.account-avatar-fallback {
  background: linear-gradient(135deg, #3a3a3a, #1a1a1a) !important;
  color: #ffffff !important;
}
/* inputs di light: semua putih seragam */
body.light-theme input,
body.light-theme select,
body.light-theme textarea {
  background: #ffffff !important;
  border: 1px solid var(--border) !important;
  color: #0f0f0f !important;
}

/* ═══════════════════════════════════════════════════════════
   SHADOW SYSTEM — hanya 3 macam, seragam di seluruh panel
   - card: 0 1px 2px (hanya light mode; dark = none)
   - pop : modal, dropdown, tooltip
   - drawer: sidebar mobile
   Semua shadow lain (glow, ring, multi-layer) DIBUANG.
   ═══════════════════════════════════════════════════════════ */
.surface-box, .panel-card, .mc-card, .dashboard-stat-card, .heatmap-card,
.timeseries-card, .dashboard-history-card, .settings-item, .modal, #user-menu-dropdown,
.toast, .heatmap-tooltip, #ts-tooltip {
  box-shadow: none !important;
}
body.light-theme .surface-box,
body.light-theme .panel-card,
body.light-theme .mc-card,
body.light-theme .panel-card,
body.light-theme .modal {
  box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
}
.modal, #user-menu-dropdown, .heatmap-tooltip, #ts-tooltip {
  box-shadow: var(--shadow-pop) !important;
}
.sidebar { box-shadow: none !important; }
.sidebar.mobile-open { box-shadow: none !important; }
body.light-theme .sidebar.mobile-open { box-shadow: none !important; }

/* Glow hijau di dot/dll dibuang (monochrome) */
* { box-shadow: none !important; }
.dot.dot-active::after, .dot.dot-connected::after { box-shadow: none !important; }
/* Pemulihan: pop & drawer butuh shadow-nya kembali (rule di atas lebih spesifik) */

/* ── DROPDOWN MOBILE: tetap menempel navbar (bukan bottom-sheet) ── */
@media (max-width: 640px) {
  #user-menu-dropdown {
    position: fixed !important;
    top: 56px !important;          /* tepat di bawah navbar (52-56px) */
    right: 8px !important;
    left: auto !important;
    bottom: auto !important;
    width: min(300px, calc(100vw - 16px)) !important;
    min-width: 0 !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-pop) !important;
    z-index: 4010 !important;      /* level navbar */
    animation: userMenuIn 0.16s cubic-bezier(0.16,1,0.3,1) !important;
    transform-origin: top right !important;
  }
  /* pastikan aturan bottom-sheet lama (top:auto/bottom:12px) kalah */
}

/* ── TIMESERIES MOBILE FIX: Y-label tidak keluar batas ── */
.timeseries-svg { overflow: hidden !important; }
@media (max-width: 640px) {
  .timeseries-chart-wrapper { margin-left: 34px; width: calc(100% - 34px); }  /* ruang label kiri */
  .timeseries-y-label { font-size: 9px !important; }
}

/* ── STAT PLAIN: angka besar tanpa kotak ── */
.stat-plain {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 4px;
}
.stat-plain .stat-card-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.stat-plain .stat-card-value {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 640px) {
  .stat-plain .stat-card-value { font-size: 1.35rem; }
}
/* Grid stat tetap rapi tanpa kartu */
#dashboard-live-grid {
  gap: var(--space-md, 12px) var(--space-lg, 16px) !important;
}

/* Chips rows: scroll mulus dengan ruang kanan */
@media (min-width: 641px) {
  .timeseries-pills-group { padding-right: 8px; scrollbar-width: none; }
  .timeseries-pills-group::-webkit-scrollbar { display: none; }
}
@media (max-width: 640px) {
  .timeseries-pills-group {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
    overflow: visible !important;
  }
  .ts-pill, .ts-range-pill {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-secondary) !important;
  }
  .ts-pill.active, .ts-range-pill.active {
    background: var(--surface-hover) !important;
    border-color: var(--text-primary) !important;
    color: var(--text-primary) !important;
  }
}

/* ── ACTION BUTTONS (edit/delete row): kontras jelas di kedua tema ── */
.action-btn {
  color: var(--text-secondary) !important;
  border: 1px solid var(--border-light) !important;
  background: var(--surface) !important;
  opacity: 1 !important;
}
.action-btn:hover {
  color: var(--text-primary) !important;
  border-color: var(--text-muted) !important;
  background: var(--surface-hover) !important;
}
.action-btn i { opacity: 1 !important; }
/* Danger (trash) tetap merah agar fungsional */
.action-btn.danger, button[onclick*="delete"] {
  color: var(--red, #eb5757) !important;
}
/* Anti-dim: jangan ada rule yang mendorong opacity tombol row */
tr .action-btn, td .action-btn { opacity: 1 !important; }

/* ── TABLE SYSTEM: bersih di kedua tema ── */
.table-container, .table-responsive {
  background: var(--surface-solid) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: none !important;
  overflow: hidden;  /* radius clip; scroll dalam */
}
.table-container table, .table-responsive table { background: transparent !important; }
thead th, table th {
  background: var(--surface) !important;
  color: var(--text-muted) !important;
  font-weight: 600 !important;
  text-transform: uppercase;
  font-size: 0.72rem !important;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border) !important;
}
tbody td { border-bottom: 1px solid var(--border) !important; }
tbody tr:last-child td { border-bottom: none !important; }
tbody tr:hover td { background: var(--surface-hover) !important; }
/* Row badges: teks jelas, bg halus */
td span[style*="border-radius: 4px"], td span[style*="border-radius:4px"] {
  color: var(--text-primary) !important;
}

@media (max-width: 640px) {
  .timeseries-hero-val-row { flex-wrap: wrap; gap: 8px; }
  .timeseries-hero-subtitle { word-break: break-word; }
}

/* ═══ DASHBOARD STATS: FULL FLAT (tanpa kotak sama sekali) ═══ */
.dashboard-stat-card, .stat-card {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 4px 2px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
}
.dashboard-stat-card:hover, .stat-card:hover {
  transform: none !important;
  border: none !important;
  box-shadow: none !important;
}
.dashboard-stat-card .stat-card-icon { display: none !important; }
.dashboard-stat-card .stat-card-label, .stat-plain .stat-card-label {
  font-size: 0.7rem !important;
  color: var(--text-muted) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.08em !important;
  font-weight: 600 !important;
  opacity: 1 !important;
}
.dashboard-stat-card .stat-card-value, .stat-plain .stat-card-value {
  font-size: 1.8rem !important;
  font-weight: 700 !important;
  color: var(--text-primary) !important;
  letter-spacing: -0.02em !important;
  line-height: 1.1 !important;
  font-variant-numeric: tabular-nums !important;
}
@media (max-width: 768px) {
  .dashboard-stat-card .stat-card-value, .stat-plain .stat-card-value { font-size: 1.4rem !important; }
}
#dashboard-live-grid {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
  gap: 10px 18px !important;
}
@media (max-width: 768px) {
  #dashboard-live-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px 14px !important; }
}

/* ── AUDIO PANEL: tombol kontrol wrap di mobile (tidak terpotong) ── */
@media (max-width: 640px) {
  /* Row Aktifkan TTS + Skip + Clear Queue */
  #panel-audio div[style*="display: flex"][style*="margin-bottom: 20px"] {
    flex-wrap: wrap !important;
  }
  #panel-audio #tts-toggle { flex: 1 1 100% !important; }
  #panel-audio #tts-skip-btn,
  #panel-audio #tts-clear-btn { flex: 1 1 auto !important; }
  /* Semua btn di panel audio boleh menyusut, teks nowrap */
  #panel-audio .btn { min-width: 0 !important; }
  /* Sub-tab switcher juga wrap-safe */
  #panel-audio > div:first-child { flex-wrap: wrap !important; }
}
/* Global safety: flex rows tombol tidak boleh overflow diam-diam */
.btn { white-space: nowrap; }

/* ── FORM CONTROLS: kontras pasti di light mode ── */
.custom-checkbox {
  border: 1.5px solid var(--text-muted) !important;  /* terlihat jelas */
  background: var(--surface) !important;
}
.custom-checkbox:checked { background: var(--primary) !important; }
/* file-btn & file-text: konsisten */
.file-btn {
  background: var(--surface-hover) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border) !important;
}
.file-text { color: var(--text-secondary) !important; }
/* helper text jangan terlalu pudar */
.helper-text { color: var(--text-secondary) !important; opacity: 1 !important; }
/* color input swatch */
input[type="color"] {
  border: 1px solid var(--border-light) !important;
  border-radius: var(--radius-md) !important;
  min-height: 34px;
  padding: 2px !important;
  background: var(--surface) !important;
}

/* ── OVERLAY STUDIO: panel UI theme-aware (stage canvas TETAP gelap = representasi OBS) ── */
.cs-widget-box { background: var(--surface-hover) !important; border: 1px solid var(--border) !important; }
.cs-scrub-handle { background: var(--surface-hover) !important; }
.cs-layer-stack-list { background: var(--surface) !important; border: 1px solid var(--border) !important; }
.cs-layer-item { background: transparent !important; border-color: var(--border) !important; }
.cs-layer-item:hover { background: var(--surface-hover) !important; }
.cs-overview-card { background: var(--surface-solid) !important; border-color: var(--border) !important; }
/* sidebar mobile: pastikan BISA scroll (drawer body overflow) */
@media (max-width: 768px) {
  .sidebar {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .sidebar .tabs.sidebar-tabs {
    min-height: 0 !important;
    flex: 1 1 auto !important;
    height: auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  .sidebar .tab-settings-bottom { flex-shrink: 0 !important; }
}

/* ── ACCOUNT: langganan mobile rapi ── */
@media (max-width: 640px) {
  #account-plan-limits { grid-template-columns: 1fr 1fr !important; }
  .account-upgrade-row { flex-direction: column !important; align-items: stretch !important; }
  .account-upgrade-row .input-field { min-width: 0 !important; width: 100% !important; }
  .account-upgrade-row .btn { width: 100% !important; justify-content: center; }
  #account-plan-card { padding: var(--space-md) !important; }
}

/* ═══ NUKLIR ANTI-PILL: label & stat SEKALI SELAMANYA tanpa stroke/pill ═══ */
.stat-plain .stat-card-label,
.dashboard-stat-card .stat-card-label,
.stat-plain .stat-card-value,
.dashboard-stat-card .stat-card-value,
.stat-plain, .dashboard-stat-card {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  padding: 2px 0 !important;
  text-shadow: none !important;
}
.stat-plain .stat-card-label::before,
.stat-plain .stat-card-label::after,
.dashboard-stat-card .stat-card-label::before,
.dashboard-stat-card .stat-card-label::after {
  display: none !important;
  content: none !important;
}

/* ═══════════════════════════════════════════════════════════
   PAGINATION STANDARD — satu komponen untuk semua tabel
   (acuan: music playlist). Struktur:
   .pagination-bar > .pagination-left (limit select + summary)
                   + .pagination-right (prev, counter, next)
   ═══════════════════════════════════════════════════════════ */
.pagination-bar, .footer-bar[id$="-pagination"], [id$="-pagination"] {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  padding: 10px 14px !important;
  border-top: 1px solid var(--border) !important;
  font-size: var(--font-sm, 12px) !important;
  background: transparent !important;
}
.pagination-left, [id$="-pagination"] > div:first-child {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}
.pagination-right, [id$="-pagination"] > div:last-child {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
}
.pagination-limit, [id$="-pagination"] select {
  padding: 5px 8px !important;
  font-size: var(--font-sm, 12px) !important;
  width: auto !important;
  min-height: 30px !important;
  border-radius: var(--radius-md, 10px) !important;
  background: var(--input-bg) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-primary) !important;
}
.pagination-btn {
  width: 32px !important;
  height: 32px !important;
  min-height: 32px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  border-radius: var(--radius-md, 10px) !important;
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-secondary) !important;
  cursor: pointer !important;
  transition: background 0.12s, border-color 0.12s, color 0.12s !important;
}
.pagination-btn:hover:not(:disabled) {
  background: var(--surface-hover) !important;
  border-color: var(--text-muted) !important;
  color: var(--text-primary) !important;
}
.pagination-btn:disabled {
  opacity: 0.4 !important;
  cursor: not-allowed !important;
}
.pagination-counter, [id$="-page-counter"] {
  font-weight: 700 !important;
  min-width: 48px !important;
  text-align: center !important;
  font-variant-numeric: tabular-nums !important;
  color: var(--text-primary) !important;
  font-size: var(--font-sm, 12px) !important;
}
.pagination-info, [id$="-pagination-info"] {
  color: var(--text-secondary) !important;
  font-weight: 600 !important;
  font-variant-numeric: tabular-nums !important;
}
.pagination-label { color: var(--text-muted) !important; }
.pagination-summary { color: var(--text-muted) !important; font-variant-numeric: tabular-nums !important; }
@media (max-width: 640px) {
  .pagination-bar, [id$="-pagination"] {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .pagination-left, .pagination-right,
  [id$="-pagination"] > div:first-child,
  [id$="-pagination"] > div:last-child {
    justify-content: space-between !important;
  }
}

/* ═══ MODAL SOLID: tidak pernah fade — selalu opacity 1, animasi transform saja ═══ */
.modal-overlay { animation: none !important; opacity: 1 !important; }
.modal {
  animation: modalPop 0.16s cubic-bezier(0.16, 1, 0.3, 1) !important;
  opacity: 1 !important;
}
@keyframes modalPop {
  0%   { transform: scale(0.97) translateY(6px); }   /* TANPA opacity di keyframes */
  100% { transform: scale(1) translateY(0); }
}
/* Backdrop lebih tipis — modal jelas pop, bukan "redup di balik kabut" */
.modal-overlay { background: rgba(0, 0, 0, 0.45) !important; backdrop-filter: blur(2px) !important; }
body.light-theme .modal-overlay { background: rgba(0, 0, 0, 0.25) !important; }
/* Modal sendiri: solid penuh */
.modal { background: var(--surface-solid) !important; }
body.light-theme .modal { background: #ffffff !important; }
/* Anti-fade di semua varian modal (interactionModal, timerModal, dll) */
.modal-overlay .modal, .modal.large, .modal-overlay > .modal {
  opacity: 1 !important;
  animation: modalPop 0.16s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* ═══ Mobile drawer: touch scroll robustness (Samsung/Chrome Android) ═══ */
@media (max-width: 768px) {
  .sidebar.mobile-open {
    visibility: visible !important; /* lawan inline gate style yang bisa tertinggal */
    pointer-events: auto !important;
    touch-action: pan-y !important;
    overscroll-behavior: contain;
  }
  .sidebar.mobile-open .tabs.sidebar-tabs {
    touch-action: pan-y !important;
    overscroll-behavior-y: contain !important;
    -webkit-overflow-scrolling: touch !important;
    /* nested scroll di Chrome Android: konten flex harus boleh melebihi container */
    display: block !important;
    padding-bottom: 24px;
  }
  .sidebar.mobile-open .nav-group-items { display: block !important; }
  /* backdrop tidak boleh menelan touch sidebar */
  body.sidebar-open::after { touch-action: pan-y; }
}

/* ═══ Elemen form native sisanya: radio & color — konsisten semua theme ═══ */
.custom-radio,
input[type="radio"] {
  -webkit-appearance: none !important;
  appearance: none !important;
  width: 18px !important; height: 18px !important;
  min-width: 18px !important; max-width: 18px !important;
  min-height: 18px !important; max-height: 18px !important;
  border-radius: 50%;
  border: 1.5px solid var(--text-muted) !important;
  background: var(--surface) !important;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  position: relative;
  transition: all 0.15s ease;
  flex-shrink: 0;
  margin: 0;
}
.custom-radio:hover, input[type="radio"]:hover { border-color: var(--text-primary) !important; }
.custom-radio:checked, input[type="radio"]:checked {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
}
.custom-radio:checked::after, input[type="radio"]:checked::after {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary-text);
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}

/* Color input: swatch bulat rapi, border theme-aware */
input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm, 8px);
  background: var(--surface) !important;
  cursor: pointer;
  padding: 2px !important;
  min-height: 34px;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 4px; }
input[type="color"]::-moz-color-swatch { border: none; border-radius: 4px; }

/* ═══ Chrome autofill fix: tidak boleh putih/kuning di kedua theme ═══ */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px var(--input-bg) inset !important;
  -webkit-text-fill-color: var(--text-primary) !important;
  caret-color: var(--text-primary);
  transition: background-color 9999s ease-in-out 0s;
}

/* Number spinner: theme-aware (bukan default abu chrome) */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

/* File input native (kalau terlihat): theme-aware */
input[type="file"] {
  color: var(--text-secondary);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 12px;
}
input[type="file"]::file-selector-button {
  background: var(--surface-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  margin-right: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
}
input[type="file"]::file-selector-button:hover { background: var(--border-light); }

/* ═══ LIGHT-FIRST: glass → semi-solid putih + border tegas (aturan anti-glass) ═══ */
@media (prefers-reduced-workarounds: none) { /* noop guard */
}
body.light-theme .app-header {
  background: rgba(255, 255, 255, 0.92) !important;  /* bg-white/92 */
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  border-bottom: 1px solid var(--border) !important; /* border tegas */
}
body.light-theme .player-bar {
  background: rgba(255, 255, 255, 0.94) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-card) !important;
}
body.light-theme .toast {
  background: #ffffff !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-strong) !important;
  box-shadow: var(--shadow-pop) !important;
}
body.light-theme .sidebar {
  background: #ffffff !important;
  border-right: 1px solid var(--border) !important;
}
body.light-theme .main-wrapper { background: var(--bg) !important; }
/* modal card: putih murni + shadow ambient */
body.light-theme .modal,
body.light-theme .modal-content {
  background: #ffffff !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-ambient) !important;
}
/* scrim modal: slate gelap transparan (bukan hitam pekat) */
body.light-theme .modal-overlay {
  background: rgba(15, 23, 42, 0.42) !important;
  backdrop-filter: blur(4px) !important;
}


/* ═══════════════════════════════════════════════════════════════════════════
   UNSLOP PASS — heydamir/unslop (CC BY 4.0)
   Direction: craft monochrome, quiet chrome, satu accent. Tetap fitur & konten.
   ═══════════════════════════════════════════════════════════════════════════ */

/* 1) Toggle/switch: hijau → neutral accent (primary). Hijau hanya utk sukses
      semantik; "enabled" bukan sukses. */
.switch input:checked + .slider,
.toggle-switch input:checked + .slider,
input:checked + .slider {
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
}
.switch input:checked + .slider:before,
.toggle-switch input:checked + .slider:before {
  background-color: var(--primary-text, #0a0a0a) !important;
}

/* 2) Uppercase tracked labels → sentence case (skill: no NAVIGATION-style
      uppercase tracking). */
.nav-group-header,
.mc-section-label,
.section-label,
[class*="section-label"],
.sidebar .nav-group > .nav-group-header span {
  text-transform: none !important;
  letter-spacing: 0 !important;
}

/* 3) Reconnect/secondary: orange semantik-salah → neutral outline.
      (kuning/oranye disisakan hanya utk warning asli). */
.btn-secondary.btn-warning,
.btn.btn-warning-outline,
.mc-btn-reconnect,
[class*="reconnect"] {
  color: var(--text-primary) !important;
  border-color: var(--border) !important;
}

/* 4) Motion: hilangkan transition-all berlebihan pada switch (per skill:
      transition hanya color/background/border/opacity/transform). */
.slider, .slider:before {
  transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* 5) Badge versi / status: pill → quiet text (skill: badges quiet). */
.version-badge, .app-version {
  background: transparent !important;
  border: 1px solid var(--border) !important;
  color: var(--text-muted) !important;
}


/* ── UNSLOP PASS 2: selektor spesifik ── */

/* Toggle/switch (index.css asli: input:checked + .slider → var(--green)) */
input:checked + .slider {
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
}
input:checked + .slider:before {
  background-color: var(--primary-text) !important;
}

/* Reconnect = bukan warning, jadi bukan oranye (kuning disisakan hanya utk
   peringatan nyata). */
.btn-warning-outline {
  color: var(--text-primary) !important;
  border: 1px solid var(--border-strong) !important;
}
.btn-warning-outline:hover {
  background: var(--surface-hover) !important;
  border-color: var(--text-muted) !important;
}

/* Section labels: sentence case (hilangkan wide tracking) */
.mc-section-label,
.section-label,
[data-lang-id^="mc-section"],
[id$="-label"].uppercase {
  text-transform: none !important;
  letter-spacing: 0.01em !important;
}


/* ── UNSLOP PASS 3: specificity setingkat body.light-theme (kalahkan linear-layout) ── */
body.light-theme input:checked + .slider,
body.light-theme .switch input:checked + .slider,
body.light-theme .toggle-switch input:checked + .slider,
body input:checked + .slider {
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
}
body.light-theme input:checked + .slider:before,
body input:checked + .slider:before {
  background-color: var(--primary-text) !important;
}
/* Reconnect netral (kalahkan .btn-warning-outline oranye) */
body.light-theme .btn-warning-outline,
body .btn-warning-outline {
  color: var(--text-primary) !important;
  border: 1px solid var(--border-strong) !important;
  background: transparent !important;
}
body.light-theme .btn-warning-outline:hover,
body .btn-warning-outline:hover {
  background: var(--surface-hover) !important;
  border-color: var(--text-muted) !important;
}


/* ── UNSLOP PASS 4: sentence case untuk semua label kecil ── */
body th,
body .nav-group-header,
body [data-lang-id$="-label"],
body [id$="-label"] {
  text-transform: none !important;
  letter-spacing: 0.01em !important;
}
/* Berat heading: 700 → 600 pada label kecil (skill: weights 400–500, 600 jarang) */
body .nav-group-header {
  font-weight: 600 !important;
}
