/* ==========================================================================
   Carlos Silveira — Herramientas y Calculadoras (carlossilveira.dev/tools/)
   Design System: Apple iOS 26 / macOS Tahoe Liquid Glass (.agents/skills/liquid-glass-design/SKILL.md)
   Modern Web Guidance: dark-mode, dark-mode-toggle, validate-input-after-interaction
   ========================================================================== */

:root {
  color-scheme: light dark;

  /* 1. Mandatory Unified Typography & Wide Layout */
  --font-display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --container-wide: min(1380px, 94vw);

  /* 2. Light Mode Liquid Glass Tokens */
  --canvas-bg-light: #f4f7fb;
  --text-primary-light: #0f172a;
  --text-secondary-light: #475569;
  --text-muted-light: #64748b;

  --lg-surface-light: rgba(255, 255, 255, 0.58);
  --lg-surface-elevated-light: rgba(255, 255, 255, 0.76);
  --lg-surface-interactive-light: rgba(255, 255, 255, 0.88);
  --lg-border-light: rgba(255, 255, 255, 0.78);
  --lg-border-outer-light: rgba(15, 23, 42, 0.07);
  --lg-specular-light: inset 0 1.5px 1px 0 rgba(255, 255, 255, 0.92),
                       inset 0 -1px 1px 0 rgba(255, 255, 255, 0.45),
                       inset 0 0 22px 0 rgba(255, 255, 255, 0.25);
  --lg-shadow-light: 0 20px 50px -12px rgba(15, 23, 42, 0.10),
                     0 4px 16px -2px rgba(15, 23, 42, 0.05);

  /* 3. Dark Mode Liquid Glass Tokens */
  --canvas-bg-dark: #070b14;
  --text-primary-dark: #f8fafc;
  --text-secondary-dark: #cbd5e1;
  --text-muted-dark: #94a3b8;

  --lg-surface-dark: rgba(18, 25, 43, 0.56);
  --lg-surface-elevated-dark: rgba(26, 35, 58, 0.72);
  --lg-surface-interactive-dark: rgba(36, 48, 78, 0.86);
  --lg-border-dark: rgba(255, 255, 255, 0.16);
  --lg-border-outer-dark: rgba(255, 255, 255, 0.10);
  --lg-specular-dark: inset 0 1.5px 1px 0 rgba(255, 255, 255, 0.28),
                      inset 0 -1px 1px 0 rgba(0, 0, 0, 0.45),
                      inset 0 0 24px 0 rgba(99, 102, 241, 0.10);
  --lg-shadow-dark: 0 24px 60px -12px rgba(0, 0, 0, 0.58),
                    0 4px 16px -2px rgba(0, 0, 0, 0.35);

  /* 4. Default Light Mode Assignment (Fallback for pre-light-dark() browsers) */
  --canvas-bg: var(--canvas-bg-light);
  --text-primary: var(--text-primary-light);
  --text-secondary: var(--text-secondary-light);
  --text-muted: var(--text-muted-light);
  --lg-surface: var(--lg-surface-light);
  --lg-surface-elevated: var(--lg-surface-elevated-light);
  --lg-surface-interactive: var(--lg-surface-interactive-light);
  --lg-border: var(--lg-border-light);
  --lg-border-outer: var(--lg-border-outer-light);
  --lg-specular: var(--lg-specular-light);
  --lg-shadow: var(--lg-shadow-light);
  --lg-blur: blur(16px) saturate(180%);
  --orb-opacity: 0.32;

  /* Brand & Semantic Accents */
  --accent-primary: #0066ff;
  --accent-secondary: #6366f1;
  --accent-aqua: #06b6d4;
  --accent-rose: #ec4899;
  --accent-gradient: linear-gradient(135deg, #0066ff 0%, #5b5bf6 52%, #06b6d4 100%);
  --accent-link: #0066ff;

  --color-success: #059669;
  --bg-success: rgba(16, 185, 129, 0.14);
  --color-warning: #d97706;
  --bg-warning: rgba(245, 158, 11, 0.15);
  --color-danger: #dc2626;
  --bg-danger: rgba(239, 68, 68, 0.14);

  /* Radii & Motion */
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --spring-easing: cubic-bezier(0.22, 1, 0.36, 1);

  /* 5. MANDATORY Fallback for browsers without light-dark() support */
  @media (prefers-color-scheme: dark) {
    --canvas-bg: var(--canvas-bg-dark);
    --text-primary: var(--text-primary-dark);
    --text-secondary: var(--text-secondary-dark);
    --text-muted: var(--text-muted-dark);
    --lg-surface: var(--lg-surface-dark);
    --lg-surface-elevated: var(--lg-surface-elevated-dark);
    --lg-surface-interactive: var(--lg-surface-interactive-dark);
    --lg-border: var(--lg-border-dark);
    --lg-border-outer: var(--lg-border-outer-dark);
    --lg-specular: var(--lg-specular-dark);
    --lg-shadow: var(--lg-shadow-dark);
    --accent-link: #60a5fa;
    --color-success: #34d399;
    --color-warning: #fbbf24;
    --color-danger: #f87171;
    --orb-opacity: 0.26;
  }

  /* 6. Modern light-dark() automatic scheme switching */
  @supports (color: light-dark(white, black)) {
    --canvas-bg: light-dark(var(--canvas-bg-light), var(--canvas-bg-dark));
    --text-primary: light-dark(var(--text-primary-light), var(--text-primary-dark));
    --text-secondary: light-dark(var(--text-secondary-light), var(--text-secondary-dark));
    --text-muted: light-dark(var(--text-muted-light), var(--text-muted-dark));
    --lg-surface: light-dark(var(--lg-surface-light), var(--lg-surface-dark));
    --lg-surface-elevated: light-dark(var(--lg-surface-elevated-light), var(--lg-surface-elevated-dark));
    --lg-surface-interactive: light-dark(var(--lg-surface-interactive-light), var(--lg-surface-interactive-dark));
    --lg-border: light-dark(var(--lg-border-light), var(--lg-border-dark));
    --lg-border-outer: light-dark(var(--lg-border-outer-light), var(--lg-border-outer-dark));
    --accent-link: light-dark(#0066ff, #60a5fa);
    --color-success: light-dark(#059669, #34d399);
    --color-warning: light-dark(#d97706, #fbbf24);
    --color-danger: light-dark(#dc2626, #f87171);
  }

  /* 7. MANDATORY dark-mode-toggle mapping from <meta name="color-scheme"> to CSS */
  &:has(> head > meta[name="color-scheme"][content="dark"]) {
    color-scheme: dark;
    --lg-specular: var(--lg-specular-dark);
    --lg-shadow: var(--lg-shadow-dark);
    --orb-opacity: 0.26;
  }
  &:has(> head > meta[name="color-scheme"][content="light"]) {
    color-scheme: light;
    --lg-specular: var(--lg-specular-light);
    --lg-shadow: var(--lg-shadow-light);
    --orb-opacity: 0.32;
  }

  accent-color: var(--accent-primary);
}

/* ==========================================================================
   Living Ambient Mesh Backdrop (.lg-ambient-canvas)
   ========================================================================== */
@keyframes floatOrbA {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50%      { transform: translate3d(6vw, 4vh, 0) scale(1.12); }
}

@keyframes floatOrbB {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50%      { transform: translate3d(-7vw, -5vh, 0) scale(1.08); }
}

.lg-ambient-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  contain: strict;
  background: var(--canvas-bg);
}

.lg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: var(--orb-opacity);
  will-change: transform;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .lg-orb {
    animation: none !important;
  }
}

.lg-orb-1 {
  width: 560px;
  height: 560px;
  top: -120px;
  left: -80px;
  background: radial-gradient(circle, #0066ff 0%, transparent 70%);
  animation: floatOrbA 22s ease-in-out infinite;
}

.lg-orb-2 {
  width: 620px;
  height: 620px;
  top: 10%;
  right: -140px;
  background: radial-gradient(circle, #6366f1 0%, transparent 70%);
  animation: floatOrbB 26s ease-in-out infinite;
}

.lg-orb-3 {
  width: 520px;
  height: 520px;
  bottom: -140px;
  left: 22%;
  background: radial-gradient(circle, #06b6d4 0%, transparent 70%);
  animation: floatOrbA 28s ease-in-out infinite reverse;
}

.lg-orb-4 {
  width: 440px;
  height: 440px;
  bottom: 18%;
  right: 18%;
  background: radial-gradient(circle, #ec4899 0%, transparent 72%);
  opacity: calc(var(--orb-opacity) * 0.65);
  animation: floatOrbB 30s ease-in-out infinite reverse;
}

/* ==========================================================================
   Base Reset & Typography
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  background-color: var(--canvas-bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: transparent;
  color: var(--text-primary);
}

h1, h2, h3, h4, .brand-link, .kpi-value, .btn {
  font-family: var(--font-display);
}

a {
  color: var(--accent-link);
  text-decoration: none;
  transition: color 0.2s var(--spring-easing), opacity 0.2s var(--spring-easing);
}

a:hover {
  text-decoration: underline;
}

code, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--lg-surface-elevated);
  padding: 2px 7px;
  border-radius: 8px;
  border: 1px solid var(--lg-border);
}

.tabular, .mono {
  font-variant-numeric: tabular-nums;
}

.eyebrow, .micro-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-link);
  background: var(--lg-surface-elevated);
  border: 1px solid var(--lg-border);
  box-shadow: var(--lg-specular);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  margin-bottom: 12px;
}

/* ==========================================================================
   Floating Liquid Glass Navbar (.site-header)
   ========================================================================== */
.site-header {
  position: sticky;
  top: 14px;
  z-index: 60;
  width: var(--container-wide);
  margin: 14px auto 0;
  border-radius: var(--radius-pill);
  background: var(--lg-surface-elevated);
  backdrop-filter: var(--lg-blur);
  -webkit-backdrop-filter: var(--lg-blur);
  border: 1px solid var(--lg-border);
  outline: 1px solid var(--lg-border-outer);
  box-shadow: var(--lg-specular), var(--lg-shadow);
}

.nav-container {
  padding: 10px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  text-decoration: none !important;
  min-height: 44px;
}

.brand-logo-img {
  height: 38px;
  width: auto;
  display: block;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-link {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none !important;
  padding: 8px 16px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-pill);
  transition: all 0.25s var(--spring-easing);
}

.nav-link:hover,
.nav-link[aria-current="page"] {
  color: var(--text-primary);
  background: var(--lg-surface-interactive);
  box-shadow: var(--lg-specular);
}

.nav-link[aria-current="page"] {
  color: var(--accent-link);
  font-weight: 700;
}

.nav-admin-link {
  font-family: var(--font-display);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--lg-surface);
  border: 1px solid var(--lg-border);
  box-shadow: var(--lg-specular);
  padding: 8px 15px;
  min-height: 40px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none !important;
  transition: transform 0.2s var(--spring-easing), background-color 0.2s ease;
}

.nav-admin-link:hover {
  transform: translateY(-1px);
  background: var(--lg-surface-interactive);
}

/* Theme Toggle Button (CSS-driven state visibility per dark-mode-toggle guide) */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  min-height: 40px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--lg-border);
  background: var(--lg-surface);
  box-shadow: var(--lg-specular);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s var(--spring-easing), background-color 0.2s ease;
}

.theme-toggle-btn:hover {
  transform: scale(1.03);
  background: var(--lg-surface-interactive);
}

.theme-toggle-btn .theme-opt-light {
  display: none;
}
.theme-toggle-btn .theme-opt-dark {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

@media (prefers-color-scheme: dark) {
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .theme-toggle-btn .theme-opt-dark {
    display: none;
  }
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .theme-toggle-btn .theme-opt-light {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
}

:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-toggle-btn .theme-opt-dark {
  display: none;
}
:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-toggle-btn .theme-opt-light {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   Wide Horizontal Layout Container (1380px)
   ========================================================================== */
.main-container {
  width: var(--container-wide);
  margin: 0 auto;
  padding: 36px 0 88px;
  flex: 1;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.hero-header {
  margin-bottom: 36px;
  max-width: 980px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.15rem, 4.2vw, 3.35rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.08;
  color: var(--text-primary);
  margin: 6px 0 14px;
}

.hero-subtitle {
  font-size: clamp(1.05rem, 1.5vw, 1.22rem);
  line-height: 1.55;
  color: var(--text-secondary);
  max-width: 860px;
  margin: 0;
}

/* ==========================================================================
   Refractive Liquid Glass Cards & Grids (.lg-card / .bento-card)
   ========================================================================== */
.bento-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 980px) {
  .bento-grid-2col {
    grid-template-columns: 5fr 7fr;
    align-items: start;
  }
  .bento-grid-cards {
    grid-template-columns: repeat(2, 1fr);
  }
  .bento-grid-3col {
    grid-template-columns: repeat(3, 1fr);
  }
}

.lg-card,
.bento-card {
  position: relative;
  overflow: visible;
  background: var(--lg-surface);
  backdrop-filter: var(--lg-blur);
  -webkit-backdrop-filter: var(--lg-blur);
  border-radius: var(--radius-xl);
  border: 1px solid var(--lg-border);
  outline: 1px solid var(--lg-border-outer);
  box-shadow: var(--lg-specular), var(--lg-shadow);
  padding: 28px;
  transition: transform 0.35s var(--spring-easing), box-shadow 0.35s var(--spring-easing), background-color 0.25s ease;
}

/* Interactive cursor spotlight sheen */
.lg-card::before,
.bento-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(
    520px circle at var(--mouse-x, 50%) var(--mouse-y, 0%),
    rgba(255, 255, 255, 0.24),
    transparent 60%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lg-card:hover::before,
.bento-card:hover::before {
  opacity: 1;
}

.bento-card-interactive:hover {
  transform: translateY(-4px);
  background: var(--lg-surface-elevated);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.32rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.025em;
  margin: 0 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Interactive Liquid Glass Tooltips (? Popovers for Everyday Users)
   ========================================================================== */
.lg-tooltip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-left: 6px;
}

.lg-tooltip-btn {
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--lg-border);
  background: var(--lg-surface-elevated);
  box-shadow: var(--lg-specular);
  color: var(--accent-link);
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: transform 0.2s var(--spring-easing), background-color 0.2s ease;
}

.lg-tooltip-btn:hover,
.lg-tooltip-btn:focus-visible {
  transform: scale(1.12);
  background: var(--accent-primary);
  color: #ffffff;
  outline: none;
}

.lg-tooltip-popover {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  width: min(310px, 82vw);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--lg-surface-interactive);
  backdrop-filter: blur(32px) saturate(210%);
  -webkit-backdrop-filter: blur(32px) saturate(210%);
  border: 1px solid var(--lg-border);
  outline: 1px solid var(--lg-border-outer);
  box-shadow: var(--lg-specular), 0 18px 40px -8px rgba(15, 23, 42, 0.28);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.48;
  text-align: left;
  z-index: 90;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s var(--spring-easing), transform 0.2s var(--spring-easing), visibility 0.2s;
}

.lg-tooltip-popover strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--accent-link);
  margin-bottom: 4px;
}

.lg-tooltip-wrap:hover .lg-tooltip-popover,
.lg-tooltip-wrap:focus-within .lg-tooltip-popover,
.lg-tooltip-wrap[data-open="true"] .lg-tooltip-popover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   Form Controls & validate-input-after-interaction Compliance
   ========================================================================== */
.field {
  margin-bottom: 20px;
}

.field label {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  font-family: var(--font-display);
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

/* MANDATORY (validate-input-after-interaction): Place format hints above the input
   so mobile keyboards and autocomplete popovers never obscure them during editing */
.hint {
  display: block;
  font-size: 0.83rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.error-msg {
  display: none;
  color: var(--color-danger);
  background-color: var(--bg-danger);
  border: 1px solid var(--color-danger);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: 600;
  margin-top: 8px;
}

input[type="number"],
input[type="text"],
input[type="search"],
input[type="date"],
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 16px;
  font-family: var(--font-sans);
  font-size: 1.02rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  background: var(--lg-surface-elevated);
  border: 1.5px solid var(--lg-border);
  outline: 1px solid var(--lg-border-outer);
  box-shadow: var(--lg-specular);
  border-radius: var(--radius-md);
  transition: all 0.2s var(--spring-easing);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: var(--lg-surface-interactive);
  box-shadow: var(--lg-specular), 0 0 0 4px rgba(0, 102, 255, 0.18);
}

/* DO: Only show error styles after user interaction (:user-invalid + fallback) */
input:user-invalid,
input.user-invalid-fallback {
  border-color: var(--color-danger);
  background-color: var(--bg-danger);
}

/* DO: Reveal the error message using the adjacent sibling selector */
input:user-invalid + .error-msg,
input.user-invalid-fallback + .error-msg {
  display: block;
}

/* DO: Provide a clear success indication on :user-valid */
input:user-valid,
input.user-valid-fallback {
  border-color: var(--color-success);
}

/* Highlight hint when field contains an invalid input via modern :has() */
.field:has(input:user-invalid) .hint,
.field:has(input.user-invalid-fallback) .hint {
  color: var(--color-danger);
  font-weight: 600;
}

/* ==========================================================================
   Segmented Control & Toggle Rows (Liquid Glass Tactile Pills)
   ========================================================================== */
.segmented-control {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 6px;
  background: var(--lg-surface);
  border: 1px solid var(--lg-border);
  box-shadow: var(--lg-specular);
  padding: 6px;
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}

.segment-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.25s var(--spring-easing);
  text-align: center;
}

.segment-btn[aria-pressed="true"],
.segment-btn.active {
  background: var(--accent-gradient);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.6), 0 6px 18px -4px rgba(0, 102, 255, 0.45);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  min-height: 52px;
  border-radius: var(--radius-md);
  background: var(--lg-surface-elevated);
  border: 1px solid var(--lg-border);
  box-shadow: var(--lg-specular);
  margin-bottom: 10px;
  cursor: pointer;
  transition: transform 0.2s var(--spring-easing), background-color 0.2s ease;
}

.toggle-row:hover {
  background: var(--lg-surface-interactive);
}

.toggle-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  cursor: pointer;
  flex-shrink: 0;
}

/* ==========================================================================
   KPI Hero Cards, Plain-Spanish Visual Explainer & Stacked Bars
   ========================================================================== */
.kpi-hero {
  background: linear-gradient(135deg, rgba(0, 102, 255, 0.13) 0%, rgba(99, 102, 241, 0.10) 55%, rgba(6, 182, 212, 0.12) 100%);
  border: 1px solid var(--lg-border);
  outline: 1px solid rgba(0, 102, 255, 0.18);
  box-shadow: var(--lg-specular), var(--lg-shadow);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}

.kpi-value {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 4.2vw, 2.95rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  margin: 6px 0;
}

.kpi-sub {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-mini {
  background: var(--lg-surface-elevated);
  border: 1px solid var(--lg-border);
  box-shadow: var(--lg-specular);
  border-radius: var(--radius-md);
  padding: 16px;
}

.kpi-mini-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.kpi-mini-val {
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  margin-top: 6px;
}

/* Visual Plain-Spanish Explainer Box */
.lg-visual-explainer {
  background: var(--lg-surface-elevated);
  border: 1px solid var(--lg-border);
  box-shadow: var(--lg-specular);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin: 20px 0;
}

.lg-visual-explainer-title {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 800;
  margin: 0 0 6px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.lg-visual-explainer-text {
  font-size: 0.94rem;
  color: var(--text-secondary);
  margin: 0 0 14px;
  line-height: 1.55;
}

.stacked-bar-wrap {
  margin: 14px 0 6px;
}

.stacked-bar {
  height: 18px;
  width: 100%;
  background: var(--lg-surface);
  border: 1px solid var(--lg-border);
  box-shadow: inset 0 2px 4px rgba(15, 23, 42, 0.08);
  border-radius: var(--radius-pill);
  overflow: hidden;
  display: flex;
}

.bar-segment {
  height: 100%;
  transition: width 0.35s var(--spring-easing);
}

.bar-neto  { background: linear-gradient(90deg, #0066ff, #10b981); }
.bar-isr   { background: linear-gradient(90deg, #ef4444, #f97316); }
.bar-imss  { background: linear-gradient(90deg, #f59e0b, #eab308); }
.bar-extra { background: linear-gradient(90deg, #6366f1, #06b6d4); }

.stacked-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 4px;
}

/* ==========================================================================
   Tables
   ========================================================================== */
.table-scroll {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--lg-border);
  outline: 1px solid var(--lg-border-outer);
  background: var(--lg-surface-elevated);
  box-shadow: var(--lg-specular);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}

.data-table th,
.data-table td {
  padding: 13px 16px;
  text-align: left;
  border-bottom: 1px solid var(--lg-border-outer);
}

.data-table th {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-secondary);
  background: var(--lg-surface);
}

.data-table td.num,
.data-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr.row-highlight {
  background: rgba(0, 102, 255, 0.09);
  font-weight: 700;
}

/* ==========================================================================
   Liquid Glass Buttons & Preset Pills
   ========================================================================== */
.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  min-height: 46px;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: 0.94rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--lg-border);
  outline: 1px solid var(--lg-border-outer);
  background: var(--lg-surface-elevated);
  box-shadow: var(--lg-specular);
  color: var(--text-primary);
  text-decoration: none !important;
  transition: transform 0.22s var(--spring-easing), box-shadow 0.22s var(--spring-easing), background-color 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
  background: var(--lg-surface-interactive);
  color: var(--accent-link);
}

.btn-primary {
  background: var(--accent-gradient);
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.42);
  box-shadow: inset 0 1.5px 1px rgba(255, 255, 255, 0.65),
              0 12px 28px -6px rgba(0, 102, 255, 0.45);
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.01);
  filter: brightness(1.06);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  min-height: 30px;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid var(--lg-border);
  background: var(--lg-surface-elevated);
  box-shadow: var(--lg-specular);
  color: var(--text-secondary);
  transition: all 0.2s var(--spring-easing);
}

button.badge {
  min-height: 38px;
  padding: 7px 15px;
  cursor: pointer;
}

button.badge:hover {
  transform: translateY(-1px);
  background: var(--lg-surface-interactive);
  color: var(--accent-link);
  border-color: var(--accent-primary);
}

.badge-cyan,
.badge-accent {
  color: var(--accent-link);
  background: rgba(0, 102, 255, 0.11);
  border-color: rgba(0, 102, 255, 0.25);
}

.badge-success {
  color: var(--color-success);
  background: var(--bg-success);
  border-color: rgba(16, 185, 129, 0.28);
}

/* ==========================================================================
   Editorial Guides & Expandable FAQs (Wide Multi-Column Friendly)
   ========================================================================== */
.editorial-section {
  width: 100%;
  margin: 56px auto 0;
  padding-top: 40px;
  border-top: 1px solid var(--lg-border-outer);
}

.editorial-section h2 {
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 2.8vw, 2.15rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-top: 28px;
  margin-bottom: 14px;
}

.editorial-section h3 {
  font-family: var(--font-display);
  font-size: 1.22rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-top: 24px;
  margin-bottom: 10px;
}

.editorial-section p,
.editorial-section li {
  font-size: 1.02rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.faq-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 20px;
}

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

details.faq-item,
details.lg-faq-item {
  background: var(--lg-surface);
  backdrop-filter: var(--lg-blur);
  -webkit-backdrop-filter: var(--lg-blur);
  border: 1px solid var(--lg-border);
  outline: 1px solid var(--lg-border-outer);
  box-shadow: var(--lg-specular), var(--lg-shadow);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  margin-bottom: 14px;
  transition: background-color 0.25s ease;
}

details.faq-item:hover,
details.lg-faq-item:hover {
  background: var(--lg-surface-elevated);
}

details.faq-item summary,
details.lg-faq-item summary {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-primary);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 36px;
}

details.faq-item summary::-webkit-details-marker,
details.lg-faq-item summary::-webkit-details-marker {
  display: none;
}

details.faq-item summary::after,
details.lg-faq-item summary::after {
  content: "+";
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--lg-surface-elevated);
  border: 1px solid var(--lg-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent-link);
  flex-shrink: 0;
}

details.faq-item[open] summary::after,
details.lg-faq-item[open] summary::after {
  content: "−";
  background: var(--accent-primary);
  color: #ffffff;
}

details.faq-item p,
details.lg-faq-item p {
  margin: 12px 0 0;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  width: var(--container-wide);
  margin: auto auto 24px;
  padding: 24px 28px;
  border-radius: var(--radius-xl);
  background: var(--lg-surface);
  backdrop-filter: var(--lg-blur);
  -webkit-backdrop-filter: var(--lg-blur);
  border: 1px solid var(--lg-border);
  outline: 1px solid var(--lg-border-outer);
  box-shadow: var(--lg-specular), var(--lg-shadow);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

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