/* =========================================================
   ESTRUCTURA.CSS
   Archivo unificado con toda la estructura (layout, posicionamiento, dimensiones)
   ========================================================= */

/* =========================================================
   CORE / LAYOUT-TOKENS-ESTRUCTURA.CSS
   Tokens estructurales globales
   ========================================================= */
:root {
  /* ======================================================
     RADII (estructura)
     ====================================================== */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 20px;
  --radius-2xl: 26px;

  /* Compatibilidad con tu CSS actual */
  --radius: var(--radius-lg);

  /* ======================================================
     SPACING SCALE (estructura)
     ====================================================== */
  --space-1: 4px;
  --space-2: 6px;
  --space-3: 8px;
  --space-4: 10px;
  --space-5: 12px;
  --space-6: 14px;
  --space-7: 16px;
  --space-8: 18px;
  --space-9: 22px;
  --space-10: 26px;

  /* ======================================================
     LAYOUT — 3 COLUMNAS
     ====================================================== */
  --ad-col: clamp(240px, 18vw, 320px);
  --center-max: clamp(740px, 60vw, 920px);
  --gap: clamp(12px, 1.2vw, 18px);
  --page-pad-desktop: 18px;
  --page-pad-1550: 14px;
  --page-pad-mobile: 8px;
  --center-pad-desktop: 22px;
  --center-pad-mobile: 12px;

  /* ======================================================
     TABLA (estructura)
     ====================================================== */
  --table-max-h: 230px;

  /* ======================================================
     Z-INDEX (estructura)
     ====================================================== */
  --z-base: 0;
  --z-header: 10;
  --z-sticky: 20;
  --z-modal: 1000;
  --z-cookie: 9999;

  /* ======================================================
     BREAKPOINT PRINCIPAL (documentación)
     ====================================================== */
  --bp-main: 1100px;
}

/* =========================================================
   CORE / BASE-ESTRUCTURA.CSS
   Reset + Base estructural global
   ========================================================= */

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

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  height: 100%;
  margin: 0;
  overflow-x: hidden;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  margin: 0;
}

button {
  background: none;
  border: 0;
  cursor: pointer;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

:focus-visible {
  outline: none;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.panel {
  border-radius: var(--radius);
  overflow: hidden;
}

body.modal-open {
  overflow: hidden;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 10px;
  z-index: 10000;
  text-decoration: none;
}

.skip-link:focus {
  top: 10px;
}

/* =========================================================
   LAYOUT / LAYOUT-ESTRUCTURA.CSS
   Estructura general + grid + responsive
   ========================================================= */

.page {
  min-height: 100vh;
  padding: var(--page-pad-desktop);
}

.shell {
  max-width: calc((var(--ad-col) * 2) + var(--center-max) + (var(--gap) * 2));
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--ad-col) minmax(0, 1fr) var(--ad-col);
  gap: var(--gap);
  align-items: start;
}

.center {
  min-height: auto;
  padding: var(--center-pad-desktop);
  padding-bottom: clamp(8px, 2vh, 16px);
  border-radius: var(--radius-2xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  max-width: var(--center-max);
  margin: 0 auto;
}

.pdh-main {
  flex: 0;
}

.pdh-main-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  column-gap: 18px;
  row-gap: 10px;
  align-items: start;
  grid-template-areas:
    "pills pills"
    "ad    ad"
    "calc  best"
    "table best"
    "table sunat"
    "final final";
}

.pdh-pills { grid-area: pills; }
.conversor-wrapper-modern { grid-area: calc; }
.best-deal { grid-area: best; }
.casas-cambio { grid-area: table; }
.sunat-widget { grid-area: sunat; }
.ad-inline { grid-area: ad; }
.ad-final { grid-area: final; }

@media (max-width:1100px) {
  .shell {
    grid-template-columns: 1fr;
    max-width: 100%;
  }
  .ads.left,
  .ads.right {
    display: none;
  }
}

@media (max-width:700px) {
  .page {
    padding: var(--page-pad-mobile);
  }
  .center {
    padding: var(--center-pad-mobile);
    border-radius: var(--radius-xl);
  }
  .sunat-widget {
    display: none;
  }
  .pdh-main-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "pills"
      "calc"
      "ad"
      "best"
      "final"
      "table";
  }
}

