/* color-scheme: dark mencegah scrollbar default jadi terang & form controls konsisten */
:root {
    color-scheme: dark;
    --bg: #070b14;
    --card: #0f172a;
    --card2: #111c33;
    --line: #1e2d4a;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --dim: #64748b;
    --accent: #38bdf8;
    --accent2: #a78bfa;
    --ok: #34d399;
    --bad: #f87171
}

body {
    height: 100dvh;
    overflow: hidden;
    background: radial-gradient(1200px 800px at 20% -10%, #12203a, #070b14 55%);
    color: var(--text);
    font: 13px ui-sans-serif, system-ui, sans-serif;
    display: flex;
    flex-direction: column
}


/* SVG Icon Base */
.icon {
  width: 1.1em;
  height: 1.1em;
  vertical-align: -0.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* Memperbaiki tombol icon kecil di daftar patch */
.icon-btn .icon {
  width: 1.2em;
  height: 1.2em;
  vertical-align: middle;
  margin: -1px 0 0 0;
}

.about-website-link,
.about-website-link:hover {
  color: var(--accent);
  text-decoration: none;
}

.about-website-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

header {
    height: 56px;
    gap: 10px;
    padding: 0 14px;
    background: #080d18;
    border-bottom: 1px solid var(--line);
    flex: none
}

.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 200px
}

.logo {
    width: 30px;
    height: 30px;
    border-radius: 5px;
    display: grid;
    place-items: center;
    color: #06111f;
    font-weight: 900
}

.brand b {
    font-size: 13px
}

.brand span {
    display: block;
    font-size: 9px;
    color: var(--dim);
    letter-spacing: .12em;
    text-transform: uppercase
}

.actions {
    display: flex;
    gap: 7px;
    margin-left: auto;
    flex-wrap: nowrap;
    align-items: center
}

.language-label {
    color: var(--muted);
    font-size: 11px;
}

#languageSelect {
    width: auto;
    flex: none;
    min-height: 32px;
    padding: 5px 28px 5px 9px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background-color: var(--card2);
    color: var(--text);
    cursor: pointer;
    outline: none;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

#languageSelect:hover {
    background-color: #16233d;
    border-color: #2b446b;
}

#languageSelect:focus-visible {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgb(56 189 248 / 20%);
}

#btnAbout,
.actions a.btn[href="index.html"] {
    min-height: 32px;
}

.btn.primary {
    background: var(--accent);
    border: 1px solid var(--accent);
    color: #000;
    font-weight: 600
}

.btn.primary:hover:not(:disabled) {
    background: #79b8ff;
    border-color: #79b8ff;
}

.btn.small {
    padding: 4px 8px;
    font-size: 11px
}

.btn.danger {
    color: var(--bad);
    border-color: #4a2029
}

.btn.active {
    background: rgba(56, 189, 248, .15);
    border-color: var(--accent)
}

.icon-btn {
    padding: 0 5px;
    font-size: 11px;
    line-height: 18px;
    height: 20px;
    border-radius: 4px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--muted);
    cursor: pointer;
    flex: none
}

.icon-btn:hover {
    background: #16233d;
    border-color: #2b446b;
    color: var(--text)
}

.icon-btn.danger:hover {
    color: var(--bad);
    border-color: #4a2029
}

.app {
    flex: 1;
    display: flex;
    min-height: 0
}

aside {
    width: var(--sidebar-width);
    border-right: 1px solid var(--line);
    padding: 10px;
    overflow: auto;
    background: rgba(8, 13, 24, .45);
    flex: none
}

main {
    flex: 1;
    overflow: auto;
    padding: 12px 14px 30px;
    min-width: 0
}

.card {
    background: linear-gradient(180deg, rgba(17, 28, 51, .95), rgba(15, 23, 42, .95));
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 11px;
    margin-bottom: 10px
}
.card:last-child {
    margin-bottom: 0px;
}

.card h3 {
    margin: 0 0 8px;
    font-size: 10px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted)
}

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

.stat {
    background: #0a1222;
    border: 1px solid #172541;
    border-radius: 7px;
    padding: 6px 8px
}

.stat label {
    display: block;
    font-size: 9px;
    text-transform: uppercase;
    color: var(--dim);
    letter-spacing: .08em
}

