/* ============================================================
   TuPlazoFijo — Design System v2
   Tokens + componentes compartidos por todas las páginas.
   Cargar antes del <style> propio de cada página.
   ============================================================ */

/* ---------- TOKENS ---------- */
:root {
  /* Marca: dos azules + acentos. El verde es SOLO para ganancias. */
  --blue-dark:  #0a52b8;
  --blue-mid:   #0d66d0;
  --blue-light: #2b7ff5;
  --blue-pale:  #e8f0fe;

  --green:      #17a768;
  --green-pale: #e6f6ef;

  --amber:      #f59e0b;   /* UVA / avisos */
  --amber-dark: #b45309;
  --amber-pale: #fef3c7;

  --red:        #e11d48;   /* tasas en baja */
  --red-pale:   #fff1f2;

  --text-primary:   #0f1923;
  --text-secondary: #455060;
  --text-muted:     #5f6b7a;  /* pasa contraste 4.5:1 sobre blanco */

  --border:  #e2e8f0;
  --surface: #f4f7fb;
  --card:    #ffffff;

  --radius:      0.75rem;
  --radius-sm:   0.5rem;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 3px rgba(10,25,50,0.08);
  --shadow-md: 0 4px 16px rgba(10,25,50,0.10);
  --shadow-lg: 0 8px 32px rgba(10,25,50,0.14);

  --transition: all 0.22s ease;

  --nav-h: 62px;
}

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--surface);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font-family: inherit; }
:focus-visible { outline: 3px solid var(--blue-light); outline-offset: 2px; }

/* Accesibilidad: saltar al contenido */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--blue-dark); color: #fff;
  padding: 0.6rem 1.1rem; border-radius: 0 0 var(--radius-sm) 0;
  font-size: 0.85rem; font-weight: 600;
}
.skip-link:focus { left: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ---------- BANNER DE PREVIEW (solo mockups) ---------- */
.preview-banner {
  background: linear-gradient(90deg, #7c3aed, #4f46e5);
  color: #fff; text-align: center;
  padding: 0.45rem 1rem;
  font-size: 0.8rem; font-weight: 600;
}
.preview-banner span { opacity: 0.8; }
.preview-banner a { text-decoration: underline; }

/* ---------- NAV (multinivel) ---------- */
.nav {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}
.nav-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 0 1.5rem; height: var(--nav-h);
  display: flex; align-items: center; gap: 1.25rem;
}
.nav-logo { flex-shrink: 0; display: flex; align-items: center; }
.nav-logo img { width: 186px; height: 36px; }

.nav-links { display: flex; gap: 0.1rem; flex: 1; list-style: none; align-items: center; }
.nav-links > li { position: relative; }
.nav-links > li > a, .nav-top {
  display: flex; align-items: center; gap: 0.25rem;
  font-size: 0.85rem; font-weight: 500;
  color: var(--text-secondary);
  padding: 0.4rem 0.6rem; border-radius: var(--radius-sm);
  transition: var(--transition); white-space: nowrap;
  background: none; border: none; cursor: pointer; font-family: inherit;
}
.nav-links > li > a:hover, .nav-top:hover { background: var(--blue-pale); color: var(--blue-dark); }
.nav-links a[aria-current="page"], .nav-top[aria-current="page"] { color: var(--blue-dark); font-weight: 600; background: var(--blue-pale); }
.nav-top .caret { font-size: 0.6rem; opacity: 0.6; transition: var(--transition); }

/* Panel desplegable */
.nav-drop {
  position: absolute; top: calc(100% + 6px); left: 0;
  min-width: 250px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 0.5rem;
  list-style: none; z-index: 120;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}
.nav-item:hover > .nav-drop,
.nav-item:focus-within > .nav-drop,
.nav-drop.open { opacity: 1; visibility: visible; transform: translateY(0); }
.nav-item:hover > .nav-top .caret { transform: rotate(180deg); }
.nav-drop a {
  display: block; padding: 0.5rem 0.7rem;
  font-size: 0.84rem; font-weight: 500; color: var(--text-secondary);
  border-radius: var(--radius-sm); transition: var(--transition);
}
.nav-drop a:hover { background: var(--blue-pale); color: var(--blue-dark); }
.nav-drop a strong { display: block; font-weight: 600; color: var(--text-primary); }
.nav-drop a span { display: block; font-size: 0.72rem; color: var(--text-muted); margin-top: 0.1rem; }
.nav-drop a:hover strong { color: var(--blue-dark); }
.nav-drop-head {
  font-size: 0.65rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); padding: 0.5rem 0.7rem 0.3rem;
}
.nav-drop-sep { height: 1px; background: var(--border); margin: 0.4rem 0.3rem; }
.nav-drop--wide { min-width: 460px; display: grid; grid-template-columns: 1fr 1fr; gap: 0 0.25rem; }
.nav-drop--wide .nav-drop-head, .nav-drop--wide .nav-drop-sep { grid-column: 1 / -1; }