@media (max-width:360px) {
  /* reservado */
}

/* =========================================================
   LAYOUT / HEADER-ESTRUCTURA.CSS
   Header estructural
   ========================================================= */

.pdh-header__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-7);
  padding: 0;
}

.pdh-brand {
  display: flex;
  align-items: center;
  gap: var(--space-7);
  min-width: 0;
}

.pdh-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  flex: 0 0 auto;
}

.brand-title {
  margin: 0;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.brand-title .accent-hoy,
.brand-title .accent-pe {
  /* sin propiedades estructurales */
}

.brand-subtitle {
  margin: 4px 0 0;
  line-height: 1.2;
  min-width: 0;
}

.pdh-top-controls {
  display: flex;
  align-items: flex-start;
  min-width: 0;
}

.pdh-updated {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.pdh-updated strong {
  /* sin propiedades estructurales */
}

.pdh-header__top a:focus-visible,
.pdh-header__top button:focus-visible {
  border-radius: var(--radius-sm);
  outline: none;
}

@media (max-width:1100px) {
  .pdh-header__top {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }
  .pdh-logo {
    width: 48px;
    height: 48px;
  }
}

@media (max-width:700px) {
  /* vacío */
}

@media (max-width:360px) {
  /* vacío */
}

/* =========================================================
   FOOTER / FOOTER-ESTRUCTURA.CSS
   Footer layout
   ========================================================= */

.pdh-footer {
  margin-top: var(--space-8);
  padding: 0;
}

.pdh-footer__inner {
  border-radius: var(--radius-xl);
  padding: var(--space-7);
  display: grid;
  gap: var(--space-7);
}

@media (min-width: 980px) {
  .pdh-footer__inner {
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
    align-items: start;
  }
}

.pdh-footer__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: center;
  gap: 16px;
}

.pdh-footer__logo {
  display: block;
}

.pdh-footer__logo img {
  width: 88px;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 18px;
}

.pdh-footer__title {
  margin: 0 0 12px 0;
}

.pdh-footer__col {
  display: grid;
  gap: 10px;
}

.pdh-footer__social {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.pdh-footer__icon {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: grid;
  place-items: center;
}

.pdh-footer__icon svg {
  width: 20px;
  height: 20px;
}

.pdh-footer__store {
  display: inline-grid;
  gap: 2px;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  max-width: 220px;
}

.pdh-footer__bottom {
  margin-top: 14px;
  padding: 14px 18px;
}

.pdh-footer__dot {
  margin: 0 10px;
}

@media (max-width: 700px) {
  .pdh-footer__inner {
    padding: var(--space-6);
    border-radius: var(--radius-lg);
  }
}

/* =========================================================
   COMPONENTS / COMPONENTS-ESTRUCTURA.CSS
   UI estructural: headers, botones, pills, best-deal, SUNAT, SEO
   ========================================================= */

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  padding: var(--space-6) var(--space-7);
  border-bottom-width: 1px;
  border-bottom-style: solid;
}

.section-head--tight {
  padding: var(--space-5) var(--space-6);
}

.section-title {
  margin: 0;
}

.table-subtitle {
  display: block;
  margin-top: 2px;
}

.table-head-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.btn-primary {
  width: 100%;
  border: 0;
  cursor: pointer;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  transition: transform 0.08s ease, filter 0.12s ease;
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-link {
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: transform 0.08s ease, filter 0.12s ease;
}

.pdh-pills {
  display: flex;
  gap: var(--space-7);
  margin: 2px 0 2px;
}

.pdh-pill {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 8px 14px;
  border-radius: 999px;
  min-width: 0;
}

.pdh-pill__label {
  white-space: nowrap;
}

.pdh-pill__value {
  white-space: nowrap;
  display: inline-block;
  width: 3.9ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pdh-pill__arrow {
  display: inline-block;
  width: 1.5ch;
  text-align: center;
}

.ver-todo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  user-select: none;
}

.ver-todo input {
  width: 16px;
  height: 16px;
}

.best-deal {
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border-width: 1px;
  border-style: solid;
}

.best-deal__head {
  padding: 10px 14px;
  border-bottom-width: 1px;
  border-bottom-style: solid;
  text-align: center;
}

.best-deal__tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: 6px 10px;
  border-radius: 999px;
}

.best-deal__body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.best-deal__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-4);
}

