/* ============================================================
   GEBANG LAGU — UI modern: emerald + gold, glassmorphism subtle
   Dark mode default, Light mode via [data-theme="light"]
   ============================================================ */

:root {
  --emerald: #10b981;
  --emerald-2: #059669;
  --emerald-soft: rgba(16, 185, 129, .14);
  --gold: #f2b33d;
  --gold-soft: rgba(242, 179, 61, .14);
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, .14);

  --radius-lg: 18px;
  --radius-md: 13px;
  --radius-sm: 9px;
  --ease: cubic-bezier(.4, 0, .2, 1);
  --dur: .2s;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #0c1210;
  --bg-top: #0e2a1e;
  --bg-bottom: #03080a;
  --bg-grad-1: rgba(16, 185, 129, .10);
  --bg-grad-2: rgba(16, 185, 129, .06);
  --surface: rgba(22, 30, 27, .82);
  --surface-1: #161e1b;
  --surface-2: #161e1b;
  --surface-3: #1b2521;
  --border: rgba(255, 255, 255, .08);
  --border-2: rgba(255, 255, 255, .16);
  --text: #e7efe9;
  --muted: #93a29a;
  --muted-2: #5d6b64;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --glass: blur(16px) saturate(1.25);
  --code-bg: rgba(0, 0, 0, .35);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f4f7f5;
  --bg-top: #f8fbf8;
  --bg-bottom: #edf3ef;
  --bg-grad-1: rgba(16, 185, 129, .09);
  --bg-grad-2: rgba(16, 185, 129, .05);
  --surface: rgba(255, 255, 255, .85);
  --surface-1: #ffffff;
  --surface-2: #ffffff;
  --surface-3: #f0f4f1;
  --border: rgba(12, 18, 15, .10);
  --border-2: rgba(12, 18, 15, .18);
  --text: #17211b;
  --muted: #5c6b63;
  --muted-2: #96a29b;
  --shadow: 0 10px 30px rgba(20, 40, 30, .10);
  --glass: blur(16px) saturate(1.1);
  --code-bg: rgba(16, 185, 129, .08);
  color-scheme: light;
}

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

html, body { height: 100%; }

body {
  background:
    radial-gradient(1150px 560px at 50% -14%, var(--bg-grad-1), transparent 62%),
    radial-gradient(760px 420px at 88% -12%, var(--bg-grad-2), transparent 55%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 48%, var(--bg-bottom) 100%);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  /* Seluruh window bisa digeser dari area kosong mana pun */
  -webkit-app-region: drag;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(128, 148, 138, .35); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(128, 148, 138, .55); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

code { font-family: var(--mono); font-size: 12px; background: var(--code-bg); padding: 2px 6px; border-radius: 6px; color: var(--emerald); }

/* Drag area atas (di bawah traffic light macOS) — body sudah drag,
   strip ini tetap dijaga supaya area traffic light selalu bisa dipakai geser */
.dragbar {
  position: fixed; top: 0; left: 0; right: 0; height: 42px;
  -webkit-app-region: drag; z-index: 5;
}

/* Elemen interaktif & area scroll: TIDAK ikut menggeser jendela,
   jadi tetap bisa diklik / di-scroll / diseleksi teksnya */
button, input, select, textarea, summary, label, a,
[contenteditable], .main-body, .log, .song-item, .song-result,
.project-item, .key-item, .pathbox, .check, .seg, .toast {
  -webkit-app-region: no-drag;
}

/* ============ LAYOUT ============ */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: 248px;
  display: flex; flex-direction: column;
  background: var(--surface);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border-right: 1px solid var(--border);
  padding: 58px 12px 16px;
  transition: width var(--dur) var(--ease);
  z-index: 10;
}

.main {
  position: fixed; top: 0; left: 248px; right: 0; bottom: 0;
  display: flex; flex-direction: column;
  transition: left var(--dur) var(--ease);
}

