/* plate-viewer.css - component styles for Plate Viewer (integrated into tmec) */
/* Note: body/layout styles removed - the host page handles those */

:root {
  --pv-box-pad-x: 14px;
  --pv-box-pad-y: 11px;
  --pv-box-gap: 10px;
  --pv-soft-border-light: rgba(0, 0, 0, 0.12);
  --pv-soft-border-dark: rgba(255, 255, 255, 0.16);
}

#pv-toolbar > div,
#pv-toolbar > button {
  min-height: 40px;
}

/* ---- Buttons (matches tmec .btn-small) ---- */
.pv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0.55rem 1rem;
  font-size: 0.8125rem;
  line-height: 1.25;
  border: 1px solid #000;
  background: #fff;
  color: #000;
  cursor: pointer;
  font-family: system-ui, sans-serif;
  font-weight: 500;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.pv-btn:hover {
  background: #f3f4f6;
}
.dark .pv-btn {
  border-color: #fff;
  background: #18181b;
  color: #fff;
}
.dark .pv-btn:hover {
  background: #27272a;
}

/* ---- Select inputs ---- */
.pv-select {
  min-height: 38px;
  padding: 0.45rem 0.7rem;
  border: 1px solid #000;
  background: #fff;
  color: #000;
  font-family: system-ui, sans-serif;
  font-size: 0.8125rem;
  line-height: 1.3;
  cursor: pointer;
  outline: none;
}
.pv-select:focus {
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
}
.dark .pv-select {
  border-color: #fff;
  background: #18181b;
  color: #fff;
}
.dark .pv-select:focus {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3);
}

/* ---- Text input ---- */
.pv-input {
  min-height: 40px;
  padding: 0.55rem 0.8rem;
  border: 1px solid #000;
  background: #fff;
  color: #000;
  font-family: system-ui, sans-serif;
  line-height: 1.35;
  outline: none;
  width: 100%;
}
.pv-input:focus {
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
}
.dark .pv-input {
  border-color: #fff;
  background: #18181b;
  color: #fff;
}
.dark .pv-input:focus {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3);
}

/* ---- Cards (legend, summary, etc.) ---- */
.pv-card {
  background: #fff;
  border: 1px solid #000;
  color: #111827;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}
.dark .pv-card {
  background: #18181b;
  border-color: #fff;
  color: #f5f5f5;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03);
}

.color-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.color-legend-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  font-size: 0.75rem;
  line-height: 1.3;
}

.color-legend-title-label {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.5;
}

.color-legend-title-value {
  font-weight: 600;
  text-transform: capitalize;
  opacity: 0.92;
}

.color-legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
}

.color-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 22px;
  font-size: 0.75rem;
  line-height: 1.35;
}

.color-legend-swatch {
  flex-shrink: 0;
}

.color-legend-label {
  color: inherit;
  opacity: 0.88;
}

.color-legend-note {
  font-size: 0.75rem;
  font-style: italic;
  line-height: 1.45;
  opacity: 0.48;
}

.summary-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
}

.summary-stage {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 220px;
  padding: 10px 12px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.025);
}

.dark .summary-stage {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.035);
}

.summary-stage-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.summary-stage-name {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: capitalize;
}

.summary-stage-total {
  font-size: 0.75rem;
  opacity: 0.6;
}

.summary-stage-plates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.summary-stage-plate {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 4px 8px;
  border: 1px solid rgba(0, 0, 0, 0.09);
  background: rgba(255, 255, 255, 0.55);
  font-size: 0.72rem;
  line-height: 1.3;
}

.dark .summary-stage-plate {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(24, 24, 27, 0.5);
}

.summary-stage-plate-label {
  opacity: 0.58;
}

.summary-stage-plate-count {
  font-weight: 600;
  opacity: 0.98;
}

.summary-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.summary-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid currentColor;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.25;
}

.summary-chip-filtered {
  border-color: #ca8a04;
  color: #a16207;
}

.dark .summary-chip-filtered {
  color: #facc15;
}

.summary-clear-btn {
  border: 0;
  background: transparent;
  color: inherit;
  opacity: 0.45;
  font-size: 0.75rem;
  line-height: 1.2;
  text-decoration: underline;
  cursor: pointer;
}

.summary-clear-btn:hover {
  opacity: 1;
}

/* ---- Drop zone ---- */
.pv-drop-zone {
  border: 1px dashed #000;
  min-height: 40px;
  padding: 9px 14px;
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
  line-height: 1.35;
}
.pv-drop-zone.drag-over {
  background: #f3f4f6;
}
.dark .pv-drop-zone {
  border-color: #fff;
}
.dark .pv-drop-zone.drag-over {
  background: #27272a;
}

/* ---- How-to-use screen ---- */
.pv-step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid #000;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  margin-top: 1px;
}
.dark .pv-step-num {
  border-color: #fff;
}

.pv-code {
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  padding: 1px 4px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: rgba(0, 0, 0, 0.03);
}
.dark .pv-code {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
}

.pv-howto-divider {
  height: 1px;
  background: #000;
  opacity: 0.1;
}
.dark .pv-howto-divider {
  background: #fff;
}

