/* PachBae Studi-OS — Input Sheets module */

.inputsheets {
  padding: 36px 36px 80px;
  width: 100%;
}

/* ─── Session picker ─────────────────────────────────────────────────── */
.is-sess-section { margin-top: 24px; }
/* Also used by the Recall session picker — keep the two menus reading as one
   family. Rendered as a <button>, hence the reset. */
.is-sess-section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 2px;
  font-size: 11px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
}
.is-sess-section-head:hover { color: var(--accent); }
/* One glyph that rotates, rather than swapping ▸/▾ — the swap reads as a jump.
   Driven off aria-expanded so the state lives in one place. */
.is-sess-section-caret {
  display: inline-block;
  width: 12px;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0;
  transition: transform 0.15s, color 0.12s;
}
.is-sess-section-head[aria-expanded="false"] .is-sess-section-caret {
  transform: rotate(-90deg);
}
.is-sess-section-head:hover .is-sess-section-caret { color: var(--accent); }

/* Cards settle in when a section opens, staggered 30ms apart and capped so a
   long list doesn't crawl. ease-out (fast start, gentle landing) reads as a
   settle rather than a linear slide — matches the lift on :hover.
   fill-mode is `backwards`, not `both`: `both` would leave transform:none
   winning over the cards' :hover lift for good. */
@keyframes sessSectionIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
.is-sess-grid > *,
.is-bk-card-list > * {
  animation: sessSectionIn 0.32s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.is-sess-grid > :nth-child(2),   .is-bk-card-list > :nth-child(2)    { animation-delay: 30ms; }
.is-sess-grid > :nth-child(3),   .is-bk-card-list > :nth-child(3)    { animation-delay: 60ms; }
.is-sess-grid > :nth-child(4),   .is-bk-card-list > :nth-child(4)    { animation-delay: 90ms; }
.is-sess-grid > :nth-child(5),   .is-bk-card-list > :nth-child(5)    { animation-delay: 120ms; }
.is-sess-grid > :nth-child(n+6), .is-bk-card-list > :nth-child(n+6)  { animation-delay: 150ms; }

@media (prefers-reduced-motion: reduce) {
  .is-sess-grid > *,
  .is-bk-card-list > * { animation: none; }
  .is-sess-section-caret { transition: none; }
}
.is-sess-section-count {
  font-size: 11px;
  color: var(--text-faint);
  padding: 1px 8px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.is-sess-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.is-sess-card {
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.14s, transform 0.14s, box-shadow 0.14s;
  overflow: hidden;
}
.is-sess-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--border-strong);
  transition: background 0.14s;
}
.is-sess-card:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: 0 8px 24px -10px rgba(0,0,0,0.4); }
.is-sess-card:hover::before { background: var(--accent); }
.is-sess-card--active { border-color: color-mix(in oklab, var(--accent) 35%, var(--border)); }
.is-sess-card--active::before { background: var(--accent); box-shadow: 0 0 10px var(--accent); }

/* Cancelled session card */
.is-sess-card--cancelled {
  opacity: 0.55;
  border-color: oklch(0.60 0.14 5 / 0.3);
}
.is-sess-card--cancelled::before { background: oklch(0.60 0.14 5); }
.is-sess-card--cancelled:hover { opacity: 0.75; }
.is-sess-cancelled-tag {
  position: absolute;
  top: 14px; right: 14px;
  font-size: 8.5px;
  letter-spacing: 0.12em;
  color: oklch(0.70 0.16 5);
  background: oklch(0.70 0.16 5 / 0.12);
  border: 1px solid oklch(0.70 0.16 5 / 0.35);
  border-radius: 3px;
  padding: 2px 6px;
}

/* Cancelled section — muted header */
.is-sess-section--muted { margin-top: 32px; }
.is-sess-section--muted .is-sess-section-head {
  color: var(--text-faint);
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

/* Cancelled booking banner inside SheetView */
.is-cancelled-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  margin-bottom: 12px;
  background: oklch(0.60 0.14 5 / 0.08);
  border: 1px solid oklch(0.60 0.14 5 / 0.28);
  border-radius: 6px;
  color: oklch(0.72 0.16 5);
  font-size: 12.5px;
}
.is-cancelled-banner-icon {
  font-size: 15px;
  flex-shrink: 0;
  opacity: 0.85;
}