.stat b {
    font-size: 12px
}

.list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 180px;
    overflow: auto
}

.li {
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: 5px;
    background: #0a1222;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 6px;
    font-size: 12px;
    align-items: center
}

.li:hover {
    background: #101c33
}

.li.active {
    border-color: var(--accent);
    background: rgba(56, 189, 248, .1)
}

.li .meta {
    color: var(--dim);
    font-size: 10px;
    flex: none
}

.li .name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0
}

.li .tools {
    display: flex;
    gap: 2px;
    flex: none
}

.welcome {
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 12px;
    color: var(--muted);
    border: 1px dashed #1e3357;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 10px;
}

.welcome h1 {
    margin: 0;
    color: var(--text);
    font-size: 24px
}

.welcome p {
    margin: 0;
    max-width: 900px;
    line-height: 1.7
}

.grid {
    display: grid;
    gap: 8px
}

.g2 {
    grid-template-columns: repeat(2, 1fr)
}

.g3 {
    grid-template-columns: repeat(3, 1fr)
}

.loop-controls-panel {
    margin: 6px 0 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: rgba(8, 15, 30, .55);
}

.loop-controls-heading {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin-bottom: 8px;
}

.loop-controls-heading h3,
.loop-controls-layout h4 {
    margin: 0;
    color: var(--muted);
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.loop-controls-heading .hint,
.loop-threshold-panel .hint {
    margin: 0;
}

.loop-controls-layout {
    display: grid;
    grid-template-columns: minmax(220px, .85fr) minmax(0, 1.6fr);
    gap: 14px;
    align-items: start;
}

.loop-actions-panel,
.loop-threshold-panel {
    min-width: 0;
}

.loop-actions-panel h4,
.loop-threshold-panel h4 {
    margin-bottom: 5px;
}

.loop-action-buttons {
    margin-bottom: 0;
}

.loop-threshold-grid {
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    margin-top: 6px;
}

.range-value-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.range-value-row input[type="range"] {
    flex: 1;
    min-width: 0;
    accent-color: var(--accent);
    background: transparent;
    border: 0;
    padding: 0;
}

.range-value-row output {
    min-width: 38px;
    color: var(--text);
    font: 11px ui-monospace, monospace;
    text-align: right;
}

.g4 {
    grid-template-columns: repeat(4, 1fr)
}

.g6 {
    grid-template-columns: repeat(6, 1fr)
}

.field {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0
}

.field label {
    font-size: 9px;
    color: var(--dim);
    text-transform: uppercase;
    letter-spacing: .05em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.hint {
    font-size: 10px;
    color: var(--dim);
    line-height: 1.5
}

.samples {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 6px
}

.sc {
    background: #0a1222;
    border: 1px solid #172541;
    border-radius: 7px;
    padding: 8px;
    cursor: pointer;
    transition: .14s
}

.sc:hover {
    border-color: #2b446b;
    transform: translateY(-1px)
}

.sc.active {
    border-color: var(--accent);
    background: rgba(56, 189, 248, .07)
}

.sc.add-sample-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 72px;
    color: var(--accent);
    text-align: center
}

.sc.add-sample-card:hover {
    background: rgba(56, 189, 248, .07)
}

.sc.add-sample-card:disabled {
    cursor: not-allowed;
    opacity: .5;
    transform: none
}

.add-sample-plus {
    font-size: 22px;
    font-weight: 500;
    line-height: 1
}

.sc .n {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
    font-size: 12px
}

.sc .m {
    display: flex;
    flex-wrap: wrap;
    gap: 3px
}

.tag {
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 3px;
    background: #13213a;
    color: var(--muted);
    border: 1px solid #1d2e4d
}

.tag.loop {
    color: var(--accent);
    border-color: #1e4a6b
}

.wave-wrap {
    position: relative;
    border: 1px solid #1a2b49;
    border-radius: 5px;
    overflow: hidden;
    background: #060c17
}

#waveCanvas {
    display: block;
    width: 100%;
    height: 200px;
    cursor: crosshair;
    touch-action: none
}

.wave-overlay {
    position: absolute;
    left: 8px;
    top: 6px;
    display: flex;
    gap: 4px;
    pointer-events: none
}

