:root {
  --blue: #1d4ed8;
  --green: #059669;
  --amber: #d97706;
  --red: #dc2626;
  --indigo: #4f46e5;
  --bg-dark: #0c1f45;
  --bg-dark2: #1a3870;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-dark2) 100%);
  min-height: 100vh;
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: #1f2937;
}

/* ── CARDS ── */
.card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}

/* ── INPUTS ── */
.inp {
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  width: 100%;
  transition: .2s;
  background: #fff;
}
.inp:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(29,78,216,.15); }
.inp.warn  { border-color: #f59e0b !important; background: #fffbeb !important; }
.inp.ok    { border-color: #10b981; background: #f0fdf4; }
.inp.empty { border-color: #e5e7eb; background: #f9fafb; }
.inp-auto  { border: 1.5px solid #c7d2fe; border-radius: 8px; padding: 7px 10px; font-size: 13px; width: 100%; background: #eef2ff; color: #3730a3; font-weight: 600; cursor: default; }
textarea.inp { resize: vertical; }

/* ── LABELS ── */
.lbl { font-size: 10.5px; font-weight: 700; letter-spacing: .7px; color: #374151; margin-bottom: 3px; display: block; text-transform: uppercase; }
.lbl .req  { color: #dc2626; }
.lbl .auto { color: #6366f1; font-size: 9px; font-weight: 600; letter-spacing: .5px; background: #eef2ff; padding: 1px 5px; border-radius: 4px; margin-left: 4px; }

/* ── BUTTONS ── */
.btn { border-radius: 9px; padding: 9px 18px; font-weight: 700; font-size: 13px; border: none; cursor: pointer; transition: .2s; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; filter: none; }
.btn-primary { background: linear-gradient(135deg,#1d4ed8,#2563eb); color: #fff; }
.btn-success { background: linear-gradient(135deg,#047857,#059669); color: #fff; }
.btn-amber   { background: linear-gradient(135deg,#b45309,#d97706); color: #fff; }
.btn-red     { background: linear-gradient(135deg,#b91c1c,#dc2626); color: #fff; }
.btn-gray    { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; }
.btn-indigo  { background: linear-gradient(135deg,#4338ca,#6366f1); color: #fff; }
.btn-sm      { padding: 6px 12px; font-size: 12px; }

/* ── TABS PRINCIPALES ── */
.main-tab { padding: 10px 22px; border-radius: 10px; cursor: pointer; font-weight: 700; font-size: 14px; transition: .2s; border: none; display: flex; align-items: center; gap: 7px; }
.main-tab.on  { background: #fff; color: var(--blue); box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.main-tab.off { background: rgba(255,255,255,.12); color: #bfdbfe; border: 1px solid rgba(255,255,255,.2); }
.main-tab.off:hover { background: rgba(255,255,255,.22); }

/* ── TABS INTERNOS ── */
.tab-btn { padding: 8px 20px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; transition: .2s; border: none; }
.tab-btn.on  { background: var(--blue); color: #fff; box-shadow: 0 4px 12px rgba(29,78,216,.35); }
.tab-btn.off { background: rgba(255,255,255,.15); color: #bfdbfe; border: 1px solid rgba(255,255,255,.2); }
.tab-btn.off:hover { background: rgba(255,255,255,.25); }

/* ── DROP ZONE ── */
.drop-zone {
  border: 2.5px dashed #93c5fd;
  border-radius: 12px;
  transition: all .25s;
  background: linear-gradient(135deg,#f0f7ff,#e0edff);
  cursor: pointer;
}
.drop-zone:hover, .drop-zone.over {
  border-color: var(--blue);
  background: linear-gradient(135deg,#dbeafe,#bfdbfe);
  transform: scale(1.01);
}

/* ── STAGE BOX ── */
.stage { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: 10px; font-size: 13px; }
.stage-proc { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.stage-ok   { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.stage-err  { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.stage-warn { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }

/* ── TOAST ── */
.toast-wrap { position: fixed; top: 16px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast-item { padding: 12px 18px; border-radius: 10px; color: #fff; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: fadeIn .3s ease-out; pointer-events: auto; max-width: 380px; }
.t-ok   { background: #059669; }
.t-err  { background: #dc2626; }
.t-warn { background: #d97706; }
.t-info { background: #2563eb; }

/* ── TABLE ── */
table { width: 100%; border-collapse: collapse; }
table th { background: #1e3a6f; color: #fff; font-size: 10.5px; padding: 9px 6px; text-align: left; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
table td { font-size: 11.5px; padding: 6px; border-bottom: 1px solid #f0f4f8; vertical-align: middle; }
tr:hover td { background: #f0f7ff; }
tr.rev-row td { background: #fffbeb; }
.edit-cell { min-width: 70px; max-width: 180px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; }
.edit-cell:focus { outline: 2px solid #2563eb; border-radius: 4px; background: #eff6ff; white-space: normal; }

/* ── PROGRESS ── */
.progress-bar  { height: 5px; background: #e5e7eb; border-radius: 3px; overflow: hidden; margin-top: 6px; }
.progress-fill { height: 100%; background: linear-gradient(90deg,#2563eb,#06b6d4); border-radius: 3px; transition: width .4s; }

/* ── SPIN ── */
.spin { animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── FADE IN ── */
.fade-in { animation: fadeIn .35s ease-out; }
@keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

/* ── VERIFICACION BADGE ── */
.vbadge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 700; }
.vbadge-ok   { background: #d1fae5; color: #065f46; }
.vbadge-warn { background: #fef3c7; color: #92400e; }
.vbadge-err  { background: #fee2e2; color: #991b1b; }

/* ── GRID UTILIDADES ── */
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.g3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-5 { padding: 20px; }
.p-6 { padding: 24px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.font-bold { font-weight: 700; }
.text-gray-400 { color: #9ca3af; }
.text-gray-500 { color: #6b7280; }
.text-gray-800 { color: #1f2937; }
.text-white  { color: #fff; }
.text-blue-200 { color: #bfdbfe; }
.text-blue-300 { color: #93c5fd; }
.text-blue-400 { color: #60a5fa; }
.text-green-300 { color: #6ee7b7; }
.text-green-400 { color: #34d399; }
.text-amber-600 { color: #d97706; }
.text-red-500   { color: #ef4444; }
.rounded-full { border-radius: 9999px; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }
.max-h-table { max-height: 70vh; }
.border-t { border-top: 1px solid #e5e7eb; }
.italic { font-style: italic; }
.whitespace-nowrap { white-space: nowrap; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.flex-shrink-0 { flex-shrink: 0; }
.space-y-2 > * + * { margin-top: 8px; }
.space-y-3 > * + * { margin-top: 12px; }
.rounded-xl { border-radius: 12px; }
.border { border: 1px solid #e5e7eb; }
.bg-blue-50  { background: #eff6ff; }
.bg-green-50 { background: #ecfdf5; }
.bg-amber-50 { background: #fffbeb; }
.bg-white { background: #fff; }
.shadow { box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* ── QUEUE ITEMS ── */
.queue-item { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px 14px; display: flex; align-items: center; gap: 10px; font-size: 12px; }
.queue-item.processing { background: #eff6ff; border-color: #bfdbfe; }
.queue-item.done       { background: #ecfdf5; border-color: #a7f3d0; }
.queue-item.error      { background: #fef2f2; border-color: #fecaca; }
.queue-item.warn       { background: #fffbeb; border-color: #fde68a; }

/* ── VERIFICATION PANEL ── */
.verif-panel { border-radius: 12px; border: 2px solid; padding: 16px; }
.verif-ok    { border-color: #10b981; background: #ecfdf5; }
.verif-warn  { border-color: #f59e0b; background: #fffbeb; }
.verif-err   { border-color: #ef4444; background: #fef2f2; }
.verif-field { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(0,0,0,.06); font-size: 12px; }
.verif-field:last-child { border-bottom: none; }
.verif-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.verif-label { font-weight: 600; color: #374151; min-width: 90px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; }
.verif-value { color: #1f2937; flex: 1; word-break: break-word; }
.verif-note  { color: #6b7280; font-size: 10px; font-style: italic; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .g2, .g3 { grid-template-columns: 1fr; }
  .lg-grid-2 { grid-template-columns: 1fr; }
}
.lg-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .lg-grid-2 { grid-template-columns: 1fr; } }

/* ── BADGE COUNT ── */
.badge-count { background: white; color: var(--blue); border-radius: 9999px; padding: 1px 8px; font-size: 11px; font-weight: 800; margin-left: 4px; }
.badge-indigo { background: #e0e7ff; color: #3730a3; border-radius: 9999px; padding: 1px 8px; font-size: 11px; font-weight: 800; margin-left: 4px; }

/* ── MOTOR STATUS BAR ── */
.motor-bar {
  background: rgba(5,120,70,.18);
  border: 1px solid rgba(16,185,129,.35);
  border-radius: 14px;
  padding: 12px 18px;
  backdrop-filter: blur(6px);
}
.chip {
  background: rgba(16,185,129,.15);
  border: 1px solid rgba(16,185,129,.4);
  color: #6ee7b7;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #10b981; box-shadow: 0 0 6px #10b981; display: inline-block; }

/* MODAL */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { background: #fff; border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.4); max-width: 560px; width: 100%; max-height: 90vh; overflow-y: auto; }
