*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --void: #070a12;
  --forge: #0d1120;
  --plate: #141929;
  --lifted: #1c2438;
  --hairline: #1f2840;
  --score: #2e3a54;
  --plasma: #ff5219;
  --plasma-dim: rgba(255, 82, 25, 0.15);
  --grid: #0ea5e9;
  --grid-dim: rgba(14, 165, 233, 0.12);
  --arc: #6366f1;
  --success: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --text-hi: #edf0fa;
  --text-mid: #8894af;
  --text-lo: #4a5472;
  --font-ui: "Space Grotesk", system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, monospace;
  --topbar-h: 53px;
  --sidebar-w: 70px;
}

[data-theme="light"] {
  --void: #eef1f7;
  --forge: #e8ecf5;
  --plate: #ffffff;
  --lifted: #f5f7fc;
  --hairline: #d9deeb;
  --score: #b9c1d4;
  --text-hi: #141827;
  --text-mid: #526078;
  --text-lo: #8a94aa;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  min-width: 1180px;
  background: var(--void);
  color: var(--text-hi);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.4;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: var(--forge);
  border-bottom: 1px solid var(--hairline);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 132px;
  color: var(--text);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.3px;
  text-decoration: none;
}

.brand-lockup span {
  color: var(--plasma);
  padding: 0 4px;
  font-size: 20px;
  line-height: 1;
}

.bot-mark {
  width: 24px;
  height: 24px;
}

.bot-mark rect {
  fill: var(--plasma-dim);
  stroke: rgba(255, 82, 25, 0.55);
}

.bot-mark path,
.bot-mark circle {
  fill: none;
  stroke: var(--plasma);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bot-mark circle {
  fill: var(--plasma);
}

.top-divider {
  width: 1px;
  height: 20px;
  background: var(--hairline);
}

.current-job-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.job-chip,
.machine-state,
.ghost-button,
.icon-button {
  border: 1px solid var(--score);
  border-radius: 5px;
  background: var(--plate);
  color: var(--text-mid);
}

.job-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  height: auto;
  padding: 4px 10px;
}

.job-chip span {
  color: var(--plasma);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
}

.job-chip small {
  color: var(--text-mid);
  font-size: 13px;
}

.top-spacer {
  flex: 1;
}

.top-crumb {
  display: none;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text-lo);
  font-size: 13px;
}

body[data-route="cockpit"] .top-crumb {
  display: flex;
}

.top-crumb button {
  border: 0;
  background: transparent;
  color: var(--grid);
  font-weight: 700;
  padding: 0;
}

.top-crumb strong {
  overflow: hidden;
  color: var(--text-mid);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-crumb em {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 6px;
  border: 1px solid rgba(99, 102, 241, 0.45);
  border-radius: 3px;
  background: rgba(99, 102, 241, 0.18);
  color: #c4b5fd;
  font-family: var(--font-mono);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

.machine-state {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 0;
  background: transparent;
  font-size: 12px;
}

.machine-state i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.primary-button,
.ghost-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 33px;
  height: auto;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
  transition: 120ms ease;
}

.primary-button {
  border: 1px solid var(--plasma);
  border-radius: 5px;
  background: var(--plasma);
  color: #fff;
}

.primary-button:hover,
.ghost-button:hover,
.icon-button:hover {
  filter: brightness(1.12);
}

.icon-button {
  width: 40px;
  height: 40px;
  padding: 0;
}

.avatar {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--plasma), var(--arc));
  color: white;
  font-size: 11px;
  font-weight: 800;
}

.app-body {
  display: flex;
  height: calc(100vh - var(--topbar-h));
  overflow: hidden;
}

.rail {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0;
  overflow: visible;
  background: var(--forge);
  border-right: 1px solid var(--hairline);
}

.rail-item {
  width: 48px;
  height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-lo);
  transition: 120ms ease;
}

.rail-item:hover {
  background: var(--lifted);
  color: var(--text-mid);
}

.rail-item.active {
  border-color: rgba(255, 82, 25, 0.3);
  background: var(--plasma-dim);
  color: var(--plasma);
}

.rail-item svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rail-item span {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.rail-spacer {
  flex: 1;
}

.workspace {
  flex: 1;
  min-width: 0;
  display: flex;
  overflow: hidden;
  background: var(--void);
}

.screen {
  display: none;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

.screen-header {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--hairline);
  background: var(--forge);
}

.screen-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
}

.screen-subtitle {
  margin-top: 2px;
  color: var(--text-mid);
  font-size: 13px;
}

.compact-link {
  margin: 0 0 6px;
  padding: 0;
  border: 0;
  background: transparent;
}

.screen-body {
  flex: 1;
  overflow: auto;
  padding: 20px 24px;
}

body[data-route="parts"] .screen-body {
  padding-top: 12px;
}

body[data-route="parts"] .screen-header {
  padding-top: 16px;
  padding-bottom: 14px;
}

body[data-route="part-detail"] .screen-header {
  padding: 14px 24px 12px;
}

