/* ============================================================================
   MiDeuda.app — Editorial Financial Design System
   ============================================================================ */

/* ---- Design tokens ---------------------------------------------------- */
:root {
  /* Palette */
  --ink: #1a1612;
  --ink-soft: #3a3530;
  --ink-mute: #6e6862;
  --ink-faint: #b3aca4;
  --paper: #f5f1e8;
  --paper-deep: #ebe5d6;
  --paper-card: #fdfaf2;
  --rule: #d8d1bf;
  --rule-soft: #e6dfca;

  --bordeaux: #7a1530;
  --bordeaux-deep: #5a0e22;
  --bordeaux-soft: #f0d4dc;
  --bordeaux-tint: #fbeaef;

  --moss: #264b3a;
  --moss-tint: #d6e4dc;

  --amber: #b8860b;
  --amber-tint: #f5e8c5;

  --danger: #8a2828;
  --danger-tint: #f5d8d8;

  /* Typography */
  --font-display: 'Fraunces', 'Times New Roman', Georgia, serif;
  --font-body: 'Inter Tight', -apple-system, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;
  --space-10: 128px;

  /* Layout */
  --container: 1200px;
  --container-narrow: 760px;
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 16px;

  /* Motion */
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---- Reset ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; }
input, textarea, select, button {
  font-family: inherit;
  color: inherit;
}

/* ---- Typography ------------------------------------------------------- */
.display, h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0;
}

h1 { font-size: clamp(2.4rem, 5vw, 4.2rem); line-height: 1.02; }
h2 { font-size: clamp(1.8rem, 3.2vw, 2.6rem); line-height: 1.1; }
h3 { font-size: 1.35rem; line-height: 1.25; font-weight: 500; }
h4 { font-size: 1rem; font-weight: 600; margin: 0; letter-spacing: -0.01em; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
}

.eyebrow-num {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--bordeaux);
  font-weight: 600;
}

.eyebrow-num::before {
  content: attr(data-num);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0;
  text-transform: none;
  color: var(--bordeaux);
}

.lead {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 1.6vw, 1.35rem);
  line-height: 1.45;
  font-weight: 400;
  font-style: italic;
  color: var(--ink-soft);
  letter-spacing: -0.005em;
}

p { margin: 0 0 var(--space-4); }
strong { font-weight: 600; }

.dot { color: var(--bordeaux); }

/* Pull quote */
.pull-quote {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-style: italic;
  font-weight: 400;
  line-height: 1.2;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin: var(--space-7) 0;
  padding-left: var(--space-5);
  border-left: 2px solid var(--bordeaux);
}

/* ---- Layout primitives ------------------------------------------------ */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--space-5);
}
.container-narrow {
  max-width: var(--container-narrow);
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.rule {
  height: 1px;
  background: var(--rule);
  border: 0;
  margin: 0;
}
.rule-thick {
  height: 2px;
  background: var(--ink);
  border: 0;
  margin: 0;
}

/* ---- Top navigation bar ---------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.topbar-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 18px var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
}
.topbar a.logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--ink);
  height: 28px;
}
.topbar a.logo svg { height: 28px; width: auto; }

.topbar-nav {
  display: flex;
  gap: var(--space-6);
  align-items: center;
}
.topbar-nav a {
  font-size: 14px;
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 500;
  transition: color .2s var(--ease);
}
.topbar-nav a:hover { color: var(--bordeaux); }

.topbar-right {
  display: flex;
  gap: var(--space-3);
  align-items: center;
}

.user-badge {
  font-size: 13px;
  color: var(--ink-mute);
  font-family: var(--font-mono);
}

.topbar-link {
  font-size: 14px;
  text-decoration: none;
  color: var(--bordeaux);
  font-weight: 500;
  white-space: nowrap;
  transition: color .2s var(--ease);
}
.topbar-link:hover { color: var(--bordeaux-soft); }

@media (max-width: 720px) {
  .topbar-nav { display: none; }
  .topbar-inner { padding: 14px var(--space-4); gap: var(--space-3); }
  .topbar-right { gap: var(--space-2); }
  /* Email ocupa demasiado, lo ocultamos en móvil */
  .user-badge { display: none; }
  /* "Mi certificado" pasa a texto corto */
  .topbar-link { font-size: 13px; }
}
@media (max-width: 480px) {
  /* En pantallas muy pequeñas, abreviar aún más */
  .topbar-link { font-size: 12px; }
}