.nav-cta {
  background: var(--blue-dark); color: #fff;
  padding: 0.5rem 1.15rem; border-radius: var(--radius-pill);
  font-size: 0.85rem; font-weight: 600;
  white-space: nowrap; transition: var(--transition); flex-shrink: 0;
}
.nav-cta:hover { background: var(--blue-mid); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(13,102,208,0.3); }

/* Botón de menú mobile */
.nav-toggle {
  display: none; background: none; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.4rem 0.6rem;
  cursor: pointer; color: var(--text-secondary); font-size: 1.1rem; line-height: 1;
}
.nav-toggle:hover { border-color: var(--blue-light); color: var(--blue-dark); }

/* ---------- PAGE HERO (páginas interiores) ---------- */
.page-hero {
  background: linear-gradient(135deg, #071d4a 0%, var(--blue-dark) 55%, var(--blue-light) 100%);
  color: #fff; padding: 2.25rem 1.5rem;
  position: relative; overflow: hidden;
}
.page-hero::before {
  content: ''; position: absolute;
  width: 400px; height: 400px; border-radius: 50%;
  background: rgba(255,255,255,0.06);
  top: -180px; right: -80px; pointer-events: none;
}
.page-hero-inner { max-width: 1200px; margin: 0 auto; position: relative; z-index: 1; }
.page-hero h1 { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.page-hero .sub { font-size: 0.95rem; opacity: 0.88; margin-top: 0.35rem; max-width: 640px; }
.breadcrumb { font-size: 0.78rem; opacity: 0.75; margin-bottom: 0.6rem; }
.breadcrumb a:hover { text-decoration: underline; }
.page-hero-meta { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.9rem; flex-wrap: wrap; }
.hero-mini-stat { font-size: 0.8rem; opacity: 0.85; }
.hero-mini-stat strong { font-size: 0.95rem; }

/* Píldora "actualizado" */
.updated-pill {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.25);
  font-size: 0.75rem; font-weight: 600;
  border-radius: var(--radius-pill); padding: 0.3rem 0.8rem;
}
.updated-pill .dot {
  width: 7px; height: 7px; background: #4ade80; border-radius: 50%;
  box-shadow: 0 0 6px #4ade80; flex-shrink: 0;
}
.updated-pill--light { background: var(--green-pale); color: var(--green); border-color: #a7f3d0; }

/* ---------- LAYOUT CON SIDEBAR ---------- */
.layout {
  max-width: 1200px; margin: 0 auto;
  padding: 2rem 1.5rem;
  display: grid; grid-template-columns: 1fr 320px; gap: 2rem;
  align-items: start;
}
/* Sin sidebar: una sola columna, ancho contenido para lectura cómoda */
.layout--full { grid-template-columns: minmax(0, 900px); justify-content: center; }
.main-col { min-width: 0; }

/* ---------- SECCIONES (home) ---------- */
.section { max-width: 1200px; margin: 0 auto; padding: 3rem 1.5rem; }
.section-header {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.75rem; flex-wrap: wrap;
}
.section-title { font-size: 1.45rem; font-weight: 700; color: var(--text-primary); letter-spacing: -0.02em; }
.section-title span { color: var(--blue-mid); }
.section-link { font-size: 0.85rem; font-weight: 600; color: var(--blue-mid); white-space: nowrap; }
.section-link:hover { color: var(--blue-dark); text-decoration: underline; }
.section-sub { font-size: 0.9rem; color: var(--text-muted); margin-top: -1.25rem; margin-bottom: 1.5rem; }
.divider { height: 1px; background: var(--border); max-width: 1200px; margin: 0 auto; }
.block-title { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 0.9rem; }
.block-title span { color: var(--blue-mid); }

/* ---------- CHIPS ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.chip {
  border: 1.5px solid var(--border); background: var(--card);
  border-radius: var(--radius-pill); padding: 0.4rem 0.95rem;
  font-size: 0.85rem; font-weight: 600; color: var(--text-secondary);
  cursor: pointer; transition: var(--transition); white-space: nowrap;
}
.chip:hover { border-color: var(--blue-light); color: var(--blue-dark); }
.chip.active { background: var(--blue-dark); border-color: var(--blue-dark); color: #fff; }
.chip small { opacity: 0.75; font-weight: 500; }

/* ---------- TABLAS DE TASAS ---------- */
.table-wrap {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow-x: auto;
  box-shadow: var(--shadow-sm); -webkit-overflow-scrolling: touch;
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
  background: var(--blue-dark); color: #fff;
  font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 0.8rem 1rem; text-align: left; white-space: nowrap;
}
.data-table tbody tr { border-bottom: 1px solid var(--border); transition: background 0.15s; }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--blue-pale); }
.data-table tbody td { padding: 0.8rem 1rem; font-size: 0.9rem; color: var(--text-secondary); }
.data-table .num { text-align: center; }
.rate-val { font-weight: 700; color: var(--blue-dark); }
.gain-val { font-weight: 700; color: var(--green); }
.rank-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  font-size: 0.72rem; font-weight: 700;
  background: var(--surface); color: var(--text-muted);
}
.rank-badge.r1 { background: var(--amber-pale); color: #92400e; }
.bank-cell { display: flex; align-items: center; gap: 0.7rem; }
.bank-cell-logo {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--blue-pale); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.62rem; font-weight: 700; color: var(--blue-dark);
}
.bank-cell-name { font-weight: 600; color: var(--blue-dark); font-size: 0.88rem; line-height: 1.25; }
.bank-cell-name:hover { text-decoration: underline; }
.bank-cell-sub { font-size: 0.7rem; color: var(--text-muted); }
.trend { font-size: 0.85rem; font-weight: 700; }
.trend.up { color: var(--green); }
.trend.down { color: var(--red); }
.trend.flat { color: var(--text-muted); }
.table-note { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.75rem; line-height: 1.5; }
.table-note a { color: var(--blue-mid); font-weight: 600; }

