/* LYNX SHARE web — design tokens taken from the native LYNX theme (src/ui/Theme.h) */

:root {
  --bg0: #0e0f12;
  --bg1: #15161a;
  --bg2: #1b1d22;
  --bg3: #23262c;
  --bg4: #2c2f37;
  --bg5: #363a43;
  --bg6: #434852;
  --border: #2a2d34;
  --border-strong: #3b3f48;
  --text: #eceef2;
  --text-2: #a1a6b0;
  --text-3: #60656f;
  --accent: #e5383b;
  --accent-hover: #f2545a;
  --accent-pressed: #c12a30;
  --accent-muted: #5c1f24;
  --on-accent: #fff;
  --automation: #4cc9c0;
  --info: #6ea8fe;
  --led-on: #3ddc84;
  --led-off: #3a3e47;
  --warning: #f5b942;
  --meter-low: #3ddc84;
  --meter-mid: #f5c542;
  --meter-clip: #ff3b3f;
  --record: #ff3b3f;
  --knob-arc: #c5c9d1;
  --knob-track: #444955;
  --step-off: #2a2d34;
  --step-off-alt: #33363f;
  --step-note: #e8a3a6;
  --grid-bar: #3a3e47;
  --grid-beat: #262930;
  --grid-step: #1d1f24;
  --row-white: #1c1e23;
  --row-black: #16171b;
  --note-soft: #b3545a;
  --note-hard: #ff6b6e;
  --audio-clip: #5a87b8;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.45);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, "Cascadia Mono", "Roboto Mono", Menlo, monospace;

  --toolbar-h: 66px;
  --status-h: 26px;
  --row: 26px;
  --panel-title-h: 27px;
  --panel-radius: 4px;
}

* { box-sizing: border-box; }

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg1);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}

button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

input,
select {
  font-family: inherit;
  color: var(--text);
  background: var(--bg0);
  border: 1px solid var(--border);
  border-radius: 3px;
  outline: none;
  padding: 3px 6px;
  font-size: 12px;
}

input:focus,
select:focus { border-color: var(--border-strong); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #33363f; border-radius: 5px; border: 2px solid var(--bg2); }
::-webkit-scrollbar-thumb:hover { background: #454a55; }

#app {
  display: grid;
  grid-template-rows: var(--toolbar-h) 1fr var(--status-h);
  height: 100%;
  width: 100%;
}

/* ------------------------------------------------------------------ toolbar */

#toolbar {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: var(--bg1);
  border-bottom: 1px solid var(--border);
  padding: 4px 8px;
  min-width: 0;
  position: relative;
  z-index: 20;
}

.tb-left {
  display: grid;
  grid-template-rows: var(--row) 1fr;
  width: 322px;
  min-width: 240px;
  flex: 0 0 322px;
  padding-right: 8px;
}

.tb-menurow {
  display: flex;
  align-items: center;
  gap: 1px;
  height: var(--row);
  min-width: 0;
}

.menu-btn {
  height: 22px;
  padding: 0 5px;
  font-size: 11.5px;
  color: var(--text-2);
  border-radius: 3px;
  white-space: nowrap;
}
.menu-btn:hover { background: var(--bg4); color: var(--text); }

.tb-project {
  margin-left: auto;
  margin-right: 4px;
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
  text-align: right;
}

.tb-hint {
  display: flex;
  align-items: center;
  height: 100%;
  min-width: 0;
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 4px;
}
.tb-hint b { color: var(--text-2); font-weight: 500; }
.tb-hint .spark { color: var(--accent); margin-right: 6px; }

.tb-groups {
  display: flex;
  align-items: stretch;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.tb-group {
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 4px;
  position: relative;
  flex: 0 0 auto;
}
.tb-group.hidden { display: none; }
.tb-group + .tb-group::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: var(--border);
}

.tb-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
}
.tb-row {
  display: flex;
  align-items: center;
  gap: 3px;
}
.tb-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(2, 25px);
  gap: 2px 3px;
  align-content: center;
}
.tb-grid.three { grid-template-rows: repeat(2, 25px); }

.icon-btn {
  width: 25px;
  height: 25px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  background: transparent;
  flex: 0 0 auto;
  position: relative;
}
.icon-btn:hover { background: var(--bg4); color: var(--text); }
.icon-btn:active { background: var(--bg5); }
.icon-btn.on { background: var(--bg4); color: var(--text); }
.icon-btn.disabled { opacity: 0.32; pointer-events: none; }
.icon-btn.accent { background: var(--accent); color: var(--on-accent); }
.icon-btn.accent:hover { background: var(--accent-hover); }
.icon-btn svg { width: 15px; height: 15px; pointer-events: none; }
.icon-btn.sm svg { width: 13px; height: 13px; }
.icon-btn.rec { color: var(--record); }
.icon-btn.rec.on { color: var(--on-accent); background: var(--record); }