.wave-overlay span {
    background: rgba(6, 12, 23, .72);
    border: 1px solid #1d3050;
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 10px;
    color: var(--muted)
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 6px 0;
    align-items: center
}

.sep {
    width: 1px;
    background: var(--line);
    margin: 0 3px
}

.play-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    margin-bottom: 8px
}

.hold-btn {
    background: #059669;
    border: 0;
    color: #fff;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: 5px;
    cursor: pointer;
    user-select: none
}

.hold-btn:active {
    transform: scale(.98)
}

.divider {
    height: 1px;
    background: var(--line);
    margin: 10px 0
}

.subhead {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px
}

.subhead h2 {
    margin: 0;
    font-size: 14px
}

.subhead .spacer {
    flex: 1
}

.pill {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 99px;
    background: #101d34;
    border: 1px solid #1e3253;
    color: var(--muted)
}

.card .pill {
    margin-top: -3px;
}

.check-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px
}

.check {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #0a1222;
    border: 1px solid #1b2b49;
    border-radius: 5px;
    padding: 4px 7px;
    font-size: 11px;
    cursor: pointer;
    user-select: none
}

.check input {
    accent-color: var(--accent);
    width: 12px;
    height: 12px
}

footer {
    height: 28px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    background: #060a12;
    border-top: 1px solid var(--line);
    color: var(--dim);
    font-size: 11px;
    flex: none
}

.midi-box {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--card);
    border: 1px solid var(--line);
    padding: 4px 6px;
    border-radius: 8px
}

.midi-box select {
    width: auto;
    min-width: 0;
    flex: 0 1 140px;
    background: transparent;
    border: 0;
    color: var(--text);
    max-width: 140px;
    font-size: 11px;
    outline: none
}

@media (max-width: 560px) {
    header {
        height: auto;
        min-height: 56px;
        flex-wrap: wrap;
        padding: 8px 12px;
    }

    .brand {
        min-width: 0;
    }

    .actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
}

.dot {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: #475569;
}

.dot.on {
    background: var(--ok);
    box-shadow: 0 0 0 3px rgba(52, 211, 153, .16)
}

.drum-pads-midi-controls {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.drum-pads-midi-seek-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.drum-pads-midi-seek-controls .midi-time-labels {
  font-size: 10px;
  gap: 8px;
  white-space: nowrap;
}


.add-patch-choice {
    margin: 14px 0 0
}

.add-patch-choice button {
    width: 100%
}

.add-patch-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0;
    color: var(--dim);
    font-size: 11px
}

.add-patch-divider::before,
.add-patch-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line)
}

@media(max-width:900px) {

    .g6,
    .g4 {
        grid-template-columns: repeat(2, 1fr)
    }

    .loop-controls-layout {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    aside {
        width: var(--sidebar-width-compact)
    }
}

@media(max-width:720px) {
    .app {
        flex-direction: column
    }

    aside {
        width: 100%;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px
    }

    aside .card {
        margin: 0
    }

    body {
        overflow: auto
    }

    main {
        overflow: visible
    }
}











/* ===== Bank Manager ===== */
#bankManagerCard { margin-bottom: 10px; }

.bank-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}

.bank-toolbar .hint { flex: 1; min-width: 200px; }

.bank-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px;
  background: #060c17;
}

.bank-group-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  margin-top: 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  border-bottom: 1px solid #1a2b49;
}
.bank-group-header:first-child { margin-top: 0; }

/* Grid yang sama untuk header dan row — 9 kolom */
.bank-row,
.bank-col-header {
  display: grid;
  grid-template-columns: 18px 14px 70px 26px 46px 1fr 50px 46px 28px;
  gap: 6px;
  align-items: center;
  padding: 4px 6px;
  font-size: 11px;
}

/* Header baris (label kolom) */
.bank-col-header {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--dim);
  font-weight: 600;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2px;
  position: sticky;
  top: 0;
  background: #060c17;
  z-index: 2;
}

.bank-col-header > span {
  text-align: center;
}

.bank-col-header > span.bank-col-header-left {
  text-align: left;
}

