.mib-pro-workspace {
  margin: 0 16px 14px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #1b202b, #171a22);
  border: 1px solid var(--gb-border);
  border-radius: 10px;
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(280px, 2fr);
  gap: 14px;
  align-items: center;
}

.mib-ai-workbench {
  margin: 14px 16px 0;
  padding: 16px 18px;
  background: linear-gradient(135deg, #1d2531, #171b23 70%);
  border: 1px solid #3b485d;
  border-top: 2px solid var(--gb-cyan);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,.26);
}
.mib-ai-head { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; }
.mib-ai-kicker { color:var(--gb-cyan); font:800 10px var(--font-mono); letter-spacing:.12em; }
.mib-ai-head h2 { margin:4px 0 5px; font-size:18px; line-height:1.2; }
.mib-ai-head p { max-width:800px; color:var(--gb-muted); font-size:12px; line-height:1.45; }
.mib-ai-status { display:flex; align-items:center; gap:7px; white-space:nowrap; color:#86efac; font-size:12px; font-weight:800; }
.mib-ai-status.error { color:#fca5a5; }
.mib-ai-status-led { width:9px; height:9px; border-radius:50%; background:#22c55e; box-shadow:0 0 10px rgba(34,197,94,.75); }
.mib-ai-status.error .mib-ai-status-led { background:#ef4444; box-shadow:0 0 10px rgba(239,68,68,.75); }
.mib-ai-controls, .mib-ai-actions, .mib-ai-stems { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-top:13px; }
.mib-ai-button { min-height:34px; border:1px solid #3b485d; border-radius:7px; padding:7px 12px; background:#242d3b; color:#e2e8f0; font:800 12px var(--font-ui); cursor:pointer; }
.mib-ai-button:hover { border-color:var(--gb-cyan); color:#fff; }
.mib-ai-button.primary, .mib-ai-button.analyse { background:#0891b2; border-color:#22d3ee; color:#071017; }
.mib-ai-button.analyse:disabled { opacity:.45; cursor:not-allowed; }
.mib-ai-file { color:#cbd5e1; font:500 12px var(--font-mono); min-width:180px; flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mib-ai-field { display:flex; align-items:center; gap:5px; color:#94a3b8; font-size:11px; font-weight:700; }
.mib-ai-field input, .mib-ai-field select { width:72px; border:1px solid #3b485d; border-radius:6px; padding:7px 8px; background:#10151d; color:#f8fafc; font:700 12px var(--font-mono); }
.mib-ai-field select { width:88px; }
.mib-ai-label { color:#94a3b8; font:800 10px var(--font-mono); letter-spacing:.08em; text-transform:uppercase; }
.mib-ai-check { display:inline-flex; align-items:center; gap:6px; padding:7px 9px; border:1px solid #354154; border-radius:7px; color:#cbd5e1; font-size:11px; cursor:pointer; }
.mib-ai-check:has(input:checked) { border-color:#22d3ee; color:#fff; background:rgba(8,145,178,.15); }
.mib-ai-check input { accent-color:var(--gb-cyan); }
.mib-ai-progress { height:8px; min-width:140px; flex:1; max-width:360px; background:#0b1016; border:1px solid #334155; border-radius:5px; overflow:hidden; }
.mib-ai-progress-bar { width:0; height:100%; background:linear-gradient(90deg,#06b6d4,#22c55e); transition:width .25s ease; }
.mib-ai-progress-text { color:#94a3b8; font:500 11px var(--font-mono); }
.mib-ai-workbench.collapsed { padding: 8px 14px; margin-top: 8px; margin-bottom: 8px; }
.mib-ai-workbench.collapsed .mib-ai-head h2 { font-size: 13px; margin: 2px 0 0; }
.mib-ai-workbench.collapsed .mib-ai-kicker { font-size: 9px; }
@media (max-width: 780px) {
  .mib-ai-workbench { margin:8px; padding:10px; }
  .mib-ai-workbench.collapsed { padding: 6px 10px; }
  .mib-ai-head { display:flex; align-items:center; justify-content:space-between; }
  .mib-ai-status { margin-top:0; font-size:11px; }
  .mib-ai-controls, .mib-ai-actions, .mib-ai-stems { align-items:stretch; }
  .mib-ai-button, .mib-ai-progress { flex:1 1 100%; }
  .mib-ai-file { flex-basis:100%; }
  .mib-ai-progress { max-width:none; }
}
.mib-pro-project-line, .mib-pro-arrangement-line { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.mib-pro-project-title { font-size:13px; font-weight:800; color:#fff; }
.mib-pro-project-state { color:var(--gb-muted); font-size:11px; }
.mib-pro-workspace button { font: inherit; }
.mib-pro-small-btn { border:1px solid var(--gb-border-light); background:#202632; color:#e2e8f0; border-radius:6px; padding:5px 8px; cursor:pointer; font-size:11px; }
.mib-pro-small-btn:hover, .mib-pro-small-btn.active { border-color:var(--gb-cyan); color:#fff; background:#243244; }
.mib-pro-section { border-left: 2px solid var(--gb-gold); padding-left: 10px; }
.mib-pro-section-label { color:var(--gb-muted); font-size:10px; font-weight:800; letter-spacing:.08em; text-transform:uppercase; margin-bottom:5px; }
.mib-pro-section-list { display:flex; gap:6px; flex-wrap:wrap; }
.mib-pro-section-chip { border:1px solid #465066; background:#222938; color:#f8fafc; border-radius:5px; padding:5px 8px; font-size:11px; cursor:pointer; }
.mib-pro-section-chip.active { background:#b45309; border-color:#f59e0b; color:#fff; }
.mib-pro-record-state { color:#fb7185; font-size:11px; font-weight:800; }

/* GarageBand-style library: persistent patches beside the arrangement. */
.gb-workspace {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 0;
  align-items: start;
}
.mib-studio-library {
  grid-column: 1;
  grid-row: 1 / span 99;
  min-height: calc(100vh - 108px);
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 16px 12px;
  background: #1b1d24;
  border-right: 1px solid var(--gb-border);
  box-shadow: 10px 0 26px rgba(0,0,0,.16);
}
.mib-library-header { display:flex; justify-content:space-between; gap:8px; align-items:flex-start; margin:2px 2px 12px; }
.mib-library-kicker { color:#94a3b8; font-size:9px; font-weight:800; letter-spacing:.14em; }
.mib-library-title { color:#f8fafc; font-size:14px; font-weight:800; margin-top:4px; }
.mib-library-collapse { width:28px; height:28px; border:1px solid #3b4659; border-radius:6px; background:#232833; color:#cbd5e1; cursor:pointer; }
.mib-library-search { height:32px; display:flex; gap:8px; align-items:center; padding:0 9px; border:1px solid #3b4659; border-radius:6px; background:#13161d; color:#94a3b8; }
.mib-library-search input { width:100%; min-width:0; border:0; outline:0; background:transparent; color:#f8fafc; font:inherit; font-size:11px; }
.mib-library-search input::placeholder { color:#64748b; }
.mib-library-tabs { display:flex; gap:4px; margin:12px 0 14px; overflow:auto; padding-bottom:2px; }
.mib-library-tab { flex:0 0 auto; border:0; border-radius:5px; padding:5px 8px; color:#94a3b8; background:transparent; cursor:pointer; font:700 10px inherit; }
.mib-library-tab:hover { color:#fff; background:#242a35; }
.mib-library-tab.active { color:#111827; background:var(--gb-gold); }
.mib-library-group-label { color:#64748b; font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:.1em; margin:0 4px 7px; }
.mib-library-list { display:flex; flex-direction:column; gap:4px; }
.mib-library-item { width:100%; display:grid; grid-template-columns:30px minmax(0,1fr); gap:8px; align-items:center; text-align:left; padding:7px; border:1px solid transparent; border-radius:6px; color:#e2e8f0; background:transparent; cursor:pointer; }
.mib-library-item:hover, .mib-library-item.active { border-color:#536176; background:#272d38; }
.mib-library-icon { width:28px; height:28px; display:grid; place-items:center; border-radius:5px; color:#fff; background:#334155; font-size:12px; }
.mib-library-item[data-category="guitar"] .mib-library-icon { background:#075985; }
.mib-library-item[data-category="bass"] .mib-library-icon { background:#5b21b6; }
.mib-library-item[data-category="drums"] .mib-library-icon { background:#9a3412; }
.mib-library-item[data-category="fx"] .mib-library-icon { background:#166534; }
.mib-library-item-title { font-size:11px; font-weight:800; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.mib-library-item-copy { color:#94a3b8; font-size:9px; margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.mib-library-empty { color:#64748b; font-size:10px; padding:12px 6px; }
.mib-library-footer { display:flex; gap:6px; align-items:center; color:#64748b; font-size:9px; margin:18px 4px 0; }
.mib-library-status-dot { width:6px; height:6px; border-radius:50%; background:#22c55e; box-shadow:0 0 8px rgba(34,197,94,.7); }
body.mib-library-collapsed .gb-workspace { grid-template-columns:52px minmax(0,1fr); }
.mib-library-collapsed .mib-studio-library { padding-inline:8px; }
.mib-library-collapsed .mib-library-search, .mib-library-collapsed .mib-library-tabs, .mib-library-collapsed .mib-library-group-label, .mib-library-collapsed .mib-library-list, .mib-library-collapsed .mib-library-footer, .mib-library-collapsed .mib-library-title { display:none; }
.mib-library-collapsed .mib-studio-library { min-width:52px; }
.gb-workspace > .starter-sessions, .gb-workspace > .gb-view-panel { grid-column:2; min-width:0; }
.daw-track-row.is-playing { box-shadow: inset 3px 0 0 #22c55e, inset 0 0 24px rgba(34,197,94,.08); }
.daw-track-row.is-playing .track-color-pill { box-shadow: 0 0 0 3px rgba(34,197,94,.16), 0 0 10px rgba(34,197,94,.9); }
.track-meter-fill { transition: width .05s linear; }
.mib-input-level { display:flex; align-items:center; gap:6px; color:var(--gb-muted); font-size:10px; white-space:nowrap; }
.mib-input-level > div { width:52px; height:6px; overflow:hidden; background:#090c10; border:1px solid #233042; border-radius:2px; }
.mib-input-level i { display:block; width:100%; height:0%; background:linear-gradient(90deg,#22c55e,#f59e0b,#ef4444); transition:height .05s linear; }
@media (max-width: 780px) {
  .gb-workspace { display:block; }
  .mib-studio-library { display: none; }
  body.mobile-library-open .mib-studio-library { display: block; position: fixed; top: 56px; left: 0; right: 0; bottom: 0; z-index: 999; background: #181a20; padding: 12px; overflow-y: auto; }
  .mib-library-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
  .mib-library-footer { display:none; }
  .gb-header { height:auto; min-height:56px; padding:6px 8px; gap:6px; flex-wrap:wrap; align-items:center; }
  .gb-brand { flex:1 1 auto; min-width:110px; gap:6px; }
  .gb-app-icon { width:28px; height:28px; font-size:13px; }
  .gb-title { font-size:12px; }
  .gb-subtitle { font-size:9px; }
  .gb-lcd { order:3; flex:1 0 100%; min-width:0; height:46px; padding:3px 6px; }
  .gb-transport { order:2; padding:2px 3px; gap:4px; }
  .transport-btn { width:30px; height:30px; font-size:11px; }
  .transport-btn.rec-btn {
    width: 36px !important;
    height: 36px !important;
    font-size: 13px !important;
    background: #991b1b !important;
    border-color: #ef4444 !important;
    color: #ffffff !important;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5) !important;
  }
  .transport-btn.rec-btn.active {
    background: #ef4444 !important;
    animation: recPulse 1s infinite alternate;
  }
  .gb-master { display:none; }
  .gb-view-toolbar { height:auto; min-height:40px; padding:4px 6px; gap:4px; align-items:stretch; flex-direction:column; }
  .gb-view-buttons, .gb-project-actions { overflow-x:auto; justify-content:flex-start; flex-wrap:nowrap; width:100%; padding-bottom:2px; -webkit-overflow-scrolling:touch; }
  .gb-tab-btn, .gb-action-btn { flex:0 0 auto; white-space:nowrap; }
  .gb-tab-btn { padding:5px 8px; font-size:10px; }
  .gb-project-actions { gap:4px; }
  .gb-project-actions .gb-action-btn { font-size:10px; padding:4px 7px; }

  /* Touch-friendly compact mobile track headers: leaving 70-85% for the Arranger! */
  .daw-track-header-corner, .daw-track-header { width:112px; min-width:112px; padding:6px 6px; }
  .daw-track-row { height:84px; }
  .track-name-badge { font-size:10px; max-width:96px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .track-name-badge span:last-child { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .track-btns-row { gap:2px; }
  .track-btn { width:20px; height:20px; font-size:9px; border-radius:3px; }
  .track-slider-row { gap:4px; margin-top:2px; }
  .track-meter { width:24px; height:5px; }

  .daw-view-panel, .gb-view-panel { padding:6px; }
  .mib-pro-workspace { margin:6px; padding:8px 10px; grid-template-columns:1fr; }
  .mib-pro-section-list { overflow-x:auto; flex-wrap:nowrap; -webkit-overflow-scrolling:touch; padding-bottom:4px; }
  .mib-pro-section-chip { flex:0 0 auto; padding:4px 8px; font-size:10px; }
  .mib-pro-project-line, .mib-pro-arrangement-line { align-items:flex-start; }
}

/* Optional Ultra-Compact Mode (GarageBand mobile style: 52px icon strip) */
body.compact-tracks .daw-track-header-corner,
body.compact-tracks .daw-track-header {
  width: 52px !important;
  min-width: 52px !important;
  padding: 6px 4px !important;
  align-items: center;
  text-align: center;
}
body.compact-tracks .track-name-badge span:last-child,
body.compact-tracks .track-slider-row,
body.compact-tracks .track-btn.rec,
body.compact-tracks .track-btn.mon {
  display: none !important;
}
body.compact-tracks .track-title-row {
  flex-direction: column;
  gap: 3px;
  align-items: center;
}
body.compact-tracks .track-btns-row {
  gap: 2px;
}

/* Luminous playhead line slicing through all tracks */
.daw-tracks-playhead-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ef4444;
  z-index: 75;
  pointer-events: none;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.85);
  transition: opacity 0.15s;
}

/* Synchronized smooth touch scrolling */
.daw-ruler-scroll, .daw-tracks-lanes-scroll, .daw-track-lane {
  -webkit-overflow-scrolling: touch;
}