.transport-btn {
  width: 30px;
  height: 40px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  background: transparent;
}
.transport-btn svg { width: 17px; height: 17px; }
.transport-btn:hover { background: var(--bg4); }
.transport-btn.on { background: var(--accent); color: var(--on-accent); }
.transport-btn.play { color: var(--text); }
.transport-btn.rec { color: var(--record); }
.transport-btn.rec.on { background: var(--record); color: #fff; }

.mode-btn {
  height: 25px;
  min-width: 72px;
  border-radius: 3px;
  border: 1px solid transparent;
  color: var(--text-2);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 8px;
}
.mode-btn svg { width: 13px; height: 13px; }
.mode-btn:hover { background: var(--bg4); color: var(--text); }
.mode-btn.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }

.display {
  background: var(--bg0);
  border: 1px solid var(--border);
  border-radius: 3px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  color: var(--text);
  cursor: ns-resize;
  position: relative;
  padding: 0 6px;
  overflow: hidden;
}
.display:hover { border-color: var(--border-strong); }
.display .big { font-size: 17px; letter-spacing: 0.5px; line-height: 1; }
.display .big small { font-size: 10px; color: var(--text-3); letter-spacing: 0; margin-left: 2px; }
.display.tempo { width: 88px; }
.display.time { width: 104px; }
.display .sub {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2px;
  text-align: center;
  font-size: 7.5px;
  color: var(--text-3);
  letter-spacing: 1.4px;
  font-family: var(--font);
}
.display .unit { color: var(--text-3); font-size: 9px; margin-left: 4px; letter-spacing: 0.5px; }

.copy-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  justify-content: center;
  align-items: stretch;
  height: 100%;
}

.mini-knob {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 48px;
  gap: 1px;
}
.mini-knob canvas { width: 34px; height: 34px; cursor: ns-resize; }
.mini-knob .k-label {
  font-size: 8px;
  letter-spacing: 0.7px;
  color: var(--text-3);
  text-transform: uppercase;
  white-space: nowrap;
}
.mini-knob .k-value { font-size: 9px; color: var(--text-2); font-family: var(--mono); margin-top: -1px; }

.select-inline {
  height: 25px;
  background: var(--bg0);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-2);
  font-size: 11px;
  padding: 0 22px 0 7px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%),
    linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 11px) 11px, calc(100% - 7px) 11px;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  cursor: pointer;
  max-width: 160px;
  text-overflow: ellipsis;
}
.select-inline:hover { border-color: var(--border-strong); color: var(--text); }
.select-inline.wide { min-width: 128px; }

.caption {
  font-size: 8px;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
}

.meter-inline {
  width: 12px;
  height: 42px;
  border-radius: 2px;
  background: var(--bg0);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
}
.meter-inline i {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0%;
  background: linear-gradient(to top, var(--meter-low), var(--meter-mid) 70%, var(--meter-clip));
  transition: height 60ms linear;
}
.meter-block { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.meter-block .caption { font-size: 7.5px; }
.cpu-block { min-width: 104px; }
.cpu-bar {
  height: 6px;
  width: 92px;
  background: var(--bg0);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}
.cpu-bar i { display: block; height: 100%; width: 4%; background: var(--meter-low); border-radius: 3px; }
.cpu-read { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 9px; color: var(--text-3); width: 92px; margin-top: 2px; }

/* ------------------------------------------------------------------ workspace + panels */

#workspace {
  position: relative;
  overflow: hidden;
  background: var(--bg1);
}

.panel {
  position: absolute;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--panel-radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 240px;
  min-height: 120px;
  box-shadow: var(--shadow);
}
.panel.docked { box-shadow: none; border-radius: 0; border-top: 0; border-bottom: 0; border-left: 0; }
.panel.hidden { display: none; }
.panel.maximised { border-radius: 0; }
.panel.focused { border-color: var(--border-strong); }
.panel.dragging, .panel.resizing { user-select: none; }