.best-deal__logo {
  display: flex;
  align-items: center;
  justify-content: center;
}

.best-deal__logo img {
  width: 120px;
  height: 56px;
  object-fit: contain;
}

.best-deal__title {
  display: none;
}

.best-deal__note {
  /* sin propiedades visuales */
}

.best-deal__rates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.best-deal__rate {
  text-align: center;
  border-radius: var(--radius-lg);
  padding: 12px 10px;
}

.best-deal__lbl {
  display: block;
}

.best-deal__num {
  display: block;
  margin-top: 6px;
}

.best-deal__cta {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.best-deal__fine {
  margin: 0;
}

.sunat-widget__head {
  padding: 10px 14px;
  border-bottom-width: 1px;
  border-bottom-style: solid;
}

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

.sunat-logo {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.sunat-sub {
  /* sin propiedades visuales */
}

.sunat-widget__body {
  padding: 12px;
}

.sunat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
  margin-bottom: var(--space-4);
}

.sunat-item {
  border-radius: var(--radius-md);
  padding: 8px;
  text-align: center;
}

.sunat-lbl {
  display: block;
}

.sunat-val {
  display: block;
  margin-top: 6px;
}

.sunat-mini {
  margin: 8px 0 8px;
}

.sunat-note {
  margin: 0 0 10px;
  line-height: 1.25;
}

.sunat-widget__link {
  width: 100%;
  text-align: left;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  transition: transform 0.08s ease, filter 0.12s ease;
}

.sunat-badge,
.sunat-widget__title,
.sunat-widget__small {
  display: none !important;
}

.seo-intro {
  margin: 4px 0 6px;
}

.seo-intro__details {
  border-radius: var(--radius-md);
}

.seo-intro details {
  border-radius: var(--radius-md);
  padding: 8px 12px;
}

.seo-intro summary,
.seo-intro__summary {
  cursor: pointer;
  list-style: none;
}

.seo-intro summary::-webkit-details-marker,
.seo-intro__summary::-webkit-details-marker {
  display: none;
}

.seo-intro__text,
.seo-intro p {
  margin: 8px 0 0;
  line-height: 1.45;
}

.seo-faq {
  margin-top: 14px;
  padding: 12px 14px 14px;
  border-radius: var(--radius-lg);
}

.seo-faq h2 {
  margin: 0 0 10px;
}

.seo-faq details {
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin: 10px 0;
}

.seo-faq summary {
  cursor: pointer;
  list-style: none;
}

.seo-faq summary::-webkit-details-marker {
  display: none;
}

.seo-faq details p {
  margin: 8px 0 0;
  line-height: 1.45;
}

.btn-primary:focus-visible,
.btn-link:focus-visible,
.sunat-widget__link:focus-visible,
.chip:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
}

@media (max-width:1100px) and (min-width:701px) {
  .pdh-pills {
    flex-wrap: wrap;
  }
  .pdh-pill {
    flex: 1 1 220px;
  }
}

@media (max-width:700px) {
  .pdh-pill__label {
    padding-left: 2px;
  }
  .pdh-pills {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 6px 0 2px;
  }
  .pdh-pill {
    width: 260px;
    margin-right: auto;
  }
  .sunat-widget__body {
    padding: 10px;
  }
  .sunat-grid {
    gap: 10px;
  }
  .sunat-item {
    padding: 8px;
  }
  .sunat-note {
    display: none;
  }
  .seo-faq {
    padding: 12px;
  }
  .seo-faq details {
    margin: 8px 0;
  }
}

@media (max-width:360px) {
  /* reservado */
}

/* =========================================================
   COMPONENTS / CALCULATOR-ESTRUCTURA.CSS
   Conversor (estructura)
   ========================================================= */

.conversor-wrapper-modern {
  padding-bottom: var(--space-4);
}

.modo-opciones {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3);
  margin: 0 var(--space-7);
  border-radius: var(--radius-md);
}

.radio-pill {
  position: relative;
  flex: 1;
  cursor: pointer;
}

.radio-pill input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.radio-pill span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: transform 0.08s ease, background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.radio-pill:active span {
  transform: translateY(1px);
}

.modo-opciones .radio-pill:hover input:not(:checked) + span {
  transform: translateY(-1px);
}

.modo-opciones .radio-pill:active input:not(:checked) + span {
  transform: translateY(0);
}