/* ============ SIDEBAR ============ */
.side-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 0 6px 18px;
  min-height: 44px;
}
.side-logo {
  width: 38px; height: 38px; border-radius: 11px;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(242, 179, 61, .25);
}
.side-brand-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.side-title { font-size: 15.5px; font-weight: 800; letter-spacing: .2px; white-space: nowrap; }
.side-title em { font-style: normal; color: var(--emerald); }
.side-sub { font-size: 11px; color: var(--muted); white-space: nowrap; }
.side-collapse { margin-left: auto; }

.side-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--muted);
  font-size: 13.5px; font-weight: 600;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  white-space: nowrap;
  overflow: hidden;
}
.nav-item svg { width: 19px; height: 19px; flex-shrink: 0; }
.nav-item:hover { color: var(--text); background: var(--surface-3); }
.nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, var(--emerald), var(--emerald-2));
  box-shadow: 0 6px 16px rgba(16, 185, 129, .35);
}
[data-theme="light"] .nav-item.active { color: #fff; }
.nav-item:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.side-bottom { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.profile { display: flex; align-items: center; gap: 11px; padding: 8px; border-radius: var(--radius-md); }
.profile:hover { background: var(--surface-3); }
.profile-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--gold), var(--emerald));
  color: #fff; flex-shrink: 0;
}
.profile-avatar svg { width: 18px; height: 18px; }
.profile-text { display: flex; flex-direction: column; min-width: 0; }
.p-name { font-size: 13px; font-weight: 700; white-space: nowrap; }
.p-mail { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-check { justify-content: center; }

/* collapsed */
body.side-collapsed .sidebar { width: 68px; }
body.side-collapsed .main { left: 68px; }
body.side-collapsed .side-brand-text,
body.side-collapsed .ni-label,
body.side-collapsed .profile-text { display: none; }
/* Saat diciutkan: logo benar-benar di tengah, tombol collapse jadi
   overlay transparan di area logo (tetap bisa diklik untuk kembangkan) */
body.side-collapsed .side-brand { position: relative; justify-content: center; }
body.side-collapsed .side-collapse {
  position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; opacity: 0; border-radius: var(--radius-md);
}
body.side-collapsed .nav-item { justify-content: center; padding: 10px 0; }
body.side-collapsed .profile { justify-content: center; }
body.side-collapsed .side-check span { display: none; }
body.side-collapsed .side-check svg { margin: 0; }
body.side-collapsed .side-bottom { align-items: center; }

/* ============ MAIN HEADER ============ */
.main-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 30px 10px;
  gap: 12px;
}
.head-crumb { font-size: 12.5px; color: var(--muted); }
.head-crumb b { color: var(--text); font-weight: 700; }
.crumb-sep { margin: 0 6px; color: var(--muted-2); }
.head-actions { display: flex; align-items: center; gap: 10px; }

.main-body {
  flex: 1; overflow-y: auto;
  padding: 6px 30px 40px;
}

/* ============ PAGES ============ */
.page { display: none; animation: fade-up .22s var(--ease); }
.page.active { display: block; }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-head { margin: 8px 0 18px; }
.page-head h2 { font-size: 22px; font-weight: 800; letter-spacing: -.3px; }
.page-head p { font-size: 13px; color: var(--muted); margin-top: 3px; }