/* Baris data */
.bank-row {
  border-radius: 5px;
  background: #0a1222;
  border: 1px solid transparent;
  cursor: default;
  transition: background .1s;
}
.bank-row {
  display: grid;
  grid-template-columns: 18px 14px 70px 34px 46px 1fr 50px 52px 28px;
  gap: 6px;
  align-items: center;
  padding: 4px 6px;
  border-radius: 5px;
  background: #0a1222;
  border: 1px solid transparent;
  font-size: 11px;
  cursor: grab;
  user-select: none;        /* <-- tambahkan */
  transition: background .1s;
}

.bank-row:active {
  cursor: grabbing;
}

/* Pastikan :hover tidak "menempel" pada border drag saat kelas drag-over selesai */
.bank-row.drag-over {
  border-color: var(--accent);
  background: rgba(56, 189, 248, .08);
}

.bank-row.dragging {
  opacity: 0.4;
}

/* Penanda baris aktif tanpa mengubah ukuran atau posisi isi grid. */
.bank-row.bank-row-current {
  box-shadow: inset 2px 0 0 var(--accent, #38bdf8);
}

/* Tombol pilih patch */
.bank-select-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.bank-select-btn .icon { width: 14px; height: 14px; }
.bank-select-btn:hover {
  background: rgba(56, 189, 248, .15);
  border-color: var(--accent);
  color: var(--accent);
}
.bank-row-current .bank-select-btn { visibility: hidden; }
.bank-row-current .bank-name { color: var(--accent); font-weight: 600; }

/* Class lama yang tidak dipakai lagi — boleh dihapus */
/* .bank-group-header { ... } */

.bank-handle {
  cursor: grab;
  color: var(--dim);
  text-align: center;
  font-size: 14px;
  user-select: none;
  line-height: 1;
}
.bank-handle:active { cursor: grabbing; }

.bank-type {
  font-size: 9px;
  font-weight: 700;
  text-align: center;
  padding: 1px 0;
  border-radius: 3px;
}
.bank-type.melodic { color: var(--accent); background: rgba(56,189,248,.15); }
.bank-type.drum { color: var(--accent2); background: rgba(167,139,250,.15); }

.bank-original, .bank-order {
  font-family: ui-monospace, monospace;
  color: var(--muted);
  text-align: center;
  font-size: 10px;
}
.bank-order { color: var(--accent); font-weight: 600; }

.bank-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.bank-program {
  font-family: ui-monospace, monospace;
  color: var(--dim);
  text-align: center;
  font-size: 10px;
}

.bank-target {
  width: 100%;
  padding: 3px 5px;
  background: #080f1e;
  border: 1px solid #1d2e4d;
  color: var(--text);
  border-radius: 4px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  text-align: center;
  outline: none;
}
.bank-target:focus { border-color: var(--accent); }
.bank-target.changed { border-color: var(--accent2); }

.bank-row input[type="checkbox"] { accent-color: var(--accent); width: 14px; height: 14px; }

.bank-empty {
  padding: 12px;
  text-align: center;
  color: var(--dim);
  font-size: 11px;
}

.subhead h2 {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bank-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}
.bank-item-info {
  font-size: 11px;
  color: var(--dim);
  margin-right: 8px;
}
.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 400px;
  overflow-y: auto;
  margin-top: 10px;
}
.breakdown-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  background: #0a1222;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 12px;
}
.breakdown-row.heavy {
  border-color: var(--bad);
  background: rgba(248, 113, 113, 0.1);
}
.breakdown-row .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.breakdown-row .size { font-family: ui-monospace, monospace; color: var(--accent); }

/* Penanda bank yang berisi patch rusak (0 byte) */
.bank-item-row.disabled .name {
  color: var(--bad);
  font-weight: bold;
}
.bank-item-row.disabled {
  opacity: 0.7;
}

/* Tombol hapus di dalam Rincian Bank */
.breakdown-row .btn-delete-patch {
  padding: 2px 8px;
  height: 22px;
  font-size: 10px;
  background: transparent;
  border: 1px solid var(--bad);
  color: var(--bad);
  border-radius: 4px;
  cursor: pointer;
  transition: 0.15s;
  margin-left: 8px;
  flex-shrink: 0;
}
.breakdown-row .btn-delete-patch:hover {
  background: var(--bad);
  color: #fff;
}
/* --- Bank Select Dialog & Breakdown Styles --- */

.bank-item-broken-row {
  opacity: 0.7;
}

