/*
 * myspice — shell v2
 *
 * New layout shell ("focus on the relevant thing fast"):
 *   - top bar with brand + huge mode tabs (DC / Transient / Phasor)
 *   - left rail vertical tool palette, grouped by family
 *   - center canvas with overlays (multimeter pill, zoom controls)
 *   - right inspector with tabs: Problem · Results · Library
 *
 * Only the SHELL is new. All the legacy element ids that myspice.js
 * binds to are preserved (#canvas, #panel, #btn-solve, #btn-mode-*,
 * #popup, #library-modal, etc.). The Style Studio + extensions ride
 * along unchanged.
 */

/* ============================================================
   App grid: header (auto) + workspace (1fr) + slim footer
   ============================================================ */
.shell-app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

/* The base.css `.toolbar` row is replaced by the rail — hide it. */
.shell-v2 .toolbar-shim { display: none; }

/* Override base.css `.main` grid (it's used in workspace below) */
.shell-app > .workspace {
  display: grid;
  grid-template-columns: 76px 1fr var(--inspector-width, 340px);
  min-height: 0; overflow: hidden;
}

/* The legacy bottom-of-canvas time-scrubber + freq-controls sit
   inside .canvas-col now. They were displayed beside the legacy
   .canvas-wrap; the canvas-col CSS keeps them aligned. */

/* ============================================================
   TOP BAR
   ============================================================ */
.topbar {
  display: flex; flex-direction: column;
  background: var(--chrome-bg, #fff);
  border-bottom: 1px solid var(--border);
  z-index: 4;
}
.topbar-row { display: flex; align-items: center; }
.topbar-brand {
  padding: 6px 16px 6px 16px;
  gap: 12px;
  min-height: 44px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
}
.topbar-brand .brand {
  display: flex; align-items: baseline; gap: 6px;
  margin: 0; font: inherit; font-size: 15px; font-weight: 600;
  letter-spacing: var(--header-tracking, -0.015em);
}
.topbar-brand .brand .wordmark-mark { margin-right: 1px; }
.topbar-brand .brand .muted { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 2px; }
.topbar-brand .actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.topbar-brand .actions button {
  font: inherit; font-size: 12px; padding: 5px 11px;
  border: 1px solid var(--border); background: var(--chrome-bg, #fff);
  color: var(--ink); border-radius: 5px; cursor: pointer;
  transition: background 120ms, border-color 120ms;
}
.topbar-brand .actions button:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 8%, var(--chrome-bg));
  border-color: var(--accent);
}
.topbar-brand .actions button:disabled { opacity: 0.45; cursor: not-allowed; }
.topbar-brand .actions .iconbtn { padding: 6px 7px; line-height: 0; }

/* HUGE mode tabs */
.topbar-modes {
  padding: 0; min-height: 56px;
  background: color-mix(in srgb, var(--panel) 60%, var(--chrome-bg));
}
.mode-tabs-big {
  display: grid; grid-template-columns: repeat(3, 1fr);
  width: 100%; gap: 0;
}
.mode-tab-big {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; padding: 8px 16px; min-height: 56px;
  font: inherit; border: none; cursor: pointer;
  background: transparent; color: var(--muted);
  border-bottom: 3px solid transparent;
  transition: color 140ms, background 140ms, border-color 140ms;
  position: relative;
}
.mode-tab-big + .mode-tab-big {
  box-shadow: inset 1px 0 0 color-mix(in srgb, var(--border) 70%, transparent);
}
.mode-tab-big .mt-label {
  font-size: 16px; font-weight: 600; letter-spacing: -0.01em;
}
.mode-tab-big .mt-sub {
  font-size: 11px; color: var(--muted); font-weight: 400;
  text-transform: lowercase; letter-spacing: 0.01em;
}
.mode-tab-big:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}
.mode-tab-big.active {
  color: var(--ink);
  background: var(--chrome-bg);
  border-bottom-color: var(--accent);
}
.mode-tab-big.active .mt-label { color: var(--ink); }
.mode-tab-big.active .mt-sub { color: var(--accent); font-weight: 500; }