.quick-row {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-7) var(--space-3);
  flex-wrap: wrap;
}

.quick-row .quick-amt {
  appearance: none;
  border-radius: 999px;
  padding: 7px 11px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.quick-row .chip:hover,
.quick-row .quick-amt:hover {
  filter: brightness(1.02);
}

.quick-row .chip:active,
.quick-row .quick-amt:active {
  transform: translateY(1px);
}

.quick-row .quick-amt:hover {
  transform: translateY(-1px);
}

.quick-row .quick-amt:active {
  transform: translateY(0);
}

.fila-triple {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-7) 0;
  align-items: end;
}

.fila-triple--pro {
  grid-template-columns: 1.35fr 1.65fr;
}

.grupo-campo {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.grupo-campo label {
  /* sin propiedades visuales */
}

.conversor-wrapper-modern .gc-monto label {
  /* sin propiedades visuales */
}

.input-with-prefix {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-md);
}

.input-with-prefix .prefix {
  /* sin propiedades visuales */
}

.input-with-prefix input {
  border: 0;
  outline: 0;
  background: transparent;
  width: 100%;
}

.input-with-prefix input::placeholder {
  /* sin propiedades visuales */
}

.input-with-prefix.is-empty .prefix {
  /* sin propiedades visuales */
}

.gc-moneda-pro > label {
  display: none;
}

.gc-moneda-pro .currency-line {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.cur-pill {
  flex: 1;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: var(--radius-md);
  white-space: nowrap;
  transition: transform 0.18s ease, filter 0.12s ease;
}

.cur-pill--ghost {
  /* sin propiedades visuales */
}

.swap {
  height: 44px;
  width: 44px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform 0.18s ease, filter 0.12s ease;
}

.swap:hover {
  filter: brightness(1.02);
}

.swap:active {
  transform: translateY(1px);
}

.currency-line.is-swap .swap {
  transform: rotate(180deg);
}

.currency-line.is-swap .cur-pill {
  transform: translateY(-1px);
}

.resultado-modern {
  margin: var(--space-5) var(--space-7) 0;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border-width: 1px;
  border-style: solid;
  min-height: 41px;
  display: flex;
  align-items: center;
}

.resultado-modern:empty {
  visibility: hidden;
}

.fineprint {
  margin: var(--space-3) var(--space-7) 0;
}

@media (max-width:700px) {
  .fila-triple--pro {
    grid-template-columns: 1fr;
  }
  .gc-moneda-pro {
    margin-top: var(--space-4);
  }
  .modo-opciones {
    margin: 0 var(--space-6);
    padding: 7px;
  }
  .radio-pill span {
    height: 32px;
    padding: 0 8px;
  }
  .quick-row {
    padding: var(--space-5) var(--space-6) var(--space-3);
  }
  .resultado-modern {
    margin: var(--space-5) var(--space-6) 0;
  }
  .fineprint {
    margin: var(--space-3) var(--space-6) 0;
  }
}

@media (max-width:360px) {
  .quick-row {
    gap: var(--space-2);
    padding: var(--space-4) var(--space-6) var(--space-2);
  }
  .quick-row .quick-amt {
    padding: 6px 10px;
  }
}

/* =========================================================
   COMPONENTS / TABLE-ESTRUCTURA.CSS
   Tabla Casas (estructura)
   ========================================================= */

.tabla-casas-wrapper {
  padding: var(--space-4) var(--space-7) var(--space-7);
  min-height: 249px;
}

.tabla-casas-wrapper--wide {
  padding: var(--space-4) var(--space-7) var(--space-7);
  border-top-width: 1px;
  border-top-style: solid;
  max-height: none;
  overflow: visible;
  scrollbar-gutter: stable;
}

.tabla-casas-wrapper--wide.is-all {
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

.tabla-casas-wrapper--wide.is-all .tabla-casas thead th {
  padding: 10px 12px;
}

.tabla-casas-wrapper--wide::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.tabla-casas-wrapper--wide::-webkit-scrollbar-thumb {
  border-radius: 999px;
  border-width: 2px;
  border-style: solid;
}

.tabla-casas-wrapper--wide::-webkit-scrollbar-track {
  border-radius: 999px;
}

.tabla-casas {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.tabla-casas thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 12px 12px;
  text-align: left;
  border-bottom-width: 1px;
  border-bottom-style: solid;
}

.tabla-casas thead th:first-child {
  border-top-left-radius: var(--radius-md);
}
.tabla-casas thead th:last-child {
  border-top-right-radius: var(--radius-md);
}

.tabla-casas thead th.compra,
.tabla-casas thead th.venta,
.tabla-casas thead th#columna-resultado {
  text-align: center;
}

.tabla-casas tbody td {
  padding: 12px 12px;
  border-bottom-width: 1px;
  border-bottom-style: solid;
  vertical-align: middle;
}

.tabla-casas td.casa {
  /* font-size se ha movido a diseño */
}

.tabla-casas td .casa-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-5);
  min-width: 0;
  text-decoration: none;
}