/* ============ CARDS ============ */
.card {
  background: var(--surface);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  transition: border-color var(--dur) var(--ease);
}
.card:hover { border-color: var(--border-2); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h3 { font-size: 14.5px; font-weight: 700; }
.hint { font-size: 12px; color: var(--muted); }
.opts-hint { margin-bottom: 14px; }

/* ============ STATS ============ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat-card {
  background: var(--surface);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 3px;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--border-2); }
.stat-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.stat-card b { font-size: 26px; font-weight: 800; letter-spacing: -.5px; color: var(--emerald); }
.stat-card b.gold { color: var(--gold); }
.stat-sub { font-size: 11.5px; color: var(--muted-2); }

.dash-actions { display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.dash-output { margin-top: 4px; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 13.5px; font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  white-space: nowrap;
  user-select: none;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.btn-primary {
  background: linear-gradient(135deg, var(--emerald), var(--emerald-2));
  color: #fff;
  box-shadow: 0 6px 18px rgba(16, 185, 129, .35);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(16, 185, 129, .45); }
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary.loading { pointer-events: none; color: transparent; }
.btn-primary.loading::after {
  content: ""; position: absolute;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn-primary.loading { position: relative; }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-2);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--emerald); color: var(--emerald); box-shadow: 0 0 0 3px var(--emerald-soft); }

.btn-tertiary { background: transparent; color: var(--muted); padding: 7px 10px; }
.btn-tertiary:hover:not(:disabled) { color: var(--emerald); background: var(--emerald-soft); }

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(248, 113, 113, .4);
}
.btn-danger:hover:not(:disabled) { background: rgba(248, 113, 113, .2); box-shadow: 0 0 0 3px rgba(248, 113, 113, .12); }

.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-big { padding: 13px 26px; font-size: 15px; border-radius: var(--radius-md); }
@keyframes spin { to { transform: rotate(360deg); } }

/* icon-only button */
.icon-btn {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { color: var(--text); background: var(--surface-3); border-color: var(--border-2); }
.icon-btn.danger:hover { color: var(--danger); border-color: rgba(248,113,113,.4); }
.icon-btn.ok:hover { color: var(--emerald); border-color: rgba(16,185,129,.45); }
.icon-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

[data-theme="dark"] .ico-moon { display: none; }
[data-theme="light"] .ico-sun { display: none; }

/* ============ FIELDS ============ */
.field-row { display: flex; align-items: center; gap: 12px; margin-bottom: 11px; }
.field-row > label { width: 132px; font-size: 12.5px; color: var(--muted); flex-shrink: 0; }
.pathbox {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 8px 7px 13px;
  transition: border-color var(--dur) var(--ease);
}
.pathbox:focus-within { border-color: var(--emerald); }
.path-text { font-family: var(--mono); font-size: 12px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }

.opts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(205px, 1fr)); gap: 14px; margin-bottom: 10px; }
.opt { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.opt > label { font-size: 12px; font-weight: 600; color: var(--muted); }

select, input[type="text"], input[type="number"], input[type="password"] {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  width: 100%;
  min-width: 0;
}
select:focus, input:focus { border-color: var(--emerald); box-shadow: 0 0 0 3px var(--emerald-soft); }
input::placeholder { color: var(--muted-2); }
input.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; padding: 9px 0; min-height: 38px; }
.check input { width: 16px; height: 16px; accent-color: var(--emerald); flex-shrink: 0; }

.action-row { display: flex; gap: 12px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.action-row.inline { margin: 0 0 14px; }

/* segmented (tema) */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; gap: 3px; }
.seg-btn {
  border: none; background: transparent; color: var(--muted);
  padding: 6px 14px; border-radius: 7px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: linear-gradient(135deg, var(--emerald), var(--emerald-2)); color: #fff; }
.pref-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 10px; }