.panel-title {
  height: var(--panel-title-h);
  flex: 0 0 var(--panel-title-h);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px 0 8px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  cursor: default;
  position: relative;
}
.panel.focused .panel-title { background: #262a31; }
.panel-title .p-icon { color: var(--text-3); display: flex; }
.panel-title .p-icon svg { width: 13px; height: 13px; }
.panel-title .p-name {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.25px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.panel.focused .panel-title .p-name { color: var(--text); }
.panel-title .p-accessory {
  margin-left: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 10.5px;
  color: var(--text-3);
}
.panel-title .p-buttons { margin-left: auto; display: flex; align-items: center; gap: 1px; }
.panel-title .p-btn {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.panel-title .p-btn:hover { background: var(--bg5); color: var(--text); }
.panel-title .p-btn svg { width: 12px; height: 12px; }

.panel-toolbar {
  height: 29px;
  flex: 0 0 29px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  min-width: 0;
}
.panel-toolbar .sep { width: 1px; height: 16px; background: var(--border); margin: 0 4px; flex: 0 0 1px; }
.panel-toolbar .grow { flex: 1 1 auto; }
.tool-btn {
  width: 23px;
  height: 23px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  flex: 0 0 auto;
}
.tool-btn svg { width: 14px; height: 14px; }
.tool-btn:hover { background: var(--bg4); color: var(--text); }
.tool-btn.on { background: var(--accent); color: var(--on-accent); }
.tool-btn.plain.on { background: var(--bg5); color: var(--text); }
.tool-select {
  height: 23px;
  font-size: 11px;
  background: var(--bg0);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-2);
  padding: 0 20px 0 6px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%),
    linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 10px) 10px, calc(100% - 6px) 10px;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  cursor: pointer;
  max-width: 160px;
}
.tool-select:hover { border-color: var(--border-strong); color: var(--text); }

.panel-body {
  flex: 1 1 auto;
  position: relative;
  min-height: 0;
  min-width: 0;
  display: flex;
}
.canvas-wrap { position: relative; flex: 1 1 auto; min-width: 0; min-height: 0; overflow: hidden; }
.canvas-wrap canvas { display: block; width: 100%; height: 100%; touch-action: none; }

.panel-split { display: flex; flex: 1 1 auto; min-width: 0; min-height: 0; }
.side-panel {
  flex: 0 0 296px;
  border-left: 1px solid var(--border);
  background: var(--bg2);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.side-panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.side-panel-head .title { font-size: 11.5px; font-weight: 600; color: var(--text); }
.side-panel-head .sub { font-size: 10px; color: var(--text-3); }
.fx-toggle {
  margin-left: auto;
  height: 18px;
  padding: 0 7px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  background: var(--bg4);
  color: var(--text-2);
  border: 1px solid var(--border-strong);
}
.fx-toggle.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ------------------------------------------------------------------ browser */

.browser {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  background: var(--bg2);
}
.browser-tabs {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 5px 10px 0;
  flex: 0 0 auto;
}
.browser-tab {
  font-size: 9.5px;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--text-3);
  padding-bottom: 5px;
  border-bottom: 2px solid transparent;
  font-weight: 600;
}
.browser-tab:hover { color: var(--text-2); }
.browser-tab.on { color: var(--text); border-bottom-color: var(--accent); }
.browser-search {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.browser-search svg { width: 13px; height: 13px; color: var(--text-3); flex: 0 0 auto; }
.browser-search input {
  flex: 1 1 auto;
  height: 22px;
  background: var(--bg0);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 11px;
  padding: 0 7px;
  color: var(--text);
  min-width: 0;
}
.browser-search input::placeholder { color: var(--text-3); }
.browser-tree {
  flex: 1 1 auto;
  overflow: auto;
  padding: 4px 0 12px;
  font-size: 11.5px;
}
.tree-row {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 23px;
  padding: 0 8px 0 8px;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
}
.tree-row:hover { background: var(--bg4); color: var(--text); }
.tree-row.selected { background: var(--accent-muted); color: var(--text); }
.tree-row .caret {
  width: 10px;
  height: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  flex: 0 0 10px;
}
.tree-row .caret svg { width: 8px; height: 8px; transition: transform 0.12s; }
.tree-row.open .caret svg { transform: rotate(90deg); }
.tree-row .tico { width: 14px; height: 14px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-3); flex: 0 0 14px; }
.tree-row .tico svg { width: 12px; height: 12px; }
.tree-row .tname { overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; }
.tree-row .badge { font-size: 9px; color: var(--text-3); font-family: var(--mono); }
.tree-row .dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; }
.tree-row.indent-1 { padding-left: 22px; }
.tree-row.indent-2 { padding-left: 38px; }
.browser-foot {
  flex: 0 0 auto;
  border-top: 1px solid var(--border);
  padding: 7px 9px;
  font-size: 10px;
  color: var(--text-3);
  display: flex;
  gap: 6px;
  align-items: center;
}
.browser-foot b { color: var(--text-2); font-weight: 500; }