/* ---- Pipeline ---- */
.plate-svg    { display: block; }
.well         { cursor: pointer; }
.well-occupied { transition: opacity 0.07s; }
.well-occupied:hover { filter: brightness(1.08); }
.well-empty { cursor: cell; }

/* Uses an inset box-shadow (not background) so the flash isn't masked by the
   `!important` backgrounds used for row selection / banding, and `!important`
   isn't needed here (which CSS animations ignore inside @keyframes anyway). */
@keyframes pv-row-flash {
  0%   { box-shadow: inset 0 0 0 9999px rgba(66, 133, 244, 0.28); }
  100% { box-shadow: inset 0 0 0 9999px rgba(66, 133, 244, 0); }
}
.pv-row-flash td { animation: pv-row-flash 1.4s ease-out forwards; }
.pipeline-row { user-select: none; }

.stage-col    { width: 400px; display: flex; flex-direction: column; }
.stage-plates { overflow-y: auto; }
.stage-plates::-webkit-scrollbar { width: 5px; }
.stage-plates::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 4px; }
.dark .stage-plates::-webkit-scrollbar-thumb { background: #3f3f46; }

.plate-wrap { width: 380px; }
.plate-title-row {
  width: 100%;
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr) 4rem;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.25rem;
}
.plate-title-row .plate-label {
  justify-self: center;
  text-align: center;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.plate-hide-btn {
  justify-self: start;
  border: 0;
  background: transparent;
  color: inherit;
  opacity: 0.3;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.25rem;
  transition: opacity 0.15s, color 0.15s;
}
.plate-hide-btn:hover {
  opacity: 1;
  color: #dc2626;
}
.plate-select-all {
  justify-self: end;
  border: 0;
  background: transparent;
  color: #2563eb;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.15rem 0;
  white-space: nowrap;
}
.plate-select-all:hover { text-decoration: underline; }
.dark .plate-select-all { color: #60a5fa; }
.plate-label:hover { color: #3B82F6; }

/* ---- Table side panel ---- */
#table-panel {
  position: fixed;
  right: 0;
  bottom: 0;
  top: 0;
  width: 460px;
  background: white;
  border-left: 1px solid #000;
  box-shadow: -4px 0 16px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transform: translateX(100%);
  transition: transform 0.22s ease;
  color: #111827;
}
#table-panel.panel-open { transform: translateX(0); }

/* Slide-away tab on the left edge of the table panel — click to collapse */
#table-panel-collapse-tab {
  position: absolute;
  left: -18px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: white;
  color: #111827;
  border: 1px solid #000;
  border-right: none;
  border-radius: 6px 0 0 6px;
  box-shadow: -2px 0 8px rgba(0,0,0,0.08);
  cursor: pointer;
  z-index: 1;
}
#table-panel-collapse-tab:hover { background: #f3f4f6; }
.dark #table-panel-collapse-tab {
  background: #18181b;
  color: #f5f5f5;
  border-color: #fff;
}
.dark #table-panel-collapse-tab:hover { background: #27272a; }
#table-panel.table-fullscreen #table-panel-collapse-tab { display: none; }
.dark #table-panel {
  background: #18181b;
  border-left-color: #fff;
  box-shadow: -4px 0 16px rgba(0,0,0,0.3);
  color: #f5f5f5;
}

/* Panel header */
#table-panel-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 12px 16px;
  border-bottom: 1px solid #000;
  background: #fafafa;
}
.dark #table-panel-header {
  background: #18181b;
  border-bottom-color: #fff;
}

.pv-table-band-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  min-height: 30px;
  padding: 0.25rem 0.45rem;
  border: 1px solid rgba(0, 0, 0, 0.18);
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  font-family: system-ui, sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.pv-table-band-toggle input {
  margin: 0;
}

.dark .pv-table-band-toggle {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.05);
}

/* Extended table actions (+ Row, banding) — hidden in the compact
   side panel, shown only when the table is expanded to full screen */
.pv-table-extended-actions {
  display: none;
  align-items: center;
  gap: 0.5rem;
}
#table-panel.table-fullscreen .pv-table-extended-actions {
  display: flex;
  flex-wrap: wrap;
}

#table-fullscreen-toggle svg {
  display: block;
}

/* ---- Full screen table modal ---- */
#table-fullscreen-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99;
}
#table-fullscreen-backdrop.active {
  display: block;
}
#table-panel.table-fullscreen {
  left: 50%;
  top: 50%;
  right: auto;
  bottom: auto;
  width: min(1100px, 94vw);
  height: min(820px, 90vh);
  transform: translate(-50%, -50%) !important;
  transition: none;
  border: 1px solid #000;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  z-index: 101;
  overflow: hidden;
}
.dark #table-panel.table-fullscreen {
  border-color: #fff;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
#table-panel.table-fullscreen #table-panel-header {
  border-radius: 11px 11px 0 0;
}
#table-panel.table-fullscreen #table-body-wrap {
  border-radius: 0 0 11px 11px;
}

/* Table scroll area inside panel */
#table-body-wrap {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  background: inherit;
}

#table-body-wrap [data-table-scroll] {
  padding-left: 0.75rem;
  box-sizing: border-box;
}