.is-sess-live {
  position: absolute;
  top: 14px; right: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.10em;
  color: oklch(0.72 0.20 25);
}
.is-sess-room {
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 2px;
}
.is-sess-artist {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.1;
  font-feature-settings: "ss01" on;
}
.is-sess-project {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: -0.005em;
  line-height: 1.3;
}
.is-sess-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}
.is-sess-eng { font-size: 12px; color: var(--text-secondary); }
.is-sess-day {
  font-size: 10.5px;
  color: var(--text-faint);
  padding: 2px 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
}
.is-sess-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.is-sess-date { font-size: 11px; color: var(--text-faint); }
.is-sess-sheets {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-left: auto;
}
.is-sess-status {
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Back button in breadcrumb */
.is-back-crumb {
  background: none; border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  padding: 0;
  transition: color 0.12s;
}
.is-back-crumb:hover { color: var(--accent); }

/* ─── Editable bits ──────────────────────────────────────────────────── */
.is-flag.clickable { cursor: pointer; user-select: none; }
.is-flag.clickable:hover {
  border-color: color-mix(in oklab, var(--accent) 30%, var(--border-strong));
  color: var(--text-secondary);
}
.is-flag.clickable.on:hover {
  background: color-mix(in oklab, var(--accent) 22%, transparent);
}

/* + Add channel row */
.is-add-row { cursor: pointer; color: var(--text-muted); transition: background 0.12s, color 0.12s; }
.is-add-row:hover {
  background: color-mix(in oklab, var(--accent) 8%, var(--surface)) !important;
  color: var(--accent);
}
.is-add-cell {
  display: flex !important;
  align-items: center !important;
  gap: 8px;
  font-size: 12px;
  letter-spacing: -0.005em;
}
.is-add-glyph {
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1;
  color: var(--accent);
}

/* × remove on row hover (anchored to row's right edge) */
.is-row { position: relative; }
.is-row-remove {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  width: 20px; height: 20px;
  border-radius: 4px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 10px;
  display: grid; place-items: center;
  opacity: 0;
  transition: opacity 0.12s, color 0.12s, background 0.12s, border-color 0.12s;
  z-index: 3;
}
.is-row:hover .is-row-remove { opacity: 1; }
.is-row-remove:hover {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

/* ─── Channel editor sidebar ─────────────────────────────────────────── */
.is-ch-editor { border-color: color-mix(in oklab, var(--accent) 35%, var(--border)); }
.is-ch-editor .is-side-head { margin-bottom: 14px; }
.ch-edit-pip { color: var(--accent); font-size: 12px; }
.ch-edit-close {
  width: 22px; height: 22px;
  border-radius: 4px;
  color: var(--text-faint);
  font-size: 11px;
  display: grid; place-items: center;
  transition: background 0.12s, color 0.12s;
}
.ch-edit-close:hover { color: var(--text-primary); background: var(--surface-3); }

.ch-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.ch-edit-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ch-edit-span2 { grid-column: 1 / -1; }
.ch-edit-label {
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.ch-edit-input {
  height: 30px;
  padding: 0 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12.5px;
  width: 100%;
}
.ch-edit-input:focus { border-color: var(--accent); outline: none; background: var(--surface); }
.ch-edit-input.mono { font-family: var(--font-mono); font-size: 12px; }
.ch-edit-textarea {
  height: auto;
  min-height: 60px;
  padding: 7px 9px;
  resize: vertical;
  line-height: 1.45;
  font-family: var(--font-serif);
  font-style: italic;
}
.ch-edit-flags {
  display: flex; gap: 4px;
  height: 30px;
  align-items: center;
}
.ch-edit-flags .is-flag {
  height: 24px;
  cursor: pointer;
  min-width: 36px;
}

/* ─── Toast ──────────────────────────────────────────────────────────── */
.is-toast {
  position: fixed;
  bottom: 28px; left: 50%;
  transform: translateX(-50%);
  background: var(--surface-3);
  color: var(--text-primary);
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in oklab, var(--accent) 35%, var(--border-strong));
  font-size: 12.5px;
  letter-spacing: -0.005em;
  box-shadow: 0 12px 32px -10px rgba(0,0,0,0.6);
  z-index: 50;
  animation: toast-in 0.2s ease-out;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* Print-only adjustments — hide sidebar, chrome, toolbars */
@media print {
  .sidebar, .topbar, .tweaks-panel, .is-sidebar,
  .wb-tabs, .song-meta, .page-head-r, .sheet-tabs { display: none !important; }
  .inputsheets { padding: 0; }
  .is-body { grid-template-columns: 1fr !important; }
  .sheet-wrap { border: 1px solid #ccc !important; box-shadow: none !important; }
  .is-row-remove, .is-add-row { display: none !important; }
}

/* ─── Session header ─────────────────────────────────────────────────── */
.session-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: flex-end;
  padding: 22px 24px;
  background:
    linear-gradient(180deg,
      color-mix(in oklab, var(--accent) 5%, var(--surface-2)),
      var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.session-head::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 60% at 100% 0%, color-mix(in oklab, var(--accent) 10%, transparent), transparent 60%);
  pointer-events: none;
}
.session-head::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent);
}

.session-kicker {
  font-size: 10.5px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.live-pip {
  width: 8px; height: 8px; border-radius: 50%;
  background: oklch(0.72 0.20 25);
  box-shadow: 0 0 8px oklch(0.72 0.20 25);
  animation: livepip 1.6s ease-in-out infinite;
}
@keyframes livepip {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.warn-pip {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 6px var(--red);
}

.session-title {
  font-size: 38px;
  font-weight: 500;
  letter-spacing: -0.028em;
  line-height: 1;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.session-title em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: -0.015em;
}
.session-title-sep {
  font-weight: 300;
  color: var(--text-faint);
  font-size: 32px;
}

.session-sub {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--text-muted);
  letter-spacing: 0.005em;
}

.session-head-r {
  position: relative;
  z-index: 1;
}
.sh-grid {
  display: grid;
  grid-template-columns: auto auto auto;
  gap: 14px 28px;
}
.sh-cell { min-width: 0; }
.sh-k {
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 3px;
}
.sh-v {
  font-size: 12px;
  color: var(--text-primary);
  letter-spacing: -0.005em;
}
.sh-edit-input {
  width: 100%;
  height: 22px;
  padding: 0 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font-mono);
}
.sh-edit-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}
.sh-edit-input::placeholder { color: var(--text-faint); }

/* ─── Template save/load dialog ─────────────────────────────────────── */
.tpl-row {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.tpl-row:hover { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 6%, var(--surface-2)); }
.tpl-row-l { flex: 1; min-width: 0; }
.tpl-row-body { flex: 1; min-width: 0; background: none; border: none; text-align: left; cursor: pointer; padding: 0; color: inherit; }
.tpl-row-title { font-size: 13px; color: var(--text-primary); letter-spacing: -0.005em; }
.tpl-row-sub { font-size: 10.5px; color: var(--text-faint); margin-top: 2px; letter-spacing: 0.04em; }
.tpl-row-cta { color: var(--text-muted); font-size: 14px; margin-left: 12px; }
.tpl-row--general { padding: 8px 12px; gap: 8px; }
.tpl-row-del {
  width: 24px; height: 24px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text-faint);
  cursor: pointer;
}
.tpl-row-del:hover { color: var(--red, oklch(0.7 0.18 25)); border-color: var(--red, oklch(0.7 0.18 25)); }
.tpl-section-title {
  font-size: 9.5px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: 6px;
}
.export-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border-strong, var(--border));
  border-radius: var(--radius);
  box-shadow: 0 8px 24px -4px rgba(0,0,0,0.55), 0 2px 8px rgba(0,0,0,0.35);
  padding: 4px;
  z-index: 60;
  display: flex;
  flex-direction: column;
}
.export-menu button {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  font-size: 12.5px;
  transition: background 0.1s;
}
.export-menu button:hover { background: var(--surface-2); }
.export-menu-icon { color: var(--text-muted); font-size: 12px; }
.export-menu-label { font-weight: 500; }
.export-menu-sub { font-size: 10px; color: var(--text-faint); letter-spacing: 0.04em; }