.tabla-casas td .casa-logo {
  width: 88px;
  height: 34px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-width: 1px;
  border-style: solid;
}

.tabla-casas td .casa-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.tabla-casas td .logo-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tabla-casas td .casa-chevron {
  margin-left: auto;
}

.tabla-casas td.compra,
.tabla-casas td.venta {
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.tabla-casas td.resultado {
  font-variant-numeric: tabular-nums;
  text-align: center;
  white-space: nowrap;
}

.tabla-casas tbody tr.winner-row td {
  border-bottom-width: 1px;
  border-bottom-style: solid;
}

.tabla-casas thead th.compra,
.tabla-casas thead th.venta {
  /* transition se ha movido a diseño */
}

.tabla-casas.usa-compra thead th.compra {
  border-radius: 10px 10px 0 0;
}

.tabla-casas.usa-venta thead th.venta {
  border-radius: 10px 10px 0 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px 10px;
  border-radius: 999px;
}

.table-footer {
  padding: var(--space-4) var(--space-7) var(--space-7);
  border-top-width: 1px;
  border-top-style: solid;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.table-footer--split {
  justify-content: space-between;
}

.tabla-casas thead th:nth-child(1) { width: 40%; }
.tabla-casas thead th:nth-child(2) { width: 16%; }
.tabla-casas thead th:nth-child(3) { width: 16%; }
.tabla-casas thead th:nth-child(4) { width: 28%; }

.tabla-casas .casa-wrap:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
}

@media (max-width:700px) {
  .tabla-casas thead th:nth-child(1) { width: auto; }
  .tabla-casas thead th:nth-child(4) { width: auto; }
  .tabla-casas { min-width: 0; }
  .tabla-casas th.compra,
  .tabla-casas th.venta,
  .tabla-casas td.compra,
  .tabla-casas td.venta {
    display: none;
  }
  .tabla-casas thead th {
    padding: 10px 10px;
  }
  .tabla-casas tbody td {
    padding: 10px 10px;
  }
  .tabla-casas td.resultado {
    text-align: right;
    white-space: nowrap;
  }
  .tabla-casas th#columna-resultado {
    text-align: right;
    white-space: nowrap;
  }
  .tabla-casas td .casa-logo {
    width: 64px;
    height: 28px;
    border-radius: 10px;
  }
  .tabla-casas td .casa-chevron {
    display: none;
  }
}

/* =========================================================
   COMPONENTS / MODAL-ESTRUCTURA.CSS
   Modal + Chart (estructura)
   ========================================================= */

.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: var(--z-modal);
}

.modal[aria-hidden="false"] {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vh 10px;
}

.modal__overlay {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.modal__panel {
  position: relative;
  width: 100%;
  max-width: 900px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  z-index: 1;
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  padding: 12px 16px;
  border-bottom-width: 1px;
  border-bottom-style: solid;
}

.modal__title {
  margin: 0;
}

.modal__meta {
  margin-top: 2px;
}

.modal__close {
  background: none;
  border: none;
  cursor: pointer;
}

.modal__close:hover {
  /* color en diseño */
}

.modal__body {
  padding: 14px 16px 16px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

body.modal-open {
  overflow: hidden;
}

#graficoSunat {
  width: 100% !important;
  height: 340px !important;
  display: block;
}

.modal__close:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
}

@media (max-width:700px) {
  .modal[aria-hidden="false"] {
    padding: 10vh 10px;
  }
  .modal__panel {
    border-radius: var(--radius-md);
    max-height: 84vh;
  }
  #graficoSunat {
    height: 280px !important;
  }
}

