/* Tessera Design System — Precision Lab Instrument (Light & Dark Switchable)
 * Strict 4px spacing scale, tinted cool-slate surfaces (zero raw #fff/#000),
 * locked 100dvh hairline-divided workbench (zero stacked card mosaics). */

:root,
:root[data-theme="light"] {
  color-scheme: light;
  --bg-app: #f2f5f7;
  --bg-canvas: #f9fbfc;
  --bg-elevated: #fcfdfe;
  --bg-subtle: #e9eef2;
  --bg-hover: #eef3f6;
  --border-hairline: #d6dfe6;
  --border-strong: #bcc8d2;
  --ink: #121a21;
  --ink-secondary: #475563;
  --ink-muted: #617180;
  --accent: #0a5c59;
  --accent-hover: #074745;
  --on-accent: #f4faf9;
  --accent-soft: #e2f2f1;
  --accent-border: #9bd0cc;
  --backdrop: rgba(13, 19, 24, 0.45);
  --success: #176943;
  --success-soft: #e6f5ee;
  --warning: #8f530c;
  --warning-soft: #fbf1e2;
  --warning-border: #e6c696;
  --error: #b42318;
  --error-soft: #fceceb;
  --error-border: #efb4af;
  --info: #1c5ca3;
  --info-soft: #e7f1fc;
  --info-border: #b3d0f0;
  --violet: #5e38b0;
  --violet-soft: #f0ebfa;
  --mat-bg: #26313a;
  --toast-bg: #15222a;
  --toast-ink: #edf4f7;
  --font-sans: "IBM Plex Sans", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-app: #0d1318;
  --bg-canvas: #111920;
  --bg-elevated: #17212b;
  --bg-subtle: #1c2834;
  --bg-hover: #1f2c38;
  --border-hairline: #253340;
  --border-strong: #344759;
  --ink: #eaf0f5;
  --ink-secondary: #b4c3d1;
  --ink-muted: #889bad;
  --accent: #45c7bd;
  --accent-hover: #58d6cc;
  --on-accent: #071918;
  --accent-soft: #133133;
  --accent-border: #225e60;
  --backdrop: rgba(6, 10, 14, 0.65);
  --success: #4cc38a;
  --success-soft: #133024;
  --warning: #e5a94c;
  --warning-soft: #312512;
  --warning-border: #63481c;
  --error: #f17a72;
  --error-soft: #361918;
  --error-border: #6e2d29;
  --info: #6cb0f5;
  --info-soft: #162a40;
  --info-border: #2a4f78;
  --violet: #b197fc;
  --violet-soft: #261e3d;
  --mat-bg: #0a0f14;
  --toast-bg: #eaf0f5;
  --toast-ink: #111920;
}

* {
  box-sizing: border-box;
}

input[type="checkbox"] {
  accent-color: var(--accent);
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow-x: clip;
  background: var(--bg-app);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  padding: 8px 16px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  left: 8px;
}

a {
  color: var(--accent);
}

a:visited {
  color: var(--violet);
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--ink-muted);
  font-size: 12px;
}

/* Locked 100dvh Application Shell */
.app-shell {
  display: grid;
  grid-template-columns: 212px minmax(0, 1fr);
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  background: var(--bg-canvas);
}

/* Light/Dark Quiet Slate Sidebar */
.sidebar {
  background: var(--bg-app);
  border-right: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  padding: 12px;
  gap: 4px;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 12px;
  border-bottom: 1px solid var(--border-hairline);
  margin-bottom: 8px;
}

.brand-id {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
  color: var(--accent);
}

.brand-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.lab-select-wrap {
  margin-bottom: 12px;
}

.lab-select-wrap select {
  width: 100%;
  font-size: 12px;
  font-weight: 500;
  padding: 8px;
  background: var(--bg-elevated);
}

.nav-group-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-muted);
  padding: 12px 8px 4px;
}

.nav-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-secondary);
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: background-color 120ms ease-out, color 120ms ease-out, border-color 120ms ease-out;
}

.nav-btn:hover {
  background: var(--bg-subtle);
  color: var(--ink);
}

.nav-btn:active {
  background: var(--border-hairline);
}