.tpl-empty {
  font-size: 11.5px;
  color: var(--text-muted);
  padding: 10px;
  text-align: center;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ─── Song workbook tabs ─────────────────────────────────────────────── */
.wb-tabs {
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 0 4px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border-strong);
  position: relative;
}
.wb-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  color: var(--text-secondary);
  font-size: 12.5px;
  letter-spacing: -0.005em;
  transition: background 0.12s, color 0.12s;
  position: relative;
  top: 1px;
}
.wb-tab:hover { color: var(--text-primary); background: var(--surface-2); }
.wb-tab.active {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border-strong);
  border-bottom-color: var(--surface);
  font-weight: 500;
  z-index: 2;
}
.wb-tab.active::before {
  content: "";
  position: absolute;
  left: -1px; right: -1px; top: -1px;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  border-radius: 6px 6px 0 0;
}
.wb-tab-num {
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  padding: 2px 5px;
  background: var(--surface-2);
  border-radius: 3px;
  border: 1px solid var(--border);
}
.wb-tab.active .wb-tab-num {
  color: var(--accent);
  border-color: color-mix(in oklab, var(--accent) 30%, var(--border));
  background: color-mix(in oklab, var(--accent) 10%, var(--surface-2));
}
.wb-tab-icon {
  color: var(--text-muted);
  font-size: 13px;
}
.wb-tab.active .wb-tab-icon { color: var(--accent); }
.wb-tab-label { letter-spacing: -0.005em; }
.wb-tab-count {
  font-size: 10px;
  color: var(--text-faint);
  padding-left: 4px;
  border-left: 1px solid var(--border);
}
.wb-tab.plus {
  width: 34px;
  padding: 0;
  justify-content: center;
  color: var(--text-muted);
  font-size: 15px;
}
.wb-tab.check.active::before { background: oklch(0.72 0.14 200); box-shadow: 0 0 8px oklch(0.72 0.14 200); }

/* ─── Song meta strip (under tabs) ───────────────────────────────────── */
.song-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.sm-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 10px 5px 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
}
.sm-pill.accent {
  background: color-mix(in oklab, var(--accent) 10%, var(--surface-2));
  border-color: color-mix(in oklab, var(--accent) 28%, var(--border-strong));
}
.sm-k {
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.sm-pill.accent .sm-k { color: color-mix(in oklab, var(--accent) 70%, var(--text-muted)); }
.sm-v {
  color: var(--text-primary);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.005em;
}
.sm-pill.accent .sm-v { color: var(--accent); font-weight: 500; }
.song-meta-spacer { flex: 1; }
.sm-btn { height: 28px !important; padding: 0 12px; font-size: 11.5px !important; }

/* ─── Body ───────────────────────────────────────────────────────────── */
.is-body {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 18px;
  align-items: flex-start;
}
/* The 18px gap has no room for a floating rail, so widen it — matching the
   56px the sheet already gets for free on its left, between it and the nav
   rail — whenever the add rail is on screen. Shrinks the sheet column
   itself rather than the fixed 300px sidebar. */
.is-body.is-body-rail-gutter {
  gap: 56px;
}
/* `.is-body` collides with the inventory drawer rule in inventory.css, which
   hands this grid an `overflow-y: auto` it never needs — the grid is
   auto-height, so it never scrolls, but being a scrollport silently kills
   `position: sticky` for everything inside it (the pulled-gear sidebar and
   the add rail both rely on it). Scoped to this page so the drawer keeps its
   own scrolling. The same rule's 20px padding would also inset the sheet
   from the header cards above it, so that's dropped too. */
.inputsheets .is-body { overflow: visible; padding: 0; }
/* Last sheet column stretches to fill a sheet wider than its columns. */
.is-sheet-wrap .is-col-fill { flex-grow: 1; }
/* Available-channels panel tucked away: the sidebar shrinks to a slim tab
   so the sheet gets nearly the full width. */
.is-body.is-body-io-collapsed { grid-template-columns: 1fr 28px; }
.is-main { min-width: 0; }

/* The sheet styles inherit from .sheet-wrap / .sheet-row in inventory.css */
.is-sheet-wrap .sheet-rows { background:
  repeating-linear-gradient(
    180deg,
    var(--surface) 0,
    var(--surface) 30px,
    var(--surface-2) 30px,
    var(--surface-2) 60px
  );
}
.is-sheet-wrap .sheet-row { height: 30px; }

/* Cell content tweaks */
.is-source {
  color: var(--text-primary);
  font-weight: 500;
  letter-spacing: -0.005em;
}
.is-pos {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-secondary);
  letter-spacing: -0.005em;
}
.cell-dim-2 {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
}
.is-gain {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.is-notes {
  font-size: 11.5px;
  color: var(--text-secondary);
  letter-spacing: 0.001em;
  font-style: italic;
  font-family: var(--font-serif);
}

/* Flag (48V / Pad / HPF) */
.flag {
  display: inline-grid;
  place-items: center;
  width: 18px; height: 18px;
  border-radius: 4px;
  font-size: 9px;
  line-height: 1;
}
.flag.on {
  color: var(--accent);
  background: color-mix(in oklab, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in oklab, var(--accent) 35%, var(--border));
  box-shadow: 0 0 6px color-mix(in oklab, var(--accent) 30%, transparent);
}
.flag.off {
  color: var(--text-faint);
  border: 1px solid var(--border);
}

/* Gear chip (inline reference into inventory) */
.gear-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 6px 2px 5px;
  background: color-mix(in oklab, var(--surface-3) 70%, transparent);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 11.5px;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  line-height: 1.2;
  letter-spacing: -0.005em;
}
.gear-chip.empty {
  color: var(--text-faint);
  background: transparent;
  border-style: dashed;
  font-style: italic;
  font-family: var(--font-serif);
  font-size: 11px;
  padding: 1px 6px;
}
.gear-chip-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.gear-chip-text {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.gear-chip-brand { color: var(--text-muted); font-size: 10.5px; }
.gear-chip-model { color: var(--text-primary); }
.gear-chip-id {
  font-size: 9.5px;
  color: var(--text-faint);
  padding-left: 4px;
  margin-left: 2px;
  border-left: 1px solid var(--border);
  letter-spacing: 0.04em;
}

.sheet-row.selected .gear-chip {
  background: color-mix(in oklab, var(--accent) 14%, var(--surface));
  border-color: color-mix(in oklab, var(--accent) 35%, var(--border-strong));
}
.sheet-row.selected .gear-chip-brand { color: var(--text-secondary); }
.sheet-row.selected .flag.off { border-color: var(--border-strong); }

.tieline-opt {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, black 18%, transparent);
}