/* ------------------------------------------------------------------ effects panel */

.fx-list { flex: 1 1 auto; overflow: auto; padding: 6px; display: flex; flex-direction: column; gap: 3px; min-height: 72px; }
.fx-slot {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 6px;
  border-radius: 3px;
  background: var(--bg3);
  border: 1px solid transparent;
  color: var(--text-2);
  font-size: 11px;
  cursor: pointer;
  flex: 0 0 auto;
}
.fx-slot:hover { background: var(--bg4); }
.fx-slot.selected { border-color: var(--accent); background: #2a2225; color: var(--text); }
.fx-slot.empty { background: transparent; border: 1px dashed #2f333b; color: var(--text-3); }
.fx-slot.empty:hover { border-color: var(--border-strong); color: var(--text-2); }
.fx-slot .slot-no { width: 14px; font-family: var(--mono); font-size: 9px; color: var(--text-3); text-align: center; }
.fx-slot .slot-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-slot .fx-led {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--led-off);
  border: 1px solid #14161a;
  flex: 0 0 13px;
}
.fx-slot .fx-led.on { background: var(--led-on); box-shadow: 0 0 5px rgba(61, 220, 132, 0.5); }
.fx-slot .chev { color: var(--text-3); font-size: 9px; }
.fx-slot .fx-mini { width: 28px; height: 16px; }

.fx-editor {
  flex: 0 1 auto;
  border-top: 1px solid var(--border);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 202px;
  min-height: 0;
  max-height: none;
  overflow: auto;
  position: relative;
}
.fx-editor .fx-title { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--text); }
.fx-editor .fx-title .sub { color: var(--text-3); font-weight: 400; font-size: 10px; }
.fx-editor .fx-actions { margin-left: auto; display: flex; gap: 4px; }
.fx-knobs { display: flex; flex-wrap: wrap; gap: 6px 2px; justify-content: flex-start; }
.fx-knob { display: flex; flex-direction: column; align-items: center; width: 62px; }
.fx-knob canvas { width: 42px; height: 42px; cursor: ns-resize; }
.fx-knob .k-label { font-size: 9.5px; color: var(--text-2); margin-top: 1px; text-align: center; white-space: nowrap; }
.fx-knob .k-value { font-size: 9px; color: var(--text-3); font-family: var(--mono); }
.fx-empty { color: var(--text-3); font-size: 11px; padding: 10px; text-align: center; line-height: 1.5; }
.eq-wrap { display: flex; flex-direction: column; gap: 8px; }
.eq-canvas { width: 100%; height: 88px; background: var(--bg0); border: 1px solid var(--border); border-radius: 3px; display: block; touch-action: none; }
.eq-bands { display: flex; gap: 3px; }
.eq-band {
  flex: 1 1 0;
  height: 20px;
  border-radius: 2px;
  background: var(--bg4);
  color: var(--text-3);
  font-size: 9px;
  font-family: var(--mono);
  display: flex;
  align-items: center;
  justify-content: center;
}
.eq-band.on { background: var(--accent-muted); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent); }
.eq-params { display: flex; gap: 2px; }

/* ------------------------------------------------------------------ menus */

.menu {
  position: fixed;
  z-index: 900;
  background: var(--bg3);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.6);
  padding: 4px;
  min-width: 190px;
  max-width: 340px;
  max-height: 76vh;
  overflow: auto;
  font-size: 12px;
}
.menu .mi {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 25px;
  padding: 0 9px;
  border-radius: 3px;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
}
.menu .mi:hover { background: var(--bg5); color: var(--text); }
.menu .mi.disabled { color: var(--text-3); pointer-events: none; }
.menu .mi .check { width: 12px; display: inline-flex; justify-content: center; color: var(--accent); flex: 0 0 12px; }
.menu .mi .label { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; }
.menu .mi .sc { color: var(--text-3); font-size: 10px; margin-left: 22px; }
.menu .mi .arrow { color: var(--text-3); font-size: 9px; margin-left: 12px; }
.menu .sep { height: 1px; background: var(--border); margin: 4px 6px; }
.menu .header { font-size: 8.5px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-3); padding: 6px 9px 4px; }
.menu .mi.danger { color: #ff8a8d; }
.menu .mi.danger:hover { background: #4a1c1f; color: #ff9b9e; }

/* ------------------------------------------------------------------ dialogs */

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 8, 0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(1.5px);
}
.dialog {
  width: 460px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 60px);
  background: var(--bg2);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.dialog.wide { width: 720px; }
.dialog-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
}
.dialog-head .title { font-size: 13px; font-weight: 600; }
.dialog-head .close { margin-left: auto; color: var(--text-3); width: 22px; height: 22px; border-radius: 3px; }
.dialog-head .close:hover { background: var(--bg5); color: var(--text); }
.dialog-body { padding: 14px; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.dialog-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg1);
  justify-content: flex-end;
}
.btn {
  height: 27px;
  padding: 0 13px;
  border-radius: 3px;
  background: var(--bg4);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover { background: var(--bg5); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-3); }