/* ---- Buttons ---------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform .25s var(--ease), background .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease);
  line-height: 1;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.btn-primary:hover {
  background: var(--bordeaux);
  border-color: var(--bordeaux);
  transform: translateY(-1px);
}

.btn-bordeaux {
  background: var(--bordeaux);
  color: var(--paper);
  border-color: var(--bordeaux);
}
.btn-bordeaux:hover {
  background: var(--bordeaux-deep);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.btn-ghost:hover {
  background: var(--ink);
  color: var(--paper);
}

.btn-link {
  background: transparent;
  color: var(--ink);
  padding: 8px 0;
  border-radius: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
}
.btn-link:hover { color: var(--bordeaux); border-bottom-color: var(--bordeaux); }

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 15px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ============================================================================
   LANDING
   ============================================================================ */

/* ---- Hero ------------------------------------------------------------- */
.hero {
  position: relative;
  padding: var(--space-9) 0 var(--space-10);
  overflow: hidden;
  border-bottom: 1px solid var(--rule);
}

/* Subtle grain texture using SVG noise */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.04 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  pointer-events: none;
  opacity: 0.6;
}

.hero-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--space-5);
  position: relative;
  z-index: 1;
}

.hero-headline {
  font-size: clamp(2.8rem, 8vw, 6.8rem);
  line-height: 0.96;
  letter-spacing: -0.035em;
  font-weight: 400;
  margin: 0 0 var(--space-6);
  max-width: 14ch;
}
.hero-headline em {
  font-style: italic;
  font-weight: 400;
  color: var(--bordeaux);
}
.hero-headline .small-cap {
  font-size: 0.5em;
  font-style: italic;
  font-weight: 400;
  color: var(--ink-mute);
  display: block;
  margin-top: 0.25em;
  letter-spacing: -0.01em;
  max-width: 22ch;
}

.hero-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-mute);
  display: flex;
  gap: var(--space-5);
  margin-bottom: var(--space-6);
  align-items: center;
}
.hero-meta span:not(:last-child)::after {
  content: '·';
  margin-left: var(--space-5);
  color: var(--bordeaux);
}

/* Bottom row: lead text on the left, stat on the right */
.hero-foot {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 240px;
  gap: var(--space-8);
  align-items: end;
  margin-top: var(--space-7);
}

.hero-cta {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-5);
  flex-wrap: wrap;
}

.hero-stat {
  border-left: 1px solid var(--rule);
  padding-left: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.hero-stat-num {
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 6vw, 5rem);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--bordeaux);
  font-weight: 400;
}
.hero-stat-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-mute);
  line-height: 1.4;
}
.hero-stat-rule {
  width: 28px;
  height: 1px;
  background: var(--bordeaux);
  margin-bottom: var(--space-2);
}

@media (max-width: 900px) {
  .hero-foot {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
  .hero-stat {
    border-left: 0;
    padding-left: 0;
    border-top: 1px solid var(--rule);
    padding-top: var(--space-5);
  }
}

/* ---- Hero animation -------------------------------------------------- */
.fade-up {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeUp 0.9s var(--ease-out) forwards;
}
.fade-up-1 { animation-delay: 0.05s; }
.fade-up-2 { animation-delay: 0.18s; }
.fade-up-3 { animation-delay: 0.32s; }
.fade-up-4 { animation-delay: 0.48s; }
.fade-up-5 { animation-delay: 0.62s; }

@keyframes fadeUp {
  to { opacity: 1; transform: none; }
}

/* ---- Marquee ticker -------------------------------------------------- */
.ticker {
  background: var(--ink);
  color: var(--paper);
  padding: 14px 0;
  overflow: hidden;
  white-space: nowrap;
  border-bottom: 1px solid var(--ink);
}
.ticker-track {
  display: inline-flex;
  gap: var(--space-7);
  animation: marquee 60s linear infinite;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.ticker-track span { display: inline-flex; align-items: center; gap: var(--space-3); }
.ticker-track .dot { color: var(--bordeaux); font-size: 18px; line-height: 0; }

@keyframes marquee {
  to { transform: translateX(-50%); }
}

/* ---- Section base ---------------------------------------------------- */
.section {
  padding: var(--space-9) 0;
  border-bottom: 1px solid var(--rule);
}
.section-dark {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink-soft);
}
.section-dark .eyebrow,
.section-dark .eyebrow-num,
.section-dark .lead { color: var(--paper); }
.section-dark .eyebrow-num::before,
.section-dark .eyebrow-num { color: var(--bordeaux-soft); }
.section-dark h1, .section-dark h2, .section-dark h3 { color: var(--paper); }

.section-cream {
  background: var(--paper-deep);
}

.section-head {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--space-7);
  margin-bottom: var(--space-7);
  align-items: start;
}
.section-head h2 { max-width: 18ch; }

