:root {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-input: #0b1220;
  --border: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --pending: #f59e0b;
  --done: #10b981;
  --failed: #ef4444;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }
.error { color: var(--failed); }

/* Login */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.login-card h1 { margin: 0 0 4px; font-size: 24px; }
.login-card .muted { margin: 0 0 12px; }

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.brand { font-size: 18px; font-weight: 700; }
.topbar-actions { display: flex; gap: 8px; }

.container { max-width: 1100px; margin: 0 auto; padding: 24px; }

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  text-align: center;
}
.stat-num { font-size: 30px; font-weight: 800; }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 4px; }
.stat-pending { color: var(--pending); }
.stat-done { color: var(--done); }
.stat-failed { color: var(--failed); }

/* Toolbar */
.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar input[type="text"],
.toolbar select { flex: 1; min-width: 180px; }

/* Inputs */
input, select, textarea {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }

label { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* Buttons */
.btn {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { filter: brightness(1.15); }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 10px; font-size: 13px; }

/* Table */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(37, 99, 235, 0.06); }

.serial { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; font-weight: 600; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge.pending { background: rgba(245, 158, 11, 0.15); color: var(--pending); }
.badge.done { background: rgba(16, 185, 129, 0.15); color: var(--done); }
.badge.failed { background: rgba(239, 68, 68, 0.15); color: var(--failed); }

.row-actions { display: flex; gap: 6px; }
.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 13px;
}
.icon-btn:hover { color: var(--text); border-color: var(--text); }
.icon-btn.danger:hover { color: var(--failed); border-color: var(--failed); }

.footer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  gap: 12px;
  flex-wrap: wrap;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}
.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  width: 100%;
  max-width: 440px;
}
.modal-card h2 { margin: 0 0 12px; }
.modal-card form { display: flex; flex-direction: column; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

@media (max-width: 640px) {
  .toolbar { flex-direction: column; }
  .toolbar input[type="text"], .toolbar select { min-width: 0; }
}

/* ============================================================
   Landing pública
   ============================================================ */

.landing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1140px;
  margin: 0 auto;
  padding: 18px 28px;
}
.landing-nav { display: flex; gap: 10px; }

.hero {
  max-width: 880px;
  margin: 0 auto;
  padding: 64px 24px 32px;
  text-align: center;
  background: radial-gradient(620px 260px at 50% -8%, rgba(37, 99, 235, 0.30), transparent 72%);
}

.pill {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.14);
  border: 1px solid rgba(59, 130, 246, 0.45);
  color: #93c5fd;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.hero h1 {
  font-size: 46px;
  line-height: 1.08;
  letter-spacing: -0.025em;
  margin: 18px 0 14px;
}
.hero-sub {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
  max-width: 620px;
  margin: 0 auto 28px;
}
.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn-lg { padding: 13px 22px; font-size: 16px; border-radius: 10px; }

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 48px;
  margin-top: 46px;
  flex-wrap: wrap;
}
.hero-stats div { display: flex; flex-direction: column; gap: 2px; }
.hero-stats strong { font-size: 26px; font-weight: 800; }
.hero-stats span { color: var(--muted); font-size: 13px; }

.section {
  max-width: 1080px;
  margin: 0 auto;
  padding: 46px 24px;
}
.section-head { text-align: center; margin-bottom: 30px; }
.eyebrow {
  color: #93c5fd;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.section-head h2 {
  font-size: 30px;
  letter-spacing: -0.02em;
  margin: 8px 0 0;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(228px, 1fr));
  gap: 16px;
}
.step-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  transition: transform 0.16s ease, border-color 0.16s ease;
}
.step-card:hover {
  transform: translateY(-3px);
  border-color: #3b82f6;
}
.step-num {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  font-weight: 800;
  margin-bottom: 14px;
}
.step-card h3 { margin: 0 0 8px; font-size: 17px; }
.step-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }

.code-card {
  max-width: 720px;
  margin: 0 auto;
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.code-top {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border);
}
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.red { background: #ef4444; }
.dot.yellow { background: #f59e0b; }
.dot.green { background: #10b981; }
.code-title { margin-left: 8px; color: var(--muted); font-size: 12px; }
.code-card pre { margin: 0; padding: 18px; overflow-x: auto; }
.code-card code {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.75;
  color: #cbd5e1;
}

.landing-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1080px;
  margin: 30px auto 0;
  padding: 22px 24px 34px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}

.link-btn {
  background: none;
  border: none;
  color: #93c5fd;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  font-family: inherit;
}
.link-btn:hover { text-decoration: underline; }
.back { align-self: flex-start; margin-bottom: 10px; }

@media (max-width: 720px) {
  .hero { padding-top: 40px; }
  .hero h1 { font-size: 33px; }
  .hero-sub { font-size: 16px; }
  .landing-header { padding: 14px 18px; }
  .section { padding: 34px 18px; }
  .landing-footer { flex-direction: column; gap: 10px; }
}

/* ============================================================
   Manual / guía por registro
   ============================================================ */

.guide-card {
  max-width: 640px;
  max-height: 88vh;
  overflow-y: auto;
}

.guide-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.guide-head h2 { margin: 4px 0 0; font-size: 22px; }

.serial-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0 4px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.10);
  border: 1px solid rgba(59, 130, 246, 0.35);
  font-size: 14px;
}
.serial-chip strong {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

.guide-steps {
  margin: 16px 0;
  padding-left: 22px;
  font-size: 14px;
  line-height: 1.75;
}
.guide-steps li { margin-bottom: 8px; }
.guide-steps strong { color: #fff; }
.guide-steps code {
  background: rgba(255, 255, 255, 0.07);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 12px;
}

.guide-code { margin-top: 8px; }
.guide-code .code-top { justify-content: flex-start; }
.guide-code .code-top .btn { margin-left: auto; }
.guide-code code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.guide-note {
  font-size: 12px;
  text-align: center;
  margin: 10px 0 0;
}

@media (max-width: 640px) {
  .guide-card { max-height: 94vh; padding: 20px; }
}

/* ============================================================
   Marca / logos
   ============================================================ */

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(37, 99, 235, 0.45));
}

.hero-logo {
  display: block;
  width: 210px;
  max-width: 55vw;
  margin: 0 auto 18px;
  filter: drop-shadow(0 14px 40px rgba(37, 99, 235, 0.35));
}

.login-mark {
  display: block;
  width: 68px;
  height: 68px;
  object-fit: contain;
  margin: 0 auto 8px;
  filter: drop-shadow(0 6px 20px rgba(37, 99, 235, 0.4));
}

@media (max-width: 720px) {
  .hero-logo { width: 160px; }
}