body[data-route="part-detail"] .screen-body {
  min-height: 0;
  display: flex;
  overflow: hidden;
  padding: 14px 24px;
}

body[data-route="material-detail"] .screen-header {
  padding: 14px 24px 12px;
}

body[data-route="material-detail"] .screen-body {
  padding: 14px 24px 24px;
}

.parts-header-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.parts-filter-row,
.parts-action-row {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
}

.parts-search {
  width: 240px;
}

.parts-customer-filter {
  width: 190px;
}

.parts-material-filter {
  width: 190px;
}

.table-wrap {
  border: 1px solid var(--hairline);
  border-radius: 6px;
  overflow-x: auto;
  background: rgba(13, 17, 32, 0.44);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--hairline);
  text-align: left;
  vertical-align: middle;
}

th {
  color: #586487;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

tbody tr {
  transition: background 100ms ease;
}

tbody tr:hover {
  background: rgba(28, 36, 56, 0.52);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.mono {
  font-family: var(--font-mono);
  font-weight: 600;
}

.status-light {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.green {
  background: var(--success);
  box-shadow: 0 0 5px rgba(16, 185, 129, 0.7);
}

.yellow {
  background: var(--warn);
  box-shadow: 0 0 5px rgba(245, 158, 11, 0.7);
}

.red {
  background: var(--danger);
  box-shadow: 0 0 5px rgba(239, 68, 68, 0.7);
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 0;
  padding: 2px 6px;
  border: 1px solid var(--score);
  border-radius: 3px;
  background: var(--plate);
  color: var(--text-mid);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.chip.ready,
.chip.active {
  border-color: rgba(14, 165, 233, 0.35);
  background: rgba(14, 165, 233, 0.12);
  color: #67e8f9;
}

.chip.nested {
  border-color: rgba(99, 102, 241, 0.45);
  background: rgba(99, 102, 241, 0.18);
  color: #c4b5fd;
}

.chip.cut,
.chip.ok {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
}

.chip.warn {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.13);
  color: var(--warn);
}

.chip.draft,
.chip.inactive {
  opacity: 0.75;
}

.link-button {
  border: 1px solid var(--score);
  border-radius: 4px;
  background: transparent;
  color: var(--text-mid);
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 700;
}

.link-button:hover {
  border-color: var(--plasma);
  color: var(--plasma);
}

.cockpit {
  display: grid;
  grid-template-rows: 37px 40px 32px 1fr;
  height: 100%;
}

.crumbbar,
.material-tabs,
.sheet-tabs,
.issue-banner {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--hairline);
  background: var(--forge);
}

.crumbbar {
  gap: 8px;
  padding: 0 14px;
  color: var(--text-lo);
  font-size: 13px;
}

.crumbbar button {
  border: 0;
  background: transparent;
  color: var(--grid);
  font-weight: 700;
}

.material-tabs,
.sheet-tabs {
  gap: 2px;
  padding: 0 12px;
}

.empty-tab-row {
  color: var(--text-lo);
  font-size: 12px;
}

.material-tabs {
  min-height: 34px;
  background: var(--plate);
  border-bottom-color: var(--score);
  align-items: flex-end;
}

.sheet-tabs {
  height: 36px;
  min-height: 36px;
  align-items: flex-end;
}

.mat-tab,
.sheet-tab,
.tab-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: auto;
  border: 1px solid var(--hairline);
  border-radius: 4px 4px 0 0;
  background: var(--plate);
  color: var(--text-mid);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
}

.sheet-tab {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
}

.mat-tab.active,
.sheet-tab.active {
  border-color: var(--score);
  border-bottom-color: var(--void);
  background: var(--void);
  color: var(--text-hi);
}

.mat-tab.active .count,
.sheet-tab.active .util {
  color: var(--plasma);
}

.swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.count,
.util {
  color: var(--text-lo);
  font-family: var(--font-mono);
  font-size: 10px;
}

.tab-add {
  border-style: dashed;
  border-radius: 4px;
  background: transparent;
  margin-left: 4px;
  margin-bottom: 4px;
  padding: 4px 10px;
}

.issue-banner {
  gap: 8px;
  padding: 7px 14px;
  background: rgba(239, 68, 68, 0.09);
  color: #fca5a5;
  font-size: 12px;
}

.issue-banner.ok {
  background: rgba(16, 185, 129, 0.09);
  color: #86efac;
}

.issue-banner a,
.issue-banner button {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
}

.main-panel {
  min-height: 0;
  display: grid;
  grid-template-columns: 270px minmax(500px, 1fr) 264px;
}

.parts-queue,
.right-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--forge);
}

.parts-queue {
  border-right: 1px solid var(--hairline);
}

.right-panel {
  border-left: 1px solid var(--hairline);
}

.right-panel .export-section {
  flex: 1 1 auto;
}

.panel-head {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--hairline);
}