/* ============================================================
   LEFT RAIL — vertical tool palette
   ============================================================ */
.rail {
  background: var(--chrome-bg, #fff);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 10px 6px 6px;
  gap: 4px; overflow-y: auto;
  min-height: 0;
}
.rail-group {
  display: flex; flex-direction: column;
  gap: 2px; padding-bottom: 4px;
}
.rail-group + .rail-group {
  border-top: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
  padding-top: 6px; margin-top: 2px;
}
.rail-label {
  font-size: 8.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); font-weight: 600; padding: 0 4px 2px;
  text-align: center;
}
.rail-btn.tool-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; padding: 8px 4px;
  background: var(--chrome-bg, #fff);
  border: 1px solid transparent;
  color: var(--ink); cursor: pointer; border-radius: 6px;
  transition: background 120ms, border-color 120ms, transform 60ms;
  min-height: 50px;
}
.rail-btn.tool-btn svg { display: block; }
.rail-btn .rail-cap {
  font-size: 9.5px; line-height: 1.1; color: var(--muted);
  font-weight: 500; margin-top: 2px;
}
.rail-btn.tool-btn:hover:not(.active) {
  background: color-mix(in srgb, var(--accent) 6%, var(--chrome-bg));
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}
.rail-btn.tool-btn:hover .rail-cap { color: var(--ink); }
.rail-btn.tool-btn.active {
  background: var(--accent); color: var(--bg);
  border-color: var(--accent);
}
.rail-btn.tool-btn.active .rail-cap { color: var(--bg); }
.rail-btn.tool-btn.active .ink,
.rail-btn.tool-btn.active .wire { stroke: var(--bg); }
.rail-btn.tool-btn.active .ink-fill { fill: var(--bg); }

.rail-spacer { flex: 1; }