@media (max-width: 760px) {
  .section-head {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }
}

/* ---- Feature columns (process steps) -------------------------------- */
.process {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--rule);
}
.process-step {
  padding: var(--space-6) var(--space-5) var(--space-6) 0;
  border-right: 1px solid var(--rule);
  position: relative;
}
.process-step:last-child { border-right: 0; }

.process-step .num {
  font-family: var(--font-display);
  font-size: 64px;
  font-weight: 400;
  line-height: 1;
  color: var(--bordeaux);
  font-style: italic;
  letter-spacing: -0.02em;
}
.process-step h3 {
  margin: var(--space-4) 0 var(--space-3);
}
.process-step p {
  color: var(--ink-soft);
  font-size: 15px;
  margin: 0;
  max-width: 38ch;
}
.process-step .icon-box {
  position: absolute;
  top: var(--space-6);
  right: var(--space-5);
  width: 32px;
  height: 32px;
  color: var(--ink-faint);
}

@media (max-width: 800px) {
  .process { grid-template-columns: 1fr; }
  .process-step { border-right: 0; border-bottom: 1px solid var(--rule); padding-right: 0; }
  .process-step:last-child { border-bottom: 0; }
}

/* ---- Two-column editorial split ------------------------------------- */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-8);
  align-items: start;
}
@media (max-width: 800px) { .split { grid-template-columns: 1fr; gap: var(--space-6); } }

/* ---- Drop cap -------------------------------------------------------- */
.dropcap::first-letter {
  font-family: var(--font-display);
  font-size: 5em;
  line-height: 0.85;
  float: left;
  margin: 0.05em 0.08em 0 0;
  color: var(--bordeaux);
  font-weight: 500;
  font-style: italic;
}

/* ---- Fact card grid -------------------------------------------------- */
.facts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
}
.fact {
  border-top: 2px solid var(--ink);
  padding: var(--space-5) 0;
}
.fact-num {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 4.5vw, 3.6rem);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-weight: 400;
}
.fact-num em {
  font-style: italic;
  color: var(--bordeaux);
  font-weight: 400;
}
.fact-label {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: var(--space-3);
  line-height: 1.4;
}
@media (max-width: 760px) { .facts { grid-template-columns: repeat(2, 1fr); } }

/* ---- Pricing / CTA card --------------------------------------------- */
.cta-block {
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius-lg);
  padding: clamp(var(--space-6), 5vw, var(--space-8));
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-7);
  align-items: center;
  position: relative;
  overflow: hidden;
}
.cta-block::after {
  content: '';
  position: absolute;
  right: -120px;
  top: -120px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--bordeaux) 0%, transparent 70%);
  opacity: 0.5;
  pointer-events: none;
}
.cta-block h2 { color: var(--paper); position: relative; z-index: 1; max-width: 18ch; }
.cta-block p { color: var(--ink-faint); margin-top: var(--space-4); max-width: 50ch; position: relative; z-index: 1;}
.cta-actions { display: flex; gap: var(--space-3); position: relative; z-index: 1; flex-wrap: wrap; }
.cta-actions .btn-bordeaux { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.cta-actions .btn-bordeaux:hover { background: var(--bordeaux); color: var(--paper); }
@media (max-width: 800px) {
  .cta-block { grid-template-columns: 1fr; }
}

/* ---- Footer ---------------------------------------------------------- */
.footer {
  background: var(--ink);
  color: var(--paper);
  padding: var(--space-8) 0 var(--space-6);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: var(--space-6);
  margin-bottom: var(--space-7);
}
.footer-brand .logo { display: inline-block; height: 28px; color: var(--paper); margin-bottom: var(--space-3); }
.footer-brand .logo svg { height: 28px; width: auto; }
.footer-brand p { color: var(--ink-faint); font-size: 14px; max-width: 36ch; }
.footer h4 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bordeaux-soft);
  margin: 0 0 var(--space-4);
  font-weight: 600;
}
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer li { margin-bottom: var(--space-2); }
.footer a {
  color: var(--paper);
  text-decoration: none;
  font-size: 14px;
  opacity: 0.85;
  transition: opacity .2s var(--ease);
}
.footer a:hover { opacity: 1; color: var(--bordeaux-soft); }