.panel-title {
  color: var(--text-mid);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.panel-action {
  border: 0;
  background: transparent;
  color: var(--plasma);
  font-size: 12px;
  font-weight: 800;
}

.panel-action:disabled {
  color: var(--text-lo);
  cursor: not-allowed;
  opacity: 0.58;
}

.queue-action {
  padding: 10px 12px;
  border-top: 1px solid var(--hairline);
}

.nest-quality-toggle {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 8px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(14, 20, 36, 0.72);
}

.nest-quality-toggle button {
  min-height: 26px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text-lo);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.nest-quality-toggle button:hover {
  color: var(--text);
  border-color: rgba(255, 79, 26, 0.35);
}

.nest-quality-toggle button.active {
  border-color: rgba(255, 79, 26, 0.58);
  background: rgba(255, 79, 26, 0.18);
  color: var(--plasma);
}

.nest-quality-toggle button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.renest-button {
  width: 100%;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--plasma);
  border-radius: 5px;
  background: var(--plasma);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: 120ms ease;
}

.renest-button:hover {
  filter: brightness(1.12);
}

.renest-button span {
  font-size: 16px;
  line-height: 1;
}

.button-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.renest-button:disabled {
  border-color: rgba(255, 79, 26, 0.22);
  background: rgba(255, 79, 26, 0.11);
  color: rgba(255, 199, 181, 0.58);
  cursor: not-allowed;
  filter: none;
}

.renest-button.busy:disabled {
  border-color: rgba(255, 79, 26, 0.64);
  background: rgba(255, 82, 25, 0.72);
  color: #fff;
}

.renest-button:disabled .button-spinner {
  border-color: rgba(255, 199, 181, 0.25);
  border-top-color: rgba(255, 199, 181, 0.9);
}

.renest-button.busy:disabled .button-spinner {
  border-color: rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.queue-list,
.export-list {
  flex: 1;
  min-height: 0;
  overflow-y: scroll;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--score) transparent;
}
.export-list::-webkit-scrollbar {
  width: 5px;
}
.export-list::-webkit-scrollbar-track {
  background: transparent;
}
.export-list::-webkit-scrollbar-thumb {
  background: var(--score);
  border-radius: 3px;
}

.queue-item {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 34px 24px;
  gap: 8px;
  align-items: center;
  padding: 9px 8px 9px 12px;
  border: 0;
  border-bottom: 1px solid var(--hairline);
  background: transparent;
  color: var(--text-hi);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.queue-remove-button {
  position: absolute;
  top: 6px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text-lo);
  cursor: pointer;
  font: 800 15px/1 var(--font-mono);
  opacity: 0.6;
  transition:
    opacity 120ms ease,
    color 120ms ease,
    border-color 120ms ease,
    background 120ms ease;
}

.queue-item:hover .queue-remove-button,
.queue-item.selected .queue-remove-button,
.queue-remove-button:focus-visible {
  opacity: 1;
}

.queue-remove-button:hover,
.queue-remove-button:focus-visible {
  border-color: rgba(239, 68, 68, 0.55);
  background: rgba(239, 68, 68, 0.14);
  color: #ff8b8b;
  outline: none;
}

.queue-remove-confirm {
  position: absolute;
  top: 6px;
  right: 7px;
  z-index: 3;
  display: grid;
  grid-template-columns: auto auto auto;
  gap: 5px;
  align-items: center;
  padding: 4px 5px 4px 8px;
  border: 1px solid rgba(239, 68, 68, 0.45);
  border-radius: 5px;
  background: rgba(20, 25, 41, 0.98);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  color: var(--text-hi);
  font-size: 11px;
  line-height: 1;
}

.queue-remove-confirm button {
  height: 22px;
  border: 1px solid var(--score);
  border-radius: 4px;
  background: var(--lifted);
  color: var(--text-mid);
  padding: 0 7px;
  font: 700 10px/1 var(--font-ui);
  cursor: pointer;
}

.queue-remove-confirm button:hover,
.queue-remove-confirm button:focus-visible {
  border-color: var(--text-mid);
  color: var(--text-hi);
  outline: none;
}

.queue-remove-confirm button.danger {
  border-color: rgba(239, 68, 68, 0.55);
  background: rgba(239, 68, 68, 0.18);
  color: #ffb0b0;
}

.queue-remove-confirm button.danger:hover,
.queue-remove-confirm button.danger:focus-visible {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.28);
  color: #fff;
}

.queue-item.selected {
  background: var(--plasma-dim);
  box-shadow: inset 2px 0 0 var(--plasma);
  padding-left: 10px;
}

.queue-edit-button {
  align-self: end;
  justify-self: end;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--score);
  border-radius: 4px;
  background: var(--lifted);
  color: var(--text-mid);
  cursor: pointer;
  opacity: 0.72;
}

.queue-edit-button:hover {
  border-color: var(--plasma);
  color: var(--plasma);
  opacity: 1;
}

.queue-edit-button svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.queue-qty-control {
  align-self: stretch;
  display: grid;
  grid-template-rows: 14px 22px 14px;
  place-items: center;
  min-height: 50px;
  font-family: var(--font-mono);
}

