/* ── Variables ───────────────────────────────────────────── */
:root {
  --mv-green:  #23d18b;
  --mv-gdim:   rgba(35, 209, 139, .08);
  --mv-yellow: #f0b429;
  --mv-ydim:   rgba(240, 180, 41, .08);
  --mv-purple: #c084fc;
  --mv-pdim:   rgba(192, 132, 252, .08);
  --mv-b2:     #30304a;
}

/* ── Mix View ─────────────────────────────────────────── */
.mv-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-base);
  overflow: hidden;
}

/* ── Toolbar ─────────────────────────────────────────── */
.mv-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 12px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.mv-title {
  font-size: 11px;
  font-weight: 600;
  color: #4fc3f7;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  flex: 1;
}

.mv-add-btns {
  display: flex;
  gap: 6px;
}

.mv-add-btn {
  padding: 3px 9px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid;
  background: transparent;
  transition: filter 0.1s;
}

.mv-add-btn[data-type="reverb"] { border-color: #4ade80; color: #4ade80; }
.mv-add-btn[data-type="delay"]  { border-color: #fbbf24; color: #fbbf24; }
.mv-add-btn[data-type="sc"]     { border-color: #c084fc; color: #c084fc; }
.mv-add-btn:hover { filter: brightness(1.25); }

/* ── Matrix scroll ───────────────────────────────────── */
.mv-matrix-scroll {
  flex: 1;
  overflow: auto;
  position: relative;
}

.mv-matrix {
  border-collapse: collapse;
  min-width: 100%;
  table-layout: fixed;
}

.mv-matrix th,
.mv-matrix td {
  border: 1px solid var(--border-subtle);
  padding: 0;
  vertical-align: middle;
}

/* ── Section banner row ──────────────────────────────── */
.mv-section-row .mv-corner {
  background: var(--bg-panel);
}

.mv-section-header {
  padding: 0 8px;
  height: 22px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 12;
}

.mv-section-header.sec-reverb {
  background: var(--mv-gdim);
  color: var(--mv-green);
  border-left: 2px solid var(--mv-green);
}
.mv-section-header.sec-delay {
  background: var(--mv-ydim);
  color: var(--mv-yellow);
  border-left: 2px solid var(--mv-yellow);
}
.mv-section-header.sec-sc {
  background: var(--mv-pdim);
  color: var(--mv-purple);
  border-left: 2px solid var(--mv-purple);
}

/* ── Bus header row ──────────────────────────────────── */
.mv-corner {
  width: 150px;
  min-width: 150px;
  position: sticky;
  left: 0;
  z-index: 22;
  background: var(--bg-panel);
}

.mv-inst-header {
  width: 150px;
  min-width: 150px;
  padding: 7px 12px !important;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--bg-panel);
  text-align: left;
  white-space: nowrap;
  position: sticky;
  left: 0;
  z-index: 11;
}

td.mv-send-cell.sec-start,
th.mv-bus-header.sec-start {
  border-left: 2px solid var(--mv-b2);
}

.mv-bus-header {
  width: 120px;
  min-width: 100px;
  background: var(--bg-panel);
  vertical-align: top;
}

.mv-bus-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px 3px;
  gap: 4px;
}

.mv-bus-name {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-base);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.mv-bus-remove {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  line-height: 14px;
  text-align: center;
  border-radius: 3px;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.mv-bus-remove:hover {
  color: #e8453c;
}

/* ── Bus params ──────────────────────────────────────── */
.mv-bus-params {
  padding: 0 6px 6px;
}

.mv-params-inner {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mv-param {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 18px;
}

.mv-param-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  min-width: 26px;
  text-transform: uppercase;
}

.mv-param-val {
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-base);
  cursor: ns-resize;
  padding: 1px 4px;
  border-radius: 2px;
  user-select: none;
  white-space: nowrap;
}

.mv-param-val:hover {
  background: rgba(255,255,255,0.07);
}

.mv-param-sel {
  font-size: 9px;
  padding: 1px 3px;
  border-radius: 2px;
  background: #1e1e2e;
  border: 1px solid var(--border-subtle);
  color: var(--text-base);
  cursor: pointer;
  max-width: 72px;
}

.mv-param-sel option {
  background: #1e1e2e;
  color: var(--text-base);
}

.mv-param-trigger {
  flex-wrap: wrap;
  gap: 3px;
}

/* ── Instrument rows ─────────────────────────────────── */
.mv-inst-row td {
  height: 34px;
}

.mv-sub-row td {
  height: 26px;
  background: rgba(0,0,0,0.18);
}

.mv-inst-name {
  padding: 0 10px !important;
  font-size: 11px;
  color: var(--text-base);
  white-space: nowrap;
  background: var(--bg-panel);
}

.mv-inst-name-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 100%;
}