.footer-base {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-5);
  border-top: 1px solid var(--ink-soft);
  font-size: 12px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}
@media (max-width: 800px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
  .footer-base { flex-direction: column; gap: var(--space-3); text-align: center; }
}

/* ============================================================================
   AUTH (login / register)
   ============================================================================ */

.auth-page {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: calc(100vh - 64px);
}
.auth-side {
  background: var(--ink);
  color: var(--paper);
  padding: var(--space-8) var(--space-7);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.auth-side::after {
  content: '';
  position: absolute;
  bottom: -100px;
  right: -100px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--bordeaux) 0%, transparent 70%);
  opacity: 0.4;
  pointer-events: none;
}
.auth-side h1 {
  color: var(--paper);
  font-size: clamp(2rem, 3.5vw, 3rem);
  position: relative;
  z-index: 1;
  max-width: 16ch;
}
.auth-side h1 em { color: var(--bordeaux-soft); font-style: italic; }
.auth-side .lead { color: var(--ink-faint); position: relative; z-index: 1; }
.auth-side-foot {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  position: relative;
  z-index: 1;
}

.auth-form-wrap {
  padding: var(--space-8) var(--space-7);
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--paper);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}
.auth-card .eyebrow-num { margin-bottom: var(--space-4); }
.auth-card h2 { margin-bottom: var(--space-2); font-size: 2rem; }
.auth-card .helper { color: var(--ink-mute); font-size: 14px; margin-bottom: var(--space-6); }

@media (max-width: 800px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-side { padding: var(--space-6); }
  .auth-side h1 { font-size: 1.6rem; }
  .auth-form-wrap { padding: var(--space-6); }
}

/* ---- Form fields ---------------------------------------------------- */
.field { margin-bottom: var(--space-4); }
.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: var(--space-2);
  font-weight: 500;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 14px 16px;
  font-size: 15px;
  font-family: var(--font-body);
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: var(--ink);
  transition: border-color .2s var(--ease), background .2s var(--ease);
  outline: none;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--ink);
  background: #fff;
}
.field input::placeholder,
.field textarea::placeholder {
  color: var(--ink-faint);
}
.field textarea { font-family: var(--font-mono); font-size: 13px; resize: vertical; }
.full-width { grid-column: 1 / -1; }

.error-msg {
  background: var(--danger-tint);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  border-left: 3px solid var(--danger);
}
.hidden { display: none !important; }

.auth-card .btn-primary { width: 100%; justify-content: center; padding: 14px; font-size: 15px; }

.auth-foot-link {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--rule);
  font-size: 14px;
  color: var(--ink-mute);
  text-align: center;
}
.auth-foot-link a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--bordeaux); padding-bottom: 1px; }
.auth-foot-link a:hover { color: var(--bordeaux); }

/* ============================================================================
   DASHBOARD
   ============================================================================ */

.dashboard {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--space-7) var(--space-5);
  flex: 1;
}

.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: var(--space-5);
  margin-bottom: var(--space-7);
  padding-bottom: var(--space-5);
  border-bottom: 2px solid var(--ink);
}
.dash-header h1 {
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  margin: 0 0 var(--space-2);
  letter-spacing: -0.025em;
}
.dash-header .subtitle {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--ink-mute);
  font-size: 1.1rem;
  margin: 0;
}

/* ---- Dossier card --------------------------------------------------- */
.dossier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: var(--space-5);
}

.dossier-card {
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  position: relative;
  transition: border-color .25s var(--ease), transform .25s var(--ease);
}
.dossier-card:hover { border-color: var(--ink); }

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
}

.status-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 999px;
  font-weight: 600;
}
.status-pending           { background: var(--amber-tint); color: var(--amber); }
.status-processing        { background: var(--paper-deep); color: var(--ink-soft); }
.status-completed         { background: var(--bordeaux-tint); color: var(--bordeaux); }
.status-activated         { background: var(--moss-tint); color: var(--moss); }
.status-identity_pending  { background: var(--amber-tint); color: var(--amber); }
.status-identity_confirmed{ background: var(--moss-tint); color: var(--moss); }
.status-error             { background: var(--danger-tint); color: var(--danger); }