.queue-qty-input {
  width: 32px;
  height: 21px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text-hi);
  font-size: 13px;
  font-family: var(--font-mono);
  font-weight: 800;
  line-height: 1;
  text-align: center;
  appearance: textfield;
}

.queue-qty-input::-webkit-outer-spin-button,
.queue-qty-input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.queue-qty-input:focus {
  outline: none;
  border-color: var(--plasma);
  background: rgba(255, 82, 25, 0.1);
  box-shadow: 0 0 0 2px rgba(255, 82, 25, 0.16);
}

.qty-step {
  display: grid;
  place-items: center;
  width: 20px;
  height: 14px;
  border: 1px solid var(--score);
  border-radius: 3px;
  color: var(--text-mid);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}

.qty-step:hover {
  border-color: var(--plasma);
  color: var(--plasma);
}

.qty-step.disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.thumb-stack {
  display: grid;
  place-items: center;
  gap: 4px;
}

.part-thumb {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--score);
  border-radius: 4px;
  background: var(--lifted);
}

.part-thumb-wrap {
  position: relative;
  display: inline-grid;
  place-items: center;
}

.part-thumb svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: var(--grid);
  stroke-width: 1.2;
}

.hidden-file {
  display: none;
}

.dxf-preview {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.part-thumb .dxf-preview {
  width: 32px;
  height: 32px;
}

.dxf-preview.large {
  position: absolute;
  inset: 24px;
  width: calc(100% - 48px);
  height: calc(100% - 48px);
}

.dxf-preview.zoom {
  width: 260px;
  height: 210px;
}

.part-preview-overlay {
  position: fixed;
  z-index: 1000;
  display: grid;
  gap: 7px;
  width: 300px;
  min-height: 280px;
  padding: 14px;
  border: 1px solid var(--score);
  border-radius: 8px;
  background: var(--plate);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-8px);
  transition:
    opacity 120ms ease,
    transform 120ms ease;
}

.part-preview-overlay::before {
  content: "";
  position: absolute;
  right: 100%;
  top: 132px;
  border: 8px solid transparent;
  border-right-color: var(--score);
}

.part-preview-overlay.open-left::before {
  left: 100%;
  right: auto;
  border-right-color: transparent;
  border-left-color: var(--score);
}

.part-preview-overlay.visible {
  opacity: 1;
  transform: translateX(0);
}

.part-preview-overlay strong {
  font-family: var(--font-mono);
  font-size: 13px;
}

.part-preview-overlay small {
  color: var(--text-mid);
  font-size: 12px;
}

.cut-geometry,
.etch-geometry {
  vector-effect: non-scaling-stroke;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.part-body-fill {
  pointer-events: none;
  fill: #0b1020;
  stroke: none;
}

.cut-geometry {
  stroke: var(--grid);
  stroke-width: 1.6;
}

.etch-geometry {
  stroke: var(--warn);
  stroke-width: 1.1;
  stroke-dasharray: 6 4;
}

.etch-placement-canvas {
  cursor: crosshair;
}

.part-number-etch {
  pointer-events: none;
  filter: drop-shadow(0 0 7px rgba(255, 82, 25, 0.86));
}

.part-number-etch path {
  vector-effect: non-scaling-stroke;
  fill: none;
  stroke: var(--plasma);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.part-number-etch-text {
  stroke-width: 2.1;
  opacity: 1;
}

.part-number-etch-anchor {
  stroke-width: 1.4;
  opacity: 0.75;
}

.nest-part-number-etch {
  filter: drop-shadow(0 0 5px rgba(255, 82, 25, 0.82));
}

.nest-part-number-etch-text {
  stroke-width: 1.45;
  opacity: 1;
}

.nest-part-number-etch-anchor {
  stroke-width: 1.05;
  opacity: 0.72;
}

.ghost-geometry {
  opacity: 0.35;
}

.part-detail-heading {
  margin: 7px 0 12px;
  font-family: var(--font-mono);
  font-size: 18px;
}

.detail-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: 5px;
  background: var(--hairline);
}

.detail-stat-grid div {
  display: grid;
  gap: 3px;
  background: var(--plate);
  padding: 8px;
}

.detail-stat-grid span {
  color: var(--text-lo);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-stat-grid strong {
  font-family: var(--font-mono);
  font-size: 16px;
}

.queue-meta {
  min-width: 0;
}

.queue-meta strong {
  display: block;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-detail {
  margin-top: 1px;
  color: var(--text-mid);
  font-size: 12px;
}

.queue-tags {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  margin-top: 3px;
}

.microtag {
  padding: 1px 5px;
  border: 1px solid var(--score);
  border-radius: 3px;
  color: var(--text-mid);
  font-size: 11px;
  font-weight: 500;
}

.microtag.ok {
  border-color: rgba(16, 185, 129, 0.26);
  color: var(--success);
}

.microtag.warn {
  border-color: rgba(245, 158, 11, 0.26);
  color: var(--warn);
}

.microtag.bad {
  border-color: rgba(239, 68, 68, 0.26);
  color: var(--danger);
}

.queue-foot {
  padding: 8px 12px;
  border-top: 1px solid var(--hairline);
  color: var(--text-lo);
  font-size: 12px;
}

.queue-foot div {
  display: flex;
  justify-content: space-between;
}

.canvas-wrap {
  position: relative;
  overflow: hidden;
  background: #070911;
  min-height: 0;
}

.canvas-toolbar {
  position: absolute;
  top: 10px;
  left: 50%;
  z-index: 3;
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--score);
  border-radius: 6px;
  background: rgba(13, 17, 32, 0.95);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.28);
  transform: translateX(-50%);
}

.nest-activity {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 4;
  width: min(320px, calc(100% - 24px));
  border: 1px solid var(--score);
  border-radius: 6px;
  background: rgba(13, 17, 32, 0.95);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.36), 0 0 0 1px rgba(14, 165, 233, 0.08) inset;
  backdrop-filter: blur(12px);
  pointer-events: auto;
  overflow: hidden;
  opacity: 1;
  transform: translateY(0);
  transition:
    max-height 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.nest-activity.complete {
  border-color: rgba(78, 240, 163, 0.34);
}

.nest-activity.collapsed {
  width: min(300px, calc(100% - 24px));
  border-color: var(--score);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.28);
}