.field input, .field select { height: 28px; font-size: 12px; }
.field-row { display: flex; gap: 10px; }
.field-row > * { flex: 1 1 0; }
.hint { font-size: 11px; color: var(--text-3); line-height: 1.5; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 22px; height: 22px; border-radius: 4px; border: 1px solid rgba(255, 255, 255, 0.12); }
.swatch.on { box-shadow: 0 0 0 2px var(--text); }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.settings-section { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 2px; }
.settings-section > h4 {
  margin: 0 0 8px;
  font-size: 9.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 600;
}
.knob-row { display: flex; flex-wrap: wrap; gap: 4px; }
.knob-row .fx-knob { width: 58px; }
.section-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-3); margin-bottom: 2px; }

/* ------------------------------------------------------------------ status bar */

#statusbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
  background: var(--bg1);
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 10.5px;
  z-index: 30;
  overflow: hidden;
  white-space: nowrap;
}
#statusbar .st-left { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; overflow: hidden; }
#statusbar .st-left svg { width: 11px; height: 11px; color: var(--accent); flex: 0 0 11px; }
#statusbar .st-left span { overflow: hidden; text-overflow: ellipsis; }
#statusbar .st-right { display: flex; align-items: center; gap: 14px; flex: 0 0 auto; font-family: var(--mono); font-size: 9.5px; }
#statusbar .st-right b { color: var(--text-2); font-weight: 500; }
#statusbar .st-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
#statusbar .st-dot.ready { background: var(--led-on); }
#statusbar .st-dot.suspended { background: var(--warning); }

/* ------------------------------------------------------------------ misc */

.toast {
  position: fixed;
  left: 50%;
  bottom: 44px;
  transform: translateX(-50%);
  background: var(--bg3);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 4px;
  font-size: 11.5px;
  z-index: 1200;
  box-shadow: var(--shadow);
  animation: toast-in 0.16s ease-out;
  max-width: 70vw;
  text-align: center;
}
.toast .accent { color: var(--accent); }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.badge-pill {
  font-size: 8.5px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 2px 5px;
  border-radius: 8px;
  background: var(--bg4);
  color: var(--text-2);
}
.badge-pill.alpha { background: var(--accent-muted); color: #ffb9bb; }

.record-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--record);
  display: inline-block;
}
.blink { animation: blink 1s steps(2, start) infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

.zoom-readout { min-width: 47px; text-align: center; font-family: var(--mono); font-size: 10px; color: var(--text-3); }

.spacer { flex: 1 1 auto; min-width: 2px; }

.overlay-loading {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(9, 10, 13, 0.82);
  color: var(--text-2);
  font-size: 12px;
  flex-direction: column;
  gap: 12px;
  backdrop-filter: blur(2px);
}
.overlay-loading .ring {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #33363f;
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1280px) {
  .tb-left { flex-basis: 322px; width: 322px; }
  .tb-project { display: none; }
}
@media (max-width: 1080px) {
  .tb-group[data-priority="low"] { display: none; }
  .side-panel { flex-basis: 270px; }
}

/* --- panel helpers added for the web workspace --- */
.panel-body.column { flex-direction: column; }
.browser-host { display: flex; flex: 1 1 auto; min-height: 0; min-width: 0; }
.resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 15px;
  height: 15px;
  cursor: nwse-resize;
  z-index: 8;
}
.resize-handle::after {
  content: "";
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 7px;
  height: 7px;
  border-right: 1px solid #4b505b;
  border-bottom: 1px solid #4b505b;
}
.panel.maximised .resize-handle { display: none; }
.panel-title .p-accessory b { color: var(--text-2); font-weight: 500; }
