/* style.css — Sistema de diseño renovado
   Fuentes: DM Serif Display · DM Mono · Syne (Google Fonts)
   Paleta: ink / paper / coral con semánticos azul, verde, ámbar */

/* ── Variables ─────────────────────────────────────────────────── */
:root {
  --coral:     #FF5A5F;
  --coral-d:   #D94F54;
  --coral-l:   #FFE8E9;
  --ink:       #0F0F0F;
  --ink-60:    #6B6B6B;
  --ink-20:    #E8E8E8;
  --paper:     #FAF9F7;
  --paper-d:   #F0EDE8;
  --blue:      #1F4E79;
  --blue-l:    #EBF3FA;
  --green:     #1A7A4A;
  --green-l:   #E8F5EE;
  --amber:     #B45309;
  --amber-l:   #FEF3C7;
  --radius:    10px;
  --radius-sm: 6px;
  --shadow:    0 8px 24px rgba(0,0,0,0.08);
  /* Alias legado — no eliminar, los usan expresiones inline de app.js */
  --color-primary:    #FF5A5F;
  --color-primary-dk: #D94F54;
  --color-success:    #1A7A4A;
  --color-warning:    #B45309;
  --color-info:       #1F4E79;
  --color-bg:         #FAF9F7;
  --color-surface:    #FFFFFF;
  --color-border:     #E8E8E8;
  --color-text:       #0F0F0F;
  --color-text-muted: #6B6B6B;
  --transition:       0.2s ease;
}

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base / Tipografía ─────────────────────────────────────────── */
html { font-size: 16px; }

body {
  font-family: 'Syne', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Evitar zoom automático en inputs de iOS */
input, select, textarea { font-size: max(16px, 1em); }

img, iframe { max-width: 100%; }

/* ── NAVBAR ─────────────────────────────────────────────────────── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #0F0F0F;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 52px;
  border-bottom: 2px solid #FF5A5F;
}

.brand {
  font-family: 'DM Serif Display', serif;
  font-size: 1.1rem;
  color: #FF5A5F;
  text-decoration: none;
  margin-right: auto;
  flex-shrink: 0;
}

#nav-guest,
#nav-user {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: nowrap;
}
#nav-guest[hidden],
#nav-user[hidden] { display: none !important; }

.nav-welcome {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.4);
  white-space: nowrap;
}

/* Links del nav */
.nav-link {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-family: 'Syne', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  transition: color 0.2s, opacity 0.2s;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: 0;
  height: auto;
  min-width: 0;
}
.nav-link:hover { color: #FF5A5F; }
.nav-link:disabled { opacity: 0.35; cursor: not-allowed; }

.nav-link--coral       { color: #FF5A5F; }
.nav-link--coral:hover { color: #fff; }

.nav-link--green { color: rgba(255,255,255,0.7); }

/* ── HERO ────────────────────────────────────────────────────────── */
.hero {
  background: #0F0F0F;
  color: #fff;
  padding: 4rem 2rem 3rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at 80% 50%,
    rgba(255,90,95,0.15) 0%,
    transparent 70%
  );
  pointer-events: none;
}

.hero-inner {
  max-width: 900px;
  margin: 0 auto;
  position: relative;
}

.hero-tag {
  display: inline-block;
  background: #FF5A5F;
  color: #fff;
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.3rem 0.8rem;
  border-radius: 2px;
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: 1.05;
  margin-bottom: 1.2rem;
  color: #fff;
}

.hero h1 em {
  font-style: italic;
  color: #FF5A5F;
}

.hero p {
  font-size: 1rem;
  max-width: 580px;
  color: rgba(255,255,255,0.65);
  margin-bottom: 2rem;
  font-weight: 400;
  line-height: 1.6;
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.8);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 0.3rem 0.75rem;
  border-radius: 100px;
}

.chip.coral {
  background: rgba(255,90,95,0.15);
  border-color: #FF5A5F;
  color: #FF5A5F;
}

/* ── PROPERTY BAR ───────────────────────────────────────────────── */
#property-bar {
  background: #1a1a1a;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 0.5rem 2rem;
}
#property-bar[hidden] { display: none !important; }

.property-bar-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 960px;
  margin: 0 auto;
}

.property-bar-icon {
  font-size: 0.85rem;
  opacity: 0.5;
  flex-shrink: 0;
  line-height: 1;
}

.property-bar-select {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.9);
  font-family: 'Syne', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  min-width: 150px;
  outline: none;
}