.bank-broken {
  color: #f87171 !important; /* Warna merah untuk item rusak */
  font-weight: bold;
}

.bank-item-actions {
  display: flex;
  align-items: center;
}

.bank-info-btn {
  padding: 2px;
  margin-left: 4px;
  color: var(--accent);
}

.bank-info-btn .icon {
  width: 16px;
  height: 16px;
}

.breakdown-row.broken {
  border: 1px solid #f87171;
  background-color: rgba(248, 113, 113, 0.1);
}

.breakdown-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.breakdown-size {
  margin-right: 12px;
}

/* Tombol hapus spesifik di dalam rincian bank */
.btn-delete-patch {
  padding: 4px 10px;
  font-size: 11px;
  background: var(--bad);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.2s;
}

.btn-delete-patch:hover {
  background: #ef4444; /* Sedikit lebih gelap saat di-hover */
}

/* ===== Export Banks Dialog ===== */
.export-banks-panel {
  width: min(800px, 100%);
}

.export-header-action {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  margin-bottom: 8px;
}

.export-select-all-label {
  font-weight: bold;
  cursor: pointer;
  user-select: none;
}

/* ===== Export Banks Dialog ===== */
.export-table-container {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
}

.export-table {
  width: 100%;
  /* 1. Wajib separate agar z-index sticky bekerja sempurna */
  border-collapse: separate; 
  border-spacing: 0; 
  font-size: 12px;
  text-align: left;
}

.export-table th {
  padding: 10px;
  position: sticky;
  top: 0;
  /* 2. Paksa warna background yang solid (sesuai warna panel/card Anda) */
  background-color: #0f172a !important; 
  z-index: 10;
  /* 3. Gunakan box-shadow inset sebagai border agar tidak bocor saat di-scroll */
  box-shadow: inset 0 -1px 0 var(--line);
}

.export-table td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  /* 4. Beri background pada td agar tidak transparan menimpa header */
  background-color: var(--bg); 
}

.export-col-check {
  width: 50px;
  text-align: center;
}

.export-col-target {
  width: 120px;
}

/* Sisa CSS lainnya tetap sama */
.export-header-action {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  margin-bottom: 8px;
}

.export-select-all-label {
  font-weight: bold;
  cursor: pointer;
  user-select: none;
}

.export-banks-error {
  margin-top: 8px;
}

.export-table td.text-center {
  text-align: center;
}

.export-table td.text-dim {
  color: var(--dim);
}

.export-type-tag {
  font-size: 10px;
}

.export-target-input {
  width: 80px;
  padding: 4px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.export-table td.text-center {
  text-align: center;
}

/* Warna teks yang agak redup untuk Bank Asli dan Jumlah Patch */
.export-table td.text-dim {
  color: var(--muted);
}

/* ===== Frequency Map Modal ===== */
.freq-map-container {
  position: relative;
  width: 100%;
  height: 400px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.freq-map-row {
  display: flex;
  align-items: center;
  height: 24px;
  width: 100%;
}

/* Label Pitch di Sebelah Kiri */
.freq-label {
  flex: 0 0 80px; /* Lebar tetap agar sejajar */
  text-align: right;
  padding-right: 12px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  color: var(--dim);
  white-space: nowrap;
}

/* Wadah Relatif untuk Bar */
.freq-bar-wrapper {
  position: relative;
  flex: 1;
  height: 100%;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
}

.freq-map-bar {
  position: absolute;
  height: 100%;
  top: 0;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  border-radius: 4px;
  opacity: 0.85;
  display: flex;
  align-items: center;
  padding-left: 6px;
  font-size: 10px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
  transition: opacity 0.2s;
}

.freq-map-bar:hover {
  opacity: 1;
  z-index: 10;
}

#patchNameSide{
  white-space: nowrap;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  max-width: 75%;
}

.svg-sprite {
    display: none;
}

.inline-actions {
    display: flex;
    gap: 4px;
}

.project-actions {
    margin-top: 4px;
}

.project-export-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.project-export-actions > button {
    min-width: 0;
    white-space: nowrap;
}

.project-secondary-actions,
.library-actions {
    margin-top: 6px;
}

.project-list {
    max-height: 160px;
}

.midi-preview-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.midi-seek-controls {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 0;
}

.midi-seek,
.midi-volume-slider {
    height: 24px;
    accent-color: var(--accent);
}

.midi-seek {
    width: 100%;
    cursor: pointer;
}

.midi-time-labels {
    display: flex;
    justify-content: space-between;
    color: var(--dim);
    font-size: 9px;
    font-family: ui-monospace, monospace;
}

.midi-waveform-panel {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.midi-waveform-canvas {
    display: block;
    width: 100%;
    height: 64px;
    background: #080d18;
    border: 1px solid var(--line);
    border-radius: 4px;
    cursor: pointer;
}

.midi-waveform-canvas:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.midi-waveform-caption {
    display: grid;
    grid-template-rows: 11px 11px;
    gap: 6px;
    height: 28px;
    min-width: 0;
    overflow: hidden;
    color: var(--dim);
    font-size: 9px;
    line-height: 11px;
}

.midi-waveform-caption span {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.midi-waveform-caption span:first-child {
    text-overflow: ellipsis;
}

.midi-waveform-caption span:last-child {
    text-align: right;
}

.midi-volume-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    font-size: 10px;
}

.midi-volume-label {
    display: flex;
    align-items: center;
    gap: 2px;
    color: var(--dim);
    padding: 6px 0;
    flex: none;
    white-space: nowrap;
}

.midi-volume-icon {
    display: block;
    width: 14px;
    height: 14px;
    flex: none;
}

.midi-volume-value {
    min-width: 24px;
    color: var(--accent);
    text-align: right;
}

#midiStatus {
    margin-top: 4px;
    color: var(--dim);
    font-size: 10px;
    text-align: center;
}

#libCount,
#patchNameSide {
    float: right;
}