.table-cell-input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0;
  line-height: 1.4;
  min-width: 0;
}
.table-cell-input::placeholder {
  color: rgba(107, 114, 128, 0.85);
}
.dark .table-cell-input::placeholder {
  color: rgba(212, 212, 216, 0.7);
}
.table-cell-input::selection {
  background: rgba(37, 99, 235, 0.18);
}

/* ---- Spreadsheet cell editing states ---- */
.pv-td {
  position: relative;
  cursor: default;
  user-select: text;
  /* Always-on transition so highlight/selection classes (local or remote)
     fade in smoothly instead of popping when toggled. */
  transition: box-shadow 0.12s ease, background-color 0.12s ease;
}
.pv-td.pv-cell-selected {
  box-shadow: inset 0 0 0 2px #4285f4;
  background: rgba(66, 133, 244, 0.07) !important;
  z-index: 2;
}
.pv-td.pv-cell-editing {
  box-shadow: inset 0 0 0 2px #1a73e8;
  background: #fff !important;
  z-index: 3;
}
.dark .pv-td.pv-cell-editing {
  background: #18181b !important;
}
.dark .pv-td.pv-cell-selected {
  background: rgba(66, 133, 244, 0.12) !important;
}
.pv-td .table-cell-input {
  cursor: default;
  user-select: text;
  pointer-events: none;
}
.pv-td.pv-cell-selected .table-cell-input,
.pv-td.pv-cell-editing .table-cell-input {
  cursor: text;
  user-select: text;
  pointer-events: auto;
}
.pv-td.pv-cell-editing .table-cell-input {
  outline: none;
}

/* Multi-cell range selection (Google-Sheets-style highlight + draggable fill) */
.pv-td.pv-cell-range-selected {
  background: rgba(66, 133, 244, 0.12) !important;
  z-index: 1;
}
.dark .pv-td.pv-cell-range-selected {
  background: rgba(66, 133, 244, 0.18) !important;
}

/* Export dropdown */
#export-menu button:hover {
  background: #f3f4f6;
}
.dark #export-menu {
  background: #18181b !important;
  border-color: #fff !important;
}
.dark #export-menu button:hover {
  background: #27272a;
}

/* Resizable columns */
.col-resize-handle {
  position: absolute; right: 0; top: 0; bottom: 0; width: 5px;
  cursor: col-resize; z-index: 1;
}
.col-resize-handle:hover,
.col-resize-handle:active { background: rgba(0,0,0,0.15); }
.dark .col-resize-handle:hover,
.dark .col-resize-handle:active { background: rgba(255,255,255,0.15); }

/* Table rows */
.table-row:hover td { background: #fafafa; }
.dark .table-row:hover td { background: #27272a; }
.row-selected td    { background: #EFF6FF !important; }
.dark .row-selected td { background: #1e3a5f !important; }
.row-selected       { border-left: 3px solid #000 !important; }
.dark .row-selected { border-left: 3px solid #fff !important; }

/* ---- Data table styling ---- */
/* border-collapse + box-sizing: border-box keeps each cell's borders confined to
   its own box, so 1px hairlines render the same way on every browser/zoom level
   instead of being subject to the collapsed-border-resolution algorithm
   (a frequent source of inconsistent/jittery cell boundaries across devices). */
.table-el {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.75rem;
  color: inherit;
}
.table-el th,
.table-el td {
  box-sizing: border-box;
}
.table-el th {
  position: sticky;
  top: 0;
  z-index: 20;
  white-space: nowrap;
  background: #fff !important;
  opacity: 1 !important;
  box-shadow: 0 1px 0 currentColor;
}
.table-header-cell {
  opacity: 1 !important;
  user-select: text;
}
.table-el td {
  white-space: nowrap;
  vertical-align: middle;
}
.dark .table-el th {
  background: #18181b !important;
}
#table-panel.table-banding-on .table-el tbody tr:nth-child(even):not(.row-selected) td:not(.pv-cell-selected):not(.pv-cell-editing):not(.pv-cell-range-selected) {
  background: #f3f4f6;
}
#table-panel.table-banding-on .table-el tbody tr:not(.row-selected) td:nth-child(even):not(.pv-cell-selected):not(.pv-cell-editing):not(.pv-cell-range-selected) {
  background: #eff6ff;
}
#table-panel.table-banding-on .table-el thead th:nth-child(even) {
  background: #eff6ff !important;
}
.dark #table-panel.table-banding-on .table-el tbody tr:nth-child(even):not(.row-selected) td:not(.pv-cell-selected):not(.pv-cell-editing):not(.pv-cell-range-selected) {
  background: rgba(63, 63, 70, 0.55);
}
.dark #table-panel.table-banding-on .table-el tbody tr:not(.row-selected) td:nth-child(even):not(.pv-cell-selected):not(.pv-cell-editing):not(.pv-cell-range-selected) {
  background: rgba(30, 58, 138, 0.34);
}
.dark #table-panel.table-banding-on .table-el thead th:nth-child(even) {
  background: #172554 !important;
}
.table-cell-local-active {
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.35);
}
.table-cell-remote-active {
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.16);
}
.dark .table-cell-remote-active {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.table-cell-remote-badges {
  position: absolute;
  top: 3px;
  right: 6px;
  display: flex;
  gap: 4px;
  pointer-events: none;
}
.table-cell-remote-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 1px solid currentColor;
  background: rgba(255,255,255,0.96);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}