.card-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.05em;
}

.card-body h3 {
  font-size: 1.4rem;
  margin: 0 0 var(--space-2);
  letter-spacing: -0.02em;
  font-weight: 500;
}
.card-detail {
  font-size: 13px;
  color: var(--ink-mute);
  margin: 0 0 var(--space-1);
  font-family: var(--font-mono);
}
.card-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: var(--space-2);
}

.card-actions {
  border-top: 1px solid var(--rule);
  padding-top: var(--space-4);
  margin-top: auto;
}

.action-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.action-hint {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0;
  line-height: 1.5;
}
.input-sm {
  padding: 10px 14px;
  font-size: 14px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  width: 100%;
  outline: none;
  transition: border-color .2s var(--ease);
}
.input-sm:focus { border-color: var(--ink); }

.action-row { display: flex; gap: var(--space-2); flex-wrap: wrap; }

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-9) var(--space-5);
  background: var(--paper-card);
  border: 1px dashed var(--rule);
  border-radius: var(--radius-lg);
}
.empty-state .empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--space-4);
  color: var(--ink-faint);
}
.empty-state h3 { margin: 0 0 var(--space-2); font-size: 1.6rem; }
.empty-state p { color: var(--ink-mute); margin: 0 0 var(--space-5); }

/* ---- OTP modal ------------------------------------------------------ */
.otp-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 22, 18, 0.65);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  backdrop-filter: blur(4px);
}
.otp-modal-inner {
  background: var(--paper-card);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  border: 1px solid var(--rule);
}
.otp-modal-inner h3 { font-size: 1.4rem; margin: 0 0 var(--space-2); }
.otp-modal-inner p { font-size: 14px; color: var(--ink-mute); margin: 0 0 var(--space-4); }

.reports-list {
  background: var(--paper-deep);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  margin-top: var(--space-3);
}
.reports-list-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 var(--space-2);
}
.reports-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-1) 0;
  font-size: 13px;
}
.reports-list-item a {
  color: var(--bordeaux);
  text-decoration: none;
  border-bottom: 1px solid var(--bordeaux);
  font-family: var(--font-mono);
  word-break: break-all;
}
.reports-list-item a:hover { color: var(--bordeaux-deep); }
.reports-list-item .case {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
}

/* ============================================================================
   DOSSIER WIZARD
   ============================================================================ */

.dossier-page {
  max-width: var(--container-narrow);
  margin: 0 auto;
  padding: var(--space-7) var(--space-5);
  flex: 1;
}

.dossier-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-7);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--rule);
}
.step {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  opacity: 0.4;
  transition: opacity .25s var(--ease);
}
.step.active { opacity: 1; }
.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--paper-deep);
  color: var(--ink-mute);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  transition: background .25s var(--ease), color .25s var(--ease);
}
.step.active .step-num {
  background: var(--bordeaux);
  color: var(--paper);
}
.step-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 500;
}
.step-line {
  width: 32px;
  height: 1px;
  background: var(--rule);
}

/* Stepper responsive en móvil:
   - Ocultar labels de todos los pasos excepto el ACTUAL (.current)
   - Pasos previos (.active) muestran solo el número
   - Reducir gaps y líneas para que el stepper quepa */
@media (max-width: 640px) {
  .dossier-stepper {
    gap: var(--space-2);
    padding-bottom: var(--space-4);
    margin-bottom: var(--space-5);
  }
  .step-line { width: 16px; }
  .step .step-label { display: none; }
  .step.current .step-label { display: inline; }
  .step { gap: var(--space-1); }
}
@media (max-width: 380px) {
  /* En pantallas muy pequeñas, ocultar TODOS los labels */
  .step.current .step-label { display: none; }
}

.step-panel { display: none; }
.step-panel.active {
  display: block;
  animation: fadeUp 0.5s var(--ease-out);
}
.step-panel h2 { font-size: clamp(2rem, 3.5vw, 2.6rem); margin-bottom: var(--space-2); }
.step-panel .hint {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--ink-mute);
  font-size: 1.05rem;
  margin-bottom: var(--space-6);
}

.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
@media (max-width: 600px) { .upload-grid { grid-template-columns: 1fr; } }

