:root {
  --bg: #000000;
  --card: #0A0A0A;
  --line: rgba(255, 255, 255, 0.12);
  --text: #FFFFFF;
  --muted: #A1A1A1;
  --faint: #666666;
  --green: #6830EA;
  --red: #F87171;
  color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  background: var(--bg);
  color: var(--muted);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text); text-decoration: none; }

.container { max-width: 720px; margin: 0 auto; padding: 0 1.5rem; }

nav { border-bottom: 1px solid var(--line); }
nav .container { max-width: 1200px; display: flex; align-items: center; justify-content: space-between; height: 64px; }
nav .logo { font-weight: 600; font-size: 1rem; }
nav a { margin-left: 1.5rem; font-size: 0.8125rem; color: var(--muted); }
nav a:hover { color: var(--text); }

.page { padding: 3.5rem 0 4rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 2.25rem; }
h1 { font-size: 1.35rem; font-weight: 600; color: var(--text); margin-bottom: 0.35rem; }
.subtitle { font-size: 0.9375rem; margin-bottom: 1.5rem; }
.eyebrow { font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); margin-bottom: 0.75rem; }

.steps { display: flex; align-items: center; margin-bottom: 2rem; }
.step { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8125rem; color: var(--faint); white-space: nowrap; }
.step .dot { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-size: 0.75rem; }
.step.active { color: var(--text); }
.step.active .dot { border-color: var(--text); color: var(--text); }
.step.done { color: var(--green); }
.step.done .dot { border-color: var(--green); color: var(--green); }
.step.error { color: var(--red); }
.step.error .dot { border-color: var(--red); color: var(--red); }
.steps .bar { height: 1px; background: var(--line); flex: 1; min-width: 16px; margin: 0 0.75rem; }

.result { font-size: 0.9375rem; margin-top: 1.25rem; }
.result.success { color: var(--green); }
.result.error { color: var(--red); }
.result .nota { color: var(--muted); font-size: 0.8125rem; margin-top: 0.35rem; }
.urls { margin-top: 0.75rem; }
.urls a { display: inline-block; color: var(--text); text-decoration: underline; }