/* ============ SONG LIST ============ */
.song-list { display: flex; flex-direction: column; gap: 8px; }
.song-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 15px;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.song-item:hover { border-color: var(--border-2); }
.song-item.selected { border-color: var(--emerald); background: var(--emerald-soft); }
.song-check { width: 17px; height: 17px; accent-color: var(--emerald); flex-shrink: 0; cursor: pointer; }
.song-name { font-weight: 700; font-size: 13.5px; min-width: 100px; }
.song-style { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-meta { font-size: 11px; color: var(--muted-2); font-family: var(--mono); flex-shrink: 0; }

/* ============ PROGRESS ============ */
.progress-track {
  height: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--emerald), var(--gold));
  border-radius: 999px;
  transition: width .4s var(--ease);
  box-shadow: 0 0 14px rgba(16, 185, 129, .5);
}
.song-results { margin-top: 14px; display: flex; flex-direction: column; gap: 7px; }
.log-live-head { margin-top: 18px; margin-bottom: 10px; }
.log-live-head h3 { font-size: 12.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.log-live { height: 170px; }
.song-result {
  font-size: 12.5px;
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  animation: fade-up .2s var(--ease);
}
.song-result.ok { border-color: rgba(52, 211, 153, .35); }
.song-result.ok .sr-ico { color: var(--success); }
.song-result.fail { border-color: rgba(248, 113, 113, .35); }
.song-result.fail .sr-ico { color: var(--danger); }
.sr-ico { flex-shrink: 0; display: grid; place-items: center; }
.sr-ico svg { width: 16px; height: 16px; }
.song-result .rr { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--emerald); cursor: pointer; text-decoration: underline; }

/* ============ PROJECTS ============ */
.project-list { display: flex; flex-direction: column; gap: 8px; }
.project-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 15px;
  animation: fade-up .2s var(--ease);
}
.project-item .p-ico {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--emerald-soft); color: var(--emerald);
}
.project-item .p-ico svg { width: 17px; height: 17px; }
.project-item .p-ico.fail { background: var(--danger-soft); color: var(--danger); }
.project-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.p-name { font-size: 13.5px; font-weight: 700; }
.p-time { font-size: 11px; color: var(--muted-2); font-family: var(--mono); }
.p-files { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-open { flex-shrink: 0; }
.p-actions { display: flex; gap: 8px; flex-shrink: 0; }
.p-play svg { width: 12px; height: 12px; margin-right: 5px; vertical-align: -1px; }
.sr-play { width: 28px; height: 28px; flex-shrink: 0; }
.sr-play svg { width: 13px; height: 13px; }

/* ============ PEMUTAR AUDIO (review hasil audio) ============ */
.player {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 16px;
  background: var(--surface-1);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-app-region: no-drag;
}
.player[hidden] { display: none; }
.player-btn { width: 34px; height: 34px; flex-shrink: 0; }
.player-btn svg { width: 16px; height: 16px; }
.player-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.player-title {
  font-size: 12px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.player-time { font-size: 11px; color: var(--muted-2); font-family: var(--mono); flex-shrink: 0; }
.player-vol { flex-shrink: 0; display: flex; align-items: center; width: 96px; }
#playerVolume {
  width: 100%; height: 4px; cursor: pointer;
  accent-color: var(--emerald); background: transparent;
}
#playerSeek {
  width: 100%; height: 4px; cursor: pointer;
  accent-color: var(--emerald); background: transparent;
}