.dark .table-cell-remote-badge {
  background: rgba(24,24,27,0.96);
}

/* ---- Tooltip ---- */
#tooltip {
  display: none;
  position: fixed;
  z-index: 300;
  background: white;
  border: 1px solid #000;
  padding: 12px 14px;
  font-size: 12px;
  color: #1f2937;
  max-width: 320px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  line-height: 1.55;
  pointer-events: none;
}
.dark #tooltip {
  background: #18181b;
  border-color: #fff;
  color: #e4e4e7;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.tooltip-row  { display: flex; gap: 8px; align-items: flex-start; }
.tooltip-key  { color: #6B7280; flex-shrink: 0; text-transform: capitalize; min-width: 88px; }
.tooltip-val  { color: #111827; font-weight: 500; word-break: break-word; }
.dark .tooltip-val { color: #e4e4e7; }
.dark .tooltip-key { color: #a1a1aa; }
.tooltip-multi { color: #C2410C; font-size: 11px; margin-bottom: 8px; font-weight: 700; }
.dark .tooltip-multi { color: #fb923c; }

/* ---- Warnings ---- */
#warnings {
  display: none;
  background: #FFF7ED;
  border-left: 4px solid #F97316;
  padding: 14px 16px;
  color: #9a3412;
  line-height: 1.45;
}
.dark #warnings {
  background: #451a03;
  color: #fdba74;
}

/* ---- Save modal ---- */
.pv-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pv-modal-overlay.hidden { display: none; }
.dark .pv-modal-overlay {
  background: rgba(0, 0, 0, 0.6);
}
.pv-modal {
  min-width: 320px;
  max-width: 400px;
  width: min(400px, calc(100vw - 32px));
}

/* ---- Changes modal ---- */
.pv-changes-modal {
  width: min(760px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pv-changes-header {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem 0.85rem;
  border-bottom: 1px solid rgba(128,128,128,0.18);
}

.pv-changes-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
}

.pv-changes-subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.72rem;
  opacity: 0.55;
}

.pv-changes-close {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
  opacity: 0.45;
}

.pv-changes-close:hover { opacity: 1; }

.pv-changes-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.pv-changes-import-status {
  flex-shrink: 0;
  margin: 0;
  padding: 0.75rem 1.1rem;
  border-bottom: 1px solid rgba(128,128,128,0.18);
  font-size: 0.76rem;
  line-height: 1.4;
}

.pv-changes-import-status.hidden {
  display: none;
}

.pv-changes-import-status strong {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.78rem;
}

.pv-changes-import-status p {
  margin: 0;
  opacity: 0.68;
}

.pv-changes-import-status.is-ok {
  background: rgba(22,163,74,0.08);
  color: #14532d;
}

.pv-changes-import-status.is-warn {
  background: rgba(234,179,8,0.1);
  color: #713f12;
}

.pv-changes-import-status.is-error {
  background: rgba(220,38,38,0.08);
  color: #7f1d1d;
}

.dark .pv-changes-import-status.is-ok { color: #bbf7d0; }
.dark .pv-changes-import-status.is-warn { color: #fde68a; }
.dark .pv-changes-import-status.is-error { color: #fecaca; }

.pv-changes-import-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.65rem;
}

.pv-changes-import-apply {
  color: #dc2626;
  border-color: #dc2626;
}

.pv-changes-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.pv-changes-empty {
  padding: 2rem 1rem;
  text-align: center;
  font-size: 0.82rem;
  opacity: 0.48;
}

.pv-change-item {
  border: 1px solid rgba(0,0,0,0.16);
  background: #fff;
}

.dark .pv-change-item {
  border-color: rgba(255,255,255,0.22);
  background: #18181b;
}

.pv-change-row {
  display: flex;
  align-items: stretch;
  gap: 0.55rem;
}

.pv-change-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.pv-change-entry-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.65rem 0.75rem 0.65rem 0;
}

.pv-change-entry-btn {
  border: 1px solid rgba(37,99,235,0.55);
  background: rgba(37,99,235,0.06);
  color: #2563eb;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  min-height: 28px;
  padding: 0.35rem 0.55rem;
  white-space: nowrap;
}

.pv-change-entry-btn:hover {
  background: rgba(37,99,235,0.12);
  border-color: #2563eb;
}

.pv-change-fork-btn {
  border-color: rgba(22,163,74,0.6);
  background: rgba(22,163,74,0.07);
  color: #15803d;
}

.pv-change-fork-btn:hover {
  background: rgba(22,163,74,0.13);
  border-color: #16a34a;
}

.pv-change-main:disabled {
  cursor: default;
}

.pv-change-index {
  flex: 0 0 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid currentColor;
  font-size: 0.72rem;
  font-weight: 800;
  opacity: 0.45;
}

.pv-change-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.pv-change-title {
  font-size: 0.84rem;
  font-weight: 750;
}

.pv-change-detail,
.pv-change-time {
  font-size: 0.72rem;
  line-height: 1.35;
  opacity: 0.55;
  overflow-wrap: anywhere;
}

.pv-change-reverted {
  opacity: 0.42;
  filter: grayscale(1);
}

.pv-change-open {
  border-color: #dc2626;
}

.pv-change-confirm {
  margin: 0 0.85rem 0.85rem 3.6rem;
  padding: 0.75rem;
  border-left: 3px solid #dc2626;
  background: rgba(220,38,38,0.06);
}

.pv-change-confirm-title {
  color: #dc2626;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.pv-change-confirm-copy {
  margin-top: 0.25rem;
  font-size: 0.72rem;
  line-height: 1.35;
  opacity: 0.7;
}

.pv-change-confirm-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-top: 0.65rem;
}

.pv-change-revert-btn {
  color: #dc2626;
  border-color: #dc2626;
}

.pv-change-download-current {
  display: inline-block;
  margin-top: 0.55rem;
  border: 0;
  background: transparent;
  color: #2563eb;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0;
  text-decoration: underline;
}

/* ---- Changelog preview ---- */
.pv-preview-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(37,99,235,0.35);
  background: #eff6ff;
  color: #1e3a8a;
}

.pv-preview-banner.hidden {
  display: none;
}

.dark .pv-preview-banner {
  background: rgba(37,99,235,0.16);
  color: #bfdbfe;
}

.pv-preview-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.pv-preview-kicker {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pv-preview-title {
  font-size: 0.82rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.pv-preview-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.pv-status-preview {
  color: #2563eb;
}

.dark .pv-status-preview {
  color: #93c5fd;
}

.table-readonly .table-cell-input {
  cursor: default;
}

/* ---- Stage header cards in pipeline ---- */
.stage-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #000;
  color: #111827;
}
.dark .stage-header {
  background: #18181b;
  border-color: #fff;
  color: #f5f5f5;
}

.stage-header-title-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 32px;
}

.stage-header-picker {
  flex: 1 1 auto;
}

.stage-header-format-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.stage-header-format-label,
.stage-header-badge,
.stage-header-missing {
  font-size: 0.78rem;
  line-height: 1.35;
}

.stage-header-format-label,
.stage-header-badge {
  opacity: 0.56;
}

.stage-header-missing {
  color: #dc2626;
}

.remove-col-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  margin-right: -4px;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 1.25rem;
  line-height: 1;
  opacity: 0.34;
  cursor: pointer;
  transition: opacity 0.15s, color 0.15s;
}

.remove-col-btn:hover {
  opacity: 1;
  color: #dc2626;
}

/* Stage picker select in pipeline headers */
.stage-picker {
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  outline: none;
  font-weight: 600;
  color: inherit;
  min-height: 32px;
  padding: 4px 6px;
  line-height: 1.3;
}
.stage-picker:hover {
  border-color: var(--pv-soft-border-light);
  background: rgba(0, 0, 0, 0.025);
}
.dark .stage-picker {
  color: #fff;
}
.dark .stage-picker:hover {
  border-color: var(--pv-soft-border-dark);
  background: rgba(255, 255, 255, 0.045);
}
.dark .stage-picker option {
  background: #18181b;
  color: #fff;
}

/* Format select in pipeline */
.format-select {
  border: 1px solid #000;
  background: #fff;
  cursor: pointer;
  outline: none;
  min-height: 32px;
  padding: 4px 8px;
  line-height: 1.25;
}
.dark .format-select {
  border-color: #fff;
  background: #18181b;
  color: #fff;
}
.dark .format-select option {
  background: #18181b;
  color: #fff;
}

/* ---- Inventory page layout overrides ---- */
.inventory-page {
  overflow: visible;
}

.inventory-main {
  min-height: 400px;
}

#how-to-use {
  display: flex;
  justify-content: center;
  padding: 8px 0 18px;
}

#how-to-use .pv-card {
  width: min(100%, 42rem);
}