.nest-activity-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid var(--hairline);
  background: transparent;
  color: var(--text-hi);
  font-size: 12px;
  font-weight: 800;
  text-align: left;
}

.nest-activity-head:disabled {
  cursor: default;
}

.nest-activity.complete .nest-activity-head {
  cursor: pointer;
}

.nest-activity.collapsed .nest-activity-head {
  border-bottom: 0;
}

.nest-activity-title {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.nest-activity-timer {
  flex: none;
  color: var(--plasma);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 900;
}

.nest-complete-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(78, 240, 163, 0.1), 0 0 18px rgba(78, 240, 163, 0.52);
}

.nest-activity-list {
  display: grid;
  gap: 1px;
  max-height: 220px;
  overflow-y: auto;
  padding: 7px 9px 9px;
  transition:
    max-height 180ms ease,
    padding 180ms ease,
    opacity 140ms ease;
}

.nest-activity.collapsed .nest-activity-list {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
}

.nest-activity-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 24px;
  color: var(--text-mid);
  font-size: 12px;
}

.nest-activity-row i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--plasma);
  box-shadow: 0 0 10px var(--plasma);
}

.nest-activity-row.busy i {
  width: 10px;
  height: 10px;
  border: 2px solid rgba(255, 255, 255, 0.24);
  border-top-color: var(--plasma);
  background: transparent;
  box-shadow: none;
  animation: spin 700ms linear infinite;
}

.nest-activity-row.grid i {
  background: var(--grid);
  box-shadow: 0 0 10px var(--grid);
}

.nest-activity-row.warn i {
  background: var(--warn);
  box-shadow: 0 0 10px var(--warn);
}

.nest-activity-row.success i {
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
}

.nest-activity-row.plasma i {
  background: var(--plasma);
  box-shadow: 0 0 10px var(--plasma);
}

.tool {
  height: auto;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-mid);
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
}

.tool.active {
  background: var(--plasma-dim);
  color: var(--plasma);
}

#nestCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

#nestCanvas.is-pan-tool {
  cursor: grab;
}

#nestCanvas.is-panning {
  cursor: grabbing;
}

.zoom-readout,
.canvas-hint {
  position: absolute;
  z-index: 3;
  bottom: 10px;
  border: 1px solid var(--score);
  border-radius: 4px;
  background: rgba(13, 17, 32, 0.9);
  color: var(--text-mid);
  font-size: 12px;
}

.zoom-readout,
.canvas-hint,
.export-footer {
  flex-shrink: 0;
}

.zoom-readout {
  left: 12px;
  padding: 4px 8px;
  font-family: var(--font-mono);
}

.canvas-hint {
  left: 50%;
  padding: 5px 10px;
  color: var(--text-lo);
  transform: translateX(-50%);
}

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

.inspector-body {
  padding: 0 12px 10px;
}

.part-title {
  margin-bottom: 6px;
  color: var(--text-hi);
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 800;
}

.info-row,
.check-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(31, 40, 64, 0.65);
}

.info-row span:first-child,
.check-row span:first-child {
  color: var(--text-lo);
}

.info-row strong {
  font-family: var(--font-mono);
}

.util-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--lifted);
}

.util-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--plasma), #ff8a5f);
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: 5px;
  background: var(--hairline);
}

.metric {
  background: var(--plate);
  padding: 8px 10px;
}

.metric b {
  display: block;
  color: var(--text-hi);
  font-family: var(--font-mono);
  font-size: 20px;
  line-height: 1;
}