.mv-sub-name {
  padding-left: 22px !important;
  font-size: 10px;
  color: var(--text-muted);
}

.mv-expand-btn {
  font-size: 8px;
  padding: 1px 5px;
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
}

.mv-expand-btn:hover {
  border-color: #4fc3f7;
  color: #4fc3f7;
}

/* ── Send cells ──────────────────────────────────────── */
.mv-send-cell {
  text-align: center;
  cursor: pointer;
  transition: background 0.08s;
  position: relative;
}

.mv-send-cell:hover {
  background: rgba(255,255,255,0.04);
}

.mv-send-active {
  background: rgba(255,255,255,0.06);
}

/* ── Dots (reverb / delay) ───────────────────────────── */
.mv-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  margin: 0 auto;
  border: 1.5px solid var(--mv-b2);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-family: 'JetBrains Mono', monospace;
  color: transparent;
  transition: all 0.14s;
  pointer-events: none;
}

.mv-send-cell:hover .mv-dot {
  border-color: #6060a0;
}

.mv-dot.on {
  border-color: transparent;
  color: rgba(0, 0, 0, 0.75);
  font-weight: 700;
}

/* ── SC pill ─────────────────────────────────────────── */
.mv-scpill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 18px;
  border-radius: 3px;
  border: 1.5px solid var(--mv-b2);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  transition: all 0.14s;
  pointer-events: none;
}

.mv-scpill.on {
  background: var(--mv-pdim);
  border-color: var(--mv-purple);
  color: var(--mv-purple);
}

.mv-send-cell:hover .mv-scpill {
  border-color: var(--mv-purple);
}

/* ── Empty state ─────────────────────────────────────── */
.mv-empty {
  padding: 48px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Panel container layout ──────────────────────────── */
#mix-view-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── EQ Section ──────────────────────────────────────── */
.mv-eq-section {
  flex-shrink: 0;
  background: #0b0b12;
  border-bottom: 2px solid var(--border-subtle);
}

.mv-eq-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
}

.mv-eq-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #4fc3f7;
  text-transform: uppercase;
  flex: 1;
}

.mv-eq-bypass-btn,
.mv-eq-reset-btn {
  padding: 2px 8px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid;
  background: transparent;
  font-family: var(--font-ui);
  transition: filter 0.12s;
}