.tieline-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-width: 0;
  height: 24px;
  padding: 0 7px 0 5px;
  border: 1px solid color-mix(in oklab, var(--tieline-color) 55%, var(--border));
  border-radius: 4px;
  background:
    linear-gradient(90deg,
      color-mix(in oklab, var(--tieline-color) 28%, var(--surface)) 0%,
      color-mix(in oklab, var(--tieline-color) 10%, var(--surface-2)) 100%);
  color: color-mix(in oklab, var(--tieline-color) 42%, var(--text-primary));
  font-size: 11.5px;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--tieline-color) 18%, transparent);
}
.tieline-chip-rail {
  width: 3px;
  height: 14px;
  border-radius: 2px;
  flex-shrink: 0;
  background: var(--tieline-color);
  box-shadow: 0 0 7px color-mix(in oklab, var(--tieline-color) 70%, transparent);
}
.tieline-chip-panel {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tieline-chip-label {
  color: var(--text-primary);
  font-size: 10px;
  padding-left: 5px;
  border-left: 1px solid color-mix(in oklab, var(--tieline-color) 45%, var(--border));
  flex-shrink: 0;
}

/* Row tweaks for input sheet */
.is-row .sheet-gutter { font-weight: 600; color: var(--text-secondary); }
.is-row.selected .sheet-gutter { color: oklch(0.18 0.05 60); }

/* Input sheet: don't pin the Desk gutter; reorder columns for layout.
   View DOM: [gutter][tieline][source][mic]… → tieline first, then CH.
   Edit DOM: [drag][gutter][tieline]… → drag leftmost, tieline next, then CH. */
.is-sheet-wrap .sheet-gutter,
.is-sheet-wrap .sheet-gutter-letter,
.is-sheet-wrap .sheet-gutter-label {
  position: static;
  z-index: auto;
  order: 1;
}
.is-sheet-edit .sheet-drag-col,
.is-sheet-edit .sheet-drag-letter,
.is-sheet-edit .sheet-drag-label {
  order: -1;
  width: 22px;
  min-width: 22px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--border);
  background: var(--surface-2);
  padding: 0;
}
.is-sheet-wrap .sheet-letter-row,
.is-sheet-wrap .sheet-label-row,
.is-sheet-wrap .is-row { display: flex; }
.is-sheet-wrap .sheet-letter-cell { order: 2; }
.is-sheet-wrap .sheet-label-cell  { order: 2; }
.is-sheet-wrap .sheet-cell        { order: 2; }
.is-sheet-view .sheet-letter-row > .sheet-letter-cell:nth-child(2),
.is-sheet-view .sheet-label-row  > .sheet-label-cell:nth-child(2),
.is-sheet-view .is-row           > .sheet-cell:nth-child(2)        { order: 0; }
.is-sheet-edit .sheet-letter-row > .sheet-letter-cell:nth-child(3),
.is-sheet-edit .sheet-label-row  > .sheet-label-cell:nth-child(3),
.is-sheet-edit .is-row           > .sheet-cell:nth-child(3)        { order: 0; }

/* ─── Sidebar (pulled gear) ──────────────────────────────────────────── */
.is-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 16px;
}
.is-side-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 14px 12px;
  box-shadow: var(--shadow-card);
}
.is-side-card.warn {
  border-color: color-mix(in oklab, var(--red) 25%, var(--border));
  background: color-mix(in oklab, var(--red) 3%, var(--surface));
}
.is-side-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.is-side-kicker {
  font-size: 9.5px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.is-side-kicker.warn { color: var(--red); }
.is-side-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  text-align: right;
}
.is-side-num {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.is-side-card.warn .is-side-num { color: var(--red); }
.is-side-num-sub {
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.is-side-group {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.is-side-group:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.is-side-group-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.is-side-group-count {
  font-size: 9.5px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.is-side-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px dotted var(--border);
}
.is-side-item:last-child { border-bottom: none; }
.is-side-item-id {
  font-size: 9.5px;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}
.is-side-item-body { min-width: 0; }
.is-side-item-brand {
  font-size: 9.5px;
  color: var(--text-muted);
  letter-spacing: 0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.is-side-item-model {
  font-size: 11.5px;
  color: var(--text-primary);
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.is-side-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
  flex-shrink: 0;
}

.is-side-empty {
  font-size: 11.5px;
  color: var(--text-muted);
  letter-spacing: -0.005em;
  padding: 6px 0 0;
  font-style: italic;
  font-family: var(--font-serif);
}
.is-side-missing { display: flex; flex-direction: column; }
.is-side-miss {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px dotted color-mix(in oklab, var(--red) 12%, var(--border));
}
.is-side-miss:last-child { border-bottom: none; }
.is-side-miss-ch {
  font-size: 10.5px;
  color: color-mix(in oklab, var(--red) 70%, var(--text-muted));
  font-variant-numeric: tabular-nums;
}
.is-side-miss-src {
  font-size: 12px;
  color: var(--text-primary);
  letter-spacing: -0.005em;
}
.is-side-miss-tag {
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red);
  padding: 2px 5px;
  border-radius: 3px;
  background: color-mix(in oklab, var(--red) 10%, transparent);
  border: 1px solid color-mix(in oklab, var(--red) 28%, var(--border));
}

.is-side-card.legend .legend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 12px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}
.is-side-card.legend .legend-grid > div {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.is-side-card.legend .gear-chip-dot { width: 7px; height: 7px; }
.is-side-card.legend .flag {
  width: 16px; height: 16px;
  font-size: 8px;
}

/* Tall rows — height set per is-sheet-view / is-sheet-edit */
.is-sheet-wrap .is-row-editable .sheet-cell-inner {
  display: block;
  width: 100%;
  min-width: 0;
}
.is-cell-stack {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
}
.is-cell-fields {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.is-mic-edit { flex-direction: column; align-items: stretch; gap: 2px; }
.is-source-edit .is-src-icon { flex-shrink: 0; }
.is-cell-input {
  width: 100%;
  min-width: 0;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
  color: var(--text-primary);
  font-size: 11.5px;
  letter-spacing: -0.005em;
  line-height: 1.2;
}
.is-cell-input:focus {
  outline: none;
  border-color: color-mix(in oklab, var(--accent) 50%, var(--border-strong));
  background: var(--surface);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--accent) 12%, transparent);
}
.is-cell-input-sub {
  height: 18px;
  font-size: 10px;
  color: var(--text-secondary);
}
.is-cell-input.is-cell-gain { width: 52px; text-align: right; }
.is-cell-input.is-cell-daw { width: 44px; text-align: right; }
.is-cell-input.is-cell-notes { font-style: italic; font-family: var(--font-serif); }
.is-row-editable .cs-wrap {
  min-height: 26px;
  height: 26px;
  font-size: 11px;
  padding: 0 24px 0 6px;
}
.is-row-editable .cs-value { font-size: 11px; }
.is-row-editable .cs-arrow { right: 5px; }
.is-row-editable .sheet-row:focus-within,
.is-row-editable:focus-within {
  outline: none;
}
.is-row-editable:focus-within .sheet-gutter {
  color: var(--accent);
}
.is-sheet-wrap .sheet-rows { background: var(--surface); }
.is-sheet-wrap .sheet-row { background: var(--surface); }
.is-sheet-wrap .sheet-row.is-row-stripe { background: var(--surface-2); }
.is-sheet-wrap .is-row .sheet-gutter {
  position: relative;
  font-weight: 600;
  color: var(--text-secondary);
}
.is-sheet-wrap .is-row .sheet-gutter::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--row-color, transparent);
}
/* The 3px rail at the gutter edge keeps its section color regardless of selection. */