.metric span {
  color: var(--text-lo);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.export-file {
  margin: 6px 12px 0;
  border: 1px solid var(--score);
  border-radius: 5px;
  background: var(--plate);
}

.export-file summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  color: var(--grid);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.export-file summary::-webkit-details-marker {
  display: none;
}

.export-file small {
  display: block;
  padding: 0 10px 8px;
  color: var(--text-lo);
  font-size: 11px;
}

.export-footer {
  margin-top: auto;
  padding: 10px 12px;
  border-top: 1px solid var(--hairline);
  background: var(--forge);
}

.export-footer .primary-button {
  width: 100%;
  justify-content: center;
}

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

.field {
  display: grid;
  gap: 5px;
}

.field label,
.section-title {
  color: var(--text-mid);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.field input,
.field select,
.field-input {
  min-height: 37px;
  border: 1px solid var(--score);
  border-radius: 5px;
  background: var(--plate);
  color: var(--text-hi);
  padding: 0 10px;
}

.field-input {
  min-width: 180px;
}

.card {
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--forge);
  padding: 14px;
}

.part-config {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) 380px;
  gap: 14px;
  min-height: 520px;
}

.material-detail-header {
  align-items: flex-end;
}

.material-detail-actions,
.material-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.material-detail-body {
  overflow: auto;
}

.material-detail-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(520px, 1.25fr) minmax(320px, 0.85fr);
  gap: 14px;
  max-width: 1720px;
}

.material-detail-card {
  min-width: 0;
}

.material-detail-wide {
  grid-column: 1 / -1;
}

.material-stock-card {
  grid-column: 1 / span 2;
}

.material-nc-card {
  grid-column: 3;
  grid-row: 1 / span 2;
}

.material-detail-stack,
.material-settings-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.material-settings-grid {
  grid-template-columns: repeat(2, minmax(210px, 1fr));
}

.material-detail-summary {
  display: grid;
  grid-template-columns: minmax(120px, auto) 1fr;
  gap: 8px 12px;
  color: var(--text-mid);
  font-size: 13px;
}

.material-detail-summary strong {
  color: var(--text-hi);
}

body[data-route="part-detail"] .part-config {
  flex: 1;
  min-height: 0;
  height: 100%;
}

body[data-route="part-detail"] .configure-canvas {
  min-height: 0;
  height: 100%;
}

body[data-route="part-detail"] .part-config > .card {
  min-height: 0;
  overflow: auto;
}

.configure-canvas {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  border: 1px solid var(--score);
  border-radius: 6px;
  background:
    linear-gradient(rgba(31, 40, 64, 0.65) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 40, 64, 0.65) 1px, transparent 1px),
    #070911;
  background-size: 28px 28px;
}

.etch-canvas-hint {
  position: absolute;
  left: 14px;
  bottom: 14px;
  max-width: calc(100% - 28px);
  padding: 7px 10px;
  border: 1px solid rgba(14, 165, 233, 0.28);
  border-radius: 5px;
  background: rgba(13, 17, 32, 0.88);
  color: var(--text-mid);
  font-size: 12px;
  pointer-events: none;
}

.part-preview-toolbar {
  position: absolute;
  top: 10px;
  left: 50%;
  z-index: 3;
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--score);
  border-radius: 6px;
  background: rgba(13, 17, 32, 0.95);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.28);
  transform: translateX(-50%);
}

.part-preview-zoom-readout {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 3;
  padding: 5px 8px;
  border: 1px solid var(--score);
  border-radius: 4px;
  background: rgba(13, 17, 32, 0.9);
  color: var(--text-mid);
  font-family: var(--font-mono);
  font-size: 12px;
  pointer-events: none;
}

.part-preview-zoom-readout + .etch-canvas-hint {
  left: 74px;
  max-width: calc(100% - 102px);
}

.etch-placement-card {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
}

.etch-placement-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 0.85fr;
  gap: 8px;
}

.etch-placement-actions .ghost-button {
  justify-content: center;
  min-width: 0;
}

.etch-placement-actions .ghost-button.is-pressing {
  border-color: rgba(255, 79, 26, 0.72);
  background: rgba(255, 79, 26, 0.2);
  color: var(--plasma);
}

.angle-input-wrap {
  position: relative;
  display: block;
}

.angle-input-wrap input {
  width: 100%;
  padding-right: 34px;
}

.angle-input-wrap span {
  position: absolute;
  top: 50%;
  right: 12px;
  color: var(--text-mid);
  transform: translateY(-50%);
  pointer-events: none;
}

.etch-placement-meta {
  min-height: 29px;
  display: flex;
  align-items: center;
  padding: 7px 9px;
  border: 1px solid var(--hairline);
  border-radius: 5px;
  background: rgba(7, 10, 18, 0.45);
  color: var(--text-mid);
  font-family: var(--font-mono);
  font-size: 11px;
}

.config-part {
  position: absolute;
  left: 13%;
  top: 18%;
  width: 68%;
  height: 48%;
  border: 2px solid var(--grid);
  border-radius: 12px 4px 20px 4px;
  background: rgba(14, 165, 233, 0.05);
}

.config-part::before,
.config-part::after {
  content: "";
  position: absolute;
  border: 2px solid var(--grid);
}