.upload-box {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--paper-card);
  border: 2px dashed var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color .25s var(--ease);
}
.upload-box:hover { border-color: var(--ink); }
.upload-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  cursor: pointer;
  text-align: center;
  padding: var(--space-4);
  color: var(--ink-mute);
}
.upload-placeholder svg { width: 32px; height: 32px; color: var(--ink-faint); margin-bottom: var(--space-2); }
.upload-placeholder p { font-family: var(--font-display); font-size: 1.05rem; margin: 0; color: var(--ink); }
.upload-placeholder .hint { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-mute); margin: 0; font-style: normal; }
.upload-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ocr-status {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 14px;
  background: rgba(26, 22, 18, 0.92);
  color: var(--paper);
  font-size: 12px;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.ocr-status .check-green { color: #6eb887; }
.ocr-status .error-red { color: #e88282; }
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--ink-faint);
  border-top-color: var(--paper);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }

.step-nav {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--rule);
}

.summary-card {
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
}
.summary-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--rule-soft);
  font-size: 14px;
  gap: var(--space-3);
}
.summary-row:last-child { border-bottom: 0; }
.summary-row strong {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
}
.summary-row span { font-family: var(--font-display); font-size: 1.05rem; text-align: right; }

.field-group-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 500;
  margin: var(--space-5) 0 var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--rule);
  grid-column: 1 / -1;
  letter-spacing: -0.01em;
}

/* ---- Flash messages -------------------------------------------------- */
.flash-container { max-width: var(--container); margin: var(--space-4) auto 0; padding: 0 var(--space-5); }
.flash {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: var(--space-3);
  font-size: 14px;
  border-left: 3px solid;
}
.flash-error   { background: var(--danger-tint);   color: var(--danger);  border-color: var(--danger); }
.flash-success { background: var(--moss-tint);     color: var(--moss);    border-color: var(--moss); }
.flash-info    { background: var(--paper-deep);    color: var(--ink);     border-color: var(--ink); }

/* ---- Utilities ------------------------------------------------------- */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

/* ---- Reduced motion ------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================================
   LEGAL PAGES (aviso, privacidad, cookies, términos)
   ============================================================================ */
.legal-page { flex: 1; }

.legal-header {
  padding: var(--space-8) 0 var(--space-6);
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.legal-title {
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  line-height: 1;
  letter-spacing: -0.035em;
  margin: 0 0 var(--space-4);
  font-weight: 400;
}
.legal-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0;
}

.legal-body { padding: var(--space-7) 0 var(--space-9); }

.legal-grid {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: var(--space-8);
  align-items: start;
}

.legal-toc {
  position: sticky;
  top: 96px;
  font-size: 14px;
}
.legal-toc-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 var(--space-3);
  font-weight: 600;
  border-top: 1px solid var(--ink);
  padding-top: var(--space-3);
}
.legal-toc-nav { display: flex; flex-direction: column; gap: var(--space-2); }
.legal-toc-nav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.4;
  padding: 4px 0;
  transition: color .2s var(--ease), padding-left .2s var(--ease);
  border-left: 2px solid transparent;
  padding-left: 10px;
  margin-left: -10px;
}
.legal-toc-nav a:hover {
  color: var(--bordeaux);
  border-left-color: var(--bordeaux);
}
.legal-toc-nav a.active {
  color: var(--ink);
  border-left-color: var(--bordeaux);
  font-weight: 500;
}

.legal-content {
  max-width: 70ch;
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--ink-soft);
}
.legal-content section { margin-bottom: var(--space-7); scroll-margin-top: 88px; }
.legal-content section:last-child { margin-bottom: 0; }

.legal-content h2 {
  font-size: 1.7rem;
  letter-spacing: -0.02em;
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
}
.legal-content h2 .num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--bordeaux);
  text-transform: uppercase;
  flex-shrink: 0;
}

.legal-content h3 {
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--ink);
  margin: var(--space-5) 0 var(--space-3);
  letter-spacing: -0.005em;
}

.legal-content p {
  margin: 0 0 var(--space-4);
}
.legal-content p:last-child { margin-bottom: 0; }

.legal-content strong {
  color: var(--ink);
  font-weight: 600;
}

.legal-content ul, .legal-content ol {
  margin: 0 0 var(--space-4);
  padding-left: var(--space-5);
}
.legal-content li {
  margin-bottom: var(--space-2);
}
.legal-content ul li::marker { color: var(--bordeaux); }
.legal-content ol li::marker { color: var(--bordeaux); font-family: var(--font-mono); }