/* ============ LINK EKSTERNAL (dibuka di browser default) ============ */
.ext-link { color: var(--emerald); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.ext-link:hover { color: var(--emerald-2); }
.profile-text .ext-link.watermark { color: inherit; text-decoration: none; }
.profile-text .ext-link.watermark:hover { text-decoration: underline; }
.help-links { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }

/* ============ LOG ============ */
.log {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  height: 340px;
  overflow-y: auto;
  padding: 13px 15px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
}
.log .l-info { color: var(--text); }
.log .l-ok { color: var(--success); }
.log .l-warn { color: var(--warning); }
.log .l-error { color: var(--danger); }

/* Cover page */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
.advanced { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 12px; margin-top: 8px; }
.advanced summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; }
.check input { accent-color: var(--emerald); }
.status-text { font-weight: 600; padding: 4px 10px; border-radius: 12px; font-size: 12px; }
.status-running { background: var(--emerald); color: #052e16; }
.status-done { background: var(--success); color: #052e16; }
.status-error { background: var(--danger); color: #fff; }
.status-text.status-running { display: inline-flex; align-items: center; gap: 7px; }
.status-text.status-running::before {
  content: ""; width: 11px; height: 11px; flex-shrink: 0;
  border: 2px solid rgba(5, 46, 22, .3); border-top-color: #052e16;
  border-radius: 50%; animation: spin .7s linear infinite;
}
/* Shimmer pada editor Style/Lirik saat deteksi Gemini berjalan */
.detect-busy { position: relative; color: var(--muted-2) !important; pointer-events: none; }
.detect-busy::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(100deg, transparent 30%, rgba(16,185,129,.10) 50%, transparent 70%);
  background-size: 220% 100%;
  animation: detect-shimmer 1.4s ease-in-out infinite;
}
@keyframes detect-shimmer { from { background-position: 180% 0; } to { background-position: -80% 0; } }
.log-err { color: var(--danger); }
.log-warn { color: var(--warning); }
.log-info { color: var(--text); }

/* ===== Cover Musik (page-cover) ===== */
.suno-editor { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.suno-pane {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.suno-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.suno-label { font-weight: 600; font-size: 13px; }
.suno-hint { font-size: 11px; color: var(--muted-2); }
.suno-pane textarea {
  width: 100%; resize: vertical;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
}
.suno-pane textarea:focus { outline: 1px solid var(--emerald); outline-offset: -1px; }
.suno-foot { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted-2); font-family: var(--mono); }
.suno-foot .dot { opacity: 0.5; }
.suno-section-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.sb-btn {
  background: var(--surface-1);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 11px;
  font-family: var(--mono);
  padding: 4px 8px;
  cursor: pointer;
  white-space: nowrap;
}
.sb-btn:hover { color: var(--text); border-color: var(--emerald); }
.sb-btn.ghost { background: transparent; border: none; padding: 4px 6px; }
.sb-btn.ghost svg { width: 14px; height: 14px; }
.suno-sep { width: 1px; height: 18px; background: var(--border); margin: 0 2px; }

.grid-1 { display: grid; grid-template-columns: 1fr; gap: 12px; }

.cover-preview {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-1);
}
.cover-preview .mini-play {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--emerald); color: #052e16; border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
}
.cover-preview .mini-play svg { width: 20px; height: 20px; }
.cover-preview .mini-play[disabled] { opacity: 0.4; cursor: not-allowed; }
.cover-preview-meta { flex: 1 1 auto; min-width: 0; }
.cover-preview-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cover-preview-sub { font-size: 11px; color: var(--muted-2); font-family: var(--mono); }
.cover-waveform { flex: 0 0 140px; height: 40px; display: block; }
.cover-preview .icon-btn { width: 26px; height: 26px; flex-shrink: 0; }
.cover-preview .icon-btn svg { width: 16px; height: 16px; }
#coverPreviewVolume { width: 80px; height: 4px; cursor: pointer; accent-color: var(--emerald); background: transparent; flex-shrink: 0; }

.editor-toolbar {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-bottom: none;
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
  background: var(--surface-1);
}
.editor-toolbar + textarea {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  margin-top: 0;
}
.tb-btn {
  background: transparent; border: none; color: var(--muted);
  width: 26px; height: 26px; display: inline-flex;
  align-items: center; justify-content: center;
  border-radius: 4px; cursor: pointer; padding: 0;
}
.tb-btn:hover { background: var(--surface-2); color: var(--text); }
.tb-btn svg { width: 16px; height: 16px; }
.tb-btn[data-tb="mode"] { width: auto; padding: 0 8px; font-size: 12px; font-weight: 600; }
.tb-sep { width: 1px; height: 16px; background: var(--border); margin: 0 2px; }

.cover-controls {
  display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px;
  align-items: end; margin-top: 8px;
}
@media (max-width: 900px) {
  .cover-controls { grid-template-columns: 1fr; }
}

.cover-sliders { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.cover-slider { padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-md); }
.cs-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.cs-label { font-weight: 600; font-size: 13px; }
.cs-value { font-size: 12px; color: var(--emerald); font-family: var(--mono); }
.cover-slider input[type="range"] {
  width: 100%; height: 4px; cursor: pointer;
  accent-color: var(--emerald); background: transparent;
}

.cover-actions { display: flex; align-items: center; gap: 10px; }
.cover-actions .status-text { margin-left: auto; }

.card-head-row { display: flex; align-items: center; justify-content: space-between; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn.ghost:hover { color: var(--text); background: var(--surface-1); }

/* Edit mode dropdown (Cover ▾ di card Audio) */
.edit-mode-wrap { position: relative; }
.edit-mode-menu {
  position: absolute; right: 0; top: calc(100% + 4px);
  width: min(380px, calc(100vw - 32px));
  background-color: #161e1b;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 1000;
  padding: 6px;
  max-height: min(70vh, 520px); overflow-y: auto;
  opacity: 1;
  isolation: isolate;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  overscroll-behavior: contain;
}
@media (max-width: 480px) {
  .edit-mode-menu { width: calc(100vw - 16px); }
}
[data-theme="light"] .edit-mode-menu { background-color: #ffffff; }
.edit-mode-menu[hidden] { display: none !important; }

/* Backdrop overlay di belakang dropdown (mode modal) */
.edit-mode-backdrop {
  position: fixed; inset: 0;
  background-color: rgba(0, 0, 0, 0.55);
  z-index: 9999;
  opacity: 1;
}
.emm-group + .emm-group { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--border); }
.emm-group-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--muted-2); padding: 6px 10px 2px;
}
.emm-item {
  display: flex; align-items: flex-start; gap: 10px;
  width: 100%; padding: 8px 10px;
  background: transparent; border: none; border-radius: var(--radius-md);
  color: var(--text); cursor: pointer; text-align: left;
  font-family: inherit; font-size: 13px;
}
.emm-item:hover { background: var(--surface-2); }
.emm-item.emm-active { background: var(--surface-2); border: 1px solid var(--emerald); }
.emm-ico { width: 28px; height: 28px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.emm-ico svg { width: 18px; height: 18px; }
.emm-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.emm-title { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.emm-desc { font-size: 11px; color: var(--muted-2); line-height: 1.4; }
.emm-badge {
  font-size: 9px; font-weight: 700; letter-spacing: 0.04em;
  background: var(--emerald); color: #052e16;
  padding: 1px 6px; border-radius: 8px; text-transform: uppercase;
}

.cover-mode-panel {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-1);
}
.cmp-section { display: flex; flex-direction: column; gap: 8px; }
.cmp-section h4 { margin: 0 0 4px; font-size: 14px; }
.cmp-section .hint { margin: 0; }
.cmp-section label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted-2); }
.cmp-section input, .cmp-section textarea { color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 6px 10px; font-size: 13px; }
.cmp-section textarea { resize: vertical; font-family: var(--mono); }
.cmp-section input:focus, .cmp-section textarea:focus { outline: 1px solid var(--emerald); outline-offset: -1px; }
.cmp-actions { display: flex; gap: 8px; align-items: center; }