.config-part::before {
  left: 14%;
  top: 28%;
  width: 58px;
  height: 58px;
  border-radius: 50%;
}

.config-part::after {
  right: 16%;
  top: 36%;
  width: 88px;
  height: 44px;
  border-radius: 6px;
}

.etch-label {
  position: absolute;
  left: 39%;
  top: 39%;
  color: var(--warn);
  font-family: var(--font-mono);
  font-weight: 800;
  letter-spacing: 0.04em;
  transform: rotate(-16deg);
}

.lead-marker,
.tab-marker {
  position: absolute;
  z-index: 2;
}

.lead-marker {
  left: 26%;
  top: 17%;
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 14px solid var(--plasma);
}

.tab-marker {
  width: 18px;
  height: 5px;
  border-radius: 999px;
  background: var(--warn);
}

.drawer {
  position: fixed;
  top: 52px;
  right: 0;
  bottom: 0;
  z-index: 30;
  width: 360px;
  border-left: 1px solid var(--score);
  background: var(--forge);
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.35);
  transform: translateX(100%);
  transition: transform 160ms ease;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-inner {
  height: 100%;
  overflow: auto;
  padding: 16px;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  place-items: center;
  background: rgba(4, 7, 14, 0.74);
}

.modal-backdrop.open {
  display: grid;
}

.modal {
  width: min(620px, calc(100vw - 40px));
  border: 1px solid var(--score);
  border-radius: 8px;
  background: var(--plate);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
}

.modal.wide {
  width: min(920px, calc(100vw - 56px));
}

.modal.material-modal {
  width: min(1120px, calc(100vw - 32px));
}

.modal.nest-log-modal {
  width: min(1180px, calc(100vw - 32px));
}

.modal-head,
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--hairline);
}

.modal-foot {
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--hairline);
  border-bottom: 0;
}

.modal-body {
  padding: 16px;
}

.nest-log-modal .modal-body {
  max-height: min(72vh, 760px);
  overflow: auto;
}

.nest-log-list {
  display: grid;
  gap: 10px;
}

.nest-log-entry {
  border: 1px solid var(--hairline);
  border-radius: 7px;
  background: rgba(18, 23, 40, 0.72);
  overflow: hidden;
}

.nest-log-entry summary {
  display: grid;
  grid-template-columns: 18px minmax(160px, 1fr) auto auto auto;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
  cursor: pointer;
  color: var(--text-hi);
}

.nest-log-details {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--hairline);
}

.nest-log-details div {
  display: grid;
  gap: 4px;
}

.nest-log-details span {
  color: var(--text-lo);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.nest-log-details p {
  margin: 0;
  color: var(--text-mid);
  line-height: 1.45;
}

.nest-log-details pre {
  max-height: 220px;
  overflow: auto;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: rgba(5, 8, 16, 0.72);
  color: var(--warn);
  white-space: pre-wrap;
}

.modal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 18px;
}

.material-modal-grid {
  grid-template-columns: minmax(480px, 1fr) minmax(480px, 1fr);
  gap: 28px;
}

.material-form-grid {
  grid-template-columns: minmax(260px, 1.3fr) minmax(210px, 1fr);
  gap: 18px 24px;
}

.wide-field input,
.wide-field select {
  min-height: 48px;
  font-size: 15px;
}

.material-type-field {
  gap: 8px;
}

.number-field input {
  min-height: 38px;
  max-width: 180px;
}

.unit-toggle {
  display: inline-flex;
  gap: 2px;
  margin-top: 10px;
  padding: 3px;
  border: 1px solid var(--score);
  border-radius: 6px;
  background: var(--forge);
}

.unit-toggle button {
  min-height: 28px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-mid);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.unit-toggle button.active {
  background: var(--plasma-dim);
  color: var(--plasma);
}

.with-help,
.help-field span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.help-icon {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  border: 1px solid var(--score);
  border-radius: 50%;
  color: var(--text-mid);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  cursor: help;
  text-transform: none;
}

.help-icon:hover {
  border-color: var(--plasma);
  color: var(--plasma);
}

@media (max-width: 900px) {
  .material-modal-grid {
    grid-template-columns: 1fr;
  }

  .material-form-grid {
    grid-template-columns: 1fr;
  }

  .material-detail-layout,
  .material-settings-grid {
    grid-template-columns: 1fr;
  }

  .material-stock-card,
  .material-nc-card {
    grid-column: auto;
    grid-row: auto;
  }
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.choice-card {
  display: grid;
  gap: 5px;
  min-height: 92px;
  border: 1px solid var(--score);
  border-radius: 6px;
  background: var(--forge);
  color: var(--text-hi);
  padding: 12px;
  text-align: left;
}

.choice-card.active {
  border-color: rgba(255, 82, 25, 0.6);
  background: var(--plasma-dim);
}

.choice-card span {
  color: var(--text-mid);
  font-size: 12px;
}

.review-table {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--forge);
}