@media (max-width:360px) {
  #graficoSunat {
    height: 240px !important;
  }
}

#rankingModal .tabla-casas th,
#rankingModal .tabla-casas td {
  white-space: nowrap;
}

#rankingModal .tabla-casas td.compra,
#rankingModal .tabla-casas td.venta,
#rankingModal .tabla-casas td.resultado {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

#rankingModal #rk-col-resultado {
  text-align: center;
}

#rankingModal .tabla-casas-wrapper {
  margin-bottom: 14px;
}

#rankingModal .tabla-casas.rk-compra thead th.compra {
  border-bottom-width: 2px;
  border-bottom-style: solid;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}

#rankingModal .tabla-casas.rk-venta thead th.venta {
  border-bottom-width: 2px;
  border-bottom-style: solid;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}

#rankingModal .ranking-all {
  margin-top: 6px;
}

#rankingModal .ranking-all__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0 10px;
}

#rankingModal .ranking-all__title {
  margin: 0;
}

#rankingModal .ranking-all__meta {
  /* font-size se ha movido a diseño */
}

#rankingModal .ranking-logos {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width:1100px) {
  #rankingModal .ranking-logos {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width:700px) {
  #rankingModal .ranking-logos {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }
}

#rankingModal .ranking-logos a {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 64px;
  border-radius: var(--radius-md);
  text-decoration: none;
  overflow: hidden;
  transition: transform 0.08s ease, filter 0.12s ease;
  border-width: 1px;
  border-style: solid;
}

#rankingModal .ranking-logos a:hover {
  filter: brightness(1.03); /* diseño */
}

#rankingModal .ranking-logos a:active {
  transform: translateY(1px);
}

#rankingModal .ranking-logos a[aria-disabled="true"] {
  opacity: 0.55;
  cursor: pointer;
  pointer-events: none;
}

#rankingModal .ranking-logos img {
  max-width: 92%;
  max-height: 70%;
  object-fit: contain;
  display: block;
}

/* =========================================================
   COMPONENTS / ADS-ESTRUCTURA.CSS
   Publicidad (estructura)
   ========================================================= */

.ads {
  width: 100%;
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  gap: var(--space-7);
}

.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  border-width: 1px;
  border-style: dashed;
}

.ad-300x600 {
  width: 100%;
  max-width: 300px;
  height: 600px;
}

.ad-300x250 {
  width: 100%;
  max-width: 300px;
  height: 250px;
}

.ad-inline {
  display: none;
}

.ad-slot.ad-responsive {
  width: 100%;
  max-width: 728px;
  margin: 0 auto;
  min-height: 250px;
  height: auto;
}

.ad-secondary {
  display: none;
}

.ad-final {
  display: none;
}

.ad-slot::before {
  padding: 6px 10px;
  border-radius: 999px;
  position: absolute;
  top: 10px;
  left: 10px;
  pointer-events: none;
  border-width: 1px;
  border-style: solid;
}

.ad-slot::after {
  position: absolute;
  bottom: 10px;
  left: 10px;
  pointer-events: none;
  max-width: 85%;
}

.ad-slot.is-filled::before,
.ad-slot.is-filled::after {
  display: none;
}

@supports selector(:has(*)) {
  .ad-slot:has(iframe)::before,
  .ad-slot:has(iframe)::after,
  .ad-slot:has(ins)::before,
  .ad-slot:has(ins)::after {
    display: none;
  }
}

@media (max-width:1100px) {
  .ad-inline {
    display: block;
    margin-top: var(--space-4);
    margin-bottom: var(--space-4);
  }
  .ad-inline .ad-slot {
    border-radius: var(--radius-sm);
  }
  .ad-secondary {
    display: none !important;
  }
  .ad-final {
    display: block;
    margin-top: var(--space-5);
  }
  .ad-final .ad-slot {
    min-height: 250px;
    border-radius: var(--radius-md);
  }
}

@media (max-width:700px) {
  .ad-slot.ad-responsive {
    min-height: 100px;
  }
}

@media (min-width:1101px) {
  .ad-slot.ad-responsive {
    min-height: 90px;
  }
  .ad-secondary {
    display: flex;
    margin-top: auto;
  }
}

