:root {
  color-scheme: light;
  --bg: #f1f5f9;
  --bg-soft: #f8fafc;
  --card: #ffffff;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #cbd5e1;
  --text: #0f172a;
  --muted: #475569;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --fg: #059669;
  --fg-bg: #d1fae5;
  --wip: #d97706;
  --wip-bg: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --radius: 10px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px; padding: 12px 24px;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-badge {
  width: 40px; height: 40px; border-radius: 9px;
  background: linear-gradient(135deg, #2563eb, #0ea5e9); color: #ffffff;
  display: grid; place-items: center; font-weight: 800; font-size: 16px;
}
.topbar h1 { margin: 0; font-size: 17px; }
.subtitle { font-size: 12px; color: var(--muted); }

.status-pills { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pill {
  padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
.pill-live { background: var(--fg-bg); border-color: var(--fg); color: #6ee7b7; }
.pill-warn { background: var(--wip-bg); border-color: var(--wip); color: #fcd34d; }
.pill-lpn  { background: rgba(37, 99, 235, 0.18); border-color: #3b82f6; color: #93c5fd; }
.pill-admin { background: rgba(168, 85, 247, 0.18); border-color: #a855f7; color: #e9d5ff; }

.tabs {
  display: flex; gap: 6px; padding: 10px 24px 0; flex-wrap: wrap;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.tab {
  background: transparent; color: var(--muted); border: 1px solid transparent;
  border-bottom: none; padding: 10px 16px; border-radius: 8px 8px 0 0;
  cursor: pointer; font-weight: 600; font-size: 13.5px;
}
.tab:hover { color: var(--text); }
.tab.active {
  background: var(--bg); color: var(--text);
  border-color: var(--border); margin-bottom: -1px;
}

.container { max-width: 1480px; margin: 0 auto; padding: 20px 24px 48px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.grid-two { display: grid; grid-template-columns: 1.05fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 1040px) { .grid-two { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
}
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.card-header h2 { margin: 0; font-size: 16px; }
.header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
h3 { margin: 12px 0 8px; font-size: 14px; color: #cbd5e1; }

.type-badge { padding: 5px 12px; border-radius: 6px; font-size: 12px; font-weight: 800; letter-spacing: 0.4px; }
.type-fg  { background: var(--fg-bg); color: #34d399; border: 1px solid var(--fg); }
.type-wip { background: var(--wip-bg); color: #fbbf24; border: 1px solid var(--wip); }

.hint { margin: 0 0 14px; font-size: 13px; color: var(--muted); }
code { background: var(--surface-2); padding: 2px 5px; border-radius: 4px; font-size: 12px; color: #93c5fd; }

.filter-row { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.filter-row input { flex: 1; min-width: 180px; }

.chip-group { display: flex; gap: 4px; flex-wrap: wrap; }
.chip {
  padding: 6px 10px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 600;
}
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field.align-end { justify-content: flex-end; }
label { font-size: 12px; font-weight: 600; color: #cbd5e1; }
input, select, textarea {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 7px;
  padding: 9px 11px; font-size: 14px; width: 100%; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); border-color: var(--primary); }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 780px) { .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; } }

.batch-preview-box {
  display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px; margin-bottom: 14px;
}
.batch-preview-main { flex: 1; min-width: 220px; }
.batch-input-row { display: flex; gap: 8px; margin-top: 4px; }
.batch-input { font-size: 18px; font-weight: 800; letter-spacing: 0.6px; color: #93c5fd; }
.lpn-preview-side { text-align: right; }
.mini-label { font-size: 11px; color: var(--muted); display: block; text-transform: uppercase; letter-spacing: 0.5px; }
.lpn-range { font-size: 15px; font-weight: 700; color: #34d399; margin-top: 3px; }
.total-qty-display {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px;
  padding: 9px 12px; font-size: 16px; font-weight: 800; color: #38bdf8;
}

.bom-container { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.bom-item { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.bom-item.invalid { border-color: var(--danger); }
.bom-item-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.bom-name { font-weight: 700; font-size: 13px; }
.bom-sku { font-size: 11px; color: var(--muted); }
.bom-req { font-size: 12px; font-weight: 700; white-space: nowrap; }
.bom-req.ok { color: #34d399; }
.bom-req.bad { color: #f87171; }

.lot-row { display: grid; grid-template-columns: 1fr 110px 34px; gap: 8px; align-items: center; margin-top: 6px; }
.lot-actions { margin-top: 8px; display: flex; justify-content: space-between; align-items: center; }

.btn {
  border: 1px solid transparent; border-radius: 7px; padding: 9px 14px;
  font-size: 13px; font-weight: 700; cursor: pointer; transition: 0.12s; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: #0f766e; color: #fff; }
.btn-secondary:hover { background: #115e59; }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: #64748b; }
.btn-danger-sm {
  background: var(--danger-bg); color: #fca5a5; border: 1px solid var(--danger);
  padding: 5px 9px; border-radius: 6px; cursor: pointer; font-weight: 700; font-size: 12px;
}
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-lg { padding: 12px 20px; font-size: 15px; }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; }

.submit-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding-top: 12px; border-top: 1px solid var(--border);
}
.alloc-summary { font-size: 13px; font-weight: 700; }
.alloc-summary.ok { color: #34d399; }
.alloc-summary.bad { color: #f87171; }

.history-list { display: flex; flex-direction: column; gap: 12px; }
.history-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 14px; }
.history-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.history-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.lpn-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.lpn-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 8px; font-size: 12px;
}
.lpn-chip button { background: transparent; border: none; color: #38bdf8; cursor: pointer; font-weight: 700; font-size: 11px; padding: 0; }
.lpn-chip button:hover { text-decoration: underline; }

.divider { height: 1px; background: var(--border); margin: 16px 0; }
.empty-state { padding: 20px; text-align: center; color: var(--muted); font-size: 13px; }
.hidden { display: none !important; }
.mini-status { font-size: 12px; margin-top: 4px; color: #34d399; font-weight: 600; }

.toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 1200;
  padding: 12px 18px; border-radius: 8px; font-size: 13px; font-weight: 600;
  background: #1e293b; border: 1px solid #3b82f6; color: #fff;
  box-shadow: 0 10px 25px rgba(0,0,0,0.45); max-width: 460px;
}
.toast.error { border-color: var(--danger); background: #450a0a; }
.toast.success { border-color: var(--fg); background: #064e3b; }

.checkbox-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px; margin-top: 6px;
}
.chk { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; color: var(--text); }
.chk input[type="checkbox"] { width: auto; accent-color: var(--primary); }

.designer-preview-stage {
  background: #cbd5e1; border-radius: 8px; padding: 20px;
  display: flex; justify-content: center; align-items: center; min-height: 360px;
}
.designer-preview-stage img {
  max-width: 100%; max-height: 540px; border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35); background: #fff;
}

.op-auth-box { display: flex; align-items: center; gap: 6px; border-radius: 7px; padding: 3px; }
.op-auth-box.locked { background: var(--wip-bg); border: 1px solid var(--wip); }
.op-auth-box.locked input { border: none; background: transparent; padding: 6px 8px; font-size: 13px; }
.op-auth-box.locked input:focus { outline: none; }
.op-auth-box.verified { background: var(--fg-bg); border: 1px solid var(--fg); justify-content: space-between; padding: 5px 8px; }
.op-verified-name { font-size: 13px; font-weight: 700; color: #6ee7b7; }

.studio-fieldset { border: none; padding: 0; margin: 0; }
.studio-fieldset:disabled { opacity: 0.65; }
.locked-banner {
  background: var(--fg-bg); border: 1px solid var(--fg); color: #6ee7b7;
  border-radius: 7px; padding: 9px 12px; font-size: 12px; margin-bottom: 12px;
}
.logo-upload-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }

/* Data Tables (Machines, Molds, Users, Sales Orders) */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--surface-2); }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #1e293b; }
.data-table th { background: #131d33; color: #94a3b8; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(37, 99, 235, 0.07); }

.badge-sm { display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: 11px; font-weight: 700; margin: 1px 2px; }
.badge-molding { background: rgba(59, 130, 246, 0.18); color: #93c5fd; border: 1px solid #3b82f6; }
.badge-lining { background: var(--fg-bg); color: #34d399; border: 1px solid var(--fg); }
.badge-post { background: rgba(168, 85, 247, 0.18); color: #d8b4fe; border: 1px solid #a855f7; }
.badge-warn { background: var(--wip-bg); color: #fcd34d; border: 1px solid var(--wip); }

.calc-callout {
  background: rgba(16, 185, 129, 0.12); border: 1px solid var(--fg); color: #6ee7b7;
  border-radius: 8px; padding: 10px 14px; font-size: 13px; font-weight: 700; margin-bottom: 12px;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
}

.info-banner {
  background: rgba(37, 99, 235, 0.14); border: 1px solid #3b82f6; color: #bfdbfe;
  border-radius: 8px; padding: 12px 14px; font-size: 13px; margin-bottom: 14px;
}

/* Modals */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(2, 6, 23, 0.82); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px; width: 100%; max-width: 540px;
  max-height: 92vh; overflow-y: auto; box-shadow: 0 24px 60px rgba(0,0,0,0.6);
}
.modal-card.modal-wide { max-width: 920px; }
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.modal-header h2 { margin: 0; font-size: 17px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border);
}
.confirm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 780px) { .confirm-grid { grid-template-columns: 1fr; } }
.confirm-preview-col { background: #cbd5e1; border-radius: 8px; padding: 14px; text-align: center; }
.confirm-preview-col .mini-label { color: #1e293b; font-weight: 800; }
.confirm-preview-col img { max-width: 100%; max-height: 440px; background: #fff; border-radius: 4px; box-shadow: 0 8px 24px rgba(0,0,0,0.35); }
.confirm-summary-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 14px; font-size: 13px; }
.confirm-kv { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #1e293b; gap: 12px; }
.confirm-kv:last-child { border-bottom: none; }
.confirm-kv span { color: var(--muted); }
.confirm-kv strong { text-align: right; }

/* ---------------------------------------------------------------------------
   Phase 2: Dynamic Ripple Gantt Schedule Board & Release Queue
   --------------------------------------------------------------------------- */
.kpi-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px;
}
@media (max-width: 780px) { .kpi-strip { grid-template-columns: 1fr 1fr; } }
.kpi-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px;
  padding: 12px 16px;
}
.kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; }
.kpi-val { font-size: 24px; font-weight: 800; margin-top: 2px; }
.kpi-val.ok { color: #34d399; }
.kpi-val.bad { color: #f87171; }
.kpi-val.info { color: #60a5fa; }

.gantt-wrap {
  overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2);
}
.gantt-grid { min-width: 960px; }
.gantt-header {
  display: grid; grid-template-columns: 190px 1fr;
  border-bottom: 1px solid var(--border); background: #131d33; position: sticky; top: 0; z-index: 3;
}
.gantt-head-label { padding: 8px 12px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; border-right: 1px solid var(--border); }
.gantt-days { position: relative; height: 34px; }
.gantt-day-tick {
  position: absolute; top: 0; bottom: 0; border-left: 1px solid #26344d;
  padding: 6px 6px; font-size: 11px; font-weight: 700; color: #cbd5e1; white-space: nowrap; overflow: hidden;
}
.gantt-day-tick.wknd { background: rgba(148, 163, 184, 0.08); color: #94a3b8; }

.gantt-row {
  display: grid; grid-template-columns: 190px 1fr;
  border-bottom: 1px solid #1e293b; min-height: 54px;
}
.gantt-row:last-child { border-bottom: none; }
.gantt-row-label {
  padding: 8px 10px; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; justify-content: center; gap: 4px; background: #0f172a;
}
.gantt-row-title { font-size: 13px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.gantt-row-ot { display: flex; gap: 6px; font-size: 11px; color: var(--muted); }
.gantt-row-ot label { display: inline-flex; align-items: center; gap: 3px; cursor: pointer; font-weight: 600; font-size: 10.5px; }
.gantt-row-ot input { width: auto; margin: 0; }

.gantt-track { position: relative; min-height: 54px; overflow: hidden; }
.gantt-weekend-band {
  position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(
    -45deg, rgba(148, 163, 184, 0.07), rgba(148, 163, 184, 0.07) 6px, rgba(148, 163, 184, 0.02) 6px, rgba(148, 163, 184, 0.02) 12px
  ); pointer-events: none;
}
.gantt-now-line {
  position: absolute; top: 0; bottom: 0; width: 2px; background: #f59e0b; z-index: 2; pointer-events: none;
}
.gantt-dt-block {
  position: absolute; top: 4px; bottom: 4px; z-index: 2;
  background: repeating-linear-gradient(-45deg, rgba(239,68,68,0.45), rgba(239,68,68,0.45) 6px, rgba(127,29,29,0.55) 6px, rgba(127,29,29,0.55) 12px);
  border: 1px solid #ef4444; border-radius: 5px; color: #fecaca;
  font-size: 10px; font-weight: 700; padding: 2px 5px; overflow: hidden; white-space: nowrap; cursor: pointer;
}
.gantt-bar {
  position: absolute; top: 7px; height: 40px; z-index: 2;
  border-radius: 6px; padding: 3px 8px; cursor: pointer; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center;
  border: 1px solid rgba(255,255,255,0.22); transition: transform 0.1s;
}
.gantt-bar:hover { transform: translateY(-1px); z-index: 4; }
.gantt-bar.type-imp { background: linear-gradient(135deg, #1d4ed8, #2563eb); color: #fff; }
.gantt-bar.type-fg  { background: linear-gradient(135deg, #047857, #059669); color: #fff; }
.gantt-bar.is-late  { border: 2px solid #ef4444; box-shadow: 0 0 0 2px rgba(239,68,68,0.35); }
.gantt-bar.is-done  { opacity: 0.55; }
.gantt-bar-prog {
  position: absolute; left: 0; bottom: 0; height: 4px; background: rgba(255,255,255,0.75);
}
.gantt-bar-title { font-size: 11.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt-bar-sub { font-size: 10px; opacity: 0.9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.queue-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.queue-card {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 12px;
}
.queue-card.drag-over { border-color: #38bdf8; background: rgba(56, 189, 248, 0.08); }
.queue-card-hdr { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.queue-job {
  background: var(--surface); border: 1px solid var(--border); border-radius: 7px;
  padding: 9px 10px; margin-bottom: 8px; cursor: grab;
}
.queue-job.is-late { border-color: var(--danger); }
.queue-job-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
.queue-job-meta { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.queue-job-actions { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.prog-bar-wrap { height: 5px; background: #0f172a; border-radius: 999px; overflow: hidden; margin-top: 6px; }
.prog-bar-fill { height: 100%; background: #10b981; }

.floor-job-banner {
  background: rgba(37, 99, 235, 0.14); border: 1px solid #3b82f6; border-radius: 8px;
  padding: 10px 12px; margin-bottom: 14px;
}
.badge-danger { background: var(--danger-bg); color: #fca5a5; border: 1px solid var(--danger); }

/* Phase 3: Multi-Vendor Policy Rows */
.vendor-rows-wrap { display: flex; flex-direction: column; gap: 8px; }
.vendor-row {
  display: grid; grid-template-columns: 78px 1.6fr 78px 88px 88px 100px 76px 34px; gap: 6px;
  align-items: center; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 7px; padding: 8px;
}
.vendor-row input, .vendor-row select { padding: 6px 8px; font-size: 12.5px; }
.vendor-row-hdr {
  display: grid; grid-template-columns: 78px 1.6fr 78px 88px 88px 100px 76px 34px; gap: 6px;
  font-size: 10.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; padding: 0 8px 4px;
}
@media (max-width: 820px) { .vendor-row, .vendor-row-hdr { grid-template-columns: 1fr 1fr; } }

/* ---------------------------------------------------------------------------
   Phase 4: Crisp Light Mode Theme + Traceability Genealogy Cards
   --------------------------------------------------------------------------- */
body.theme-light {
  color-scheme: light;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #cbd5e1;
  --text: #0f172a;
  --muted: #475569;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --fg: #059669;
  --fg-bg: #d1fae5;
  --wip: #d97706;
  --wip-bg: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
}
body.theme-light .topbar, body.theme-light .tabs { background: #ffffff; }
body.theme-light .pill-live { color: #065f46; }
body.theme-light .pill-warn { color: #92400e; }
body.theme-light .pill-lpn  { background: #dbeafe; color: #1d4ed8; }
body.theme-light .pill-admin { background: #f3e8ff; color: #6b21a8; }
body.theme-light .data-table th { background: #e2e8f0; color: #334155; }
body.theme-light .data-table td { border-bottom-color: #e2e8f0; }
body.theme-light .gantt-header { background: #e2e8f0; }
body.theme-light .gantt-row-label { background: #ffffff; }
body.theme-light .gantt-day-tick { color: #334155; border-left-color: #cbd5e1; }
body.theme-light .batch-input { color: #1d4ed8; }
body.theme-light code { background: #e2e8f0; color: #1d4ed8; }
body.theme-light .info-banner { background: #eff6ff; color: #1e3a8a; }
body.theme-light .badge-molding { background: #dbeafe; color: #1d4ed8; }
body.theme-light .badge-lining { background: #d1fae5; color: #065f46; }
body.theme-light .badge-post { background: #f3e8ff; color: #6b21a8; }
body.theme-light .badge-warn { background: #fef3c7; color: #92400e; }
body.theme-light .badge-danger { background: #fee2e2; color: #b91c1c; }
body.theme-light .type-fg { color: #065f46; }
body.theme-light .type-wip { color: #92400e; }
body.theme-light label { color: #334155; }
body.theme-light h3 { color: #1e293b; }
body.theme-light .op-verified-name { color: #065f46; }
body.theme-light .locked-banner { color: #065f46; }
body.theme-light .calc-callout { color: #065f46; }
body.theme-light .total-qty-display { color: #0369a1; }
body.theme-light .lpn-range { color: #047857; }
body.theme-light .confirm-kv { border-bottom-color: #e2e8f0; }

/* === QC FLOOR & MANAGEMENT CONTROLS === */
.qc-spec-strip {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  background: rgba(37, 99, 235, 0.12); border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-size: 13px;
}
.qc-cav-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(125px, 1fr));
  gap: 10px; margin-bottom: 10px;
}
.qc-cav-box {
  background: var(--bg-soft); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 8px 10px; transition: border-color 0.15s, background 0.15s;
}
.qc-cav-box.cav-pass { border-color: #16a34a; background: rgba(22, 163, 74, 0.12); }
.qc-cav-box.cav-fail { border-color: #dc2626; background: rgba(220, 38, 38, 0.16); }
.qc-cav-hdr { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 700; margin-bottom: 5px; }
.qc-cav-box input { width: 100%; font-size: 16px; font-weight: 700; padding: 7px 8px; text-align: center; }

.qc-check-row {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;
  padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-soft); margin-bottom: 8px;
}
.qc-check-row.is-fail { border-color: #dc2626; background: rgba(220, 38, 38, 0.1); }
.qc-check-info { flex: 1; min-width: 210px; }
.qc-check-title { font-weight: 700; font-size: 14px; }
.qc-toggle-group { display: flex; gap: 6px; flex-wrap: wrap; }
.qc-tbtn {
  padding: 8px 14px; border-radius: 8px; font-weight: 700; font-size: 13px;
  border: 1.5px solid var(--border); background: var(--card); color: var(--text); cursor: pointer;
}
.qc-tbtn.active-pass { background: #16a34a; border-color: #16a34a; color: #fff; }
.qc-tbtn.active-fail { background: #dc2626; border-color: #dc2626; color: #fff; }
.qc-tbtn.active-na { background: #475569; border-color: #64748b; color: #fff; }

.qc-defect-wrap {
  width: 100%; padding-top: 8px; border-top: 1px dashed var(--border);
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.qc-chip {
  padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); background: var(--card); color: var(--text); cursor: pointer;
}
.qc-chip.selected { background: #dc2626; border-color: #dc2626; color: #fff; }

.qa-hold-banner {
  background: rgba(220, 38, 38, 0.16); border: 1.5px solid #ef4444; color: #fca5a5;
  border-radius: 9px; padding: 10px 14px; margin-bottom: 12px; font-size: 13px; font-weight: 600;
}
body.theme-light .qa-hold-banner { background: #fef2f2; color: #991b1b; }
body.theme-light .qc-spec-strip { background: #eff6ff; border-color: #93c5fd; color: #1e3a8a; }
body.theme-light .qc-cav-box.cav-pass { background: #f0fdf4; }
body.theme-light .qc-cav-box.cav-fail { background: #fef2f2; }
body.theme-light .qc-check-row.is-fail { background: #fef2f2; }

/* === LAYER 1 METEOR-IMPACT LOGIN SCREEN === */
.auth-gate {
  position: fixed; inset: 0; z-index: 9999;
  background: radial-gradient(ellipse at 50% 100%, #1e293b 0%, #090d1a 55%, #03060f 100%);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.auth-gate.hidden { display: none !important; }
#meteorCanvas {
  position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;
}
.auth-gate.impact-shake {
  animation: meteorShake 0.34s cubic-bezier(.36,.07,.19,.97) both;
}
@keyframes meteorShake {
  10%, 90% { transform: translate3d(-3px, 2px, 0); }
  20%, 80% { transform: translate3d(5px, -4px, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 4px, 0); }
  40%, 60% { transform: translate3d(6px, -3px, 0); }
}
.auth-gate-card {
  position: relative; z-index: 2; width: 100%; max-width: 410px; margin: 16px;
  background: rgba(255, 255, 255, 0.97); color: #0f172a;
  border-radius: 16px; padding: 28px 30px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.55), 0 0 40px rgba(249, 115, 22, 0.25);
  border: 1px solid rgba(251, 146, 60, 0.45);
  opacity: 0; transform: translateY(34px) scale(0.92);
  transition: opacity 0.48s ease, transform 0.52s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}
.auth-gate-card.revealed {
  opacity: 1; transform: translateY(0) scale(1); pointer-events: auto;
}
.auth-gate-brand {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
}
.auth-gate-logo {
  background: linear-gradient(135deg, #f97316, #ea580c); color: #fff;
  font-weight: 900; font-size: 18px; letter-spacing: 1px;
  padding: 9px 13px; border-radius: 10px; box-shadow: 0 4px 14px rgba(234, 88, 12, 0.35);
}
.auth-gate-replay {
  position: absolute; bottom: 16px; right: 18px; z-index: 3;
  background: rgba(255,255,255,0.12); color: #cbd5e1; border: 1px solid rgba(255,255,255,0.2);
  border-radius: 999px; padding: 5px 12px; font-size: 12px; cursor: pointer;
}
.auth-gate-replay:hover { background: rgba(255,255,255,0.22); color: #fff; }
