@font-face {
  font-family: "Inter";
  src: url("./fonts/Inter-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --rb-primary: #c8102e;
  --rb-primary-700: #a50d26;
  --rb-accent: #057784;
  --rb-bg: #f6f6f6;
  --rb-surface: #ffffff;
  --rb-ink: #17181d;
  --rb-muted: #475569;
  --rb-border: rgba(15, 23, 42, 0.1);
  --rb-success: #1f7a3a;
  --rb-warn: #b8770a;
  --rb-shadow-soft: 0 20px 60px rgba(15, 23, 42, 0.08);
}

html { scroll-behavior: smooth; }

[x-cloak] { display: none !important; }

body {
  background: var(--rb-bg);
  color: var(--rb-ink);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

site-header,
site-footer {
  display: block;
}

/* Cabecera fija (sticky) y sub-navegación de Renta pegada justo debajo. */
site-header {
  position: sticky;
  top: 0;
  z-index: 50;
}

html {
  scroll-padding-top: calc(var(--rb-header-h, 78px) + 1rem);
}

::selection {
  background: rgba(200, 16, 46, 0.18);
}

.rb-card {
  background: var(--rb-surface);
  border: 1px solid var(--rb-border);
  border-radius: 1.35rem;
  box-shadow: var(--rb-shadow-soft);
}

.rb-btn-primary {
  background: var(--rb-primary);
  color: #fff;
}
.rb-btn-primary:hover { background: var(--rb-primary-700); }

.rb-tag {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .15rem .55rem; border-radius: 999px;
  font-size: .75rem; font-weight: 600;
  background: #eef3f9; color: var(--rb-primary-700);
}
.rb-tag.warn { background: #fff4e5; color: var(--rb-warn); }
.rb-tag.danger { background: #fde8e3; color: var(--rb-accent); }
.rb-tag.ok { background: #e6f4ec; color: var(--rb-success); }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(200, 16, 46, 0.16),
    0 0 0 6px rgba(255, 255, 255, 0.95);
  border-radius: .5rem;
}

.skip-link {
  position: absolute; left: -9999px;
}
.skip-link:focus {
  left: 1rem; top: 1rem; z-index: 1000;
  background: var(--rb-ink); color: #fff;
  padding: .5rem .75rem; border-radius: .5rem;
}

.rb-source {
  font-size: .75rem; color: var(--rb-muted);
}
.rb-source a { text-decoration: underline; }

/* Botones de opción del asistente. Clases planas para no depender de
   utilidades arbitrarias de Tailwind compiladas a tailwind.css. */
.rb-option {
  display: block; width: 100%; text-align: left;
  background: var(--rb-surface);
  border: 2px solid transparent;
  border-radius: .75rem;
  padding: 1rem;
  transition: transform .15s ease, border-color .15s ease, background-color .15s ease;
  cursor: pointer;
}
.rb-option:hover { transform: translateY(-1px); border-color: var(--rb-border); }
.rb-option.is-on {
  border-color: var(--rb-primary);
  background: #eef3f9;
}
.rb-option.is-on::before {
  content: "✓";
  color: var(--rb-primary);
  font-weight: 700;
  margin-right: .35rem;
}

.rb-desktop-only {
  display: none;
}

.rb-md-up-only {
  display: none;
}

.rb-mobile-only {
  display: block;
}

.rb-mobile-guide-index {
  position: static;
}

.rb-mobile-guide-index__inner {
  border: 1px solid var(--rb-border);
  border-radius: 1rem;
  background: rgba(255, 255, 255, .96);
  box-shadow: var(--rb-shadow-soft);
  padding: .6rem;
}

.rb-mobile-guide-index__button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  border-radius: .75rem;
  padding: .75rem 1rem;
  background: var(--rb-primary);
  color: #fff;
  font-size: .875rem;
  font-weight: 700;
}

.rb-mobile-guide-index__panel {
  margin-top: .6rem;
  border-top: 1px solid var(--rb-border);
  padding-top: .6rem;
}

.rb-mobile-guide-index__nav {
  display: grid;
  gap: .45rem;
}

.rb-mobile-guide-index__nav a {
  border-radius: .75rem;
  background: #f8fafc;
  padding: .65rem .75rem;
  font-size: .875rem;
  font-weight: 600;
}

.rb-critical-alert {
  border-bottom: 1px solid rgba(184, 119, 10, .24);
  background: #fff7ed;
}

.rb-critical-alert__inner {
  display: grid;
  gap: .75rem;
  align-items: start;
  max-width: 72rem;
  margin: 0 auto;
  padding: .85rem 1rem;
}

.rb-critical-alert__icon {
  display: inline-grid;
  width: 1.75rem;
  height: 1.75rem;
  place-items: center;
  border-radius: 999px;
  background: var(--rb-warn);
  color: #fff;
  font-weight: 800;
}

.rb-critical-alert__content {
  display: grid;
  gap: .25rem;
}

.rb-critical-alert__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
}

.rb-critical-alert__link,
.rb-critical-alert__close {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 .25rem;
  font-size: .875rem;
  font-weight: 700;
  text-decoration: underline;
}

.rb-weekly-card {
  display: block;
  height: 100%;
  border: 1px solid var(--rb-border);
  border-radius: 1rem;
  background: #fff;
  padding: 1rem;
  transition: border-color .15s ease, background-color .15s ease, transform .15s ease;
}

.rb-weekly-card:hover {
  border-color: rgba(15, 23, 42, .24);
  background: #f8fafc;
  transform: translateY(-1px);
}

.rb-tour-toast {
  position: fixed;
  right: 1rem;
  top: 5.25rem;
  bottom: auto;
  z-index: 60;
  width: min(25rem, calc(100vw - 2rem));
  border: 1px solid var(--rb-border);
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, .16);
  padding: 1rem;
}

.rb-tour-toast__text {
  color: #0f172a;
  font-size: .95rem;
  font-weight: 700;
  line-height: 1.35;
}

.rb-tour-toast__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .85rem;
}