/* ---------- SIDEBAR ---------- */
.sidebar { display: flex; flex-direction: column; gap: 1.25rem; position: sticky; top: calc(var(--nav-h) + 14px); }
.side-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow-sm);
}
.side-card h3 { font-size: 0.9rem; font-weight: 700; margin-bottom: 0.9rem; display: flex; align-items: center; gap: 0.45rem; }
.side-rates { list-style: none; }
.side-rates li { display: flex; align-items: center; gap: 0.7rem; padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.side-rates li:last-child { border-bottom: none; }
.side-rate-logo {
  width: 32px; height: 32px; border-radius: 50%; background: var(--blue-pale);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem; font-weight: 700; color: var(--blue-dark); flex-shrink: 0;
}
.side-rate-name { flex: 1; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); }
.side-rate-val { font-size: 0.95rem; font-weight: 800; color: var(--blue-dark); }
.side-btn {
  display: block; text-align: center;
  background: var(--blue-dark); color: #fff;
  border: none; width: 100%;
  border-radius: var(--radius-sm); padding: 0.65rem;
  font-size: 0.875rem; font-weight: 700; cursor: pointer;
  margin-top: 0.75rem; transition: var(--transition);
}
.side-btn:hover { background: var(--blue-mid); }
.side-uva { background: linear-gradient(135deg, #78350f, var(--amber-dark) 55%, var(--amber)); color: #fff; border: none; }
.side-uva h3 { color: #fff; }
.side-uva p { font-size: 0.82rem; opacity: 0.94; margin-bottom: 0.75rem; }
.side-uva strong { color: #fde68a; }
.side-uva .side-btn { background: #fff; color: var(--amber-dark); }
.side-links { list-style: none; }
.side-links li { border-bottom: 1px solid var(--border); }
.side-links li:last-child { border-bottom: none; }
.side-links a {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.55rem 0; font-size: 0.85rem; font-weight: 500;
  color: var(--text-secondary); transition: var(--transition);
}
.side-links a:hover { color: var(--blue-dark); padding-left: 4px; }
.side-news { background: var(--blue-pale); border-color: #c7dbfc; }
.side-news p { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.75rem; }
.side-news input {
  width: 100%; padding: 0.6rem 0.8rem;
  border: 1.5px solid #c7dbfc; border-radius: var(--radius-sm);
  font-size: 0.85rem; outline: none; margin-bottom: 0.5rem; background: #fff;
}
.side-news input:focus { border-color: var(--blue-mid); }

/* ---------- LOGOS DE BANCOS ----------
   El contenedor lleva las iniciales como fallback; la imagen va encima.
   Si el PNG no existe, se ve el texto. */
.blogo {
  position: relative; flex-shrink: 0;
  border-radius: 50%; background: var(--blue-pale);
  color: var(--blue-dark); font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  overflow: hidden; line-height: 1;
}
.blogo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.blogo--sm { width: 32px; height: 32px; font-size: 0.58rem; }
.blogo--md { width: 40px; height: 40px; font-size: 0.62rem; }
.blogo--lg { width: 52px; height: 52px; font-size: 0.7rem; }
.blogo--xl { width: 60px; height: 60px; font-size: 0.8rem; }

/* ---------- FOOTER ---------- */
.footer {
  background: #0a1628; color: rgba(255,255,255,0.85);
  margin-top: 3rem; border-top: 3px solid var(--blue-dark);
}
.footer-inner {
  max-width: 1200px; margin: 0 auto; padding: 3rem 1.5rem 2rem;
  display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr 1fr; gap: 2rem;
}
.footer-logo img {
  width: 186px; height: 36px; margin-bottom: 0.9rem;
  /* El logo es azul/verde: sobre fondo oscuro lo pasamos a blanco */
  filter: brightness(0) invert(1); opacity: 0.92;
}
.footer-tagline { font-size: 0.85rem; opacity: 0.7; line-height: 1.6; max-width: 40ch; margin-bottom: 1.1rem; }
.footer-badges { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.footer-badge {
  font-size: 0.68rem; font-weight: 600;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--radius-pill); padding: 0.25rem 0.7rem;
  color: rgba(255,255,255,0.75);
}
.footer-col h4 {
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: rgba(255,255,255,0.45); margin-bottom: 0.9rem;
}
.footer-links { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.footer-links a { font-size: 0.83rem; color: rgba(255,255,255,0.7); transition: var(--transition); }
.footer-links a:hover { color: #fff; padding-left: 4px; }

/* Franja de herramientas destacadas */
.footer-tools {
  max-width: 1200px; margin: 0 auto; padding: 0 1.5rem 2rem;
}
.footer-tools h4 {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: rgba(255,255,255,0.45); margin-bottom: 0.8rem;
}
.footer-tools-list { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.footer-tools-list a {
  font-size: 0.78rem; font-weight: 500;
  color: rgba(255,255,255,0.72);
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-pill); padding: 0.3rem 0.8rem;
  transition: var(--transition);
}
.footer-tools-list a:hover { background: var(--blue-dark); border-color: var(--blue-mid); color: #fff; }

/* Sitios relacionados */
.footer-network {
  max-width: 1200px; margin: 0 auto; padding: 1.25rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.footer-network-label {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: rgba(255,255,255,0.4); white-space: nowrap;
}
.footer-network-links { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.footer-network-links a { font-size: 0.83rem; color: rgba(255,255,255,0.72); transition: var(--transition); }
.footer-network-links a:hover { color: #fff; }
.footer-network-links .soon { color: rgba(255,255,255,0.38); }
.footer-network-links .soon::after {
  content: 'pronto'; font-size: 0.6rem; font-weight: 700; text-transform: uppercase;
  background: rgba(255,255,255,0.1); border-radius: var(--radius-pill);
  padding: 0.1rem 0.45rem; margin-left: 0.4rem;
}
.footer-bottom {
  background: rgba(0,0,0,0.2); padding: 1.15rem 1.5rem;
  text-align: center; font-size: 0.78rem; color: rgba(255,255,255,0.45);
}

/* ---------- RESPONSIVE COMÚN ---------- */
@media (max-width: 1024px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .footer-inner { grid-template-columns: 1fr 1fr 1fr; gap: 1.75rem; }
  .footer-inner > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 980px) {
  .nav-toggle { display: block; }
  .nav-inner { gap: 0.75rem; }
  .nav-links {
    display: none; position: absolute; top: var(--nav-h); left: 0; right: 0;
    background: var(--card); border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 0.5rem 1.25rem 1rem;
    max-height: calc(100vh - var(--nav-h)); overflow-y: auto;
  }
  .nav-links.open { display: flex; }
  .nav-links > li { border-bottom: 1px solid var(--border); }
  .nav-links > li:last-child { border-bottom: none; }
  .nav-links > li > a, .nav-top {
    padding: 0.8rem 0.4rem; border-radius: 0; width: 100%;
    justify-content: space-between; font-size: 0.9rem;
  }
  /* Los desplegables pasan a acordeón */
  .nav-drop {
    position: static; opacity: 1; visibility: visible; transform: none;
    box-shadow: none; border: none; border-radius: 0;
    min-width: 0; padding: 0 0 0.6rem 0.6rem;
    display: none;
  }
  .nav-drop.open { display: block; }
  .nav-drop--wide { display: none; grid-template-columns: 1fr; }
  .nav-drop--wide.open { display: block; }
  .nav-item:hover > .nav-drop { opacity: 1; visibility: visible; }
  .nav-item:hover > .nav-drop:not(.open) { display: none; }
  .nav-drop a { padding: 0.55rem 0.4rem; }
  .nav-drop a span { display: none; }
  .nav-top[aria-expanded="true"] .caret { transform: rotate(180deg); }
}
@media (max-width: 700px) {
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-network { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
}
@media (max-width: 768px) {
  .page-hero { padding: 1.75rem 1.25rem; }
  .page-hero h1 { font-size: 1.5rem; }
  .layout { padding: 1.5rem 1.25rem; gap: 1.5rem; }
  .section { padding: 2.25rem 1.25rem; }
  .footer-inner { gap: 1.5rem; padding: 2.25rem 1.25rem 1.5rem; }
  .footer-tools, .footer-network { padding-left: 1.25rem; padding-right: 1.25rem; }
}
@media (max-width: 480px) {
  .nav-inner { padding: 0 1rem; gap: 0.6rem; }
  .nav-logo img { width: 140px; height: 27px; }
  /* CTA compacto para que entre junto al logo y el botón de menú */
  .nav-cta { padding: 0.45rem 0.85rem; font-size: 0.8rem; }
}