/* =========================================================
   COMPONENTS / COOKIES-ESTRUCTURA.CSS
   Cookie Banner (estructura)
   ========================================================= */

#cookie-banner {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  max-width: 720px;
  width: calc(100% - 32px);
  padding: 10px 14px;
  display: none;
  z-index: var(--z-cookie);
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-radius: 999px;
}

#cookie-banner.show {
  display: flex;
  transform: translateX(-50%) translateY(0);
}

#cookie-banner a {
  white-space: nowrap;
}

#cookie-banner button {
  padding: 6px 12px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
}

#cookie-banner button:active {
  transform: translateY(1px);
}

#cookie-banner button:focus-visible {
  outline: none;
}

@media (max-width:700px) {
  #cookie-banner {
    flex-wrap: wrap;
    border-radius: var(--radius-md);
    padding: 12px;
    bottom: 14px;
  }
  #cookie-banner button {
    width: 100%;
    text-align: center;
  }
}

@media (max-width:360px) {
  #cookie-banner {
    padding: 10px;
  }
  #cookie-banner button {
    padding: 6px 10px;
  }
}

/* =========================================================
   HOME SEO – ESTRUCTURA
   ========================================================= */

.section-underline {
  width: 88px;
  height: 4px;
  border-radius: 999px;
  margin: 10px auto 0;
}

.about-site {
  margin-top: var(--space-8);
  padding: var(--space-8);
  text-align: center;
  max-width: none;
  margin-left: auto;
  margin-right: auto;
}

.about-site__title {
  margin-bottom: var(--space-4);
}

.about-site__text {
  margin-bottom: var(--space-4);
}

.howto {
  margin-top: var(--space-7);
  padding: var(--space-7);
  border-radius: var(--radius-xl);
  text-align: center;
  border-width: 1px;
  border-style: solid;
}

.howto__head--center {
  max-width: 720px;
  margin: 0 auto var(--space-7);
}

.howto__title--big {
  margin-bottom: var(--space-3);
}

.howto__lead--center {
  /* sin propiedades visuales */
}

.howto__steps {
  display: grid;
  gap: var(--space-6);
}

@media (min-width: 980px) {
  .howto__steps {
    grid-template-columns: repeat(3, 1fr);
    align-items: start;
  }
}

.howto-step {
  max-width: 320px;
  margin: 0 auto;
}

.howto-step__circle {
  width: 130px;
  height: 130px;
  margin: 0 auto var(--space-5);
  border-radius: 999px;
  border-width: 3px;
  border-style: solid;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.howto-step__icon {
  width: 48px;
  height: 48px;
}

.howto-step__number {
  position: absolute;
  bottom: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.howto-step__title {
  margin-bottom: var(--space-3);
}

.howto-step__text {
  /* sin propiedades visuales */
}

.choose {
  margin-top: var(--space-7);
  padding: var(--space-7);
  border-radius: var(--radius-xl);
  border-width: 1px;
  border-style: solid;
}

.choose__head {
  text-align: center;
  max-width: 820px;
  margin: 0 auto var(--space-7);
}

.choose__title {
  margin: 0 0 var(--space-3);
}

.choose__lead {
  margin: 0;
}

.choose__grid {
  display: grid;
  gap: var(--space-5);
}

@media (min-width: 980px) {
  .choose__grid {
    grid-template-columns: repeat(4, 1fr);
    align-items: stretch;
  }
}

.choose-card {
  border-width: 1px;
  border-style: solid;
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  text-align: center;
}

.choose-card__icon {
  width: 86px;
  height: 86px;
  margin: 0 auto var(--space-4);
  border-radius: 999px;
  display: grid;
  place-items: center;
  border-width: 1px;
  border-style: solid;
}

.choose-card__svg {
  width: 38px;
  height: 38px;
}

.choose-card__title {
  margin: 0 0 var(--space-3);
}

.choose-card__text {
  margin: 0;
}

@media (max-width: 700px) {
  .choose {
    padding: var(--space-6);
    border-radius: var(--radius-lg);
  }
  .choose__title {
    /* font-size se ha movido a diseño */
  }
}

.guides {
  margin-top: var(--space-7);
  padding: var(--space-7);
  border-radius: var(--radius-xl);
  border-width: 1px;
  border-style: solid;
}

.guides__head {
  text-align: center;
  max-width: 860px;
  margin: 0 auto var(--space-6);
}

.guides__title {
  margin: 0 0 var(--space-3);
}

.guides__lead {
  margin: 0;
}

.guides__grid {
  display: grid;
  gap: var(--space-6);
}

@media (min-width: 980px) {
  .guides__grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-7);
  }
}