.rb-tour-toast__primary,
.rb-tour-toast__secondary {
  min-height: 2.75rem;
  border-radius: .75rem;
  padding: 0 .9rem;
  font-size: .875rem;
  font-weight: 700;
}

.rb-tour-toast__primary {
  border: 0;
  background: var(--rb-primary);
  color: #fff;
}

.rb-tour-toast__secondary {
  border: 1px solid var(--rb-border);
  background: #f8fafc;
  color: #334155;
}

.driver-popover.rb-driver-popover {
  max-width: min(26rem, 90vw);
}

.driver-popover.rb-driver-popover .driver-popover-title {
  font-size: 1rem;
}

.rb-chatbot-fab {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 70;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 3.25rem;
  border: 0;
  border-radius: 999px;
  background: var(--rb-primary);
  color: #fff;
  box-shadow: 0 16px 36px rgba(15, 23, 42, .22);
  padding: .4rem 1rem .4rem .45rem;
  font-weight: 800;
}

.rb-chatbot-fab__icon {
  display: inline-grid;
  width: 2.35rem;
  height: 2.35rem;
  place-items: center;
  border-radius: 999px;
  background: #fff;
  color: var(--rb-primary);
  font-weight: 900;
}

.rb-chatbot-panel {
  position: fixed;
  right: 1rem;
  bottom: 5rem;
  z-index: 69;
  display: grid;
  width: min(22.5rem, calc(100vw - 2rem));
  max-height: 78vh;
  grid-template-rows: auto minmax(11rem, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--rb-border);
  border-radius: 1.25rem;
  background: #fff;
  box-shadow: 0 24px 54px rgba(15, 23, 42, .22);
}

.rb-chatbot-panel__header {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid var(--rb-border);
  padding: .8rem .9rem;
}

.rb-chatbot-panel__title {
  color: #0f172a;
  font-size: 1.05rem;
  font-weight: 800;
}