/* ─── Section divider row ────────────────────────────────────────────── */
.is-section-row {
  display: flex;
  align-items: center;
  gap: 6px;
  height: auto;
  min-height: 30px;
  padding: 4px 8px 4px 0;
  background:
    linear-gradient(90deg,
      color-mix(in oklab, var(--section-color) 14%, var(--surface-3)) 0%,
      color-mix(in oklab, var(--section-color) 4%, var(--surface-2)) 70%,
      var(--surface-2) 100%);
  border-bottom: 1px solid var(--border);
  border-top: 1px solid var(--border-strong);
  position: relative;
  padding: 0;
}
.is-section-row:first-child { border-top: none; }
.is-section-row.no-color {
  background: var(--surface-2);
}
.is-section-row.no-color .is-section-label,
.is-section-row.no-color .is-section-label-input {
  color: var(--text-secondary);
}
.is-section-row.no-color .is-section-label-input:focus {
  border-color: var(--border-strong);
}
.is-section-rail {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--section-color);
  box-shadow: 0 0 8px color-mix(in oklab, var(--section-color) 55%, transparent);
}
.is-section-row.no-color .is-section-rail {
  background: transparent;
  box-shadow: none;
}
.is-section-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  padding-left: 10px;
}
.is-section-label {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--section-color);
  font-weight: 600;
}
.is-section-count {
  color: var(--text-faint);
  font-weight: 400;
  letter-spacing: 0.06em;
  font-size: 10px;
}
.is-section-label-input {
  flex: 0 1 180px;
  min-width: 100px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--section-color);
  font-weight: 600;
}
.is-section-label-input:focus {
  outline: none;
  border-color: color-mix(in oklab, var(--section-color) 50%, var(--border-strong));
}
.is-section-color-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.is-section-color-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-muted);
}
.is-section-color-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.is-section-color-chip {
  display: grid;
  place-items: center;
  width: 14px;
  height: 14px;
  min-width: 14px;
  max-width: 14px;
  min-height: 14px;
  max-height: 14px;
  flex: 0 0 14px;
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
  border-radius: 3px;
  border: 1px solid color-mix(in oklab, var(--border) 80%, transparent);
  box-shadow: 0 0 8px color-mix(in oklab, var(--section-color) 45%, transparent);
}
.is-section-color-chip.empty {
  background: var(--surface-2) !important;
  box-shadow: none;
  padding: 0;
}
.is-section-no-color-icon {
  display: block;
  width: 10px;
  height: 10px;
  stroke: var(--text-faint);
  stroke-width: 1.8;
  stroke-linecap: round;
  pointer-events: none;
}
.is-section-swatches {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(23, 18px);
  gap: 0;
  align-items: center;
  padding: 6px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface-3);
  box-shadow: 0 14px 32px -16px rgba(0,0,0,0.75);
}
.is-color-swatch {
  width: 18px;
  height: 18px;
  border-radius: 0;
  border: 1px solid oklch(0.18 0.005 65);
  box-shadow:
    inset 0 0 0 1px oklch(1 0 0 / 0.10),
    0 0 0 1px oklch(0 0 0 / 0.35);
  cursor: pointer;
  padding: 0;
}
.is-color-swatch.active {
  box-shadow:
    inset 0 0 0 2px oklch(1 0 0 / 0.65),
    0 0 0 1px var(--section-color, var(--accent));
}
.is-section-delete {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  border-radius: 3px;
  font-size: 12px;
}
.is-section-delete:hover {
  color: var(--red, oklch(0.65 0.2 25));
  background: color-mix(in oklab, var(--red, oklch(0.65 0.2 25)) 12%, transparent);
}
.is-section-range {
  margin-left: auto;
  padding-right: 8px;
  flex-shrink: 0;
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ─── Source icon + 2-line source cell ───────────────────────────────── */
.is-source-stack {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  width: 100%;
}
.is-src-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-secondary);
  opacity: 0.85;
}
.is-source-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
  gap: 1px;
}
.is-source-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.is-source-pos {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-faint);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sheet-row.selected .is-src-icon { color: var(--accent); opacity: 1; }
.sheet-row.selected .is-source-pos { color: color-mix(in oklab, var(--accent) 30%, var(--text-secondary)); }

/* Mic + stand stacked */
.is-mic-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  width: 100%;
  line-height: 1.15;
}

/* ─── Consolidated flag pills (48V / PAD / HPF / Ø) ──────────────────── */
.is-flag-pills {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.is-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 19px;
  padding: 0 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.05em;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-faint);
  line-height: 1;
}
.is-flag.on {
  background: color-mix(in oklab, var(--accent) 14%, transparent);
  border-color: color-mix(in oklab, var(--accent) 40%, var(--border));
  color: var(--accent);
  box-shadow: 0 0 6px color-mix(in oklab, var(--accent) 28%, transparent);
}
.sheet-row.selected .is-flag {
  border-color: var(--border-strong);
}
.sheet-row.selected .is-flag.on {
  background: color-mix(in oklab, var(--accent) 25%, var(--surface));
  border-color: var(--accent);
}

/* ─── Gain bar + number ──────────────────────────────────────────────── */
.is-gain-wrap {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: 100%;
}
.is-gain-bar {
  flex: 1;
  max-width: 48px;
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid color-mix(in oklab, var(--border) 50%, transparent);
}
.is-gain-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, oklch(0.65 0.13 145), oklch(0.78 0.14 60));
  border-radius: 2px;
}
.is-gain-num {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.005em;
}
.sheet-row.selected .is-gain-bar { border-color: var(--border-strong); }