.mv-eq-bypass-btn          { border-color: #23d18b; color: #23d18b; }
.mv-eq-bypass-btn.bypassed { border-color: #e8453c; color: #e8453c; }
.mv-eq-reset-btn           { border-color: var(--border-strong); color: var(--text-muted); }
.mv-eq-bypass-btn:hover,
.mv-eq-reset-btn:hover     { filter: brightness(1.35); }

.mv-meter-readout {
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  white-space: nowrap;
}
.mv-meter-readout.hot { color: var(--accent-rec); }

/* ── EQ Canvas ───────────────────────────────────────── */
.mv-eq-canvas-wrap {
  position: relative;
  height: 175px;
  width: 100%;
  overflow: hidden;
}

.mv-eq-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

/* ── Frequency axis labels ───────────────────────────── */
.mv-eq-freq-labels {
  position: relative;
  height: 14px;
  background: #0b0b12;
  border-bottom: 1px solid var(--border-subtle);
}

.mv-eq-freq-label {
  position: absolute;
  top: 1px;
  font-size: 8px;
  color: rgba(255,255,255,0.30);
  font-family: var(--font-mono);
  line-height: 12px;
  transform: translateX(-50%);
}

.mv-eq-freq-label:nth-child(1)  { left:   0%;  transform: none; }
.mv-eq-freq-label:nth-child(2)  { left:  13.2%; }
.mv-eq-freq-label:nth-child(3)  { left:  23.3%; }
.mv-eq-freq-label:nth-child(4)  { left:  33.3%; }
.mv-eq-freq-label:nth-child(5)  { left:  46.6%; }
.mv-eq-freq-label:nth-child(6)  { left:  56.6%; }
.mv-eq-freq-label:nth-child(7)  { left:  66.7%; }
.mv-eq-freq-label:nth-child(8)  { left:  79.9%; }
.mv-eq-freq-label:nth-child(9)  { left:  89.9%; }
.mv-eq-freq-label:nth-child(10) { left: 100%;  transform: translateX(-100%); }

/* ── Band cards row ──────────────────────────────────── */
.mv-eq-bands {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  background: var(--bg-panel);
}

.mv-eq-band-card {
  padding: 5px 6px 4px;
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mv-eq-band-card:last-child { border-right: none; }

.mv-eq-band-hdr {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 1px;
}

.mv-eq-band-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mv-eq-band-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.mv-eq-param {
  display: flex;
  align-items: center;
  gap: 3px;
  min-height: 15px;
}

.mv-eq-param-label {
  font-size: 8px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  min-width: 24px;
  flex-shrink: 0;
  text-transform: uppercase;
}

.mv-eq-param-val {
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text-base);
  cursor: ns-resize;
  padding: 1px 3px;
  border-radius: 2px;
  user-select: none;
  white-space: nowrap;
}
.mv-eq-param-val:hover { background: rgba(255,255,255,0.08); }

/* ── Matrix Section ──────────────────────────────────── */
.mv-matrix-section {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.mv-matrix-section .mv-wrap {
  height: 100%;
}

/* ── Channel section header ──────────────────────────── */
.mv-section-header.sec-channel {
  background: rgba(79,195,247,0.07);
  color: #4fc3f7;
  border-left: 2px solid #4fc3f7;
}

/* ── Channel strip header cells ──────────────────────── */
.mv-ch-header {
  background: var(--bg-panel);
  vertical-align: bottom;
  text-align: center;
  padding: 4px 2px !important;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.mv-ch-vol { width: 76px; min-width: 64px; }
.mv-ch-pan { width: 44px; min-width: 36px; }
.mv-ch-m,
.mv-ch-s   { width: 28px; min-width: 24px; }

/* ── Volume cell ─────────────────────────────────────── */
.mv-vol-cell {
  padding: 3px 6px;
  vertical-align: middle;
}

.mv-vol-val {
  display: block;
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text-base);
  cursor: ns-resize;
  padding: 1px 3px;
  border-radius: 2px;
  user-select: none;
  text-align: center;
  white-space: nowrap;
}
.mv-vol-val:hover { background: rgba(255,255,255,0.08); }

.mv-vu-wrap {
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 2px;
}

.mv-vu-fill {
  height: 100%;
  width: 0%;
  background: hsl(120,75%,48%);
  border-radius: 2px;
}

/* ── Pan cell ────────────────────────────────────────── */
.mv-pan-cell {
  padding: 3px 4px;
  vertical-align: middle;
}

.mv-pan-val {
  display: block;
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text-base);
  cursor: ns-resize;
  padding: 1px 3px;
  border-radius: 2px;
  user-select: none;
  text-align: center;
  white-space: nowrap;
}
.mv-pan-val:hover { background: rgba(255,255,255,0.08); }

/* ── M/S cells & buttons ─────────────────────────────── */
.mv-ms-cell {
  text-align: center;
  padding: 0 3px;
  vertical-align: middle;
}

.mv-ms-btn {
  width: 20px;
  height: 20px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.03em;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: border-color 0.1s, background 0.1s, color 0.1s;
}
.mv-mute-btn:hover  { border-color: #e8453c; color: #e8453c; }
.mv-solo-btn:hover  { border-color: #f0b429; color: #f0b429; }
.mv-mute-btn.active       { background: #e8453c; border-color: #e8453c; color: #fff; }
.mv-solo-btn.active       { background: #f0b429; border-color: #f0b429; color: #000; }
.mv-mute-btn.active:hover { background: #e8453c; border-color: #e8453c; color: #fff; }
.mv-solo-btn.active:hover { background: #f0b429; border-color: #f0b429; color: #000; }

/* ── Empty sub-row channel cells ─────────────────────── */
.mv-ch-empty {
  background: rgba(0,0,0,0.12);
}