.legal-content a {
  color: var(--bordeaux);
  text-decoration: none;
  border-bottom: 1px solid var(--bordeaux-soft);
  transition: border-bottom-color .2s var(--ease);
}
.legal-content a:hover {
  border-bottom-color: var(--bordeaux);
}

.legal-content blockquote {
  margin: var(--space-5) 0;
  padding: var(--space-4) var(--space-5);
  background: var(--paper-card);
  border-left: 3px solid var(--bordeaux);
  border-radius: 4px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--ink);
  line-height: 1.5;
}

/* "Definition list" para tablas de datos: razón social, domicilio, etc. */
.legal-content dl {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--space-2) var(--space-4);
  margin: 0 0 var(--space-4);
  padding: var(--space-4);
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.legal-content dt {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
  align-self: center;
}
.legal-content dd {
  margin: 0;
  font-size: 14.5px;
  color: var(--ink);
}

.legal-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: var(--space-4) 0;
}
.legal-content table th,
.legal-content table td {
  text-align: left;
  padding: var(--space-3) var(--space-3);
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.legal-content table th {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 600;
  background: var(--paper-card);
  border-bottom: 2px solid var(--ink);
}

@media (max-width: 900px) {
  .legal-grid { grid-template-columns: 1fr; }
  .legal-toc {
    position: static;
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--rule);
  }
  .legal-content dl { grid-template-columns: 1fr; gap: 2px; }
  .legal-content dl dt { padding-top: var(--space-3); }
}

/* ============================================================================
   HELP CENTER (FAQ) — friendlier tone than legal pages
   ============================================================================ */
.help-page { flex: 1; }

.help-header {
  padding: var(--space-8) 0 var(--space-6);
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.help-title {
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  line-height: 1;
  letter-spacing: -0.035em;
  margin: 0 0 var(--space-4);
  font-weight: 400;
}
.help-lead {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 1.4vw, 1.25rem);
  font-style: italic;
  color: var(--ink-soft);
  line-height: 1.5;
  max-width: 60ch;
  margin: 0;
}
.help-lead a {
  color: var(--bordeaux);
  text-decoration: none;
  border-bottom: 1px solid var(--bordeaux-soft);
  font-style: normal;
  font-family: var(--font-body);
  font-size: 0.95em;
  font-weight: 500;
}

.help-body { padding: var(--space-7) 0 var(--space-9); }

.help-grid {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: var(--space-8);
  align-items: start;
}

.help-toc {
  position: sticky;
  top: 96px;
  font-size: 14px;
}
.help-toc-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 var(--space-3);
  font-weight: 600;
  border-top: 1px solid var(--ink);
  padding-top: var(--space-3);
}
.help-toc-nav { display: flex; flex-direction: column; gap: var(--space-2); }
.help-toc-nav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.4;
  padding: 4px 0 4px 10px;
  margin-left: -10px;
  border-left: 2px solid transparent;
  transition: color .2s var(--ease), border-left-color .2s var(--ease);
}
.help-toc-nav a:hover {
  color: var(--bordeaux);
  border-left-color: var(--bordeaux);
}

.help-content {
  max-width: 70ch;
}

.faq-section {
  margin-bottom: var(--space-8);
  scroll-margin-top: 88px;
}
.faq-section:last-child { margin-bottom: 0; }

.faq-section-head {
  display: flex;
  align-items: baseline;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--ink);
}
.faq-section-head h2 {
  font-size: clamp(1.6rem, 2.2vw, 2rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink);
}
.faq-num {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-style: italic;
  font-weight: 400;
  color: var(--bordeaux);
  letter-spacing: -0.02em;
}

.faq {
  border-bottom: 1px solid var(--rule);
  padding: var(--space-3) 0;
}
.faq summary {
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  color: var(--ink);
  transition: color 0.2s var(--ease);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '+';
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--bordeaux);
  transition: transform 0.3s var(--ease);
  line-height: 1;
  flex-shrink: 0;
}
.faq[open] summary::after { content: '−'; }
.faq summary:hover { color: var(--bordeaux); }