/* ─── Sidebar legend updates ─────────────────────────────────────────── */
.legend-sections {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border);
}
.legend-section {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: -0.005em;
}
.legend-rail {
  width: 3px;
  height: 12px;
  border-radius: 1px;
  box-shadow: 0 0 6px currentColor;
}

/* ─── Swimlane flow (visual view) ────────────────────────────────────── */
.flow-wrap {
  min-width: 860px;
  min-height: 100%;
  background:
    linear-gradient(180deg, color-mix(in oklab, var(--accent) 3%, transparent), transparent 180px),
    var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow:
    0 1px 0 oklch(0.32 0.008 65 / 0.5) inset,
    0 1px 2px rgba(0,0,0,0.3);
}
.flow-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-strong);
}
.flow-kicker {
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 4px;
}
.flow-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.flow-summary {
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  white-space: nowrap;
}
.flow-lanes {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
}
.flow-lane {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: color-mix(in oklab, var(--surface-2) 58%, var(--surface));
  overflow: hidden;
}
.flow-lane-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(90deg, color-mix(in oklab, var(--lane-color) 12%, transparent), transparent 55%),
    var(--surface-2);
}
.flow-lane-rail {
  width: 3px;
  height: 16px;
  border-radius: 2px;
  background: var(--lane-color);
  box-shadow: 0 0 8px color-mix(in oklab, var(--lane-color) 55%, transparent);
}
.flow-lane-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.flow-lane-count {
  margin-left: auto;
  font-size: 9.5px;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 1px 6px;
  background: var(--surface);
}
.flow-lane-rows {
  display: flex;
  flex-direction: column;
}
.flow-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.05fr) minmax(130px, 0.85fr) 18px minmax(130px, 0.85fr) 18px minmax(130px, 0.85fr) 18px minmax(120px, 0.75fr);
  align-items: stretch;
  gap: 8px;
  min-height: 62px;
  width: 100%;
  padding: 8px 10px;
  text-align: left;
  color: var(--text-secondary);
  border-bottom: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  transition: background 0.12s, color 0.12s;
}
.flow-row:last-child { border-bottom: 0; }
.flow-row:hover {
  background: color-mix(in oklab, var(--accent) 6%, var(--surface));
  color: var(--text-primary);
}
.flow-row.selected {
  background: color-mix(in oklab, var(--accent) 11%, var(--surface));
  box-shadow: inset 3px 0 0 var(--accent);
}
.flow-channel,
.flow-cell {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  padding: 7px 9px;
}
.flow-channel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 8px;
  align-content: center;
}
.flow-ch {
  grid-row: 1 / span 2;
  align-self: center;
  font-size: 11px;
  color: var(--accent);
  padding-right: 8px;
  border-right: 1px solid var(--border);
}
.flow-source,
.flow-cell-v {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}
.flow-source {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.flow-pos,
.flow-cell-sub {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-faint);
  font-size: 10.5px;
  margin-top: 2px;
}
.flow-cell {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.flow-cell-k {
  font-size: 9px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 3px;
}
.flow-cell-v {
  font-size: 12.5px;
  line-height: 1.2;
}
.flow-cell.empty .flow-cell-v,
.flow-cell.muted .flow-cell-v {
  color: var(--text-faint);
}
.flow-arrow {
  align-self: center;
  justify-self: center;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 12px;
}

/* View toggle on the song-meta strip */
.is-view-toggle {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px;
  margin-right: 6px;
}
.is-view-toggle button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  border-radius: 3px;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: -0.005em;
}
.is-view-toggle button:hover { color: var(--text-primary); }
.is-view-toggle button.active {
  background: var(--surface-3);
  color: var(--accent);
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.is-view-toggle .ivt-glyph {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
}
.is-edit-toggle { margin-right: 2px; }
.is-toggle-disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* Sheet view vs edit row density */
.is-sheet-view .is-row-tall { height: 44px; }
.is-sheet-view .is-row-tall .sheet-cell { padding: 4px 10px; }
.is-sheet-edit .is-row-tall { height: 52px; }
.is-sheet-edit .is-row-tall .sheet-cell { padding: 3px 8px; }
.is-row-view { cursor: pointer; }
.is-row-view:hover { background: color-mix(in oklab, var(--accent) 4%, var(--surface)) !important; }
.is-row-view.selected {
  background: linear-gradient(90deg,
    color-mix(in oklab, var(--accent) 22%, transparent),
    color-mix(in oklab, var(--accent) 10%, transparent)) !important;
  /* Single accent ring; suppress the row's grey border-bottom so the bottom edge isn't doubled. */
  border-bottom-color: transparent;
  box-shadow:
    0 0 0 1px var(--accent),
    0 0 24px color-mix(in oklab, var(--accent) 25%, transparent);
  z-index: 1;
}
.is-row-view.selected .sheet-gutter {
  color: var(--accent);
  background: transparent;
  font-weight: 700;
  box-shadow: none;
}

/* Drag reorder */
.is-drag-handle {
  display: inline-grid;
  place-items: center;
  width: 14px;
  height: 22px;
  flex-shrink: 0;
  cursor: grab;
  color: var(--text-faint);
  font-size: 10px;
  letter-spacing: -0.12em;
  user-select: none;
  opacity: 0.55;
}
.is-drag-handle:active { cursor: grabbing; }
.is-row-editable:hover .is-drag-handle,
.is-section-row:hover .is-drag-handle { opacity: 1; color: var(--text-muted); }
.is-gutter-ch { min-width: 14px; text-align: center; }
.is-sheet-edit .is-section-row .is-section-rail { left: 22px; }
/* Live reorder while dragging */
.is-sheet-edit.is-drag-active .is-rows-reordering > .sheet-row,
.is-sheet-edit.is-drag-active .is-rows-reordering > .is-section-row {
  transition: transform 0.14s ease, opacity 0.14s ease, box-shadow 0.14s ease;
}
.is-sheet-edit.is-drag-active .is-rows-reordering > .sheet-row:not(.is-dragging),
.is-sheet-edit.is-drag-active .is-rows-reordering > .is-section-row:not(.is-dragging) {
  opacity: 0.55;
}
.is-sheet-edit.is-drag-active .is-dragging {
  opacity: 1 !important;
  transform: scale(1.006);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.32), 0 0 0 1px color-mix(in oklab, var(--accent) 35%, var(--border));
  z-index: 4;
  position: relative;
  background: var(--surface-3) !important;
  cursor: grabbing;
}
.is-section-row.is-dragging,
.is-row-tall.is-dragging {
  z-index: 5;
}
.is-drop-target {
  position: relative;
}
.is-drop-target::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -1px;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px color-mix(in oklab, var(--accent) 70%, transparent);
  z-index: 6;
  pointer-events: none;
}
.is-drag-ghost-image {
  border-radius: 4px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.4);
  background: var(--surface-3) !important;
  opacity: 0.95 !important;
}
.is-sheet-edit.is-drag-active .is-drag-handle {
  opacity: 1;
  color: var(--accent);
  cursor: grabbing;
}
/* ─── Floating add rail ──────────────────────────────────────────────────
   Edit mode's only add-channel / add-section controls. They live in the
   right page gutter so they stay in reach on a long sheet (widened by
   `.is-body-rail-gutter` above so the rail has clear space instead of
   sitting over the sheet or the sidebar). The outer element spans the full
   height of the sheet column; the inner one sticks partway down `.main`
   (the page's vertical scroller) as it passes. */