#viewer-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---- Collaboration ---- */
.pv-collab-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  min-height: 28px;
}
.pv-collab-cluster,
.pv-collab-users {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pv-collab-status,
.pv-autosave-status,
.pv-room-label,
.pv-collab-pill,
.pv-collab-empty {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid currentColor;
  font-size: 11px;
  line-height: 1.25;
  letter-spacing: 0.02em;
}
.pv-collab-status,
.pv-autosave-status,
.pv-room-label,
.pv-collab-empty {
  opacity: 0.55;
}
.pv-collab-pill {
  opacity: 0.9;
  font-weight: 600;
}

#pv-presence-root {
  position: fixed;
  inset: 0;
  z-index: 250;
  pointer-events: none;
}
/* Hide remote well-pills while the table is in full screen — the main
   viewer content they're positioned over is covered by the modal. */
.pv-table-fullscreen-active .pv-remote-well-pill {
  display: none;
}
.pv-remote-well-pill {
  border: 1px solid currentColor;
  background: rgba(255,255,255,0.96);
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}
.dark .pv-remote-well-pill {
  background: rgba(24,24,27,0.96);
}
.pv-remote-well-pill {
  position: fixed;
  transform: translate(-50%, -100%);
  transition: left 0.12s linear, top 0.12s linear;
  will-change: left, top;
}
/* Pill pulses while that collaborator is actively editing something */
@keyframes pv-well-pill-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
.pv-remote-well-pill[data-context="cell-editing"],
.pv-remote-well-pill[data-context="well-edit"] { animation: pv-well-pill-pulse 1.5s ease-in-out infinite; }