.nav-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.nav-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.nav-view-btn {
  font-size: 12px;
  padding: 4px 8px;
  color: var(--ink-secondary);
}

.nav-badge {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 0 8px;
  border-radius: 9999px;
  background: var(--bg-subtle);
  color: var(--ink-secondary);
}

.nav-badge.alert {
  background: var(--error-soft);
  color: var(--error);
}

.nav-badge.warn {
  background: var(--violet-soft);
  color: var(--violet);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-footer select {
  width: 100%;
  font-size: 12px;
  padding: 8px;
}

.env-note {
  font-size: 12px;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.env-dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: var(--warning);
  flex-shrink: 0;
}

/* Main Column */
.main-col {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  overflow: hidden;
  background: var(--bg-canvas);
  color: var(--ink);
}

/* Single-Row 48px Top Context Bar */
.topbar {
  height: 48px;
  min-height: 48px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-hairline);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.view-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.015em;
  white-space: nowrap;
}

.env-pill {
  font-size: 12px;
  font-weight: 500;
  color: var(--warning);
  background: var(--warning-soft);
  border: 1px solid var(--warning-border);
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

/* Segmented Control (Table | Pivot, Zoom, Modes) */
.segmented {
  display: inline-flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  border-radius: 6px;
  padding: 4px;
  gap: 4px;
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 120ms ease-out, color 120ms ease-out;
}

.seg-btn:hover {
  color: var(--ink);
}

.seg-btn:active {
  background: var(--border-hairline);
}

.seg-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.seg-btn.active {
  background: var(--bg-elevated);
  color: var(--ink);
  font-weight: 600;
}

/* Buttons & Inputs */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  min-height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 120ms ease-out, border-color 120ms ease-out, color 120ms ease-out;
}

.btn:hover {
  background: var(--bg-subtle);
}

.btn:active {
  background: var(--border-hairline);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-primary:active {
  background: var(--accent);
}

.btn-danger {
  background: var(--error);
  border-color: var(--error);
  color: var(--on-accent);
  font-weight: 600;
}

.btn-danger:hover {
  opacity: 0.92;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-secondary);
}

.btn-ghost:hover {
  background: var(--bg-subtle);
  color: var(--ink);
}

.btn-sm {
  padding: 4px 8px;
  min-height: 28px;
  font-size: 12px;
}

input[type="text"],
input[type="number"],
input[type="email"],
select,
textarea {
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 8px;
  min-height: 32px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--ink);
  transition: border-color 120ms ease-out, background-color 120ms ease-out;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

/* Workspace Body Container */
.workspace-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.workspace-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px 32px;
}

/* Inline Metric & Filter Strip (Replaces 5 giant KPI stat cards) */
.metric-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-hairline);
  background: var(--bg-app);
  flex-wrap: wrap;
}

.metric-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-secondary);
  font-family: var(--font-sans);
  font-size: 12px;
  cursor: pointer;
  transition: background-color 120ms ease-out, border-color 120ms ease-out, color 120ms ease-out;
}

.metric-chip:hover {
  background: var(--bg-elevated);
  border-color: var(--border-hairline);
  color: var(--ink);
}

.metric-chip:active {
  background: var(--bg-subtle);
}

.metric-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.metric-chip.active {
  background: var(--bg-elevated);
  border-color: var(--accent-border);
  color: var(--accent);
}

.metric-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink);
}

.metric-chip.warn .metric-num {
  color: var(--warning);
}

.metric-chip.alert .metric-num {
  color: var(--error);
}

.metric-chip.violet .metric-num {
  color: var(--violet);
}

.strip-divider {
  width: 1px;
  height: 16px;
  background: var(--border-hairline);
}

/* Filter Toolbar Strip */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-hairline);
  background: var(--bg-canvas);
  flex-wrap: wrap;
}

.filter-search {
  flex: 1;
  min-width: 220px;
}

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--accent-border);
  background: var(--accent-soft);
  flex-wrap: wrap;
}

/* Full-Bleed Explorer Split (Table + Optional Non-Blocking Right Inspector) */
.explorer-split {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

.table-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.table-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--bg-canvas);
}