.is-add-rail {
  position: absolute;
  top: 0;
  bottom: 0;
  right: -42px;
  width: 34px;
  z-index: 5;
  pointer-events: none;
}
.is-add-rail-inner {
  position: sticky;
  /* margin-top drops its starting position past the column-letter header
     before any scrolling has happened; the matching `top` then holds it at
     that same height once scrolling would otherwise carry it off the top. */
  margin-top: 220px;
  top: 220px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  pointer-events: auto;
}
.is-add-rail-btn {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s;
}
/* Muted at rest — the rail is on screen for the whole edit session, so it
   should not compete with the sheet until you reach for it. */
.is-add-rail-btn .is-add-glyph {
  color: var(--text-secondary);
  transition: color 0.15s;
}
.is-add-rail-btn:hover { background: var(--surface-3); }
.is-add-rail-btn:hover .is-add-glyph { color: var(--accent); }
.is-add-rail-btn:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}

/* ─── Empty sheet (un-written song) ──────────────────────────────────── */
.is-empty-sheet {
  display: grid;
  place-items: center;
  min-height: 480px;
  background:
    linear-gradient(180deg, var(--surface-2), var(--surface));
}
.is-empty-inner {
  max-width: 420px;
  text-align: center;
  padding: 40px 24px;
}
.is-empty-glyph {
  font-size: 36px;
  color: var(--accent);
  margin-bottom: 8px;
  opacity: 0.7;
}
.is-empty-title {
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin: 0 0 10px;
  font-family: var(--font-serif);
  font-style: italic;
}
.is-empty-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0 0 22px;
  text-wrap: pretty;
}
.is-empty-body em { color: var(--accent); font-style: normal; font-weight: 500; }
.is-empty-actions {
  display: inline-flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  min-width: 220px;
}

