/* ============================================================
   SaaS Albion — identidad visual "cámara del tesoro".
   Oro real sobre neutros cálidos. Sin recursos externos
   (CSP default-src 'none'; style-src 'self'), sin JavaScript.
   Dos temas vía prefers-color-scheme, ambos cuidados.
   ============================================================ */

/* ── Tokens: tema claro (papel cálido) por defecto ─────────── */
:root {
  color-scheme: light dark;

  --ground:    #f6f1e7;   /* papel cálido */
  --surface:   #fffdf8;
  --surface-2: #efe7d7;
  --line:      #e2d8c4;
  --ink:       #211d15;   /* casi negro cálido */
  --muted:     #6f6656;   /* gris cálido, elegido no heredado */

  --gold:      #9a6b12;   /* oro profundo, legible sobre papel */
  --gold-soft: #b3841f;
  --gold-line: #d8b970;
  --gold-ring: rgba(154, 107, 18, 0.16);
  --on-gold:   #fffaef;

  --ok:        #2f7d4f;
  --danger:    #b23b2e;

  --shadow:    0 10px 30px rgba(60, 44, 12, 0.10);
  --radius:    14px;
}

/* ── Tokens: tema oscuro (cámara del tesoro) ───────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --ground:    #0f0d09;   /* negro cálido */
    --surface:   #191510;
    --surface-2: #221c14;
    --line:      #332a1e;
    --ink:       #ede7da;   /* blanco roto cálido */
    --muted:     #a99d88;

    --gold:      #e4bd5c;   /* oro brillante sobre lo oscuro */
    --gold-soft: #f0d288;
    --gold-line: #6b5426;
    --gold-ring: rgba(228, 189, 92, 0.20);
    --on-gold:   #17120a;

    --ok:        #4cbd82;
    --danger:    #e5726a;

    --shadow:    0 14px 40px rgba(0, 0, 0, 0.45);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(120% 60% at 50% -10%, var(--gold-ring), transparent 60%),
    var(--ground);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ── Tipografía ────────────────────────────────────────────── */
h1, h2, h3 { text-wrap: balance; margin: 0 0 0.6rem; }
h1 {
  font-size: clamp(1.7rem, 1.2rem + 2vw, 2.4rem);
  font-weight: 800; letter-spacing: -0.02em; line-height: 1.15;
  color: var(--ink);
}
h2 { font-size: 1.35rem; font-weight: 750; letter-spacing: -0.01em; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 0.9rem; }
strong { font-weight: 700; }
a { color: var(--gold-soft); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

.eyebrow {
  text-transform: uppercase; letter-spacing: 0.16em; font-size: 0.72rem;
  font-weight: 700; color: var(--gold-soft);
}

/* ── Estructura de página ──────────────────────────────────── */
header {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
nav {
  max-width: 940px; margin: 0 auto; padding: 0.85rem 1.3rem;
  display: flex; justify-content: space-between; align-items: center;
}
nav .brand {
  font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em;
  color: var(--ink); display: inline-flex; align-items: center; gap: 0.5rem;
}
nav .brand::before {
  content: ""; width: 15px; height: 15px; border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, var(--gold-soft), var(--gold) 70%);
  box-shadow: 0 0 0 3px var(--gold-ring);
}
nav .links a { color: var(--muted); margin-left: 1.4rem; font-size: 0.95rem; font-weight: 600; }
nav .links a:hover { color: var(--gold-soft); text-decoration: none; }

main { max-width: 660px; width: 100%; margin: 0 auto; padding: 2.4rem 1.3rem 3rem; flex: 1; }
main.wide { max-width: 940px; }

footer { border-top: 1px solid var(--line); margin-top: auto; }
footer p {
  max-width: 940px; margin: 0 auto; padding: 1.3rem; color: var(--muted);
  font-size: 0.82rem;
}

/* ── Portada ───────────────────────────────────────────────── */
.hero { text-align: center; padding: 2.6rem 0 1.4rem; }
.hero h1 { max-width: 16ch; margin-inline: auto; }
.hero p { color: var(--muted); max-width: 46ch; margin-inline: auto; font-size: 1.08rem; }
.hero .cta { margin-top: 1.6rem; display: flex; gap: 0.7rem; justify-content: center; flex-wrap: wrap; }
.rule {
  width: 72px; height: 2px; margin: 1.1rem auto 0; border: 0; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

/* ── Superficies ───────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem 1.6rem;
  margin-bottom: 1.2rem;
}
.card.focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold-ring), var(--shadow);
}
.card.focus h2 { color: var(--ink); }
section { margin-bottom: 1.8rem; }

/* ── Flujo guiado: stepper (secuencia real) ────────────────── */
.stepper {
  list-style: none; display: flex; padding: 0; margin: 0.5rem 0 2rem;
}
.stepper li {
  flex: 1; text-align: center; position: relative;
  font-size: 0.8rem; color: var(--muted); font-weight: 600;
}
.stepper li::before {
  content: ""; position: absolute; top: 18px; right: 50%; width: 100%; height: 2px;
  background: var(--line);
}
.stepper li:first-child::before { display: none; }
.stepper .dot {
  position: relative; z-index: 1;
  width: 38px; height: 38px; margin: 0 auto 0.45rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--line);
  font-weight: 800; color: var(--muted);
}
.stepper .label { position: relative; z-index: 1; }
.stepper li.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.stepper li.done::before { background: var(--ok); }
.stepper li.done .label { color: var(--ink); }
.stepper li.current .dot {
  background: var(--gold); border-color: var(--gold); color: var(--on-gold);
  box-shadow: 0 0 0 5px var(--gold-ring);
}
.stepper li.current .label { color: var(--gold-soft); font-weight: 800; }

/* ── Planes (tarjetas de precios) ──────────────────────────── */
.plans {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1rem; margin: 1.6rem 0 0.6rem; align-items: stretch;
}
@media (max-width: 760px) { .plans { grid-template-columns: 1fr; } }

.plan {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.7rem 1.4rem;
}
.plan .tier {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--line); color: var(--muted);
  font-weight: 800; font-size: 0.85rem; margin-bottom: 0.8rem;
}
.plan h3 { font-size: 1.15rem; margin-bottom: 0.2rem; }
.plan .tagline { color: var(--muted); font-size: 0.86rem; margin-bottom: 0.9rem; }
.plan .price {
  font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1;
  font-variant-numeric: tabular-nums; color: var(--ink);
}
.plan .price small { display: block; font-size: 0.82rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.plan .save {
  display: inline-block; margin-top: 0.5rem; padding: 0.12rem 0.6rem;
  background: var(--gold-ring); color: var(--gold-soft);
  border-radius: 999px; font-size: 0.76rem; font-weight: 700;
}
.plan ul { list-style: none; padding: 0; margin: 1.1rem 0 1.3rem; display: flex; flex-direction: column; gap: 0.55rem; }
.plan li { display: flex; gap: 0.55rem; align-items: flex-start; font-size: 0.92rem; }
.plan li::before {
  content: "✓"; color: var(--gold); font-weight: 800; flex: none;
  line-height: 1.5;
}
.plan .btn { margin-top: auto; width: 100%; justify-content: center; }

.plan.featured {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold-ring), var(--shadow);
}
@media (min-width: 761px) { .plan.featured { transform: translateY(-8px); } }
.plan.featured .tier { border-color: var(--gold); color: var(--gold-soft); }
.plan .ribbon {
  position: absolute; top: 0; right: 0;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  color: var(--on-gold); font-size: 0.72rem; font-weight: 800;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0.28rem 0.8rem; border-radius: 0 var(--radius) 0 10px;
}