.guide-item {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: var(--space-4);
  align-items: start;
  padding: var(--space-6);
  border-radius: var(--radius-xl);
  border-width: 1px;
  border-style: solid;
}

.guide-item__icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  border-width: 1px;
  border-style: solid;
  display: grid;
  place-items: center;
}

.guide-item__svg {
  width: 26px;
  height: 26px;
}

.guide-item__title {
  margin: 0 0 8px;
}

.guide-item__link {
  color: inherit;
  text-decoration: none;
}
.guide-item__link:hover {
  text-decoration: underline;
}

.guide-item__text {
  margin: 0 0 var(--space-3);
}

.guide-item__cta {
  text-decoration: none;
}
.guide-item__cta:hover {
  text-decoration: underline;
}

@media (max-width: 700px) {
  .guides {
    padding: var(--space-6);
    border-radius: var(--radius-lg);
  }
  .guides__title {
    /* font-size se ha movido a diseño */
  }
  .guide-item {
    padding: var(--space-5);
    grid-template-columns: 48px 1fr;
  }
  .guide-item__icon {
    width: 48px;
    height: 48px;
  }
}

.faq {
  margin-top: var(--space-7);
  padding: var(--space-7);
  border-radius: var(--radius-xl);
  border-width: 1px;
  border-style: solid;
}

.faq__head {
  text-align: center;
  margin-bottom: var(--space-6);
}

.faq__title {
  margin: 0 0 var(--space-3);
}

.faq__list {
  display: grid;
  gap: var(--space-4);
  max-width: 980px;
  margin: 0 auto;
}

.faq-item {
  border-width: 1px;
  border-style: solid;
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.faq-item__q {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 18px 20px;
}

.faq-item__q::-webkit-details-marker {
  display: none;
}

.faq-item__q::after {
  content: "▾";
  transition: transform 0.15s ease;
}

.faq-item[open] .faq-item__q {
  border-bottom-width: 1px;
  border-bottom-style: solid;
}

.faq-item[open] .faq-item__q::after {
  transform: rotate(180deg);
}

.faq-item__a {
  padding: 16px 20px 18px;
}

.faq-item__a p {
  margin: 0;
}

.faq-item__q:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
}

@media (max-width:700px) {
  .faq {
    padding: var(--space-5);
    border-radius: var(--radius-lg);
  }
  .faq__title {
    /* font-size se ha movido a diseño */
  }
  .faq-item__q {
    padding: 16px 16px;
  }
  .faq-item__a {
    padding: 14px 16px 16px;
  }
}

/* =========================================================
   PAGES / STATIC-PAGES-ESTRUCTURA.CSS
   Páginas estáticas (estructura)
   ========================================================= */

.shell-simple {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

.static-page {
  max-width: 820px;
  margin: 0 auto;
  padding: 22px 24px;
  border-radius: var(--radius-xl);
  border-width: 1px;
  border-style: solid;
}

.static-content h1 {
  margin: 0 0 10px;
}

.static-content h2 {
  margin: 20px 0 10px;
}

.static-content h3 {
  margin: 16px 0 8px;
}

.static-content p {
  margin: 0 0 14px;
}

.static-content ul,
.static-content ol {
  margin: 0 0 14px 18px;
  padding: 0;
}

.static-content li {
  margin: 6px 0;
}

.static-content blockquote {
  margin: 14px 0;
  padding: 12px 14px;
  border-left-width: 4px;
  border-left-style: solid;
  border-radius: var(--radius-md);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.skip-link:focus {
  left: 16px;
  top: 16px;
  width: auto;
  height: auto;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  z-index: var(--z-cookie);
  border-width: 1px;
  border-style: solid;
}

@media (max-width:1100px) {
  .static-page {
    padding: 20px 22px;
    border-radius: var(--radius-lg);
  }
}

@media (max-width:700px) {
  .static-page {
    padding: 18px 16px;
    border-radius: var(--radius-md);
  }
}

@media (max-width:360px) {
  .static-page {
    padding: 16px 14px;
  }
}