.rb-chatbot-panel__actions {
  display: flex;
  gap: .5rem;
  align-items: center;
}

.rb-chatbot-plain {
  border: 0;
  background: transparent;
  color: var(--rb-primary);
  font-size: .78rem;
  font-weight: 800;
  text-decoration: underline;
}

.rb-chatbot-close {
  display: inline-grid;
  width: 2.75rem;
  height: 2.75rem;
  place-items: center;
  border: 1px solid var(--rb-border);
  border-radius: 999px;
  background: #fff;
  color: #334155;
  font-size: 1.5rem;
  line-height: 1;
}

.rb-chatbot-panel__body {
  display: grid;
  align-content: start;
  gap: .75rem;
  overflow: auto;
  padding: .8rem;
  background: #f8fafc;
}

.rb-chatbot-message {
  max-width: 92%;
  border-radius: 1rem;
  padding: .6rem .7rem;
  font-size: .86rem;
  line-height: 1.4;
}

.rb-chatbot-message--bot {
  justify-self: start;
  border: 1px solid var(--rb-border);
  background: #fff;
  color: #1e293b;
}

.rb-chatbot-message--user {
  justify-self: end;
  background: var(--rb-primary);
  color: #fff;
}

.rb-chatbot-message--result {
  max-width: 100%;
  justify-self: stretch;
  padding: 0;
  background: transparent;
}

.rb-chatbot-result {
  border: 1px solid var(--rb-border);
  border-radius: 1rem;
  background: #fff;
  padding: 1rem;
}

.rb-chatbot-result h3 {
  color: #0f172a;
  font-size: 1rem;
  font-weight: 800;
}

.rb-chatbot-result p {
  margin-top: .35rem;
  color: #475569;
  font-size: .9rem;
}

.rb-chatbot-result__links {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .75rem;
}

.rb-chatbot-result__links a {
  display: inline-flex;
  border-radius: .75rem;
  background: #f1f5f9;
  color: var(--rb-primary);
  padding: .55rem .7rem;
  font-size: .82rem;
  font-weight: 800;
  text-decoration: underline;
}

.rb-chatbot-options {
  border-top: 1px solid var(--rb-border);
  max-height: 34vh;
  overflow: auto;
  padding: .65rem;
}

.rb-chatbot-options__grid,
.rb-chatbot-options__result-actions {
  display: grid;
  gap: .4rem;
}

.rb-chatbot-options button {
  width: 100%;
  border: 1px solid var(--rb-border);
  border-radius: .75rem;
  background: #fff;
  color: #0f172a;
  padding: .55rem .7rem;
  text-align: left;
  font-size: .84rem;
  font-weight: 800;
  line-height: 1.25;
}

.rb-chatbot-options__result-actions {
  grid-template-columns: 1fr 1fr;
}

.rb-chatbot-options__result-actions button:first-child {
  background: var(--rb-primary);
  color: #fff;
}

.rb-chatbot-fab:focus-visible,
.rb-chatbot-panel button:focus-visible,
.rb-chatbot-panel a:focus-visible {
  outline: 3px solid #ffbf47;
  outline-offset: 3px;
}

.rb-video-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 1rem;
  background: #0f172a;
}

.rb-video-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.rb-feedback-widget {
  width: min(72rem, calc(100% - 2rem));
  margin: 2rem auto 0;
  border: 1px solid var(--rb-border);
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 10px 26px rgba(15, 23, 42, .06);
  padding: 1.25rem;
}

.rb-feedback-widget__title {
  color: #0f172a;
  font-size: 1.05rem;
  font-weight: 800;
}

.rb-feedback-widget__choices,
.rb-feedback-widget__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 1rem;
}

.rb-feedback-widget__choice,
.rb-feedback-widget__primary,
.rb-feedback-widget__secondary {
  min-height: 2.75rem;
  border-radius: .85rem;
  padding: 0 1rem;
  font-size: .95rem;
  font-weight: 800;
}

.rb-feedback-widget__choice {
  border: 1px solid var(--rb-border);
  background: #f8fafc;
  color: #0f172a;
}