#btnLibraryScope,
#btnExportInst {
    width: 100%;
}

#btnLibraryScope {
    margin: 0 0 6px;
}

.library-filter {
    width: 100%;
    margin-bottom: 6px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--panel);
    color: var(--text);
    font-size: 11px;
}

.patch-list {
    max-height: 200px;
}

#btnExportInst {
    margin-top: 6px;
}

.midi-monitor {
    color: var(--dim);
    font: 11px/1.6 ui-monospace, monospace;
}

.welcome-tip {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    padding: 8px 12px;
    border: 1px solid rgba(56, 189, 248, .3);
    border-radius: 8px;
    background: rgba(56, 189, 248, .1);
    color: var(--muted);
    font-size: 12px;
}

.welcome-tip .icon {
    width: 16px;
    height: 16px;
    color: var(--accent);
}

.welcome-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

.bank-management-hint {
    margin: 0 0 8px;
}

.bank-select-all {
    margin-left: auto;
}

.grid-span-2 {
    grid-column: span 2;
}

.grid-span-4 {
    grid-column: span 4;
}

.sample-action {
    margin-right: 8px;
}

.zoom-level {
    margin-left: 4px;
    line-height: 20px;
    box-sizing: border-box;
    width: 52px;
    flex: 0 0 52px;
    text-align: center;
}

.card h3.editor-subsection-heading {
    margin: 12px 0 6px;
    color: var(--muted);
    font-size: 10px;
    text-transform: uppercase;
}

.card h3.editor-subsection-heading-compact {
    margin: 0 0 6px;
}

.piano-row {
    margin-top: 6px;
}

#footerInfo {
    margin-left: auto;
    font-family: ui-monospace, monospace;
}

.bank-select-list {
    max-height: 300px;
    overflow: auto;
}

#bankLoadingStatus {
    display: none;
    margin-top: 12px;
    font-size: 12px;
    font-weight: 500;
}

.midi-used-patches-list {
    max-height: 220px;
    overflow-y: auto;
}

.midi-patch-load-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
    font-size: 12px;
}

.midi-patch-load-list {
    display: grid;
    gap: 4px;
    max-height: 260px;
    overflow-y: auto;
}

.midi-patch-load-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 8px;
    border: 1px solid var(--line, #1e2d4a);
    border-radius: 5px;
    font-size: 11px;
}