/* ── Tablas (precios, licencias) ───────────────────────────── */
table {
  border-collapse: collapse; width: 100%; margin: 0.4rem 0 1rem;
  font-size: 0.95rem; font-variant-numeric: tabular-nums;
}
th, td { padding: 0.6rem 0.85rem; text-align: left; border-bottom: 1px solid var(--line); }
thead th, tr:first-child th {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--gold-soft); font-weight: 700;
}
tbody tr:last-child td, tr:last-child td { border-bottom: 0; }
td form { margin: 0; }

/* ── Formularios ───────────────────────────────────────────── */
label { display: block; margin: 0.9rem 0 0.3rem; font-weight: 650; font-size: 0.92rem; }
input {
  width: 100%; max-width: 100%; padding: 0.62rem 0.75rem;
  background: var(--ground); color: var(--ink);
  border: 1px solid var(--line); border-radius: 9px; font-size: 1rem;
  font-family: inherit;
}
input:focus-visible {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-ring);
}
input[type="number"] { max-width: 110px; font-variant-numeric: tabular-nums; }
.pay-form { margin-top: 1.1rem; }
form.inline { display: flex; gap: 0.6rem; align-items: flex-end; flex-wrap: wrap; }
form.inline label { margin: 0; }
form.inline input { width: auto; }

/* ── Botones ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  margin-top: 0.9rem; padding: 0.6rem 1.3rem;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  color: var(--on-gold); font-weight: 750; font-size: 0.97rem;
  border: 0; border-radius: 9px; cursor: pointer; text-decoration: none;
  transition: filter 0.15s ease, transform 0.05s ease;
}
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--gold-ring); outline-offset: 2px; }
.btn.big { font-size: 1.05rem; padding: 0.75rem 1.7rem; }
.btn.secondary {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
}
.btn.secondary:hover { color: var(--ink); border-color: var(--muted); filter: none; }
.btn.small { padding: 0.32rem 0.8rem; font-size: 0.84rem; margin: 0; }
.btn.danger { background: none; border: 1px solid var(--danger); color: var(--danger); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); filter: none; }

/* ── Detalles y mensajes ───────────────────────────────────── */
.ok { color: var(--ok); font-weight: 650; }
.err { color: var(--danger); font-weight: 650; }
.hint { color: var(--muted); font-size: 0.88rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.section-head { text-align: center; margin-bottom: 0.3rem; }
.custom-qty { margin-top: 0.8rem; }

/* ── Panel de administración ───────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.table-wrap table { margin: 0; font-size: 0.9rem; }
.table-wrap th, .table-wrap td { white-space: nowrap; }
.actions { display: flex; gap: 0.4rem; }
.actions form { margin: 0; }
.row-off { opacity: 0.55; }
.pill {
  display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px;
  font-size: 0.74rem; font-weight: 700; background: var(--surface-2); color: var(--muted);
}
.pill.on { background: color-mix(in srgb, var(--ok) 22%, transparent); color: var(--ok); }
.pill.warn { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.pill.off { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }

.code-box {
  background: var(--ground); border: 1px dashed var(--gold-line);
  border-radius: 10px; padding: 0.75rem 0.95rem; margin: 0.6rem 0;
}
code {
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  font-size: 1.02em; color: var(--gold-soft); word-break: break-all;
}

details { margin-top: 0.6rem; }
summary { cursor: pointer; }
.summary-block { margin-top: 1.4rem; }
.summary-block > summary { color: var(--muted); font-size: 0.9rem; padding: 0.5rem 0; font-weight: 600; }
.logout { margin-top: 2.2rem; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