.rb-feedback-widget__primary {
  border: 0;
  background: var(--rb-primary);
  color: #fff;
}

.rb-feedback-widget__secondary {
  border: 1px solid var(--rb-border);
  background: #fff;
  color: #334155;
}

.rb-feedback-widget__label {
  display: block;
  margin-top: 1rem;
  color: #334155;
  font-size: .9rem;
  font-weight: 700;
}

.rb-feedback-widget__textarea {
  display: block;
  width: 100%;
  margin-top: .5rem;
  border: 1px solid var(--rb-border);
  border-radius: .85rem;
  padding: .8rem;
  color: #0f172a;
}

.rb-feedback-widget__link {
  margin-top: .75rem;
  border: 0;
  background: transparent;
  color: var(--rb-primary);
  font-size: .85rem;
  font-weight: 800;
  text-decoration: underline;
}

.rb-feedback-widget button:focus-visible,
.rb-feedback-widget textarea:focus-visible {
  outline: 3px solid #ffbf47;
  outline-offset: 3px;
}

@media (max-width: 640px) {
  .rb-feedback-widget {
    width: calc(100% - 1.5rem);
    padding: 1rem;
  }

  .rb-feedback-widget__choices,
  .rb-feedback-widget__actions {
    display: grid;
  }
}

@media (max-width: 640px) {
  /* Zona de seguridad para que el botón flotante del asistente no tape
     el contenido al llegar al final de la página. */
  body { padding-bottom: 4.5rem; }

  .rb-tour-toast {
    top: 4.75rem;
    right: .75rem;
    width: min(23rem, calc(100vw - 1.5rem));
  }

  .rb-chatbot-fab {
    right: .75rem;
    bottom: .75rem;
  }

  .rb-chatbot-panel {
    inset: 0;
    width: 100%;
    max-height: none;
    height: 100svh;
    border-radius: 0;
  }

  .rb-chatbot-panel__header {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #fff;
  }

  .rb-chatbot-options {
    max-height: 36vh;
  }
}

@media (min-width: 768px) {
  .rb-critical-alert__inner {
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .rb-desktop-only {
    display: block;
  }

  .rb-mobile-only {
    display: none !important;
  }
}

@media (min-width: 768px) {
  .rb-md-up-only {
    display: block;
  }
}

/* Bloqueo de scroll del fondo cuando el asistente está en pantalla completa (móvil). */
.rb-scroll-lock {
  overflow: hidden;
}

/* Cuando el menú móvil está abierto, ocultamos la UI flotante para que no se solape. */
.rb-nav-open .rb-chatbot-fab,
.rb-nav-open .rb-tour-toast {
  display: none !important;
}

/* Sub-navegación de Renta persistente (se inyecta tras el header en páginas ciudadanas).
   Da acceso al recorrido (Inicio · Preparar · Deducciones · Presentar · Ayuda) sin depender
   del mega-menú institucional. */
.rb-subnav {
  position: sticky;
  top: var(--rb-header-h, 78px);
  z-index: 40;
  background: #fff;
  border-bottom: 1px solid var(--rb-border);
}
.rb-subnav__inner {
  max-width: 72rem;
  margin: 0 auto;
  display: flex;
  gap: .25rem;
  padding: .4rem 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.rb-subnav a {
  white-space: nowrap;
  padding: .5rem .75rem;
  border-radius: .6rem;
  font-size: .875rem;
  font-weight: 600;
  color: var(--rb-muted);
}
.rb-subnav a:hover {
  background: #f1f5f9;
  color: var(--rb-ink);
}
.rb-subnav a[aria-current="page"] {
  background: #eef3f9;
  color: var(--rb-primary-700);
}

/* Respeto a la preferencia del sistema de movimiento reducido (WCAG 2.3.3 / 2.2.2,
   exigible por RD 1112/2018). Desactiva animaciones, transiciones y scroll suave
   para quienes lo solicitan, sin afectar a la legibilidad del contenido. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