.faq-body {
  padding: var(--space-2) 0 var(--space-4);
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-soft);
}
.faq-body p { margin: 0 0 var(--space-3); }
.faq-body p:last-child { margin-bottom: 0; }
.faq-body ul, .faq-body ol {
  margin: var(--space-2) 0;
  padding-left: var(--space-5);
}
.faq-body li { margin-bottom: var(--space-2); }
.faq-body ul li::marker { color: var(--bordeaux); }
.faq-body strong { color: var(--ink); font-weight: 600; }
.faq-body a {
  color: var(--bordeaux);
  text-decoration: none;
  border-bottom: 1px solid var(--bordeaux-soft);
  transition: border-bottom-color .2s var(--ease);
}
.faq-body a:hover { border-bottom-color: var(--bordeaux); }

@media (max-width: 900px) {
  .help-grid { grid-template-columns: 1fr; }
  .help-toc {
    position: static;
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--rule);
  }
}

/* ============================================================================
   EDITORIAL IMAGE BAND (full-width photo with caption)
   ============================================================================ */
.image-band {
  position: relative;
  background: var(--ink);
  overflow: hidden;
  border-bottom: 1px solid var(--ink);
}

.image-band picture,
.image-band img {
  display: block;
  width: 100%;
}

.image-band img {
  height: clamp(320px, 52vw, 560px);
  object-fit: cover;
  object-position: center 38%;
  /* Subtle warm cast that ties the photo to the cream/bordeaux palette */
  filter: saturate(0.92) contrast(1.02);
}

.image-caption {
  position: absolute;
  left: var(--space-5);
  bottom: var(--space-5);
  max-width: 38ch;
  color: var(--paper);
  font-family: var(--font-display);
  font-size: clamp(1rem, 1.5vw, 1.35rem);
  line-height: 1.35;
  font-weight: 400;
  letter-spacing: -0.005em;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: linear-gradient(135deg,
              rgba(26, 22, 18, 0.78) 0%,
              rgba(26, 22, 18, 0.55) 100%);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  border-left: 2px solid var(--bordeaux);
  border-radius: 2px;
}
.image-caption em {
  font-style: italic;
  color: var(--bordeaux-soft);
}
.image-caption .caption-rule {
  width: 32px;
  height: 1px;
  background: var(--bordeaux-soft);
  display: block;
}

@media (max-width: 720px) {
  .image-caption {
    left: var(--space-4);
    right: var(--space-4);
    bottom: var(--space-4);
    max-width: none;
    font-size: 0.95rem;
  }
}

/* ============================================================================
   GENERIC DIALOG (replaces alert/confirm/prompt)
   ============================================================================ */
.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 22, 18, 0.6);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity .25s var(--ease);
}
.dialog-backdrop.open { opacity: 1; }

.dialog {
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  width: 100%;
  max-width: 460px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  transform: translateY(12px) scale(0.98);
  transition: transform .35s var(--ease-out);
}
.dialog-backdrop.open .dialog { transform: none; }

.dialog .eyebrow-num {
  margin-bottom: var(--space-3);
}

.dialog h3 {
  font-size: 1.5rem;
  margin: 0 0 var(--space-3);
  letter-spacing: -0.02em;
}

.dialog p {
  font-size: 14.5px;
  color: var(--ink-soft);
  margin: 0 0 var(--space-4);
  line-height: 1.55;
}

.dialog .input-sm {
  margin-bottom: var(--space-4);
}

.dialog-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: var(--space-3);
}

.dialog-variant-danger h3 .dot { color: var(--danger); }
.dialog-variant-danger .eyebrow-num,
.dialog-variant-danger .eyebrow-num::before { color: var(--danger); }

/* ============================================================================
   BUTTON SPINNER (inline)
   ============================================================================ */
.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
  opacity: 0.85;
}
.btn .btn-spinner { margin-right: 4px; }

/* When a button is loading, hide the icon and show spinner */
.btn.is-loading {
  cursor: progress;
  pointer-events: none;
}
.btn.is-loading > svg:not(.btn-spinner) { display: none; }

/* Toast (top-right notification) */
.toast-stack {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--ink);
  color: var(--paper);
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  max-width: 360px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-left: 3px solid var(--bordeaux);
  animation: toastIn .35s var(--ease-out);
}
.toast-success { border-left-color: var(--moss); }
.toast-error { border-left-color: var(--danger); }
.toast-info { border-left-color: var(--bordeaux); }
.toast.fading { animation: toastOut .25s var(--ease-out) forwards; }

@keyframes toastIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes toastOut {
  to { transform: translateX(20px); opacity: 0; }
}

@media (max-width: 560px) {
  .toast-stack { left: 16px; right: 16px; top: 16px; }
  .toast { max-width: none; }
}