.review-table div {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(160px, 1.2fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
}

.review-table div:last-child {
  border-bottom: 0;
}

.review-table strong,
.review-table b {
  font-family: var(--font-mono);
}

.review-table span {
  color: var(--text-mid);
  font-size: 12px;
}

.add-parts-list {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: 6px;
}

.add-parts-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.add-parts-filter {
  min-height: 38px;
  border: 1px solid var(--score);
  border-radius: 5px;
  background: var(--plate);
  color: var(--text-hi);
  padding: 0 12px;
  font: inherit;
}

.add-parts-count {
  color: var(--text-mid);
  font: 700 11px/1.2 var(--font-mono);
  text-transform: uppercase;
}

.add-part-row {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(140px, 1fr) 80px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
  background: var(--forge);
}

.add-part-row[hidden] {
  display: none;
}

.add-part-row:last-child {
  border-bottom: 0;
}

.add-part-row label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.add-part-row span {
  color: var(--text-mid);
  font-size: 12px;
}

.add-part-row input[type="text"],
.add-part-row input:not([type]) {
  min-height: 34px;
  border: 1px solid var(--score);
  border-radius: 5px;
  background: var(--plate);
  color: var(--text-hi);
  padding: 0 8px;
}

.stock-grid {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.stock-grid-head {
  display: grid;
  grid-template-columns: 1.1fr 0.8fr 0.8fr 0.65fr;
  gap: 6px;
  margin-top: 12px;
  color: var(--text-dim);
  font: 700 11px/1.2 var(--font-mono);
  text-transform: uppercase;
}

.stock-row {
  display: grid;
  grid-template-columns: 1.1fr 0.8fr 0.8fr 0.65fr;
  gap: 6px;
}

.stock-row input,
.code-input {
  min-width: 0;
  border: 1px solid var(--score);
  border-radius: 5px;
  background: var(--plate);
  color: var(--text-hi);
  padding: 8px 9px;
  font: inherit;
}

.code-input {
  width: 100%;
  min-height: 82px;
  margin-top: 10px;
  resize: vertical;
  color: var(--text-mid);
  font-family: var(--font-mono);
  font-size: 12px;
}

.code-input.material-condition-input {
  min-height: 210px;
  margin-top: 12px;
}

.empty-state {
  margin: 8px 12px;
  padding: 12px;
  border: 1px dashed var(--score);
  border-radius: 5px;
  color: var(--text-mid);
  font-size: 12px;
}

.empty-state.centered {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(360px, calc(100% - 48px));
  margin: 0;
  text-align: center;
  transform: translate(-50%, -50%);
}

.empty-thumb {
  display: block;
  width: 28px;
  height: 28px;
  border: 1px dashed var(--score);
  border-radius: 4px;
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  display: grid;
  gap: 8px;
}

.toast {
  min-width: 260px;
  padding: 10px 12px;
  border: 1px solid var(--score);
  border-left: 3px solid var(--plasma);
  border-radius: 6px;
  background: var(--plate);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.28);
  color: var(--text-hi);
}

.settings-stack,
.history-grid {
  display: grid;
  gap: 14px;
}

.history-grid {
  grid-template-columns: minmax(0, 7fr) minmax(320px, 3fr);
  align-items: start;
}

.chart {
  width: 100%;
  height: 150px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--forge);
}

.history-chart-card {
  position: sticky;
  top: 0;
  margin-top: 0;
  padding: 16px;
}

.muted {
  color: var(--text-mid);
}

/* Job sheet mode toggle */
.job-sheet-mode {
  border-top: 1px solid var(--hairline);
  padding-top: 16px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.toggle-label {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-hi);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 11px;
  background: var(--score);
  transition: background 0.18s;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-mid);
  transition: transform 0.18s, background 0.18s;
}

.toggle-switch input:checked + .toggle-track {
  background: var(--plasma);
}

.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(18px);
  background: #fff;
}

/* Drops section in new job modal */
#job-drops-section {
  margin-top: 14px;
}

.drops-section-head {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-hi);
  margin-bottom: 4px;
}

.drops-section-sub {
  font-size: 12px;
  margin-bottom: 10px;
}

.drop-option-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  margin-bottom: 6px;
  cursor: pointer;
}

.drop-option-row:hover {
  border-color: var(--score);
}

.drop-option-label {
  font-size: 13px;
}

.drop-option-dims {
  font-size: 11px;
  color: var(--text-dim);
}

.drops-empty {
  margin: 0;
}

.job-row-actions > div {
  display: flex;
  gap: 12px;
  align-items: center;
  white-space: nowrap;
}

.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 33px;
  padding: 0 12px;
  border: 1px solid var(--danger);
  border-radius: 5px;
  background: var(--danger);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  transition: 120ms ease;
}

.danger-button:hover {
  filter: brightness(1.12);
}

.danger-link {
  color: var(--danger) !important;
}

.danger-link:hover {
  opacity: 0.8;
}

.ghost-button.active {
  border-color: var(--plasma);
  color: var(--plasma);
}

.status-light.dim {
  background: var(--score);
  box-shadow: none;
}