.property-bar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.btn--bar-action {
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.6);
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  padding: 0.2rem 0.7rem;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.btn--bar-action:hover { border-color: rgba(255,255,255,0.5); color: #fff; }
.btn--bar-primary  { border-color: #FF5A5F; color: #FF5A5F; }
.btn--bar-primary:hover  { background: #FF5A5F; color: #fff; }
.btn--bar-danger   { border-color: rgba(220,38,38,0.5); color: rgba(220,38,38,0.8); }
.btn--bar-danger:hover   { background: #DC2626; color: #fff; border-color: #DC2626; }
.btn--bar-danger[hidden] { display: none !important; }


/* ── PANEL HISTORIAL ────────────────────────────────────────────── */
/* ── OVERLAY ────────────────────────────────────────────────────── */
.history-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 299;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.history-overlay.is-open  { opacity: 1; }
.history-overlay[hidden]  { display: none !important; }

/* ── PANEL BASE ─────────────────────────────────────────────────── */
.history-panel {
  position: fixed;
  z-index: 300;
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}
.history-panel[hidden] { display: none !important; }

/* ── DESKTOP / TABLET (≥641px) — Drawer lateral derecho ─────────── */
@media (min-width: 641px) {
  .history-panel {
    top: 0;
    right: 0;
    bottom: 0;
    width: 420px;
    border-left: 1px solid #E8E8E8;
    border-radius: 0;
    transform: translateX(100%);
    box-shadow: -8px 0 32px rgba(0,0,0,0.12);
  }
  .history-panel.is-open { transform: translateX(0); }

  @media (max-width: 900px) {
    .history-panel { width: 360px; }
  }

  .history-handle { display: none; }
}

/* ── MÓVIL (≤640px) — Sheet desde abajo ─────────────────────────── */
@media (max-width: 640px) {
  .history-panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 88vh;
    border-radius: 20px 20px 0 0;
    border-top: 1px solid #E8E8E8;
    transform: translateY(100%);
    box-shadow: 0 -8px 32px rgba(0,0,0,0.15);
  }
  .history-panel.is-open { transform: translateY(0); }

  .history-handle {
    display: block;
    width: 40px;
    height: 4px;
    background: #E8E8E8;
    border-radius: 2px;
    margin: 12px auto 0;
    flex-shrink: 0;
  }
}

/* ── HEADER ─────────────────────────────────────────────────────── */
.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #E8E8E8;
  flex-shrink: 0;
}

.history-header__title {
  font-family: 'Syne', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: #0F0F0F;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.history-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  color: #6B6B6B;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
  padding: 0;
}
.history-close:hover { background: #F0EDE8; color: #0F0F0F; }

/* ── BODY ───────────────────────────────────────────────────────── */
.history-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0;
}

/* ── ACORDEÓN POR AÑO ───────────────────────────────────────────── */
.history-year { border-bottom: 1px solid #E8E8E8; }
.history-year:last-child { border-bottom: none; }

.history-year-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  cursor: pointer;
  transition: background 0.15s;
}
.history-year-header:hover { background: #FAF9F7; }

.history-year-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.history-year-label {
  font-family: 'DM Serif Display', serif;
  font-size: 1.2rem;
  color: #0F0F0F;
}

.history-year-count {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  color: #6B6B6B;
}

.history-year-chevron {
  background: none;
  border: none;
  color: #6B6B6B;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.2rem;
  transition: transform 0.2s;
  line-height: 1;
  flex-shrink: 0;
}
.history-year-chevron[aria-expanded="true"],
.history-year-chevron.expanded { transform: rotate(90deg); }

.history-year-body[hidden] { display: none !important; }
.history-year-body { padding: 0; }

/* Pills de año */
.btn--annual-inline {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  font-weight: 500;
  padding: 0.25rem 0.75rem;
  background: transparent;
  color: #1A7A4A;
  border: 1.5px solid #1A7A4A;
  border-radius: 100px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.btn--annual-inline:hover { background: #1A7A4A; color: #fff; }

.btn--combined-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.75rem;
  background: transparent;
  color: var(--green);
  border: 1.5px solid var(--green);
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.btn--combined-inline:hover { background: var(--green); color: #fff; }

/* ── GRID DE TARJETAS ───────────────────────────────────────────── */
.history-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  padding: 0.75rem 1.25rem 1rem;
}

.history-card {
  background: #FAF9F7;
  border: 1px solid #E8E8E8;
  border-radius: 10px;
  padding: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: box-shadow 0.2s, transform 0.2s;
  cursor: default;
}
.history-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.history-card-month {
  font-family: 'Syne', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: #0F0F0F;
}
.history-card-amount {
  font-family: 'DM Serif Display', serif;
  font-size: 1rem;
  color: #FF5A5F;
  line-height: 1.2;
}
.history-card-meta {
  font-family: 'DM Mono', monospace;
  font-size: 0.62rem;
  color: #6B6B6B;
  margin-bottom: 0.4rem;
}
.history-card-actions {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.25rem;
}

/* Botones de tarjeta */
.history-card-actions button {
  height: 28px;
  font-size: 0.7rem;
  border-radius: 6px;
  border: 1.5px solid;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

.history-card-actions .btn--ver {
  flex: 1;
  background: #FF5A5F;
  color: #fff;
  border-color: #FF5A5F;
  font-family: 'Syne', sans-serif;
  font-weight: 600;
}
.history-card-actions .btn--ver:hover { background: #D94F54; border-color: #D94F54; }

.history-card-actions .btn--ia {
  width: 28px;
  background: #1F4E79;
  color: #fff;
  border-color: #1F4E79;
}
.history-card-actions .btn--ia:hover { background: #163d61; }

.history-card-actions .btn--del {
  width: 28px;
  background: transparent;
  color: #DC2626;
  border-color: #DC2626;
}
.history-card-actions .btn--del:hover { background: #DC2626; color: #fff; }

/* ── MÓVIL — lista horizontal ───────────────────────────────────── */
@media (max-width: 640px) {
  .history-grid {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
  }
  .history-card {
    flex-direction: row;
    align-items: center;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid #E8E8E8;
    padding: 0.75rem 1.25rem;
    background: #fff;
    gap: 0.5rem;
  }
  .history-card:hover { background: #FAF9F7; transform: none; box-shadow: none; }
  .history-card-month { font-size: 0.82rem; min-width: 68px; flex-shrink: 0; }
  .history-card-amount {
    font-size: 0.9rem; flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .history-card-meta { display: none; }
  .history-card-actions { flex-shrink: 0; margin-top: 0; gap: 0.25rem; }
  .history-card-actions button { height: 30px; }
  .history-card-actions .btn--ver { flex: none; width: 42px; }
  .history-card-actions .btn--ia  { width: 30px; }
  .history-card-actions .btn--del { width: 30px; }
}

/* ── EMPTY STATE ────────────────────────────────────────────────── */
.history-empty {
  padding: 3rem 1.5rem;
  text-align: center;
  color: #6B6B6B;
  font-size: 0.875rem;
  font-family: 'Syne', sans-serif;
}
.history-empty::before {
  content: '📋';
  display: block;
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

/* ── MAIN ───────────────────────────────────────────────────────── */
.main {
  max-width: 960px;
  width: 100%;
  margin: 2rem auto;
  padding: 0 2rem;
  flex: 1;
}

.section-title {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  color: var(--ink);
  margin-bottom: 0.5rem;
  font-weight: 400;
}

.section-description {
  font-size: 0.875rem;
  color: var(--ink-60);
  max-width: 640px;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

/* ── FOOTER ─────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.75rem;
  color: var(--ink-60);
  border-top: 1px solid var(--ink-20);
  background: #fff;
  margin-top: auto;
}

/* ── SISTEMA DE BOTONES ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: 'Syne', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  height: 38px;
  text-align: center;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Primario — coral sólido */
.btn--primary {
  background: var(--coral);
  color: #fff;
  border-color: var(--coral);
}
.btn--primary:hover:not(:disabled) {
  background: var(--coral-d);
  border-color: var(--coral-d);
}

/* Secundario — outline neutro */
.btn--secondary {
  background: transparent;
  color: var(--ink-60);
  border-color: var(--ink-20);
}
.btn--secondary:hover:not(:disabled) {
  border-color: var(--ink-60);
  color: var(--ink);
}

/* Análisis — azul sólido */
.btn--analysis {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.btn--analysis:hover:not(:disabled) { background: #163d61; border-color: #163d61; }

/* PDF análisis — outline azul */
.btn--analysis-pdf {
  background: transparent;
  color: var(--blue);
  border-color: var(--blue);
}
.btn--analysis-pdf:hover:not(:disabled) { background: var(--blue); color: #fff; }
.btn--analysis-pdf:disabled { opacity: 0.4; cursor: not-allowed; }

/* Small — para historial y tablas */
.btn--small {
  font-size: 0.8rem;
  padding: 0.25rem 0.75rem;
  border-radius: 8px;
  background: var(--coral);
  color: #fff;
  border-color: var(--coral);
}
.btn--small:hover { background: var(--coral-d); }

/* Icono / Danger */
.btn--icon {
  background: transparent;
  color: #DC2626;
  border: 1px solid #DC2626;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
  flex-shrink: 0;
}
.btn--icon:hover { background: #DC2626; color: #fff; }

/* Análisis small en tarjetas de historial */
.btn--analysis-small {
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}
.btn--analysis-small:hover { background: #163d61; }

/* Regenerar análisis */
.btn--regen {
  font-size: 0.72rem;
  padding: 0.2rem 0.6rem;
  background: transparent;
  color: var(--ink-60);
  border: 1px solid var(--ink-20);
  border-radius: 100px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  height: auto;
}
.btn--regen:hover { background: var(--paper-d); color: var(--ink); }

/* Ancho completo */
.btn--full { width: 100%; justify-content: center; }

/* ── UPLOAD SECTION ─────────────────────────────────────────────── */
.upload-section { margin-bottom: 2rem; }

.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.upload-card {
  background: #fff;
  border: 2px dashed var(--ink-20);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.upload-card:hover,
.upload-card.drag-over {
  border-color: var(--coral);
  background: var(--coral-l);
  box-shadow: var(--shadow);
}
.upload-card.has-file {
  border-color: var(--green);
  border-style: solid;
  background: var(--green-l);
}

.upload-card__icon {
  color: var(--ink-60);
  margin-bottom: 0.75rem;
}
.upload-card:hover .upload-card__icon,
.upload-card.drag-over .upload-card__icon { color: var(--coral); }
.upload-card.has-file .upload-card__icon  { color: var(--green); }

.upload-card__title {
  font-family: 'Syne', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.upload-card__hint {
  font-size: 0.8125rem;
  color: var(--ink-60);
}

.upload-card__input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-card__status {
  font-size: 0.8125rem;
  font-weight: 500;
  margin-top: 0.5rem;
  color: var(--green);
}
.upload-card__status.error { color: var(--coral); }

/* Columna de PDFs bancarios apilados */
.bank-column {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

/* Card opcional — más compacta */
.upload-card--optional {
  border-style: dashed;
  opacity: 0.8;
  padding: 1.25rem 1.5rem;
}
.upload-card--optional:hover,
.upload-card--optional.drag-over { opacity: 1; }
.upload-card--optional .upload-card__icon { margin-bottom: 0.5rem; }

.upload-card__title--muted {
  color: var(--ink-60);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Badge "opcional" */
.optional-badge {
  font-family: 'DM Mono', monospace;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--ink-20);
  color: var(--ink-60);
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
}

/* Badge de formato CSV / PDF */
.format-badge {
  display: inline-flex;
  align-items: center;
  font-family: 'DM Mono', monospace;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 0.4rem;
  text-transform: uppercase;
}
.format-badge--csv { background: var(--green-l); color: var(--green); border: 1px solid var(--green); }
.format-badge--pdf { background: var(--amber-l); color: var(--amber); border: 1px solid var(--amber); }

/* ── ACTION ROW ─────────────────────────────────────────────────── */
.action-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

/* Fila de botones — dos pares alineados */
.action-buttons {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* hidden en action-pair no deja espacio en blanco */
.action-pair[hidden],
#action-pair-b[hidden] {
  display: none !important;
}

.action-pair {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Par A — Generar / Limpiar */
.action-pair--a .btn {
  height: 44px;
  min-width: 190px;
  font-size: 0.875rem;
  padding: 0 1.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

/* Par B — Ver análisis / PDF análisis */
.action-pair--b .btn {
  height: 44px;
  min-width: 165px;
  font-size: 0.875rem;
  padding: 0 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.action-hint {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  color: var(--ink-60);
}

/* ── RESULTADOS ─────────────────────────────────────────────────── */
.results-section { animation: fadeIn 0.35s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Tarjetas de totales */
.totals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.total-card {
  background: #fff;
  border: 1px solid var(--ink-20);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  transition: box-shadow 0.2s, transform 0.2s;
}
.total-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.total-card__label {
  font-family: 'DM Mono', monospace;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-60);
  margin-bottom: 0.4rem;
}

.total-card__value {
  font-family: 'DM Serif Display', serif;
  font-size: 1.6rem;
  color: var(--coral);
  line-height: 1.15;
}

.total-card--airbnb .total-card__value { color: var(--coral); }
.total-card--bank    .total-card__value { color: var(--blue); }
.total-card--diff    .total-card__value { color: var(--amber); }
.total-card--ok      .total-card__value { color: var(--green); }

.total-card__sub {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  color: var(--ink-60);
  margin-top: 0.25rem;
}

/* Fuentes bancarias (badges PDF1 / PDF2) */
.bank-sources {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.bank-source-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-60);
}

.bank-source-badge {
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--blue-l);
  color: var(--blue);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
}
.bank-source-badge--2 { background: #EAF4FF; color: #0062A3; }

/* ── TABS ───────────────────────────────────────────────────────── */
.tabs-category-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-60);
  margin-bottom: 0.5rem;
}

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--ink-20);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab {
  font-family: 'Syne', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.75rem 1.25rem;
  border: none;
  background: none;
  color: var(--ink-60);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.tab:hover { color: var(--ink); }
.tab--active { color: var(--coral); border-bottom-color: var(--coral); }
.tab[hidden] { display: none !important; }

/* Badges en tabs */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--ink-20);
  color: var(--ink-60);
}
.badge--warning { background: var(--amber-l); color: var(--amber); }
.badge--info    { background: var(--blue-l);  color: var(--blue); }
.tab--active .badge { background: var(--coral-l); color: var(--coral-d); }

/* Paneles de tabs */
.tab-panel { animation: fadeIn 0.2s ease; }
.tab-panel--hidden { display: none; }

/* ── TABLAS ─────────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  font-size: 0.82rem;
}

.data-table th {
  background: var(--paper-d);
  padding: 0.75rem 1rem;
  text-align: left;
  font-family: 'DM Mono', monospace;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-60);
  border-bottom: 2px solid var(--ink-20);
  white-space: nowrap;
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--ink-20);
  color: var(--ink);
  vertical-align: middle;
}

.data-table td:first-child { color: var(--ink-60); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--paper); }

.text-right { text-align: right; }

.amount-positive { color: var(--green); font-weight: 600; }
.amount-negative { color: var(--coral); font-weight: 600; }
.amount-zero     { color: var(--ink-60); }

/* Badges de estado */
.status-badge {
  display: inline-flex;
  align-items: center;
  font-family: 'DM Mono', monospace;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}
.status-badge--pending      { background: var(--amber-l); color: var(--amber); }
.status-badge--unregistered { background: var(--coral-l); color: var(--coral-d); }

/* ── LOADER ─────────────────────────────────────────────────────── */
.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem;
}
.loader[hidden] { display: none !important; }

.loader__spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--ink-20);
  border-top-color: var(--coral);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loader__text {
  font-family: 'DM Mono', monospace;
  font-size: 0.85rem;
  color: var(--ink-60);
}

/* ── BANNERS ────────────────────────────────────────────────────── */
.error-banner {
  background: var(--coral-l);
  border: 1px solid var(--coral);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  color: var(--coral-d);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.discrepancy-banner {
  background: var(--amber-l);
  border: 1.5px solid var(--amber);
  border-radius: var(--radius-sm);
  padding: 0.875rem 1.25rem;
  color: var(--amber);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
.discrepancy-banner svg { flex-shrink: 0; }

/* ── MODALES ────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeBg 0.2s ease;
}
@keyframes fadeBg { from { opacity: 0; } to { opacity: 1; } }

.modal-overlay[hidden] { display: none; }

.modal-overlay--wide { align-items: flex-start; padding: 2rem 1rem; }

.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  animation: scaleIn 0.2s ease;
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

.modal--analysis {
  max-width: 720px;
  max-height: calc(100vh - 4rem);
}

/* Cabecera del modal — usa .modal__header en HTML */
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--ink-20);
}

.modal__title {
  font-family: 'DM Serif Display', serif;
  font-size: 1.1rem;
  color: var(--ink);
}

.modal__close {
  background: none;
  border: none;
  color: var(--ink-60);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  transition: color 0.15s;
}
.modal__close:hover { color: var(--coral); }

/* Formulario interno */
.modal__form {
  padding: 1.25rem 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

/* Pie de modal simple (auth modals) */
.modal__footer {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--ink-60);
  padding: 0 1.5rem 1.5rem;
}
.modal__footer a {
  color: var(--coral);
  text-decoration: none;
  font-weight: 600;
}
.modal__footer a:hover { text-decoration: underline; }

/* Cuerpo scrollable (modal de análisis) */
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--ink-20);
  border-bottom: 1px solid var(--ink-20);
}

/* Pie del modal de análisis */
.modal-footer {
  padding: 0.875rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.analysis-footer-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  flex: 1;
}

.analysis-footer-actions {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

.analysis-cached-badge {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  color: var(--green);
  background: var(--green-l);
  border: 1px solid var(--green);
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  white-space: nowrap;
}
.analysis-cached-badge--new {
  color: var(--blue);
  background: var(--blue-l);
  border-color: var(--blue);
}

/* ── FORMULARIOS (dentro de modales) ────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-label {
  display: block;
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-60);
}

.form-hint {
  font-weight: 400;
  color: var(--ink-60);
  text-transform: none;
  letter-spacing: 0;
}

.form-input {
  width: 100%;
  padding: 0.6rem 0.875rem;
  border: 1.5px solid var(--ink-20);
  border-radius: var(--radius-sm);
  font-family: 'Syne', sans-serif;
  font-size: 0.9375rem;
  color: var(--ink);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-input:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 3px var(--coral-l);
}

.form-error {
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
  color: #DC2626;
  background: #FFF0F0;
  border: 1px solid #FFD0D0;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
}

/* ── ANÁLISIS IA — contenido del modal ──────────────────────────── */
.analysis-content p {
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--ink);
  margin-bottom: 0.25rem;
}

.analysis-section-title {
  font-family: 'Syne', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fff;
  background: var(--blue);
  padding: 0.4rem 0.75rem;
  margin: 1rem 0 0.5rem;
  border-radius: var(--radius-sm);
}

.analysis-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 3rem 1rem;
  color: var(--ink-60);
  font-size: 0.875rem;
}

.spinner-small {
  width: 28px;
  height: 28px;
  border: 3px solid var(--ink-20);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

/* ── INDICADORES BANCARIOS ──────────────────────────────────────── */
.tabs-category-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-60);
  margin-bottom: 0.5rem;
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE — Tablet (900px) y Móvil (640px)
   ══════════════════════════════════════════════════════════════ */

/* ── Base mobile ────────────────────────────────────────────────── */
.col-hide-mobile { /* clase aplicada por JS en tablas */ }

/* ── Tablet: 900px ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  /* Navbar tablet */
  nav { padding: 0 1.25rem; gap: 1rem; }

  .nav-welcome {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .nav-link { font-size: 0.68rem; letter-spacing: 0.05em; padding: 0.2rem 0.35rem; }

  #nav-user { gap: 0.75rem; }

  /* Hero tablet */
  .hero { padding: 3rem 1.5rem 2.5rem; }

  /* Property bar tablet */
  #property-bar { padding: 0.5rem 1.25rem; }

  /* Action buttons tablet grande (769-900px) */
  .action-pair--a .btn { min-width: 160px; font-size: 0.82rem; padding: 0 1.1rem; }
  .action-pair--b .btn { min-width: 145px; font-size: 0.82rem; padding: 0 1rem; }
}

/* Tablet pequeño (641-768px): pares en columna, botones full-width */
@media (max-width: 768px) and (min-width: 641px) {
  .action-buttons {
    flex-direction: column;
    gap: 0.4rem;
    align-items: stretch;
  }
  .action-pair {
    width: 100%;
  }
  .action-pair--a .btn,
  .action-pair--b .btn {
    flex: 1;
    min-width: 0;
    font-size: 0.78rem;
    padding: 0 0.75rem;
    height: 42px;
  }
}

/* ── Móvil: 640px ───────────────────────────────────────────────── */
@media (max-width: 640px) {

  /* ─ Navbar ─────────────────────────────────────────────────── */
  nav {
    padding: 0 0.75rem;
    gap: 0.5rem;
    height: 52px;
  }

  .brand { font-size: 0.95rem; }

  .nav-welcome {
    font-size: 0.6rem;
    max-width: 65px;
    flex-shrink: 1;
  }

  #nav-user  { gap: 0.25rem; }
  #nav-guest { gap: 0.5rem; }

  /* Botones → iconos cuadrados 32×32 */
  #nav-user .nav-link {
    font-size: 0 !important;
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
    border-radius: 6px;
    background: rgba(255,255,255,0.08);
    flex-shrink: 0;
  }

  #nav-user .nav-link::before {
    content: attr(data-short);
    font-size: 1rem;
    line-height: 1;
  }

  #nav-user .nav-link:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
  }

  /* Hero móvil */
  .hero { padding: 2.5rem 1.25rem 2rem; }
  .hero h1 { font-size: clamp(1.8rem, 8vw, 2.8rem); }
  .hero p  { font-size: 0.875rem; }

  /* ─ Property bar ────────────────────────────────────────────── */
  #property-bar { padding: 0.4rem 0.75rem; }

  .property-bar-inner {
    flex-wrap: nowrap !important;
    gap: 0.4rem;
    overflow: hidden;
    padding: 0;
  }

  .property-bar-icon { display: none; }

  .property-bar-select {
    min-width: 90px !important;
    max-width: 110px !important;
    font-size: 0.72rem !important;
    padding: 0.2rem 0.4rem !important;
    flex-shrink: 1;
  }

  .property-bar-actions {
    margin-left: auto;
    flex-wrap: nowrap !important;
    gap: 0.25rem !important;
  }

  .btn--bar-action {
    font-size: 0.6rem !important;
    padding: 0.15rem 0.4rem !important;
    white-space: nowrap;
    flex-shrink: 0;
  }

  #rename-property-btn { display: none; }

  /* ─ Main ────────────────────────────────────────────────────── */
  .main { margin: 1rem auto; padding: 0 1rem; }

  /* ─ Action row ──────────────────────────────────────────────── */
  .action-row { gap: 0.4rem; margin-bottom: 1.25rem; }

  .action-buttons {
    flex-direction: column !important;
    gap: 0.4rem !important;
    align-items: stretch !important;
  }

  .action-pair {
    width: 100%;
    gap: 0.4rem;
  }

  /* Par A: cada botón ocupa 100% de ancho */
  .action-pair--a {
    flex-direction: column;
  }

  .action-pair--a .btn {
    width: 100% !important;
    min-width: 0 !important;
    height: 44px !important;
    font-size: 0.82rem !important;
    padding: 0 1rem !important;
    justify-content: center;
  }

  /* Par B: los dos botones en fila, 50% cada uno */
  .action-pair--b {
    flex-direction: row;
  }

  .action-pair--b .btn {
    flex: 1 !important;
    min-width: 0 !important;
    height: 44px !important;
    font-size: 0.75rem !important;
    padding: 0 0.5rem !important;
    justify-content: center;
  }

  /* ─ Upload ──────────────────────────────────────────────────── */
  .upload-grid { grid-template-columns: 1fr; }

  .bank-column { flex-direction: column; gap: 0.75rem; }

  .upload-card { min-height: 80px; padding: 1rem; }
  .upload-card__hint  { font-size: 0.78rem; }
  .upload-card__title { font-size: 0.9rem; }

  /* ─ Totales ─────────────────────────────────────────────────── */
  .totals-grid { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
  .total-card { padding: 0.75rem; }
  .total-card__value { font-size: 1.15rem; }
  .total-card__label { font-size: 0.6rem; }

  /* ─ Tabs ────────────────────────────────────────────────────── */
  .tabs { gap: 0; }
  .tab { font-size: 0.72rem; padding: 0.5rem 0.75rem; white-space: nowrap; flex-shrink: 0; }

  /* ─ Tablas ──────────────────────────────────────────────────── */
  .data-table { font-size: 0.72rem; min-width: 500px; }
  .data-table th, .data-table td { padding: 0.4rem 0.5rem; white-space: nowrap; }
  .col-hide-mobile { display: none; }

  /* ─ Fuentes bancarias ───────────────────────────────────────── */
  .bank-sources { flex-wrap: wrap; gap: 0.4rem; }
  .bank-source-badge { font-size: 0.65rem; padding: 0.2rem 0.5rem; }

  /* ─ Modales: deslizar desde abajo ──────────────────────────── */
  .modal-overlay,
  .modal-overlay--wide { align-items: flex-end; padding: 0; }

  .modal,
  .modal--analysis {
    width: 100%;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 90vh;
    overflow-y: auto;
  }

  .modal__header { padding: 1rem 1rem 0; }
  .modal__title  { font-size: 0.95rem; }
  .modal__form   { padding: 1rem 1rem 0.75rem; }
  .modal__footer { padding: 0 1rem 1rem; }

  .modal-body { padding: 0.75rem 1rem; font-size: 0.82rem; }

  .modal-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
  }

  .analysis-footer-info { justify-content: center; flex-wrap: wrap; }

  .analysis-footer-actions { margin-left: 0; justify-content: stretch; gap: 0.5rem; }
  .analysis-footer-actions .btn { flex: 1; justify-content: center; }
}

/* ══════════════════════════════════
   AUTH MODALS
══════════════════════════════════ */

.auth-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255,90,95,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 80%, rgba(31,78,121,0.1) 0%, transparent 60%),
    rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.auth-modal-overlay[hidden] { display: none !important; }

.auth-modal {
  background: #0F0F0F;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(255,90,95,0.1),
    0 24px 64px rgba(0,0,0,0.5);
  position: relative;
}

.auth-modal::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: #FF5A5F;
  border-radius: 16px 16px 0 0;
}

.auth-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem 0;
}

.auth-modal__brand {
  font-family: 'DM Serif Display', serif;
  font-size: 1rem;
  color: #FF5A5F;
  text-decoration: none;
}

.auth-modal__close {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.5);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  line-height: 1;
  padding: 0;
}

.auth-modal__close:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.auth-modal__body {
  padding: 1.25rem 1.5rem 1.5rem;
}

.auth-modal__tag {
  display: inline-block;
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: rgba(255,90,95,0.15);
  color: #FF5A5F;
  border: 1px solid rgba(255,90,95,0.3);
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  margin-bottom: 0.75rem;
}

.auth-modal__title {
  font-family: 'DM Serif Display', serif;
  font-size: 1.8rem;
  color: #fff;
  line-height: 1.1;
  margin-bottom: 0.4rem;
}

.auth-modal__title em {
  font-style: italic;
  color: #FF5A5F;
}

.auth-modal__subtitle {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.45);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.auth-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
}

.auth-input {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 0.65rem 0.875rem;
  font-family: 'Syne', sans-serif;
  font-size: 0.875rem;
  color: #fff;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  width: 100%;
}

.auth-input::placeholder { color: rgba(255,255,255,0.2); }

.auth-input:focus {
  border-color: #FF5A5F;
  background: rgba(255,90,95,0.05);
}

.auth-error {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  color: #FF5A5F;
  background: rgba(255,90,95,0.08);
  border: 1px solid rgba(255,90,95,0.2);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  margin: 0;
}

.auth-error[hidden] { display: none !important; }

.auth-btn--primary {
  width: 100%;
  height: 44px;
  background: #FF5A5F;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: 'Syne', sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  margin-top: 0.25rem;
}

.auth-btn--primary:hover  { background: #D94F54; }
.auth-btn--primary:active { transform: scale(0.98); }

.auth-modal__footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.auth-modal__footer-text {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.3);
}

.auth-modal__footer-link {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  color: #FF5A5F;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s;
  padding: 0;
}

.auth-modal__footer-link:hover { color: #fff; }

@media (max-width: 640px) {
  .auth-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .auth-modal {
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
  }

  .auth-modal::before { border-radius: 20px 20px 0 0; }

  .auth-modal__title { font-size: 1.5rem; }
}

.btn--annual-pdf {
  background: rgba(255,90,95,0.1);
  color: #FF5A5F;
  border-color: rgba(255,90,95,0.4);
}

.btn--annual-pdf:hover {
  background: #FF5A5F;
  color: #fff;
  border-color: #FF5A5F;
}

/* ── Match rate badge ── */
.match-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.62rem;
  font-weight: 500;
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
  border: 1px solid;
  white-space: nowrap;
}

.match-badge.badge--green {
  background: #E8F5EE;
  color: #1A7A4A;
  border-color: rgba(26,122,74,0.3);
}

.match-badge.badge--amber {
  background: #FEF3C7;
  color: #B45309;
  border-color: rgba(180,83,9,0.3);
}

.match-badge.badge--red {
  background: #FEF2F2;
  color: #DC2626;
  border-color: rgba(220,38,38,0.3);
}

@media (max-width: 640px) {
  .history-card-meta { display: flex !important; }
  .match-badge { font-size: 0.58rem; padding: 0.1rem 0.4rem; }
}

/* ── SIMETRÍA DE BOTONES ─────────────────────────────────────────── */

/* Consistencia global de border-radius */
.btn,
.action-buttons button,
.history-card-actions button {
  border-radius: 8px;
}

/* Solo pills explícitos conservan 100px */
.btn--annual-inline,
.btn--combined-inline,
.btn--regen,
.btn--bar-action,
.tab-count {
  border-radius: 100px !important;
}


/* ── DASHBOARD DE MÉTRICAS ANUALES ──────────────────────────────── */

.dashboard-section {
  background: #0F0F0F;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.dashboard-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.dashboard-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.75rem 0;
  color: rgba(255,255,255,0.6);
  font-family: 'Syne', sans-serif;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  gap: 1rem;
}

.dashboard-toggle:hover { color: rgba(255,255,255,0.9); }

.dashboard-toggle-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dashboard-toggle-icon {
  font-size: 0.6875rem;
  transition: transform 0.25s ease;
  display: inline-block;
}

.dashboard-toggle-icon.open {
  transform: rotate(90deg);
}

.dashboard-toggle-year {
  color: #FF5A5F;
  font-weight: 700;
}

.dashboard-toggle-meta {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.35);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.dashboard-body {
  overflow: hidden;
  max-height: 500px;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              opacity    0.25s ease,
              padding    0.25s ease;
  opacity: 1;
  padding-bottom: 1.25rem;
}

.dashboard-body.collapsed {
  max-height: 0;
  opacity: 0;
  padding-bottom: 0;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.dashboard-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  padding: 0.875rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.dashboard-card__label {
  font-size: 0.6875rem;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.dashboard-card__value {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  font-family: 'DM Mono', monospace;
  line-height: 1.2;
}

.dashboard-card__value.coral { color: #FF5A5F; }
.dashboard-card__value.green { color: #34C27A; }

.dashboard-card__sub {
  font-size: 0.6875rem;
  color: rgba(255,255,255,0.3);
  margin-top: 0.125rem;
}

.dashboard-compare {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 0.625rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.dashboard-compare-label {
  font-size: 0.6875rem;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.dashboard-compare-items {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.dashboard-compare-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
}

.dashboard-compare-item__name {
  color: rgba(255,255,255,0.4);
}

.dashboard-compare-item__val {
  font-weight: 700;
  font-family: 'DM Mono', monospace;
}

.dashboard-compare-item__val.up      { color: #34C27A; }
.dashboard-compare-item__val.down    { color: #FF5A5F; }
.dashboard-compare-item__val.neutral { color: rgba(255,255,255,0.45); }

.dashboard-chart-wrap {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}

#dashboard-chart {
  width: 100% !important;
  max-height: 180px;
}

@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
  .dashboard-inner { padding: 0 1rem; }
  .dashboard-grid  { grid-template-columns: repeat(2, 1fr); }
  .dashboard-body  { max-height: 800px; }
  .dashboard-card__value { font-size: 1.0625rem; }
}

/* 4K — escalar proporcionalmente */
@media (min-width: 1920px) {
  .action-pair--a .btn {
    height: 50px !important;
    font-size: 1rem !important;
    min-width: 200px !important;
  }

  .action-pair--b .btn {
    height: 50px !important;
    font-size: 1rem !important;
    min-width: 180px !important;
  }
}