/* Remote collaborator hovering a well: the well itself glows in their color
   (their cursor dot is hidden while a well is hovered — the glow IS their
   pointer). Dashed ring = they are over a blank well. */
.pv-remote-well-glow {
  stroke: var(--pv-remote-color, #2563eb);
  stroke-width: 2.5;
  filter: drop-shadow(0 0 4px var(--pv-remote-color, #2563eb));
}
.pv-remote-well-glow-empty { stroke-dasharray: 3 2; }

/* Generic "closest boundary" highlight — applied to whatever element (plate,
   stage column, table cell, panel, …) is the most specific match for a
   remote collaborator's pointer. Works for both SVG and HTML elements, and
   fades in/out smoothly as the boundary changes. */
.pv-remote-boundary {
  outline: 2px solid var(--pv-remote-color, #2563eb);
  outline-offset: -2px;
  border-radius: 4px;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--pv-remote-color, #2563eb) 16%, transparent);
  transition: outline-color 0.15s ease, box-shadow 0.15s ease;
}
td.pv-remote-boundary {
  border-radius: 0;
  outline-offset: -1px;
  z-index: 2;
}

/* Table row a remote collaborator is actively editing (cell edit or well
   editor) — stays highlighted regardless of where their pointer currently
   is, distinct from the transient boundary outline above. */
.pv-remote-row-edit > td {
  box-shadow: inset 0 1px 0 0 var(--pv-remote-color, #2563eb), inset 0 -1px 0 0 var(--pv-remote-color, #2563eb);
  background: color-mix(in srgb, var(--pv-remote-color, #2563eb) 8%, transparent);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
.pv-remote-row-edit > td:first-child {
  box-shadow: inset 0 1px 0 0 var(--pv-remote-color, #2563eb), inset 0 -1px 0 0 var(--pv-remote-color, #2563eb), inset 3px 0 0 0 var(--pv-remote-color, #2563eb);
}

/* Collaborator badge glows softly while that person is moving their pointer
   but it isn't currently resolving to any highlightable boundary — a quiet
   "still here" signal that doesn't paint a highlight anywhere. */
@keyframes pv-collab-pill-glow {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--pv-remote-color, #2563eb) 55%, transparent); }
  50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--pv-remote-color, #2563eb) 0%, transparent); }
}
.pv-collab-pill-glow {
  animation: pv-collab-pill-glow 1.6s ease-in-out infinite;
}

/* ── collab build: dynamic local well hover ──────────────────────────────────
   The cursor stays visible; a glow (tinted by what is being edited, set via
   [data-pv-edit-context] on the pipeline) layers on top to make hover state
   unmistakable for the local user too. */
body.pv-collab [data-pv-edit-context] .well-occupied:hover {
  filter: brightness(1.12) drop-shadow(0 0 6px rgba(59, 130, 246, 0.75));
}
body.pv-collab [data-pv-edit-context] .well-empty:hover {
  stroke: #10b981;
  stroke-width: 2;
  stroke-dasharray: 3 2;
  filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.6));
}
body.pv-collab [data-pv-edit-context="cell"] .well-occupied:hover,
body.pv-collab [data-pv-edit-context="cell-editing"] .well-occupied:hover {
  filter: brightness(1.12) drop-shadow(0 0 7px rgba(66, 133, 244, 0.9));
}
body.pv-collab [data-pv-edit-context="transfer"] .well-occupied:hover {
  filter: brightness(1.12) drop-shadow(0 0 7px rgba(245, 158, 11, 0.85));
}
body.pv-collab [data-pv-edit-context="well-edit"] .well-occupied:hover,
body.pv-collab [data-pv-edit-context="well-edit"] .well-empty:hover {
  filter: drop-shadow(0 0 7px rgba(168, 85, 247, 0.85));
}

/* Remote collaborator cell / range-selection highlights, with a small name
   tag so it's clear who is selecting what. Smoothing keeps quick successive
   updates (e.g. dragging a selection) from feeling laggy or jumpy. */
.pv-cell-remote,
.pv-cell-remote-range {
  position: relative;
  transition: box-shadow 0.12s ease, background-color 0.12s ease;
}
.pv-cell-remote {
  box-shadow: inset 0 0 0 2px var(--pv-remote-color, #2563eb);
  z-index: 2;
}
.pv-cell-remote-range {
  background: color-mix(in srgb, var(--pv-remote-color, #2563eb) 14%, transparent) !important;
  box-shadow: inset 0 0 0 1px var(--pv-remote-color, #2563eb);
  z-index: 1;
}
.pv-remote-cell-label {
  position: absolute;
  top: 0;
  left: 0;
  transform: translateY(-100%);
  background: var(--pv-remote-color, #2563eb);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.4;
  padding: 0 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 6;
  border-radius: 2px 2px 2px 0;
}

/* ---- Well edit popover ---- */
.well-edit-field-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 28px;
}

.well-edit-field-label {
  flex: 0 0 108px;
  text-align: right;
  font-size: 0.7rem;
  opacity: 0.52;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: system-ui, sans-serif;
  padding-right: 2px;
}

.well-edit-field-input {
  flex: 1;
  min-height: 26px;
  padding: 0.2rem 0.45rem;
  border: 1px solid rgba(128, 128, 128, 0.28);
  background: transparent;
  color: inherit;
  font-family: system-ui, sans-serif;
  font-size: 0.78rem;
  outline: none;
  transition: border-color 0.1s;
}
.well-edit-field-input:focus {
  border-color: #4285f4;
  box-shadow: 0 0 0 1px #4285f4;
}
.dark .well-edit-field-input {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.04);
}
.dark .well-edit-field-input:focus {
  border-color: #4285f4;
  box-shadow: 0 0 0 1px #4285f4;
}

#well-edit-fields::-webkit-scrollbar { width: 5px; }
#well-edit-fields::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 4px; }
.dark #well-edit-fields::-webkit-scrollbar-thumb { background: #3f3f46; }

/* ---- Save status ---- */
#autosave-status {
  align-items: center;
  gap: 0.24rem;
  font-family: system-ui, sans-serif;
  letter-spacing: 0.01em;
  transition: color 0.2s ease;
}
#autosave-status.pv-status-saved {
  display: inline-flex !important;
}
#autosave-status.pv-status-saved   { color: #16a34a; }
#autosave-status.pv-status-unsaved { color: #9ca3af; }
.pv-save-age {
  opacity: 0.62;
}
.dark #autosave-status.pv-status-saved   { color: #4ade80; }
.dark #autosave-status.pv-status-unsaved { color: #6b7280; }

/* ---- Scroll indicators ---- */
.scroll-indicator {
  position: fixed;
  right: 24px;
  z-index: 90;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #000;
  background: #fff;
  color: #000;
  opacity: 0.35;
  cursor: pointer;
  transition: opacity 0.2s;
  pointer-events: auto;
}
.scroll-indicator:hover {
  opacity: 0.8;
}
.dark .scroll-indicator {
  border-color: #fff;
  background: #18181b;
  color: #fff;
}
.scroll-indicator-down {
  bottom: 24px;
  animation: pv-bounce-down 2s ease-in-out infinite;
}
.scroll-indicator-up {
  bottom: 68px;
}

@media (max-width: 1024px) {
  #pv-toolbar {
    gap: 12px;
  }

  #pv-toolbar > div,
  #pv-toolbar > button {
    min-height: 38px;
  }

  .stage-col {
    width: 360px;
  }

  .plate-wrap {
    width: 360px;
  }

  #table-panel {
    width: min(460px, 100vw);
  }

  #table-panel.table-fullscreen {
    width: 96vw;
    height: 92vh;
  }
}

@media (max-width: 768px) {
  .pv-btn,
  .pv-select,
  .pv-input {
    font-size: 0.875rem;
  }

  #pv-toolbar {
    align-items: stretch;
  }

  #pv-toolbar > div {
    flex-wrap: wrap;
  }

  .pv-collab-bar {
    align-items: flex-start;
  }

  .stage-col {
    width: 320px;
  }

  .plate-wrap {
    width: 320px;
  }

  .pv-change-row {
    flex-direction: column;
    gap: 0;
  }

  .pv-change-entry-actions {
    justify-content: flex-end;
    padding: 0 0.75rem 0.7rem;
  }

  .pv-preview-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  #tooltip {
    max-width: min(300px, calc(100vw - 24px));
  }
}

@keyframes pv-bounce-down {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

/* ---- Transfer mode + optimizer additions ---- */
#pv-toolbar .pv-beta-tools {
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-top: -0.2rem;
}

#pv-toolbar {
  margin-bottom: 0.75rem !important;
}