.rail-danger:hover:not(.active) {
  background: color-mix(in srgb, var(--plus, #b91c1c) 12%, var(--chrome-bg)) !important;
  border-color: var(--plus, #b91c1c) !important;
}
.rail-danger:hover:not(.active) .rail-cap { color: var(--plus, #b91c1c) !important; }

.rail-tip {
  font-size: 9.5px; color: var(--muted); text-align: center;
  padding: 8px 2px 4px; line-height: 1.4;
  border-top: 1px dashed color-mix(in srgb, var(--border) 70%, transparent);
}
.rail-tip kbd {
  font-family: var(--font-mono, ui-monospace, monospace);
  border: 1px solid var(--border); background: var(--panel);
  padding: 1px 4px; border-radius: 3px; font-size: 9px;
}

/* ============================================================
   CANVAS COL
   ============================================================ */
.canvas-col {
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
  background: var(--bg);
  position: relative;
}
.canvas-col .canvas-frame {
  flex: 1; min-height: 0; overflow: hidden;
  position: relative; cursor: crosshair;
  background-image: var(--canvas-bg-image);
  background-size: var(--canvas-bg-size);
  background-color: var(--canvas-bg, var(--bg));
}
.canvas-col svg#canvas {
  display: block; width: 100%; height: 100%;
  background: transparent; border: none;
  cursor: inherit; user-select: none;
}

/* Multimeter pill (top-left of canvas) */
.multimeter-pill {
  position: absolute; top: 12px; left: 12px;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  background: color-mix(in srgb, var(--chrome-bg, #fff) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 4px 12px rgba(0,0,0,0.06);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 3;
  font-size: 12px;
  pointer-events: none;
  max-width: 460px;
  transition: border-color 140ms, box-shadow 140ms;
}
.multimeter-pill.active {
  border-color: var(--accent);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 4px 14px color-mix(in srgb, var(--accent) 22%, transparent);
}
.multimeter-pill .mm-icon { color: var(--muted); display: flex; }
.multimeter-pill.active .mm-icon { color: var(--accent); }
.multimeter-pill .mm-label {
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.10em;
  color: var(--muted); font-weight: 600;
}
.multimeter-pill .mm-readout {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 13px; font-weight: 500; color: var(--ink);
  white-space: nowrap;
}
.multimeter-pill .mm-readout.dim { color: var(--muted); font-weight: 400; font-style: italic; font-size: 11.5px; }
.multimeter-pill .mm-readout .mm-unit { color: var(--muted); font-size: 11.5px; margin-left: 2px; }
.multimeter-pill .mm-readout .mm-where { color: var(--muted); font-size: 10.5px; margin-left: 6px; font-weight: 400; }

/* Labels toggle — top-right of canvas, opposite the multimeter pill */
.canvas-overlay-tr {
  position: absolute; top: 12px; right: 12px;
  display: flex; gap: 6px; align-items: center;
  z-index: 3;
}
.labels-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px;
  font: inherit; font-size: 11.5px;
  background: color-mix(in srgb, var(--chrome-bg, #fff) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted); cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 4px 12px rgba(0,0,0,0.06);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  transition: background 140ms, border-color 140ms, color 140ms;
}
.labels-toggle:hover {
  background: var(--chrome-bg, #fff);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  color: var(--ink);
}
.labels-toggle[aria-pressed="true"] {
  background: var(--accent); color: var(--bg);
  border-color: var(--accent);
}
.labels-toggle[aria-pressed="true"]:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}
.labels-toggle .labels-toggle-state {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9.5px; padding: 1.5px 6px; border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 600;
}
.labels-toggle[aria-pressed="true"] .labels-toggle-state {
  background: color-mix(in srgb, var(--bg) 25%, transparent);
}
@media (max-width: 760px) {
  .labels-toggle .labels-toggle-label { display: none; }
  .labels-toggle { padding: 6px 9px; }
}
.canvas-overlay-br {
  position: absolute; right: 12px; bottom: 12px;
  display: flex; gap: 4px; align-items: center;
  padding: 5px 7px;
  background: color-mix(in srgb, var(--chrome-bg, #fff) 92%, transparent);
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 4px 12px rgba(0,0,0,0.05);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 3;
}
.canvas-overlay-br .canvas-tool {
  font: inherit; font-size: 11.5px; padding: 3px 9px;
  border: 1px solid transparent; background: transparent;
  color: var(--ink); cursor: pointer; border-radius: 5px;
  min-width: 26px;
}
.canvas-overlay-br .canvas-tool:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.canvas-overlay-br .canvas-tool-zoom {
  font-family: var(--font-mono, ui-monospace, monospace);
  min-width: 46px; text-align: center; font-size: 11px;
  color: var(--muted);
}

.canvas-hint {
  position: absolute; left: 12px; bottom: 12px;
  font-size: 10.5px; color: var(--muted);
  background: color-mix(in srgb, var(--chrome-bg, #fff) 85%, transparent);
  padding: 4px 9px; border-radius: 6px;
  border: 1px solid var(--border);
  pointer-events: none; opacity: 0.65;
  transition: opacity 200ms;
  z-index: 2;
}
.canvas-frame.panning .canvas-hint { opacity: 0; }

/* The legacy canvas-toolbar / scope-shell aren't used in v2 -- hide them
   to prevent extensions.js from inserting a redundant toolbar at top. */
.shell-v2 #canvas-toolbar { display: none !important; }
.shell-v2 #scope-shell { display: none !important; }

/* ============================================================
 * Oscilloscope drawer — bottom-of-canvas, collapsible
 * ============================================================ */
.scope-drawer {
  border-top: 1px solid var(--border);
  background: var(--chrome-bg, #fff);
  flex-shrink: 0;
  display: flex; flex-direction: column;
  max-height: 260px; min-height: 36px;
  transition: max-height 280ms cubic-bezier(.2,.7,.2,1);
  overflow: hidden;
}
.scope-drawer[data-collapsed="true"] { max-height: 36px; }
.scope-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 12px; font-size: 11px; flex-shrink: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
.scope-head-left { display: flex; align-items: center; gap: 9px; }
.scope-icon { color: var(--accent); display: flex; }
.scope-title {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-weight: 700; letter-spacing: 0.10em;
  color: var(--ink); text-transform: uppercase; font-size: 10px;
}
.scope-probe-count {
  font-size: 10px; color: var(--muted);
  padding: 1.5px 6px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  font-family: var(--font-mono, ui-monospace, monospace);
}
.scope-head-tools { display: flex; gap: 4px; flex-wrap: nowrap; }
.scope-head-tools .canvas-tool {
  font: inherit; font-size: 11px; padding: 3px 9px;
  border: 1px solid var(--border); background: var(--chrome-bg, #fff);
  color: var(--ink); cursor: pointer; border-radius: 4px;
  white-space: nowrap;
  transition: background 120ms, border-color 120ms;
}
.scope-head-tools .canvas-tool:hover { background: var(--panel); border-color: var(--accent); }
.scope-head-tools .canvas-tool.active {
  background: var(--accent); color: var(--bg); border-color: var(--accent);
}
.scope-toggle { min-width: 80px; }
.scope-drawer-body { flex: 1; overflow-y: auto; padding: 10px 12px; }
.scope-empty {
  color: var(--muted); font-size: 11.5px;
  padding: 8px 0; font-style: italic;
}
.scope-dc {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.scope-card {
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  padding: 6px 10px; min-width: 140px;
  background: var(--canvas-bg, #fff); border-radius: 4px;
}
.scope-card-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 10.5px;
}
.scope-card-label { font-family: var(--font-mono, ui-monospace, monospace);
  font-weight: 700; }
.scope-card-where { font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--muted); font-size: 9.5px; flex: 1; }
.scope-card-x {
  border: none; background: transparent; cursor: pointer;
  color: var(--muted); font-size: 14px; line-height: 1; padding: 0 4px;
}
.scope-card-x:hover { color: var(--plus, #b91c1c); }
.scope-card-value {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 15px; font-weight: 500; color: var(--ink);
  margin-top: 2px; font-variant-numeric: tabular-nums;
}
.scope-card-phase { font-size: 11px; color: var(--muted); margin-left: 4px; }
.scope-plot {
  background: var(--canvas-bg, #fff);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 6px;
}
.scope-plot canvas { display: block; width: 100%; height: 140px; }
.scope-plot-legend {
  display: flex; flex-wrap: wrap; gap: 10px; padding: 4px 2px 0;
  font-size: 10.5px; color: var(--muted);
}
.scope-leg-item { display: inline-flex; align-items: center; gap: 4px; }
.scope-leg-swatch { width: 12px; height: 3px; border-radius: 1px; }
@media (max-width: 760px) {
  .scope-head-tools .canvas-tool { padding: 3px 7px; font-size: 10px; }
  .scope-toggle { min-width: 60px; }
}

/* Hide on-canvas component value labels when data-labels="off".
   The Render layer assigns these via myspice.js drawCompShape. */
:root[data-labels="off"] svg#canvas .label-comp,
:root[data-labels="off"] svg#canvas .label-current { display: none; }

/* ============================================================
   INSPECTOR (right pane)
   ============================================================ */
.inspector {
  background: var(--panel-bg, var(--panel));
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  min-height: 0; overflow: hidden;
  position: relative;
}
.inspector-tabs {
  display: flex; align-items: stretch;
  border-bottom: 1px solid var(--border);
  background: var(--chrome-bg, #fff);
  flex-shrink: 0;
}
.i-tab {
  flex: 1; padding: 10px 12px;
  font: inherit; font-size: 12px; font-weight: 500;
  border: none; background: transparent;
  color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 140ms, border-color 140ms, background 140ms;
}
.i-tab + .i-tab {
  box-shadow: inset 1px 0 0 color-mix(in srgb, var(--border) 70%, transparent);
}
.i-tab:hover { color: var(--ink); background: color-mix(in srgb, var(--accent) 5%, transparent); }
.i-tab.active {
  color: var(--ink); font-weight: 600;
  border-bottom-color: var(--accent);
}
.inspector-body { flex: 1; min-height: 0; overflow-y: auto; }
.i-panel { padding: 14px 14px 16px; }

/* PROBLEM card */
.problem-card {
  background: var(--chrome-bg, #fff);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
  min-height: 160px;
}
.problem-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 18px 8px; color: var(--muted);
  gap: 10px;
}
.problem-empty-icon { color: color-mix(in srgb, var(--accent) 50%, var(--muted)); }
.problem-empty-title {
  font-size: 13.5px; font-weight: 600; color: var(--ink);
}
.problem-empty-hint { font-size: 12px; line-height: 1.55; max-width: 240px; }
.link-inline {
  background: none; border: none; padding: 0;
  color: var(--accent); font: inherit; font-size: inherit;
  cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.link-inline:hover { color: var(--accent-strong); }

.problem-loaded .problem-meta {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); margin-bottom: 6px;
}
.problem-loaded .problem-title {
  margin: 0 0 6px; font-size: 14px; font-weight: 600;
  color: var(--ink); line-height: 1.35;
}
.problem-loaded .problem-statement {
  margin: 0 0 8px; font-size: 12.5px; color: var(--ink);
  line-height: 1.55;
}
.problem-loaded .problem-expected {
  font-size: 11.5px; font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--muted); background: var(--panel);
  padding: 7px 10px; border-radius: 4px;
  border-left: 3px solid var(--accent);
  line-height: 1.5;
}

/* Solve CTA */
.solve-area {
  background: var(--chrome-bg, #fff);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}
.solve-cta {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 16px;
  font: inherit; font-size: 14px; font-weight: 600;
  background: var(--accent); color: var(--bg);
  border: none; border-radius: 6px; cursor: pointer;
  box-shadow: var(--shadow-primary, 0 1px 2px rgba(13,148,136,.25));
  transition: background 140ms, transform 60ms, box-shadow 140ms;
}
.solve-cta:hover { background: var(--accent-strong); }
.solve-cta:active { transform: translateY(1px); }
.solve-cta:disabled { opacity: 0.5; cursor: not-allowed; }
.solve-cta .solve-kbd {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px; font-weight: 600;
  background: color-mix(in srgb, var(--bg) 25%, transparent);
  padding: 1px 5px; border-radius: 3px; margin-left: auto;
  border: 1px solid color-mix(in srgb, var(--bg) 35%, transparent);
}
.solve-hint {
  font-size: 11px; color: var(--muted); margin-top: 8px;
  text-align: center;
}

/* RESULTS tab — re-uses base.css `.panel` */
.i-panel[data-i-panel="results"] { padding: 0; }
.i-panel[data-i-panel="results"] .panel {
  border-left: none; border-right: none; padding: 14px 14px 16px;
  height: auto; background: transparent;
}
.i-panel[data-i-panel="results"] .panel h2 { margin-top: 0; }

/* LIBRARY tab — inline cards */
.library-inline-head {
  padding-bottom: 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
  margin-bottom: 10px;
}
.library-inline-head input[type=text] {
  width: 100%; font: inherit; font-size: 12.5px;
  padding: 7px 10px; border: 1px solid var(--border);
  background: var(--chrome-bg, #fff); color: var(--ink);
  border-radius: 5px;
}
.library-inline-head input[type=text]:focus {
  outline: none; border-color: var(--accent);
}
.library-inline-head .filters {
  display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap;
}
.library-inline-body {
  display: flex; flex-direction: column; gap: 8px;
}
.li-row {
  background: var(--chrome-bg, #fff);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 120ms, background 120ms, transform 60ms;
}
.li-row:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, var(--chrome-bg));
}
.li-row:active { transform: translateY(1px); }
.li-row .li-title {
  font-size: 12.5px; font-weight: 600; color: var(--ink);
  margin-bottom: 3px; line-height: 1.3;
}
.li-row .li-meta {
  display: flex; align-items: center; gap: 6px;
  font-size: 10px; color: var(--muted);
}
.li-row .li-mode-chip {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9px; padding: 1.5px 5px;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent-strong);
  border-radius: 3px; text-transform: uppercase; letter-spacing: 0.04em;
}
.li-row .li-diff { color: var(--muted); }
.li-empty {
  padding: 20px 12px; text-align: center; color: var(--muted);
  font-size: 12px; font-style: italic;
}
.li-group-title {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); font-weight: 600;
  margin: 4px 0 4px; padding: 0 2px;
}

/* Inspector resize handle (left edge) */
.inspector .panel-resize-handle {
  position: absolute; left: 0; top: 0; bottom: 0; width: 6px;
  cursor: col-resize; z-index: 5;
  transition: background 120ms;
}
.inspector .panel-resize-handle:hover,
.inspector .panel-resize-handle.dragging {
  background: color-mix(in srgb, var(--accent) 40%, transparent);
}

/* ============================================================
   FOOTER
   ============================================================ */
.shell-app > .footer-hint {
  padding: 6px 16px;
  font-size: 10.5px; color: var(--muted);
  background: var(--chrome-bg, #fff);
  border-top: 1px solid var(--border);
}

/* ============================================================
   TIME SCRUBBER / FREQ — sit at bottom of canvas-col, hidden by default
   shown by myspice.js for transient/phasor modes
   ============================================================ */
.shell-v2 .time-scrubber {
  border-top: 1px solid var(--border);
  background: var(--chrome-bg, #fff);
  flex-shrink: 0;
}

/* ============================================================
   STYLE STUDIO — was floating-bottom-right; now opens from settings
   ============================================================ */
.shell-v2 .studio-panel {
  /* keep floating position from studio.css; tweak so it doesn't fight zoom controls */
  right: 16px; bottom: 56px;
  transform: translateY(calc(100% + 56px));
  opacity: 0;
  pointer-events: none;
  transition: transform 260ms cubic-bezier(.2,.7,.2,1), opacity 200ms;
}
.shell-v2 .studio-panel[data-collapsed="false"] {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.shell-v2 .studio-panel[data-collapsed="true"] {
  /* keep parked off-screen when collapsed, don't show header strip */
  transform: translateY(calc(100% + 56px));
}

/* ============================================================
   Mobile/narrow rules
   ============================================================ */
@media (max-width: 980px) {
  .shell-app > .workspace {
    grid-template-columns: 64px 1fr var(--inspector-width, 300px);
  }
  .rail-btn .rail-cap { display: none; }
  .rail-btn.tool-btn { min-height: 42px; padding: 6px 4px; }
  .rail-tip { display: none; }
}
@media (max-width: 760px) {
  .shell-app { height: auto; min-height: 100vh; grid-template-rows: auto auto auto auto; }
  .shell-app > .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto 60vh auto;
  }
  .rail {
    flex-direction: row; flex-wrap: wrap;
    border-right: none; border-bottom: 1px solid var(--border);
    padding: 6px;
  }
  .rail-group {
    flex-direction: row;
    border-top: none !important; padding-top: 0;
    margin-top: 0; gap: 4px;
  }
  .rail-group + .rail-group { border-left: 1px solid var(--border); padding-left: 6px; margin-left: 4px; }
  .rail-label { display: none; }
  .rail-spacer { display: none; }
  .inspector { border-left: none; border-top: 1px solid var(--border); }
  .mode-tab-big .mt-sub { display: none; }
}