.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1.5rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 0.625rem 1.25rem; border-radius: 8px; font-size: 0.875rem; font-weight: 600; border: none; cursor: pointer; text-decoration: none; font-family: inherit; }
.btn-primary { background: var(--text); color: #000000; }
.btn-primary:hover { background: #E5E5E5; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-secondary { border: 1px solid var(--line); color: var(--text); }
.btn-secondary:hover { border-color: rgba(255, 255, 255, 0.35); }

.resumen { margin-top: 1.5rem; }
.empresa { font-size: 0.875rem; color: var(--text); margin-bottom: 1rem; }
.empresa span { color: var(--muted); }
.ordenes { display: flex; flex-direction: column; gap: 0.75rem; }
.orden { border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.25rem; background: var(--bg); }
.orden-top { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.orden-top strong { color: var(--text); font-size: 0.9375rem; }
.orden-top .precio { color: var(--text); font-size: 0.875rem; white-space: nowrap; }
.orden-meta { font-size: 0.8125rem; color: var(--muted); margin-top: 0.25rem; }
.orden-meta strong { color: var(--text); font-weight: 600; }

.badge { display: inline-flex; align-items: center; padding: 0.1rem 0.5rem; border-radius: 999px; border: 1px solid var(--line); font-size: 0.6875rem; letter-spacing: 0.04em; text-transform: uppercase; }
.badge.pending { color: var(--muted); }
.badge.creando { color: var(--text); border-color: rgba(255, 255, 255, 0.35); }
.badge.creando::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid currentColor; border-top-color: transparent; margin-right: 0.4rem; animation: fb-spin 0.8s linear infinite; }
.badge .puntos span { animation: fb-dot 1.2s infinite; }
.badge .puntos span:nth-child(2) { animation-delay: 0.2s; }
.badge .puntos span:nth-child(3) { animation-delay: 0.4s; }
.badge.ok { color: var(--green); border-color: rgba(104, 48, 234, 0.35); }
.badge.error { color: var(--red); border-color: rgba(248, 113, 113, 0.3); }

.progreso { position: relative; height: 3px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 0 0 1.5rem; }
.progreso[hidden] { display: none; }
.progreso span { position: absolute; top: 0; left: -40%; width: 40%; height: 100%; background: var(--text); border-radius: 999px; animation: fb-progress 1.4s ease-in-out infinite; }
@keyframes fb-progress { 0% { left: -40%; } 100% { left: 100%; } }
@keyframes fb-spin { to { transform: rotate(360deg); } }
@keyframes fb-dot { 0%, 80%, 100% { opacity: 0.2; } 40% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .progreso span, .badge.creando::before, .badge .puntos span, .spinner { animation: none; }
  .progreso span { left: 30%; }
}

.aviso { font-size: 0.8125rem; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 0.75rem 1rem; margin-top: 1.25rem; }
.subtle { font-size: 0.8125rem; color: var(--muted); }

::placeholder { color: #666666; opacity: 1; font-weight: 400; -webkit-text-fill-color: #666666; }
input::placeholder, textarea::placeholder { color: #666666; opacity: 1; font-weight: 400; -webkit-text-fill-color: #666666; }

.pm-field { margin-bottom: 1.5rem; }
.pm-label { display: block; margin-bottom: 0.5rem; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: #C0C0C0; }
.pm-hint { margin-top: 0.35rem; font-size: 0.75rem; color: var(--faint); }
.pm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.5rem; }
.pm-groups { display: block; }
.pm-group { margin-bottom: 0.85rem; }
.pm-group:last-child { margin-bottom: 0; }
.pm-group-title { margin-bottom: 0.35rem; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.pm-card { position: relative; display: flex; align-items: center; gap: 0.55rem; width: 100%; padding: 0.6rem 0.7rem; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); cursor: pointer; font-family: inherit; text-align: left; transition: border-color 0.15s, background 0.15s, box-shadow 0.15s; }
.pm-card:hover { border-color: rgba(255, 255, 255, 0.3); background: #0F0F0F; }
.pm-card.selected { border-color: var(--line); background: var(--bg); box-shadow: none; }
.pm-card.selected:hover { border-color: rgba(255, 255, 255, 0.3); background: #0F0F0F; }
.pm-card:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.pm-radio { width: 15px; height: 15px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.28); flex: 0 0 auto; position: relative; transition: border-color 0.15s; }
.pm-card.selected .pm-radio { border-color: var(--text); }
.pm-card.selected .pm-radio::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--text); }
.pm-icon { width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--line); background: #111111; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.pm-logo { width: 22px; height: 22px; object-fit: contain; display: block; }
.pm-texto { min-width: 0; }
.pm-name { display: block; font-size: 0.78rem; font-weight: 600; color: var(--text); line-height: 1.3; }
.pm-meta { display: block; font-size: 0.65rem; color: var(--muted); }

.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--text); border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -2px; margin-right: 0.5rem; }
.spinner[hidden] { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.info { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-top: 1.5rem; }
.info > div { background: var(--card); padding: 1.25rem 1.5rem; }
.info h2 { font-size: 0.9375rem; color: var(--text); margin-bottom: 0.4rem; }
.info p { font-size: 0.8125rem; color: var(--muted); }

.footer { border-top: 1px solid var(--line); padding: 1.5rem 0; }
.footer .container { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: space-between; font-size: 0.8125rem; color: var(--faint); }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--text); }

@media (max-width: 640px) {
  .info { grid-template-columns: 1fr; }
  .card { padding: 1.5rem; }
  .step .lbl { display: none; }
  .page { padding: 2.5rem 0 3rem; }
}