.pv-table-toggle-wrap {
  margin-left: auto;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.18rem;
  width: max-content;
  min-width: 0;
}

.pv-table-toggle-hint {
  font-size: 0.62rem;
  line-height: 1.15;
  opacity: 0.46;
  width: 100%;
  max-width: 3.7rem;
  white-space: normal;
  text-align: center;
  font-family: system-ui, sans-serif;
}

.pv-current-file {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  min-width: 0;
  max-width: 100%;
  margin: 0 0 0.45rem;
  font-family: system-ui, sans-serif;
  font-size: 0.88rem;
  line-height: 1.35;
  flex-wrap: wrap;
}

.pv-current-file-label {
  min-width: 0;
  color: transparent;
  -webkit-text-fill-color: transparent;
  background: linear-gradient(100deg, #7c4a03 0%, #d97706 32%, #fff4b8 50%, #f59e0b 68%, #7c4a03 100%);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: pv-text-shimmer 13s linear infinite;
}

.pv-current-file-label {
  flex: 0 0 auto;
  font-weight: 400;
}

.pv-current-file-pill {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 780px;
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.16rem 0.42rem 0.16rem 0.5rem;
  border: 1px solid rgba(217, 119, 6, 0.34);
  background: rgba(255, 251, 235, 0.62);
}

.pv-current-file-type {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.15rem;
  padding: 0.12rem 0.36rem;
  border: 1px solid rgba(217, 119, 6, 0.45);
  background: rgba(254, 243, 199, 0.72);
  color: #92400e;
  font-size: 0.64rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.04em;
}

.pv-current-file-name {
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(640px, calc(100vw - 9rem));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
  color: #78350f;
}

.dark .pv-current-file-label {
  background-image: linear-gradient(100deg, #fef3c7 0%, #fde68a 32%, #ffffff 50%, #facc15 68%, #fef3c7 100%);
}

.dark .pv-current-file-pill {
  border-color: rgba(250, 204, 21, 0.34);
  background: rgba(69, 26, 3, 0.32);
}

.dark .pv-current-file-name {
  color: #fde68a;
}

.dark .pv-current-file-type {
  border-color: rgba(250, 204, 21, 0.52);
  background: rgba(113, 63, 18, 0.42);
  color: #fde68a;
}

.pv-view-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0.05rem 0 0.3rem;
  width: 100%;
}

.pv-view-control {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.pv-table-row {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  margin: 0 0 0.75rem;
}

@keyframes pv-text-shimmer {
  0% { background-position: 150% 0; }
  100% { background-position: -150% 0; }
}

.pv-beta-tool {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 36px;
  position: relative;
}

.pv-beta-info {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.18rem;
  color: #dc2626;
  font-size: 0.68rem;
  font-weight: 400;
  line-height: 1;
  cursor: help;
  outline: none;
}

.pv-beta-label {
  text-transform: none;
  letter-spacing: 0.02em;
}

.pv-beta-i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  border: 1px solid #dc2626;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 400;
}

.pv-beta-tip {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 0.45rem);
  z-index: 500;
  width: min(260px, calc(100vw - 32px));
  padding: 0.5rem 0.6rem;
  border: 1px solid #dc2626;
  background: #fff;
  color: #991b1b;
  box-shadow: 0 6px 18px rgba(0,0,0,0.14);
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.35;
  text-transform: none;
  letter-spacing: 0;
}