table.sheet {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.sheet th {
  position: sticky;
  top: 0;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-strong);
  border-right: 1px solid var(--border-hairline);
  padding: 8px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
  white-space: nowrap;
  z-index: 2;
}

table.sheet td {
  border-bottom: 1px solid var(--border-hairline);
  border-right: 1px solid var(--border-hairline);
  padding: 4px 8px;
  height: 36px;
  white-space: nowrap;
  vertical-align: middle;
}

table.sheet tbody tr {
  cursor: pointer;
  transition: background-color 120ms ease-out;
}

table.sheet tbody tr:hover td {
  background: var(--bg-hover);
}

table.sheet tbody tr.selected td {
  background: var(--accent-soft);
}

table.sheet tbody tr.inspected td {
  background: var(--info-soft);
}

.table-footer {
  height: 40px;
  min-height: 40px;
  padding: 0 16px;
  border-top: 1px solid var(--border-hairline);
  background: var(--bg-app);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Status Tags (Data carries color) */
.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  height: 20px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.status-stained {
  background: var(--accent-soft);
  color: var(--accent);
}

.status-unstained {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-imaged {
  background: var(--info-soft);
  color: var(--info);
}

.status-checked_out {
  background: var(--info-soft);
  color: var(--info);
}

.status-missing {
  background: var(--error-soft);
  color: var(--error);
}

.status-legacy {
  background: var(--violet-soft);
  color: var(--violet);
}

.status-neutral {
  background: var(--bg-subtle);
  color: var(--ink-secondary);
}

/* Inline Right Inspector Pane (Replaces heavy modal overlay on desktop) */
.inspector-pane {
  width: 420px;
  min-width: 420px;
  border-left: 1px solid var(--border-hairline);
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.inspector-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.inspector-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}

.inspector-section {
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-hairline);
}

.inspector-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.section-heading {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

/* Indented Monospace Provenance Tree (Zero left-border stripe cards) */
.tree-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tree-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
}

.tree-indent-1 {
  padding-left: 16px;
  position: relative;
}

.tree-indent-2 {
  padding-left: 32px;
  position: relative;
}

.tree-indent-3 {
  padding-left: 48px;
  position: relative;
}

.tree-branch {
  font-family: var(--font-mono);
  color: var(--ink-muted);
  user-select: none;
}

.tree-role {
  font-size: 12px;
  color: var(--ink-muted);
  min-width: 72px;
}

/* Flat Hairline Split Panes (Scan Bench, Storage Map, Label Studio, Intake) */
.split-pane {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  overflow: hidden;
}

.split-pane.config-left {
  grid-template-columns: 380px minmax(0, 1fr);
}

.pane-left {
  min-width: 0;
  overflow-y: auto;
  padding: 16px 20px;
  border-right: 1px solid var(--border-hairline);
}

.pane-right {
  min-width: 0;
  overflow-y: auto;
  padding: 16px 20px;
  background: var(--bg-app);
}

/* Scan Bench Command Area */
.scan-command-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-hairline);
  background: var(--bg-elevated);
}

.scan-command-bar.flash-ok {
  background: var(--success-soft);
  border-bottom-color: var(--accent-border);
}

.scan-command-bar.flash-warn {
  background: var(--warning-soft);
  border-bottom-color: var(--warning-border);
}

.scan-command-bar.flash-err {
  background: var(--error-soft);
  border-bottom-color: var(--error-border);
}

.scan-input-hero {
  flex: 1;
  min-height: 44px;
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 8px 12px;
}

.scan-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-hairline);
  background: var(--bg-app);
  flex-wrap: wrap;
}

.feed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-hairline);
}

/* Spatial 10x10 Slide Box Matrix */
.box-selector-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-hairline);
  background: var(--bg-app);
  flex-wrap: wrap;
}

.matrix-frame {
  display: inline-grid;
  grid-template-columns: 28px repeat(10, 48px);
  gap: 4px;
  padding: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline);
  border-radius: 6px;
}

.matrix-axis {
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
}

.slot-tile {
  height: 44px;
  border-radius: 4px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-canvas);
  color: var(--ink-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 4px;
  transition: background-color 120ms ease-out, border-color 120ms ease-out;
}

.slot-tile:hover {
  border-color: var(--accent);
}