/* History list of cover runs */
.cover-history { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.cover-history li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface-1);
}
.cover-history .hist-play {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; padding: 0;
}
.cover-history .hist-play[disabled] { opacity: 0.4; cursor: not-allowed; }
.cover-history .hist-play svg { width: 16px; height: 16px; }
.cover-history .hist-meta { flex: 1 1 auto; min-width: 0; }
.cover-history .hist-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cover-history .hist-time { font-size: 11px; color: var(--muted-2); font-family: var(--mono); }
.cover-history .hist-badge {
  font-size: 11px; padding: 3px 8px; border-radius: 10px; font-weight: 600;
  background: var(--surface-2); color: var(--muted-2);
  white-space: nowrap;
}
.cover-history .hist-badge.badge-running { background: var(--emerald); color: #052e16; }
.cover-history .hist-badge.badge-done { background: var(--success); color: #052e16; }
.cover-history .hist-badge.badge-error { background: var(--danger); color: #fff; }
.cover-history .hist-del {
  background: transparent; border: none; color: var(--muted);
  cursor: pointer; padding: 4px; border-radius: 4px;
}
.cover-history .hist-del:hover { color: var(--danger); background: var(--surface-2); }
.cover-history .hist-del svg { width: 16px; height: 16px; }
.cover-history .hist-files { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.cover-history .hist-file { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cover-history .hist-file-play {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--emerald); color: #052e16; border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; padding: 0;
}
.cover-history .hist-file-play svg { width: 13px; height: 13px; }
.cover-history .hist-file-name {
  font-family: var(--mono); font-size: 11.5px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer;
}
.cover-history .hist-file-name:hover { color: var(--emerald); text-decoration: underline; }
.log .l-mute { color: var(--muted-2); }

/* ============ EMPTY STATE ============ */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center;
  padding: 34px 20px;
  color: var(--muted);
}
.empty svg { width: 38px; height: 38px; color: var(--muted-2); margin-bottom: 4px; }
.empty b { color: var(--text); font-size: 14px; }
.empty p { font-size: 12.5px; max-width: 380px; }
.empty .btn { margin-top: 10px; }
.empty.small { padding: 20px; }
.empty.small svg { width: 28px; height: 28px; }

/* ============ JALUR & KUNCI (Settings) ============ */
.keys-desc { margin-bottom: 12px; max-width: 720px; }

.jalur-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 14px;
  overflow: hidden;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.jalur-card.selected { border-color: var(--emerald); box-shadow: 0 0 0 3px var(--emerald-soft); }

.jalur-head {
  display: flex; align-items: center; gap: 13px;
  padding: 14px 18px;
  background: var(--surface-3);
  border-bottom: 1px solid var(--border);
}
.jalur-radio { display: flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 800; }
.jalur-radio input { width: 17px; height: 17px; accent-color: var(--emerald); cursor: pointer; }
.jalur-name { font-size: 14.5px; font-weight: 800; }
.type-badge {
  font-size: 10px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
  font-family: var(--mono); letter-spacing: .5px;
}
.type-badge.sunoApi { background: var(--gold-soft); color: var(--gold); }
.type-badge.kieAi { background: rgba(96, 165, 250, .16); color: #93c5fd; }
.type-badge.apiFrame { background: var(--emerald-soft); color: var(--emerald); }
.type-badge.sunor { background: rgba(244, 114, 182, .16); color: #f9a8d4; }
.jalur-total { margin-left: auto; font-size: 12.5px; color: var(--muted); font-family: var(--mono); white-space: nowrap; }
.jalur-total b { color: var(--emerald); }

.jalur-body { padding: 15px 18px; }
.jalur-adv { margin-bottom: 12px; }
.jalur-adv summary { cursor: pointer; font-size: 12.5px; color: var(--muted); user-select: none; }
.jalur-adv summary:hover { color: var(--emerald); }
.adv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-top: 12px; }
.adv-grid .full { grid-column: 1 / -1; }
.adv-grid .opt span { font-size: 11.5px; }

.keys-head { display: flex; align-items: center; justify-content: space-between; margin: 14px 0 9px; }
.keys-head h3 { font-size: 12.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }

.keys-bulk { display: flex; align-items: center; gap: 10px; margin: 2px 0 6px; }
.k-selall-t { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.key-item .k-sel { margin: 0; accent-color: var(--emerald); }
.k-selall { accent-color: var(--emerald); }

.key-item {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 11px;
  margin-bottom: 8px;
  animation: fade-up .2s var(--ease);
}
.key-item .key-input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12px; }
.key-state { font-size: 11px; color: var(--muted-2); font-family: var(--mono); min-width: 62px; }
.key-credit {
  font-size: 11.5px; font-weight: 700; font-family: var(--mono);
  padding: 4px 11px; border-radius: 999px; white-space: nowrap;
  background: var(--emerald-soft); color: var(--emerald);
  border: 1px solid rgba(16, 185, 129, .35);
}
.key-credit.err { background: var(--danger-soft); color: var(--danger); border-color: rgba(248, 113, 113, .35); }
.key-credit.none { background: var(--surface-3); color: var(--muted); border-color: var(--border-2); }
/* Saldo ada, tapi belum cukup untuk 1 lagu di jalur ini (KIE 12, Sunor 10). */
.key-credit.low { background: var(--gold-soft, rgba(242, 179, 61, .14)); color: var(--gold, #f2b33d); border-color: rgba(242, 179, 61, .38); }
/* Status kredit cover (halaman Cover Musik): kuning bila saldo KIE belum cukup. */
#coverKieStatus.warn { color: var(--gold, #f2b33d); }

.add-key { display: flex; gap: 9px; margin-top: 11px; }
.add-key input { flex: 1; font-family: var(--mono); }

/* ============ HELP ============ */
.help-steps { padding-left: 20px; display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; }
.help-steps li::marker { color: var(--emerald); font-weight: 800; }
.help-tips { padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; color: var(--muted); }
.help-tips li::marker { color: var(--gold); }

/* ============ TOAST ============ */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 9px; z-index: 99; }
.toast {
  background: var(--surface);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border: 1px solid var(--border-2);
  border-left: 3px solid var(--emerald);
  border-radius: var(--radius-md);
  padding: 11px 16px;
  font-size: 13px;
  box-shadow: var(--shadow);
  max-width: 380px;
  animation: toast-in .22s var(--ease);
  transition: opacity .3s;
}
.toast.ok { border-left-color: var(--emerald); }
.toast.err { border-left-color: var(--danger); }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ============ TOP CREDIT ============ */
.top-credit {
  font-size: 12.5px; color: var(--muted); font-family: var(--mono);
  padding: 6px 12px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface-2);
  white-space: nowrap;
}
.top-credit b { color: var(--emerald); }

/* ============ RESPONSIVE ============ */
@media (max-width: 1000px) {
  .sidebar { width: 68px; }
  .main { left: 68px; }
  .side-brand-text, .ni-label, .profile-text { display: none; }
  .side-brand { justify-content: center; }
  .side-collapse { margin-left: 0; display: none; }
  .nav-item { justify-content: center; padding: 10px 0; }
  .profile { justify-content: center; }
  .side-check span { display: none; }
  .side-bottom { align-items: center; }
  .adv-grid { grid-template-columns: 1fr; }
  .main-body { padding: 6px 18px 30px; }
  .main-head { padding: 18px 18px 10px; }
}

@media (max-width: 640px) {
  .opts-grid { grid-template-columns: 1fr; }
  .field-row { flex-direction: column; align-items: stretch; gap: 6px; }
  .field-row > label { width: auto; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .song-item { flex-wrap: wrap; }
}

/* ---- update ---- */
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--muted);
}
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--muted); }
.btn-sm {
  padding: 8px 14px;
  font-size: 12.5px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.btn-sm svg { width: 15px; height: 15px; }
#btnCheckUpdate.has-update {
  color: var(--emerald);
  border-color: var(--emerald);
  background: color-mix(in srgb, var(--emerald) 12%, transparent);
}
.update-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin: 0 16px 12px;
  background: var(--gold-soft);
  border: 1px solid var(--gold);
  border-radius: 12px;
  font-size: 13px;
  flex-wrap: wrap;
}
.update-banner[hidden] { display: none; }
.update-banner #updateText { flex: 1; min-width: 200px; color: var(--text); }