.midi-patch-load-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.midi-patch-load-name[href] {
    color: var(--accent, #38bdf8);
    text-decoration: none;
    cursor: pointer;
}

.midi-patch-load-name[href]:hover {
    color: var(--text, #e2e8f0);
}

.midi-patch-load-state {
    flex: none;
    color: var(--dim, #64748b);
    text-align: right;
}

.midi-patch-load-row.status-loading .midi-patch-load-state {
    color: var(--accent, #38bdf8);
}

.midi-patch-load-row.status-loaded .midi-patch-load-state {
    color: var(--success, #34d399);
}

.midi-patch-load-row.status-failed .midi-patch-load-state,
.midi-patch-load-error {
    color: var(--danger, #f87171);
}

.midi-patch-load-error {
    padding-block: 6px;
}

.duplicate-import-footer {
    flex-wrap: wrap;
}

.midi-patch-load-empty {
    padding: 10px;
    color: var(--dim, #64748b);
    font-size: 11px;
}

.midi-used-patches-subtitle {
    margin-top: 12px;
}

#midiTimelineDialog .odal-body{
    max-height: 580px;
}
.midi-timeline-container {
    flex: 1;
    overflow: auto;
    background: rgba(0,0,0,0.3);
    border-radius: 6px;
    font-family: 'Consolas', 'Monaco', monospace;
    min-height: 0;
    padding: 8px;
    border: 1px solid rgba(255,255,255,0.05);
}
.midi-timeline-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
    min-width: max-content;
}
.midi-timeline-label {
    width: 92px;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
}
.midi-timeline-track {
    flex: 1;
    height: 24px;
    background: rgba(255,255,255,0.04);
    border-radius: 4px;
    position: relative;
    min-width: 800px;
    border: 1px solid rgba(255,255,255,0.06);
}
.midi-timeline-bar {
    position: absolute;
    top: 2px;
    bottom: 2px;
    border-radius: 3px;
    cursor: pointer;
    opacity: 0.85;
    min-width: 4px;
    display: flex;
    align-items: center;
    justify-content: left;
    padding-left: 4px;
    overflow: hidden;
    font-size: 10px;
    font-weight: bold;
    color: #000;
    transition: opacity 0.15s, transform 0.15s;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.3);
    z-index: 10;
}
.midi-timeline-bar:hover {
    opacity: 1;
    transform: scaleY(1.15);
    z-index: 20;
    box-shadow: 0 0 8px rgba(255,255,255,0.6);
}
.midi-timeline-tick {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    white-space: nowrap;
    color: var(--dim);
    font-size: 10px;
    user-select: none;
}

#midiTimelineContainer {
    position: relative; /* Penting untuk posisi playhead */
    max-height: 520px;
}

.midi-timeline-playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #ef4444; /* Merah */
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.8);
    display: none;
    will-change: transform;
    /* Hapus transisi agar pergerakan JS lebih mulus tanpa delay */
}

.midi-timeline-row[data-channel] {
  transition: opacity 0.15s ease;
}

#libraryCountLabel{
    color: var(--dim);
    font-size: 10px;
    text-align: center;
}



/* =====================================================================
   MIDI Timeline — layout & controls
   ===================================================================== */

/* Baris ruler tick (di atas channel rows) */
.midi-timeline-ruler-row {
  margin-bottom: 6px;
}

.midi-timeline-ruler-track {
  height: 16px;
  background: transparent;
  border: none;
}

/* Label channel + tombol M/S + nama + VU meter */
.midi-timeline-label-channel {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow: hidden;
}