.slot-tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.slot-tile.occupied {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--ink);
}

.slot-tile.unstained {
  background: var(--warning-soft);
  border-color: var(--warning-border);
  color: var(--warning);
}

.slot-tile.checked_out {
  background: var(--info-soft);
  border-color: var(--info-border);
  color: var(--info);
}

.slot-tile.missing {
  background: var(--error-soft);
  border-color: var(--error-border);
  color: var(--error);
}

.slot-tile.dimmed {
  opacity: 0.28;
}

.slot-tile.active-slot {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--ink-secondary);
  flex-wrap: wrap;
}

.legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 4px;
  margin-right: 4px;
  vertical-align: middle;
}

/* Label Studio Drafting Mat */
.drafting-mat {
  background: var(--mat-bg);
  border-radius: 8px;
  padding: 24px;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  overflow: auto;
}

/* Flat Form Sections (No nested card boxes) */
.form-section {
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-hairline);
}

.form-section:last-child {
  border-bottom: none;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-secondary);
}

.field-hint {
  font-size: 12px;
  color: var(--ink-muted);
}

/* Pivot Heat Table */
.pivot-cell-heat {
  font-weight: 500;
}

.pivot-cell-heat.high {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* Slide-Over Demo Guide Drawer (On-Demand Only) */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  z-index: 50;
  display: flex;
  justify-content: flex-end;
}

.drawer-panel {
  width: min(440px, 96vw);
  height: 100dvh;
  background: var(--bg-elevated);
  color: var(--ink);
  border-left: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.demo-step-btn {
  width: 100%;
  text-align: left;
  padding: 12px;
  border: 1px solid var(--border-hairline);
  border-radius: 6px;
  background: var(--bg-canvas);
  color: var(--ink);
  cursor: pointer;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background-color 120ms ease-out, border-color 120ms ease-out;
}

.demo-step-btn:hover {
  background: var(--bg-subtle);
  border-color: var(--accent-border);
}

.demo-step-btn:active {
  background: var(--accent-soft);
}

.demo-step-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Toast Notification */
.col-picker-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 16px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-hairline);
  font-size: 12px;
}

.col-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  cursor: pointer;
}

.btn.active-toggle {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}

.sheet tbody tr.group-header-row {
  background: var(--bg-subtle);
  cursor: default;
}

.sheet tbody tr.group-header-row:hover {
  background: var(--bg-subtle);
}

.sheet tbody tr.group-header-row td {
  padding: 6px 12px;
  font-size: 12px;
}

.toast {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: var(--toast-bg);
  color: var(--toast-ink);
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 60;
  max-width: 440px;
}

/* Mobile Bench-First Bottom Bar (Hidden on Desktop) */
.mobile-nav {
  display: none;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
    height: 100dvh;
  }

  .sidebar {
    display: none;
  }

  .topbar {
    height: 52px;
    padding: 0 12px;
  }

  .topbar .btn,
  .topbar .btn-sm {
    min-height: 36px;
    height: 36px;
    padding: 0 10px;
  }

  .scan-mode-bar .segmented {
    flex-wrap: wrap;
    max-width: 100%;
  }

  .env-pill {
    display: none;
  }

  .split-pane,
  .split-pane.config-left {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .pane-left {
    border-right: none;
    border-bottom: 1px solid var(--border-hairline);
    overflow: visible;
    padding: 12px;
  }

  .pane-right {
    overflow: visible;
    padding: 12px 12px 80px;
  }

  .inspector-pane {
    position: fixed;
    inset: 0;
    width: 100%;
    min-width: 0;
    z-index: 45;
  }

  .btn,
  input[type="text"],
  select {
    min-height: 44px;
  }

  .workspace-body {
    padding-bottom: 64px;
  }

  .matrix-frame {
    grid-template-columns: 24px repeat(5, minmax(44px, 1fr));
  }

  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border-hairline);
    z-index: 40;
  }

  .mobile-tab {
    border: none;
    background: transparent;
    color: var(--ink-secondary);
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    min-height: 44px;
  }

  .mobile-tab.active {
    color: var(--accent);
    font-weight: 600;
    background: var(--accent-soft);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
