/**
 * Orbita WMS v2 — Global Visual Contract (white operational workspace).
 *
 * CORE SYSTEM FREEZE V1 — LOCKED. See server/docs/ORBITA_CORE_SYSTEM_FREEZE_V1.md
 * Do NOT redesign desk layouts, density, or this contract without freeze version bump.
 *
 * Activation: <html class="orbita-wms-v2-unify"> + load this stylesheet LAST in <head>
 * (after page CSS) so tokens win where specificity allows.
 *
 * Visual-only: backgrounds, typography, surfaces, links, forms — no workflow logic.
 */
html.orbita-wms-v2-unify {
  color-scheme: light;
}

html.orbita-wms-v2-unify body {
  background-color: #f4f6f8 !important;
  color: #0f172a !important;
  font-family: ui-sans-serif, system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ---------- Typography ---------- */
html.orbita-wms-v2-unify h1,
html.orbita-wms-v2-unify h2,
html.orbita-wms-v2-unify h3 {
  color: #0f172a !important;
  font-weight: 700;
}

html.orbita-wms-v2-unify .wms-v2-mono,
html.orbita-wms-v2-unify code,
html.orbita-wms-v2-unify kbd,
html.orbita-wms-v2-unify pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
  color: #0d5c63;
}

/* ---------- Surfaces (cards / panels) ---------- */
html.orbita-wms-v2-unify .wms-v2-surface,
html.orbita-wms-v2-unify .panel,
html.orbita-wms-v2-unify .page .panel {
  background-color: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px;
  color: #0f172a !important;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

html.orbita-wms-v2-unify .panel:hover,
html.orbita-wms-v2-unify .wms-v2-surface:hover {
  border-color: #cbd5e1 !important;
}

html.orbita-wms-v2-unify .page {
  color: #0f172a;
}

/* ---------- Links ---------- */
html.orbita-wms-v2-unify .page a,
html.orbita-wms-v2-unify .top-nav a,
html.orbita-wms-v2-unify .back-bar a,
html.orbita-wms-v2-unify .back a,
html.orbita-wms-v2-unify .detail-nav a,
html.orbita-wms-v2-unify nav a.tr-link,
html.orbita-wms-v2-unify .quick-links a {
  color: #0d5c63;
  text-decoration: none;
  border-color: #e2e8f0;
}

html.orbita-wms-v2-unify .page a:hover,
html.orbita-wms-v2-unify .top-nav a:hover,
html.orbita-wms-v2-unify .back-bar a:hover,
html.orbita-wms-v2-unify .back a:hover,
html.orbita-wms-v2-unify .detail-nav a:hover {
  color: #127a84;
  border-color: #94a3b8;
}

/* ---------- Form controls ---------- */
html.orbita-wms-v2-unify input:not([type='checkbox']):not([type='radio']):not([type='range']):not([type='file']),
html.orbita-wms-v2-unify select,
html.orbita-wms-v2-unify textarea {
  background-color: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 0.5rem;
  color: #0f172a !important;
}

html.orbita-wms-v2-unify input:focus,
html.orbita-wms-v2-unify select:focus,
html.orbita-wms-v2-unify textarea:focus {
  outline: none;
  border-color: #0d5c63 !important;
  box-shadow: 0 0 0 3px rgba(13, 92, 99, 0.2);
}

/* ---------- Tables ---------- */
html.orbita-wms-v2-unify table {
  width: 100%;
  text-align: left;
  border-collapse: collapse;
}

html.orbita-wms-v2-unify thead th,
html.orbita-wms-v2-unify table > tr:first-child th,
html.orbita-wms-v2-unify th {
  color: #64748b !important;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

html.orbita-wms-v2-unify td {
  color: #0f172a;
  border-color: #e2e8f0;
}

/* ---------- Buttons (utility) ---------- */
html.orbita-wms-v2-unify .wms-v2-btn-primary {
  border-radius: 0.5rem;
  border: 1px solid #0a4a50;
  padding: 0.5rem 1rem;
  font-weight: 600;
  color: #f8fafc;
  background: linear-gradient(180deg, #0d5c63, #0a4a50);
  cursor: pointer;
}

html.orbita-wms-v2-unify .wms-v2-btn-primary:hover {
  filter: brightness(1.04);
}

html.orbita-wms-v2-unify .wms-v2-btn-atlas {
  border-radius: 0.5rem;
  border: 1px solid #6d28d9;
  padding: 0.5rem 1rem;
  font-weight: 600;
  color: #f5f3ff;
  background: linear-gradient(180deg, #7c3aed, #5b21b6);
  cursor: pointer;
}

html.orbita-wms-v2-unify .wms-v2-btn-secondary {
  border-radius: 0.5rem;
  border: 1px solid #cbd5e1;
  padding: 0.5rem 1rem;
  font-weight: 600;
  color: #334155;
  background: #f8fafc;
  cursor: pointer;
}

html.orbita-wms-v2-unify .wms-v2-badge-active {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.65rem;
  font-weight: 700;
  background: #ecfdf5;
  color: #065f46;
}

html.orbita-wms-v2-unify .wms-v2-badge-error {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.65rem;
  font-weight: 700;
  background: #fef2f2;
  color: #991b1b;
}

/* ---------- Empty / list helpers ---------- */
html.orbita-wms-v2-unify .wms-list-empty {
  border: 1px dashed #cbd5e1 !important;
  border-radius: 10px;
  padding: 14px 16px;
  background: #f8fafc !important;
  margin-bottom: 12px;
}

html.orbita-wms-v2-unify .wms-list-empty p {
  margin: 0 0 10px;
  line-height: 1.5;
  font-size: 14px;
  color: #475569 !important;
}

html.orbita-wms-v2-unify .wms-list-empty .wms-list-empty__muted {
  color: #64748b !important;
}

/* ---------- Errors ---------- */
html.orbita-wms-v2-unify .err {
  color: #991b1b !important;
  border: 1px solid #fecaca !important;
  background: #fef2f2 !important;
}

/* ---------- Dialog / modal forms ---------- */
html.orbita-wms-v2-unify dialog .modal-form input:not([type='checkbox']):not([type='radio']):not([type='range']):not([type='file']),
html.orbita-wms-v2-unify dialog .modal-form select,
html.orbita-wms-v2-unify dialog .modal-form textarea {
  background-color: #f8fafc !important;
  color: #0f172a !important;
  border-color: #94a3b8 !important;
  color-scheme: light;
}

html.orbita-wms-v2-unify dialog .modal-form input::placeholder,
html.orbita-wms-v2-unify dialog .modal-form textarea::placeholder {
  color: #64748b !important;
}

html.orbita-wms-v2-unify dialog .modal-form select option {
  color: #0f172a;
  background: #f8fafc;
}

html.orbita-wms-v2-unify dialog .modal-form input:read-only {
  background-color: #e2e8f0 !important;
  color: #1e293b !important;
}

html.orbita-wms-v2-unify dialog .modal-form input:focus,
html.orbita-wms-v2-unify dialog .modal-form select:focus,
html.orbita-wms-v2-unify dialog .modal-form textarea:focus {
  border-color: #0d5c63 !important;
  box-shadow: 0 0 0 2px rgba(13, 92, 99, 0.22) !important;
  outline: none !important;
}

html.orbita-wms-v2-unify dialog .modal-form input:-webkit-autofill,
html.orbita-wms-v2-unify dialog .modal-form input:-webkit-autofill:focus {
  -webkit-text-fill-color: #0f172a !important;
  box-shadow: 0 0 0 1000px #f8fafc inset !important;
}

/* ---------- Trace / tactical panels (keep accent, light shell) ---------- */
html.orbita-wms-v2-unify .tr-panel {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
}

/* ---------- Scan viewfinder: preserve contrast for camera / barcode ---------- */
html.orbita-wms-v2-unify .scan-camera-viewport,
html.orbita-wms-v2-unify .scan-viewfinder,
html.orbita-wms-v2-unify .hero-scan-viewport,
html.orbita-wms-v2-unify .putaway-overlay,
html.orbita-wms-v2-unify .scan-zero-click-hud__viewport {
  background: #0f172a !important;
  color: #e2e8f0 !important;
}

/* ---------- Legacy inline dark shells (orphan page <style> blocks) ---------- */
html.orbita-wms-v2-unify .sub,
html.orbita-wms-v2-unify .count,
html.orbita-wms-v2-unify .hint {
  color: #64748b !important;
}

html.orbita-wms-v2-unify .section h2 {
  color: #0f172a !important;
}

html.orbita-wms-v2-unify .filters {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}

html.orbita-wms-v2-unify .filters label {
  color: #64748b !important;
}

html.orbita-wms-v2-unify .btn {
  background: #ffffff !important;
  border-color: #0d9488 !important;
  color: #0d5c63 !important;
}

html.orbita-wms-v2-unify .btn:hover {
  background: #f0fdfa !important;
  border-color: #0f766e !important;
}

html.orbita-wms-v2-unify table,
html.orbita-wms-v2-unify .inbound-queue-table-scroll table {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}

html.orbita-wms-v2-unify th,
html.orbita-wms-v2-unify .inbound-queue-table-scroll thead th {
  background: #f8fafc !important;
  color: #64748b !important;
  box-shadow: 0 1px 0 #e2e8f0 !important;
}

html.orbita-wms-v2-unify td {
  color: #0f172a !important;
  border-bottom-color: #e2e8f0 !important;
}

html.orbita-wms-v2-unify tr:hover td {
  background: #f8fafc !important;
}

html.orbita-wms-v2-unify tr.inbound-row--closed td,
html.orbita-wms-v2-unify tr.inbound-row--closed:hover td {
  background: #f1f5f9 !important;
}

html.orbita-wms-v2-unify .inbound-queue-table-scroll {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.04) !important;
}

html.orbita-wms-v2-unify .inbound-tabs {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06) !important;
}

html.orbita-wms-v2-unify .inbound-tabs button {
  color: #64748b !important;
}

html.orbita-wms-v2-unify .inbound-tabs button:hover {
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
  background: #f8fafc !important;
  box-shadow: none !important;
}

html.orbita-wms-v2-unify .inbound-tabs button[aria-selected='true'] {
  color: #0d5c63 !important;
  border-color: #0d9488 !important;
  background: #f0fdfa !important;
  box-shadow: 0 0 0 1px rgba(13, 148, 136, 0.12) !important;
}

html.orbita-wms-v2-unify .actions a,
html.orbita-wms-v2-unify .actions button,
html.orbita-wms-v2-unify .inbound-act--secondary {
  color: #0d5c63 !important;
}

html.orbita-wms-v2-unify .inbound-act--primary {
  color: #0f766e !important;
}

html.orbita-wms-v2-unify .inbound-act--primary:hover,
html.orbita-wms-v2-unify .inbound-act--secondary:hover {
  color: #0d9488 !important;
}

html.orbita-wms-v2-unify .inbound-act--archived {
  color: #94a3b8 !important;
}

html.orbita-wms-v2-unify .inbound-closed-trace {
  border-top-color: #e2e8f0 !important;
  color: #64748b !important;
}

html.orbita-wms-v2-unify .modal {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
}

html.orbita-wms-v2-unify .modal .close {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #334155 !important;
}

html.orbita-wms-v2-unify .modal h4 {
  color: #0d5c63 !important;
}

html.orbita-wms-v2-unify .kv div:nth-child(odd) {
  color: #64748b !important;
}