/* Tombol M (Mute) / S (Solo) */
.midi-ch-toggle {
  width: 14px;
  height: 14px;
  padding: 0;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  border-radius: 2px;
  border: 1px solid var(--border, #334155);
  background: var(--bg2, #1e293b);
  color: var(--dim, #94a3b8);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.midi-ch-toggle:hover {
  background: #273449;
}

/* State aktif — Mute */
.midi-ch-toggle.is-mute-active,
.midi-ch-toggle.is-mute-active:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
}

/* State aktif — Solo */
.midi-ch-toggle.is-solo-active,
.midi-ch-toggle.is-solo-active:hover {
  background: #eab308;
  color: #000000;
  border-color: #eab308;
}

/* Nama channel */
.midi-ch-name {
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Channel drum — warna beda */
.midi-ch-name.is-drum {
  color: var(--accent2, #a78bfa);
}


.midi-ch-name{
    width: 92px;
}


.vu-meter{
}
.vu-meter-inner{
    opacity: 0;
    width: 8px;
    height: 8px;
    background-color: #00cf8b;
    border-radius: 4px;
}

.drum-pads-status {
  min-height: 1.4em;
  margin: 8px 0;
  color: var(--dim, #94a3b8);
  font-size: 12px;
}
.drum-pad-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 7px;
  max-height: 48dvh;
  overflow: auto;
  padding: 2px;
}
.drum-pad {
  display: flex;
  min-width: 0;
  min-height: 70px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background .04s, border-color .04s, box-shadow .04s;
}
.drum-pad:hover {
  border-color: var(--accent);
}

.drum-pad.is-missing {
  border-style: dashed;
  border-color: var(--bad);
}
.drum-pad.is-missing .drum-pad-state {
  color: var(--bad);
}
.drum-pad.is-active {
  border-color: var(--ok);
  background: color-mix(in srgb, var(--ok) 24%, var(--card2));
  box-shadow: inset 0 0 0 1px var(--ok), 0 0 12px color-mix(in srgb, var(--ok) 35%, transparent);
}
.drum-pad-number {
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
}
.drum-pad-name {
  width: 100%;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drum-pad-state {
  color: var(--ok);
  font-size: 10px;
}
.drum-kit-preview-status {
  min-height: 1.4em;
  margin: 8px 0;
  color: var(--dim, #94a3b8);
  font-size: 12px;
}
.drum-kit-preview-table-wrapper { max-height: 48dvh; }
.drum-kit-preview-action { width: 90px; text-align: right !important; }
.drum-kit-preview-table tbody td:last-child { text-align: right; }
.drum-kit-preview-table .btn { min-width: 76px; }
.instrument-preview-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}
.patch-preview-panel {
  width: min(900px, 94vw);
  max-height: 90dvh;
  overflow: auto;
}
.patch-preview-status {
  min-height: 1.4em;
  margin: 8px 0;
  color: var(--dim, #94a3b8);
  font-size: 12px;
}
.patch-preview-pad-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 7px;
  max-height: 55dvh;
  overflow: auto;
  padding: 2px;
}
.patch-preview-pad {
  min-height: 42px;
  padding: 5px 3px;
  font-size: 12px;
}
.patch-preview-pad.drum {
  min-height: 62px;
  font-size: 10px;
  line-height: 1.25;
}
.patch-preview-waveform {
  display: block;
  width: min(240px, 30vw);
  height: 36px;
  flex: 0 1 240px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0a1222;
}
.patch-preview-panel #btnAutoPlayPatchPreview {
  height: 36px;
}
@media (max-width: 560px) {
  .drum-pads-midi-controls {
    flex-basis: 100%;
  }
  .drum-pad-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.gm-map-section-title {
  margin: 14px 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent, #38bdf8);
  display: flex;
  align-items: center;
  gap: 8px;
}
.gm-map-table-wrapper {
  max-height: 30dvh;
  overflow-y: auto;
  border: 1px solid rgba(56, 189, 248, 0.15);
  border-radius: 6px;
  margin-bottom: 6px;
  background: rgba(6, 11, 20, 0.35);
}
.gm-map-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.gm-map-table thead th {
  position: sticky;
  top: 0;
  background: #0d1626;
  color: var(--dim, #94a3b8);
  font-weight: 600;
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.2);
  z-index: 1;
}
.gm-map-table tbody td {
  padding: 4px 8px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.06);
  vertical-align: middle;
}
.gm-map-table tbody tr:hover { background: rgba(56, 189, 248, 0.05); }
.gm-map-col-num {
  width: 46px;
  font-family: ui-monospace, monospace;
  color: var(--dim, #94a3b8);
}
.gm-map-col-status { width: 84px; text-align: right; }
.gm-map-link {
  color: var(--accent, #38bdf8);
  text-decoration: none;
  font-weight: 500;
}
.gm-map-link:hover { text-decoration: underline; }
.gm-map-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.gm-map-badge.available {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
}
.gm-map-badge.missing {
  background: rgba(148, 163, 184, 0.12);
  color: #64748b;
}
.gm-map-row-available td:nth-child(2) { color: #e2e8f0; }


#btnAutoPlayPatchPreview{
    width: 140px;
}