/* ─── Add sheet modal ─────────────────────────────────────────────────── */
.is-kind-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.is-kind-pill {
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.is-kind-pill:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.is-kind-pill.active {
  background: color-mix(in oklch, var(--accent) 12%, var(--surface-2));
  border-color: color-mix(in oklch, var(--accent) 40%, var(--border));
  color: var(--text-primary);
}
.is-seed-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.is-seed-check input {
  accent-color: var(--accent);
}

/* ─── Gear Picker popup ──────────────────────────────────────── */
.gp-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Popover mode: transparent backdrop, panel positioned by inline style. */
.gp-overlay-popover {
  background: transparent;
  display: block;
}
.gp-panel {
  background: var(--surface);
  border: 1px solid var(--border-strong, var(--border));
  border-radius: var(--radius);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
  width: 500px;
  max-width: calc(100vw - 32px);
  max-height: 72vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.gp-panel-popover {
  width: auto;
  max-width: none;
  max-height: none;
  border-radius: 6px;
  box-shadow: 0 8px 24px -4px rgba(0,0,0,0.55), 0 2px 8px rgba(0,0,0,0.35);
}
.gp-panel-popover .gp-title { padding: 8px 12px 6px; font-size: 9px; }
.gp-panel-popover .gp-search-wrap { padding: 6px 10px; }
.gp-panel-popover .gp-list { max-height: none; }
.gp-title {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 13px 16px 11px;
  border-bottom: 1px solid var(--border);
}
.gp-search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 14px;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  transition: border-color 0.12s;
  flex-shrink: 0;
}
.gp-search-wrap:focus-within {
  border-color: var(--accent);
}
.gp-search-icon {
  color: var(--text-faint);
  font-size: 14px;
  flex-shrink: 0;
  line-height: 1;
}
.gp-search {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 13.5px;
  color: var(--text-primary);
  font-family: var(--font-sans);
}
.gp-search::placeholder { color: var(--text-faint); }

.gp-list {
  flex: 1;
  overflow-y: auto;
  border-top: 1px solid var(--border);
}
.gp-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid color-mix(in oklab, var(--border) 55%, transparent);
  cursor: pointer;
  transition: background 0.08s;
}
.gp-item:last-child { border-bottom: 0; }
.gp-item.focused { background: var(--surface-2); }
.gp-item.gp-item-clear {
  border-bottom: 1px dashed var(--border);
  margin-bottom: 2px;
}
.gp-item.gp-item-custom {
  border-top: 1px dashed var(--border);
  margin-top: 2px;
}
.gp-item-custom .gp-item-id { color: var(--accent); }
.gp-item-custom .gp-item-brand { color: var(--text-secondary); font-size: 10.5px; }
.gp-item-custom .gp-item-model { color: var(--text-primary); font-style: italic; }
.gp-item-id {
  width: 68px;
  flex-shrink: 0;
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.03em;
}
.gp-item-clear .gp-item-id { color: var(--text-faint); }
.gp-item-body { flex: 1; min-width: 0; }
.gp-item-brand {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 1px;
}
.gp-item-model {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.gp-item-loc {
  font-size: 10px;
  color: var(--text-faint);
  margin-top: 2px;
  letter-spacing: 0.02em;
}
.gp-item-status {
  font-size: 10px;
  letter-spacing: 0.08em;
  font-family: var(--font-mono);
  flex-shrink: 0;
  white-space: nowrap;
}
.gp-item-status.free    { color: oklch(0.72 0.18 145); }
.gp-item-status.in-use  { color: var(--accent); }

.gp-item-tieline .gp-item-tieline-rail {
  width: 4px;
  height: 28px;
  border-radius: 2px;
  flex-shrink: 0;
  align-self: center;
  box-shadow: 0 0 6px color-mix(in oklab, currentColor 40%, transparent);
}
.gp-item-tieline .gp-item-body { padding-left: 2px; }

.gp-footer {
  display: flex;
  gap: 18px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 10.5px;
  color: var(--text-faint);
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.gp-footer kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  margin-right: 2px;
}
.gp-empty {
  padding: 20px 16px;
  font-size: 12px;
  color: var(--text-faint);
  font-style: italic;
}

/* Picker trigger button (replaces CustomSelect in edit cells) */
.is-picker-trigger {
  display: flex;
  align-items: center;
  width: 100%;
  height: 26px;
  padding: 0 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  gap: 4px;
  overflow: hidden;
  transition: border-color 0.1s;
}
.is-picker-trigger:hover { border-color: var(--accent); }
.is-picker-trigger .gear-chip,
.is-picker-trigger .tieline-chip { pointer-events: none; }
.gp-trigger-placeholder {
  font-size: 11.5px;
  color: var(--text-faint);
  font-style: italic;
}

/* ─── Available channel two-column table (sidebar) ───────────── */
.is-ch-avail-table {
  display: flex;
  flex-direction: column;
  margin-top: 6px;
  border-top: 1px solid var(--border);
}
.is-ch-avail-head {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.is-ch-avail-head > span {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 4px 10px;
}
.is-ch-avail-head > span + span {
  border-left: 1px solid var(--border);
}
.is-ch-avail-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid color-mix(in oklab, var(--border) 45%, transparent);
}
.is-ch-avail-row:last-child { border-bottom: 0; }
.is-ch-avail-row > span {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 3px 10px;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}
.is-ch-avail-row > span + span {
  border-left: 1px solid color-mix(in oklab, var(--border) 60%, transparent);
}
/* dim — one side assigned, the other still free */
.is-ch-avail-row > span.dim {
  color: var(--text-faint);
  opacity: 0.45;
}

/* ─── Sub-view layout ─────────────────────────────────────────── */
.is-main-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  /* Anchors the sticky add rail that rides the left page gutter. */
  position: relative;
}
.is-main-content {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

/* ─── Bottom tab bar (Inputs / Sends / Cues) ─────────────────── */
.is-subview-tabs {
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 0 4px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.is-sv-tab {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  font-size: 11.5px;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  border-radius: 0;
  transition: color 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.is-sv-tab:hover { color: var(--text-primary); }
.is-sv-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}
.is-sv-glyph { font-size: 10px; opacity: 0.7; }
.is-sv-count {
  font-size: 9.5px;
  color: var(--text-faint);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 5px;
  line-height: 1.6;
}
.is-sv-tab.active .is-sv-count { color: var(--accent); border-color: color-mix(in oklab, var(--accent) 30%, var(--border)); }

/* ─── Sends & Cues shared table ───────────────────────────────── */
.is-sends-wrap {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.is-sends-scroll {
  flex: 1;
  overflow: auto;
}
.is-tbl {
  border-collapse: collapse;
  min-width: 100%;
  font-size: 12.5px;
}
.is-tbl thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  padding: 7px 14px;
  text-align: left;
  font-size: 10px;
  font-family: var(--font-mono);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 500;
  white-space: nowrap;
}
.is-tbl tbody td {
  border-bottom: 1px solid color-mix(in oklab, var(--border) 45%, transparent);
  padding: 0;
  vertical-align: middle;
}
.is-tbl tfoot td {
  padding: 0;
  border-top: 1px solid var(--border);
}
.is-tbl-stripe td { background: var(--surface-2); }
.is-tbl-del-col { width: 32px; }

.is-tbl-input {
  display: block;
  width: 100%;
  height: 36px;
  padding: 0 14px;
  background: transparent;
  border: none;
  outline: none;
  font-size: 12.5px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  transition: background 0.1s;
}
.is-tbl-input.mono { font-family: var(--font-mono); font-size: 11.5px; }
.is-tbl-input::placeholder { color: var(--text-faint); }
.is-tbl-input:focus { background: color-mix(in oklab, var(--accent) 5%, var(--surface)); }
.is-tbl-input.readonly {
  color: var(--text-secondary);
  cursor: default;
}
.is-tbl-input.readonly::placeholder { color: transparent; }
.is-tbl-input.readonly:focus { background: transparent; }

.is-tbl-del {
  display: block;
  width: 32px;
  height: 36px;
  font-size: 10px;
  color: var(--text-faint);
  opacity: 0;
  transition: opacity 0.1s, color 0.1s;
}
.is-tbl tbody tr:hover .is-tbl-del { opacity: 1; }
.is-tbl-del:hover { color: var(--red); }

.is-tbl-add {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text-muted);
  transition: color 0.1s;
}
.is-tbl-add:hover { color: var(--accent); }

/* Mono/Stereo toggle pill */
.is-ms-toggle {
  margin: 0 10px;
  padding: 3px 10px;
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: color 0.1s, border-color 0.1s, background 0.1s;
  white-space: nowrap;
}
.is-ms-toggle.is-ms-stereo {
  color: var(--accent);
  border-color: color-mix(in oklab, var(--accent) 35%, var(--border));
  background: color-mix(in oklab, var(--accent) 8%, var(--surface));
}
.is-ms-toggle:disabled {
  cursor: default;
  opacity: 0.85;
}

/* ─── Available-channels collapse / expand ───────────────────────────── */
.is-side-collapse {
  align-self: flex-start;
  width: 22px; height: 22px;
  margin: -4px -4px 0 0;
  display: grid; place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-faint);
  font-size: 15px; line-height: 1;
  cursor: pointer;
}
.is-side-collapse:hover { color: var(--text-primary); border-color: var(--border); background: var(--surface-2, var(--surface)); }
.is-side-expand {
  width: 28px;
  padding: 10px 0;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  color: var(--text-muted);
  cursor: pointer;
}
.is-side-expand:hover { color: var(--text-primary); }
.is-side-expand-glyph { font-size: 15px; line-height: 1; }
.is-side-expand-label {
  writing-mode: vertical-rl;
  font-size: 9.5px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}
