

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }

body.bg-dashboard {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  background: #f4f6fa;
  color: #1f2937;
  overflow: hidden;
}

.app-wrap {
  display: flex;
  height: 100vh;
  width: 100vw;
}


.sidebar {
  width: 200px;
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px;
  border-bottom: 1px solid #e5e7eb;
}
.logo-text {
  font-weight: 700; font-size: 17px; color: #1f2937;
}

.sidebar-nav {
  padding: 14px 0;
  display: flex;
  flex-direction: column;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 18px;
  color: #6b7280;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
  position: relative;
}
.nav-item:hover { color: #1f2937; background: #f3f4f6; }
.nav-item.active {
  color: #1f2937;
  background: #f3f4f6;
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 4px; bottom: 4px;
  width: 3px;
  background: #22c55e;
  border-radius: 0 3px 3px 0;
}
.nav-item i { font-size: 15px; width: 16px; text-align: center; }
.nav-item .chev {
  margin-left: auto;
  font-size: 10px;
  opacity: 0.6;
}


.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f4f6fa;
}


.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}
.page-title {
  font-size: 19px;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.btn-icon {
  background: transparent;
  border: none;
  color: #6b7280;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  position: relative;
  font-size: 16px;
}
.btn-icon:hover { color: #1f2937; }
.notif-badge {
  position: absolute;
  top: 2px; right: 2px;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 700;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
  border: 2px solid #22c55e;
}
.user-text { color: #1f2937; font-size: 13px; font-weight: 500; }


.page-content {
  padding: 16px 24px 24px;
  flex: 1;
  overflow-y: auto;
}


.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.stat-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 96px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  position: relative;
}

.stat-icon-box {
  width: 60px; height: 60px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: white;
  flex-shrink: 0;
}
.icon-blue { background: #2563eb; }
.icon-green { background: #16a34a; }
.icon-red { background: #dc2626; }

.stat-body { flex: 1; min-width: 0; }
.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #1f2937;
  margin-top: 2px;
  line-height: 1.1;
}
.stat-sub {
  font-size: 11px;
  color: #6b7280;
  margin-top: 4px;
  line-height: 1.4;
}
.sub-up { color: #16a34a; font-weight: 600; }
.sub-line { display: inline; }
.sub-small { color: #6b7280; font-size: 11px; }

.stat-chart {
  position: absolute;
  right: 12px;
  bottom: 8px;
  width: 120px;
  height: 50px;
  opacity: 0.85;
  pointer-events: none;
}
.stat-chart svg { width: 100%; height: 100%; }


.main-row {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 16px;
}

.cutting-panel {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.panel-head {
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e5e7eb;
}
.panel-title {
  font-size: 12px;
  font-weight: 700;
  color: #1f2937;
  letter-spacing: 0.6px;
  margin: 0;
  text-transform: uppercase;
}
.panel-dots {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #6b7280;
}
.btn-sm-ghost {
  background: #ffffff;
  border: 1px solid #d1d5db;
  color: #6b7280;
  width: 26px; height: 26px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-sm-ghost:hover { background: #f3f4f6; color: #1f2937; border-color: #22c55e; }
.sheet-ind { font-size: 12px; color: #6b7280; min-width: 70px; text-align: center; font-weight: 500; }
.dots { cursor: pointer; padding: 0 4px; }


.canvas-wrap {
  position: relative;
  background: #fafbfc;
  display: grid;
  grid-template-columns: 60px 1fr;
  grid-template-rows: 36px 1fr 32px;
  align-items: stretch;
}
.canvas-inner {
  width: 100%;
  aspect-ratio: 3660 / 2140;
  max-height: 60vh;
  display: flex;
  flex-shrink: 0;
}
#cuttingCanvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 4px;
}

.dim-label {
  color: #1f2937;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dim-top {
  grid-row: 1;
  grid-column: 2;
}
.dim-bottom {
  grid-row: 3;
  grid-column: 2;
}
.dim-left {
  grid-row: 2;
  grid-column: 1;
  white-space: nowrap;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.remnant-list-wrap {
  margin-top: 10px;
  padding: 12px 16px 14px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}
.remnant-list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #f3f4f6;
}
.remnant-list-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: #111827;
  text-transform: uppercase;
}
.remnant-list-meta {
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
}
.remnant-list {
  list-style: decimal inside;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 4px 18px;
}
.remnant-list li {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  font-variant-numeric: tabular-nums;
  padding: 2px 0;
}
.remnant-list:empty::before {
  content: 'No usable remnants on this sheet.';
  color: #9ca3af;
  font-size: 13px;
  font-weight: 500;
}


.side-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.side-panel {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.side-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.side-label {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.side-value-lg {
  font-size: 30px;
  font-weight: 700;
  color: #16a34a;
  margin-top: 6px;
  line-height: 1;
}
.side-sub {
  font-size: 11px;
  color: #6b7280;
  margin-top: 4px;
}
.next-cut-row {
  font-size: 17px;
  font-weight: 600;
  color: #1f2937;
  margin-top: 8px;
  margin-bottom: 14px;
}
.green-text { color: #16a34a; font-weight: 700; }

.btn-complete {
  width: 100%;
  background: #22c55e;
  color: white;
  border: none;
  padding: 10px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.5px;
  cursor: pointer;
  text-transform: uppercase;
}
.btn-complete:hover { background: #16a34a; }

.side-value-red { color: #dc2626 !important; }
.side-value-dark { color: #1f2937 !important; }


.btn-top {
  background:#fff; color:#1f2937; border:1px solid #d1d5db;
  padding:6px 12px; border-radius:5px; font-size:12px; font-weight:600;
  cursor:pointer; display:inline-flex; gap:5px; align-items:center;
}
.btn-top:hover { background:#f3f4f6; border-color:#22c55e; color:#22c55e; }
.btn-top i { font-size:13px; }
#btnNewJob {
  background:#22c55e; color:#fff; border-color:#22c55e;
}
#btnNewJob:hover { background:#16a34a; color:#fff; }

.dd { position:relative; display:inline-block; }
.dd-menu {
  position:absolute; top:36px; right:0; background:#fff; border:1px solid #e5e7eb;
  border-radius:6px; min-width:180px; padding:4px 0; display:none; z-index:200;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.dd.open .dd-menu { display:block; }
.dd-menu a {
  display:block; padding:8px 14px; color:#1f2937; text-decoration:none;
  font-size:13px; cursor:pointer;
}
.dd-menu a:hover { background:#f3f4f6; }
.dd-menu a i { margin-right:8px; color:#6b7280; }


.njm-overlay {
  position:fixed; inset:0; background:rgba(0,0,0,0.5);
  display:flex; align-items:center; justify-content:center; z-index:300;
}
.njm-box {
  background:#fff; border-radius:8px; min-width:780px; max-width:95vw;
  max-height:90vh; display:flex; flex-direction:column;
  box-shadow:0 12px 40px rgba(0,0,0,0.25);
}
#newJobModal .njm-box { min-width: 1200px; max-width: 1320px; }
.njm-body-2col { display: grid; grid-template-columns: 1fr 1.15fr; gap: 18px; padding: 14px 18px; overflow-y: auto; flex: 1; }
.njm-col-left, .njm-col-right { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.njm-section-grow { display: flex; flex-direction: column; flex: 1; min-height: 220px; }
.njm-section-grow .njm-table-scroll { flex: 1; max-height: 38vh; overflow-y: auto; border: 1px solid #f3f4f6; border-radius: 4px; }
.njm-section-grow .njm-table-scroll table { margin: 0; }
.njm-section-grow .njm-table-scroll thead th { position: sticky; top: 0; background: #f9fafb; z-index: 2; }
@media (max-width: 1240px) {
  #newJobModal .njm-box { min-width: 95vw; }
  .njm-body-2col { grid-template-columns: 1fr; }
}
.njm-head {
  padding:14px 18px; border-bottom:1px solid #e5e7eb;
  display:flex; justify-content:space-between; align-items:center;
}
.njm-head h3 { margin:0; font-size:16px; font-weight:600; color:#1f2937; }
.njm-close {
  background:transparent; border:none; font-size:22px; cursor:pointer; color:#6b7280;
}
.njm-body {
  padding:14px 18px; overflow-y:auto; flex:1;
}
.njm-section { margin-bottom:18px; }
.njm-section-head {
  display:flex; justify-content:space-between; align-items:center;
  flex-wrap: wrap; row-gap: 6px;
  margin-bottom:6px; padding:6px 0; font-size:12px; font-weight:600;
  color:#374151; text-transform:uppercase; letter-spacing:0.4px;
}
.njm-section-head > span:first-child { flex-shrink: 0; }
.njm-section-head .cat-picker { flex: 1 1 auto; min-width: 0; }
.njm-section-head .njm-actions { flex-shrink: 0; }
.njm-section-head i { color:#22c55e; margin-right:4px; }
.btn-mini {
  background:#fff; color:#22c55e; border:1px solid #22c55e;
  padding:3px 10px; border-radius:4px; font-size:11px; cursor:pointer;
  display:inline-flex; gap:3px; align-items:center;
}
.btn-mini:hover { background:#22c55e; color:#fff; }

.njm-table {
  border:1px solid #e5e7eb; border-radius:5px; max-height:200px; overflow-y:auto;
}
.njm-table table { width:100%; border-collapse:collapse; font-size:12px; }
.njm-table th {
  position:sticky; top:0; background:#f9fafb; padding:8px 10px; text-align:left;
  font-weight:600; color:#6b7280; border-bottom:1px solid #e5e7eb; font-size:11px;
}
.njm-table td { padding:4px 6px; border-bottom:1px solid #f3f4f6; }
.njm-table input {
  width:100%; border:1px solid transparent; padding:4px 6px;
  font-size:12px; color:#1f2937; background:transparent; border-radius:3px;
}
.njm-table input:focus { outline:none; border-color:#22c55e; background:#fff; }
.btn-row-x {
  background:transparent; border:none; color:#dc2626; cursor:pointer; padding:2px;
}
.njm-opts {
  display:flex; gap:18px; flex-wrap:wrap; padding:8px;
  background:#f9fafb; border-radius:6px; font-size:12px;
}
.njm-opts label {
  display:flex; gap:6px; align-items:center; color:#374151;
}
.njm-opts label input[type=number] {
  width:70px; padding:4px 6px; border:1px solid #d1d5db; border-radius:4px; font-size:12px;
}
.njm-foot {
  padding:12px 18px; border-top:1px solid #e5e7eb;
  display:flex; gap:10px; justify-content:flex-end;
}
.btn-secondary-ghost {
  background:#fff; color:#6b7280; border:1px solid #d1d5db;
  padding:8px 18px; border-radius:5px; font-size:13px; cursor:pointer;
}
.btn-secondary-ghost:hover { background:#f3f4f6; }
.njm-body code { background:#f3f4f6; padding:2px 5px; border-radius:3px; font-size:11px; }

.piece-list {
  margin-top: 10px;
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.below-canvas-pieces {
  margin-top: 10px;
  padding: 12px 16px 14px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}
.bcp-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #f3f4f6;
}
.bcp-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: #111827;
  text-transform: uppercase;
}
.piece-list-grid {
  margin-top: 0;
  max-height: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.piece-list::-webkit-scrollbar { width: 6px; }
.piece-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}
.piece-row {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-left: 3px solid #22c55e;
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
}
.piece-row:hover {
  background: #f1f5f9;
  border-left-color: #16a34a;
}
.pr-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.pr-label {
  font-weight: 700;
  font-size: 11px;
  background: #22c55e;
  color: white;
  padding: 1px 7px;
  border-radius: 4px;
}
.pr-qty {
  color: #dc2626;
  font-weight: 700;
  font-size: 11px;
}
.pr-customer {
  font-weight: 600;
  color: #1f2937;
  font-size: 12px;
  margin-top: 2px;
}
.pr-meta {
  display: flex;
  justify-content: space-between;
  color: #6b7280;
  font-size: 10px;
}
.pr-size {
  color: #374151;
  font-size: 10px;
  font-weight: 500;
}


@media (max-width: 1100px) {
  .main-row { grid-template-columns: 1fr; }
  .side-column { flex-direction: row; flex-wrap: wrap; }
  .side-panel { flex: 1; min-width: 220px; }
}
@media (max-width: 768px) {
  .stats-row { grid-template-columns: 1fr; }
  .sidebar { width: 64px; }
  .logo-text, .nav-item span, .nav-item .chev { display: none; }
  .nav-item { justify-content: center; padding: 12px 0; }
  .sidebar-logo { justify-content: center; padding: 18px 0; }
}

.summary-panel { padding: 14px 16px; }
.summary-head { cursor: pointer; user-select: none; }
.summary-chev { transition: transform .2s; color: #6b7280; font-size: 14px; }
.summary-panel.collapsed .summary-chev { transform: rotate(180deg); }
.summary-panel.collapsed .summary-body { display: none; }
.summary-body { margin-top: 10px; }
.summary-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.summary-table th { text-align: left; color: #6b7280; font-weight: 600; padding: 4px 6px; border-bottom: 1px solid #e5e7eb; }
.summary-table th.num, .summary-table td.num { text-align: right; }
.summary-table td { padding: 5px 6px; color: #1f2937; border-bottom: 1px solid #f3f4f6; }
.summary-table tr.summary-total td { font-weight: 700; border-top: 1.5px solid #d1d5db; border-bottom: none; padding-top: 7px; }
.summary-table .util-cell { color: #16a34a; font-weight: 600; }
.summary-badges { display: flex; gap: 10px; margin-top: 12px; }
.sb-badge { flex: 1; border-radius: 6px; padding: 10px 12px; text-align: center; }
.sb-util { background: #dcfce7; }
.sb-util .sb-value { color: #16a34a; }
.sb-waste { background: #fee2e2; }
.sb-waste .sb-value { color: #dc2626; }
.sb-label { font-size: 10px; font-weight: 700; letter-spacing: .4px; color: #6b7280; }
.sb-value { font-size: 22px; font-weight: 800; margin-top: 2px; }

.result-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #e5e7eb;
  background: #fafbfc;
  padding: 0 12px;
}
.result-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 10px 16px 9px;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #6b7280;
  transition: color 0.12s, border-color 0.12s;
}
.result-tab:hover { color: #111827; }
.result-tab.active { color: #111827; border-bottom-color: #16a34a; background: #fff; }
.result-tab .rt-label { font-size: 12px; font-weight: 700; letter-spacing: 0.5px; }
.result-tab .rt-sub { font-weight: 500; color: #9ca3af; font-size: 11px; margin-left: 4px; }
.result-tab .rt-meta { font-size: 11px; font-weight: 500; color: #6b7280; font-variant-numeric: tabular-nums; }
.result-tab.active .rt-meta { color: #16a34a; }

td.tier-cell { text-align: center; }
.tier-cycle {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  min-width: 84px;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.tier-cycle.tier-primary { background: #dcfce7; color: #15803d; border-color: #86efac; }
.tier-cycle.tier-primary:hover { background: #bbf7d0; }
.tier-cycle.tier-secondary { background: #f1f5f9; color: #64748b; border-color: #cbd5e1; }
.tier-cycle.tier-secondary:hover { background: #e2e8f0; }

.saved-list { max-height: 60vh; overflow-y: auto; }
.saved-empty { text-align: center; padding: 40px 12px; color: #6b7280; font-size: 13px; }
.saved-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid #e5e7eb; border-radius: 6px; margin-bottom: 8px; }
.saved-row-main { flex: 1; min-width: 0; }
.saved-row-id { font-weight: 700; color: #111827; font-size: 13px; }
.saved-row-meta { font-size: 11px; color: #6b7280; margin-top: 2px; }
.saved-row-load { background: #16a34a; color: #fff; border: none; padding: 6px 14px; border-radius: 4px; cursor: pointer; font-size: 12px; font-weight: 600; }
.saved-row-load:hover { background: #15803d; }
.saved-row-del { background: transparent; color: #dc2626; border: 1px solid #fecaca; width: 28px; height: 28px; border-radius: 4px; cursor: pointer; font-size: 14px; line-height: 1; }
.saved-row-del:hover { background: #fee2e2; }

.stat-subval { font-size: 13px; color: #6b7280; font-weight: 600; margin-top: -2px; margin-bottom: 4px; }

.njm-name-section { padding: 12px 14px 14px; background: #f9fafb; border-radius: 6px; }
.plan-name-row { display: flex; align-items: center; gap: 12px; }
.plan-name-label { font-weight: 600; color: #1f2937; font-size: 13px; white-space: nowrap; }
.plan-name-row input { flex: 1; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 4px; font-size: 13px; font-family: inherit; }
.plan-name-row input:focus { outline: none; border-color: #16a34a; }

.njm-actions { display: flex; gap: 8px; }
.btn-mini-danger { color: #dc2626; border-color: #fecaca !important; background: #fff !important; }
.btn-mini-danger:hover { background: #fee2e2 !important; border-color: #fca5a5 !important; }

td.grain-cell { text-align: center; vertical-align: middle; }

.leftovers-list { max-height: 320px; overflow-y: auto; border: 1px solid #e5e7eb; border-radius: 6px; }
.leftover-row { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-bottom: 1px solid #f3f4f6; }
.leftover-row:last-child { border-bottom: none; }
.leftover-row label { display: flex; align-items: center; gap: 10px; flex: 1; cursor: pointer; }
.leftover-row input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
.leftover-dim { font-weight: 600; color: #111827; }
.leftover-area { color: #6b7280; font-size: 12px; margin-left: auto; }
.leftover-tag { padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.leftover-tag-big { background: #dcfce7; color: #16a34a; }
.leftover-tag-mid { background: #fef3c7; color: #b45309; }
.leftover-tag-small { background: #fee2e2; color: #dc2626; }
.leftovers-actions { margin-top: 10px; display: flex; gap: 8px; }

td.grain-cell input[type="checkbox"] { width: 20px; height: 20px; cursor: pointer; accent-color: #16a34a; }
.unit-toggle { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 8px 10px; background: #fff; border: 1px solid #e5e7eb; border-radius: 6px; }
.unit-toggle-label { font-size: 12px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: 0.4px; }
.unit-opt { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; font-size: 13px; font-weight: 600; color: #1f2937; padding: 4px 10px; border-radius: 4px; }
.unit-opt input { cursor: pointer; accent-color: #16a34a; }
.unit-opt:has(input:checked) { background: #dcfce7; color: #16a34a; }

.fitwarn-box { min-width: 480px; max-width: 620px; }
.fitwarn-note { margin: 0 0 12px; font-size: 13px; line-height: 1.45; color: #4b5563; }
.fitwarn-list { max-height: 320px; overflow-y: auto; border: 1px solid #e5e7eb; border-radius: 6px; }
.fitwarn-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 14px; border-bottom: 1px solid #f3f4f6; font-size: 13px; }
.fitwarn-row:last-child { border-bottom: none; }
.fitwarn-row .fw-label { font-weight: 600; color: #111827; }
.fitwarn-row .fw-size { color: #374151; font-variant-numeric: tabular-nums; }
.fitwarn-row .fw-reason { color: #b45309; font-size: 12px; }
.fitwarn-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.skipped-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; line-height: 1; }
.skipped-chip:hover { background: #fee2e2; }
.skipped-chip .bi { font-size: 14px; }
.skipped-panel { position: absolute; top: 52px; right: 12px; background: #fff; border: 1px solid #e5e7eb; border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,0.08); min-width: 280px; max-width: 360px; max-height: 320px; overflow-y: auto; z-index: 60; padding: 10px 0; }
.skipped-panel-title { padding: 0 14px 8px; font-size: 12px; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: 0.4px; border-bottom: 1px solid #f3f4f6; margin-bottom: 4px; }
.skipped-item { padding: 7px 14px; font-size: 13px; color: #1f2937; display: flex; justify-content: space-between; gap: 10px; }
.skipped-item .sk-size { font-variant-numeric: tabular-nums; }
.skipped-item .sk-qty { color: #6b7280; font-size: 12px; }

.import-unit-choice { display: flex; gap: 12px; }
.iu-btn { flex: 1; padding: 16px; border: 2px solid #e5e7eb; background: #fff; border-radius: 8px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; transition: all 0.15s; }
.iu-btn:hover { border-color: #16a34a; background: #f0fdf4; }
.iu-btn strong { font-size: 15px; color: #111827; }
.iu-btn span { font-size: 18px; font-weight: 700; color: #16a34a; }

td.grain-stock-cell { text-align: center; }
.grain-cycle { background: #fff; border: 1px solid #d1d5db; border-radius: 4px; padding: 5px 12px; cursor: pointer; min-width: 116px; font-size: 13px; line-height: 1.2; font-weight: 600; transition: background 0.12s; }
.grain-cycle:hover { background: #f3f4f6; border-color: #9ca3af; }
.grain-cycle .g-sym { font-weight: 700; margin-right: 4px; display: inline-block; min-width: 18px; }
.grain-cycle .g-none { color: #6b7280; }
.grain-cycle .g-vertical { color: #2563eb; }
.grain-cycle .g-horizontal { color: #ea580c; }

th.sr-col, td.sr-cell { width: 36px; text-align: center; color: #6b7280; font-weight: 600; font-size: 12px; }
.canvas-scroll { grid-row: 2; grid-column: 2; width: 100%; max-height: 60vh; overflow: auto; display: flex; justify-content: flex-start; align-items: flex-start; position: relative; padding: 4px 8px; }
.canvas-scroll .canvas-inner { width: 100%; aspect-ratio: 3660 / 2140; max-height: 60vh; flex-shrink: 0; }
.zoom-controls { display: inline-flex; align-items: center; gap: 4px; padding: 0 4px; margin-right: 8px; border-right: 1px solid #e5e7eb; padding-right: 10px; }
.zoom-btn { width: 28px; height: 28px; border: 1px solid #d1d5db; background: #fff; border-radius: 4px; cursor: pointer; font-size: 16px; font-weight: 700; color: #4b5563; line-height: 1; display: flex; align-items: center; justify-content: center; }
.zoom-btn:hover { background: #f3f4f6; border-color: #16a34a; color: #16a34a; }
.zoom-btn.zoom-reset { font-size: 14px; }
.zoom-pct { font-size: 12px; font-weight: 600; color: #1f2937; min-width: 42px; text-align: center; padding: 0 4px; }

.cuts-toggle { font-size: 11px !important; font-weight: 700 !important; min-width: 42px; padding: 0 6px !important; letter-spacing: 0.5px; }
.cuts-toggle.active { background: #16a34a !important; color: #fff !important; border-color: #15803d !important; }
.unit-toggle-btn { font-size: 11px !important; font-weight: 700 !important; min-width: 42px; padding: 0 6px !important; letter-spacing: 0.5px; text-transform: lowercase; }

.leftover-altdim { color: #6b7280; font-weight: 500; font-size: 11px; margin-left: 4px; }

.cat-picker { display: flex; align-items: center; gap: 12px; font-size: 11px; color: #374151; font-weight: 500; }
.cat-picker label { display: inline-flex; align-items: center; gap: 4px; }
.cat-select { padding: 3px 6px; border: 1px solid #d1d5db; border-radius: 4px; background: #fff; font-size: 12px; min-width: 70px; cursor: pointer; }
.cat-unit { color: #6b7280; font-weight: 500; }

.njm-cat-section { border-top: 1px solid #e5e7eb; padding-top: 14px; margin-top: 6px; }
.cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cat-col { display: flex; flex-direction: column; gap: 6px; }
.cat-col-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; color: #374151; text-transform: uppercase; letter-spacing: 0.4px; }
.cat-add { display: flex; gap: 4px; }
.cat-add input { padding: 3px 8px; border: 1px solid #d1d5db; border-radius: 4px; font-size: 12px; width: 90px; }
.cat-list { display: flex; flex-wrap: wrap; gap: 6px; min-height: 32px; padding: 6px; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 4px; }
.cat-item { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; background: #fff; border: 1px solid #d1d5db; border-radius: 12px; font-size: 12px; }
.cat-item button { background: transparent; border: none; color: #dc2626; cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; }
.cat-item button:hover { color: #991b1b; }

td.stock-enable-cell { text-align: center; width: 28px; }
td.stock-enable-cell input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: #16a34a; }
tr.stock-row-off { opacity: 0.45; background: #f9fafb; }
tr.stock-row-off input { color: #9ca3af; }