.dark .pv-beta-tip {
  background: #18181b;
  color: #fecaca;
}

.pv-beta-info:hover .pv-beta-tip,
.pv-beta-info:focus .pv-beta-tip,
.pv-beta-info:focus-within .pv-beta-tip {
  display: block;
}

.pipeline-scroller { position: relative; }

.transfer-btn:not(:disabled):hover {
  border-color: #3B82F6;
  color: #2563EB;
}

.transfer-btn.transfer-active {
  background: #EFF6FF;
  border-color: #3B82F6;
  color: #2563EB;
  font-weight: 600;
}

.refresh-transfers-btn:hover {
  border-color: #3B82F6;
  color: #2563EB;
}

.optimize-btn:hover {
  border-color: #6366F1;
  color: #4F46E5;
}

.transfer-mode-active .well-occupied:hover { filter: none; }
.transfer-mode-active .well-ring:not(.well-ring-selected) { display: none; }
.transfer-box { cursor: pointer; }

.transfer-op-cell { white-space: nowrap; }

.transfer-op-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  min-height: 1.25rem;
  padding: 0.1rem 0.4rem;
  border: 1px solid rgba(128,128,128,0.22);
  border-radius: 999px;
  background: rgba(255,255,255,0.72);
  font-size: 0.68rem;
  font-weight: 600;
}

.dark .transfer-op-chip { background: rgba(24,24,27,0.72); }

.transfer-op-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.transfer-op-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.transfer-op-empty {
  color: #9CA3AF;
  text-align: center;
}

.transfer-arrow { filter: drop-shadow(0 1px 1px rgba(0,0,0,0.16)); }

.optimize-panel {
  position: fixed;
  top: 5rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(320px, calc(100vw - 24px));
  background: white;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 250;
}

.dark .optimize-panel {
  background: #18181b;
  border-color: #3f3f46;
}

.optimize-panel-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid rgba(128,128,128,0.18);
  background: rgba(0,0,0,0.025);
}

.dark .optimize-panel-header { background: rgba(255,255,255,0.04); }

.optimize-panel-body {
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.optimize-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.optimize-label {
  font-size: 0.68rem;
  font-weight: 700;
  opacity: 0.55;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.compare-overlay {
  position: fixed;
  inset: 0;
  background: white;
  color: #111827;
  z-index: 220;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dark .compare-overlay {
  background: #18181b;
  color: #f4f4f5;
}

.compare-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.65rem 1.25rem;
  border-bottom: 1px solid rgba(128,128,128,0.2);
  background: rgba(0,0,0,0.025);
}

.dark .compare-header { background: rgba(255,255,255,0.04); }

.compare-stats {
  font-size: 0.75rem;
  opacity: 0.65;
}

.compare-stats strong { opacity: 1; }

.compare-body {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.compare-side {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid rgba(128,128,128,0.18);
}

.compare-side:last-child { border-right: 0; }

.compare-side-label {
  flex-shrink: 0;
  padding: 0.45rem 1rem;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.45;
  border-bottom: 1px solid rgba(128,128,128,0.12);
}

.compare-pipeline {
  flex: 1;
  overflow: auto;
  padding: 0.8rem 1rem;
}
