﻿  :root {
    --bg: #0b0d12;
    --surface: #131620;
    --surface2: #191d2b;
    --surface3: #1f2436;
    --border: #252b3d;
    --border2: #2e3650;
    --accent: #3ee8b5;
    --accent-dim: rgba(62,232,181,0.12);
    --accent-glow: rgba(62,232,181,0.25);
    --yellow: #f5c842;
    --yellow-dim: rgba(245,200,66,0.10);
    --red: #e85c5c;
    --red-dim: rgba(232,92,92,0.10);
    --text: #e2e8f5;
    --text-muted: #7a85a8;
    --text-soft: #9aa3be;
    --green: #3ee8b5;
    --radius: 14px;
    --radius-sm: 8px;
  }

  [data-theme="light"] {
    --bg: #f5f7fa;
    --surface: #ffffff;
    --surface2: #edf2f7;
    --surface3: #e2e8f0;
    --border: #e2e8f0;
    --border2: #cbd5e1;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-soft: #94a3b8;
    --accent: #059669;
    --accent-dim: rgba(5,150,105,0.12);
    --accent-glow: rgba(5,150,105,0.25);
    --yellow: #f59e0b;
  }

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

  html { scroll-behavior: smooth; font-size: 16px; }

  body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Outfit', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
  }

  body::before {
    content: '';
    position: fixed; inset: 0;
    background-image:
      linear-gradient(rgba(62,232,181,0.025) 1px, transparent 1px),
      linear-gradient(90deg, rgba(62,232,181,0.025) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none; z-index: 0;
  }

  body::after {
    content: '';
    position: fixed;
    top: -200px; right: -200px;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(62,232,181,0.06) 0%, transparent 70%);
    pointer-events: none; z-index: 0;
  }

  .container {
    position: relative; z-index: 1;
    max-width: 1180px; margin: 0 auto; padding: 0 20px;
  }

  /* ─── HEADER ─── */
  header {
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    background: var(--surface);
    position: sticky; top: 0; z-index: 200;
  }

  .header-inner {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
  }

  .logo { display: flex; align-items: center; gap: 10px; }

  .logo-mark {
    width: 34px; height: 34px;
    background: var(--accent);
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-family: 'DM Mono', 'Courier New', monospace;
    font-size: 13px; font-weight: 600;
    color: #0b0d12;
    flex-shrink: 0;
  }

  .logo-text {
    font-family: 'DM Serif Display', Georgia, 'Times New Roman', serif;
    font-size: 18px; letter-spacing: -0.3px; line-height: 1.1;
  }

  .logo-sub {
    font-size: 10px; color: var(--text-muted);
    font-family: 'DM Mono', 'Courier New', monospace;
    letter-spacing: 1.2px; text-transform: uppercase;
  }

  .breadcrumb {
    font-family: 'DM Mono', 'Courier New', monospace;
    font-size: 11px; color: var(--text-muted);
    display: flex; align-items: center; gap: 6px;
    flex-wrap: nowrap;
    max-width: 200px;
    overflow: hidden;
    white-space: nowrap;
  }

  .breadcrumb span { color: var(--accent); }
  .breadcrumb a { color: var(--text-muted); text-decoration: none; transition: color 0.2s; white-space: nowrap; }
  .breadcrumb a:hover { color: var(--accent); }

  /* ─── VIEWS ─── */
  .view { display: none; }
  .view.active { display: block; }
  #view-blocks { display: block; }

  /* ─── MODAL OVERLAY ─── */
  .modal-overlay {
    position: fixed; inset: 0; z-index: 300;
    background: rgba(7, 9, 14, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 24px 16px 24px;
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease;
    overflow-y: auto;
  }

  .modal-overlay.open { opacity: 1; pointer-events: auto; }

  .modal-panel {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: 18px;
    width: 100%; max-width: 860px;
    position: relative;
    transform: translateY(20px) scale(0.98);
    transition: transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.25s ease;
    opacity: 0;
    box-shadow: 0 32px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04);
    margin: auto;
  }

  .modal-overlay.open .modal-panel { transform: translateY(0) scale(1); opacity: 1; }

  .modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
  }

  .modal-title-area { flex: 1; min-width: 0; }

  .modal-close {
    width: 34px; height: 34px; flex-shrink: 0;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 8px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 16px;
    transition: all 0.2s; margin-left: 12px;
  }

  .modal-close:hover { background: var(--red-dim); border-color: var(--red); color: var(--red); }

  .modal-body { padding: 24px; }

  .modal-kpi-tag {
    font-family: 'DM Mono', 'Courier New', monospace;
    font-size: 10px; color: var(--accent);
    letter-spacing: 2px; text-transform: uppercase; margin-bottom: 4px;
  }

  .modal-kpi-title {
    font-family: 'DM Serif Display', Georgia, 'Times New Roman', serif;
    font-size: clamp(20px, 3vw, 28px); line-height: 1.2; margin-bottom: 6px;
  }

  .modal-kpi-desc { font-size: 13px; color: var(--text-soft); line-height: 1.6; }

  .modal-back-btn {
    display: inline-flex; align-items: center; gap: 7px;
    background: transparent; border: 1px solid var(--border);
    color: var(--text-muted); padding: 7px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer; font-family: 'Outfit', sans-serif;
    font-size: 12px; transition: all 0.2s; margin-bottom: 20px;
  }

  .modal-back-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

  .modal-search-wrap { position: relative; margin-bottom: 16px; }

  .modal-search {
    width: 100%; background: var(--surface2);
    border: 1px solid var(--border); border-radius: 10px;
    padding: 10px 14px 10px 38px;
    color: var(--text); font-family: 'Outfit', sans-serif;
    font-size: 13px; outline: none; transition: border-color 0.2s;
  }

  .modal-search:focus { border-color: var(--accent); }
  .modal-search::placeholder { color: var(--text-muted); }

  .modal-search-icon {
    position: absolute; left: 12px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted); font-size: 14px; pointer-events: none;
  }

  .modal-kpis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
  }

  .modal-kpi-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px; padding: 13px 15px;
    cursor: pointer; transition: all 0.18s;
    display: flex; align-items: flex-start; gap: 12px;
  }

  .modal-kpi-card:hover {
    border-color: rgba(62,232,181,0.3);
    background: var(--surface3);
    transform: translateY(-1px);
  }

  .modal-progress {
    display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
  }

  .modal-progress-track {
    flex: 1; height: 3px; background: var(--border);
    border-radius: 2px; overflow: hidden;
  }

  .modal-progress-fill {
    height: 100%; background: var(--accent);
    border-radius: 2px; transition: width 0.5s ease;
  }

  .modal-progress-text {
    font-family: 'DM Mono', 'Courier New', monospace;
    font-size: 10px; color: var(--text-muted); white-space: nowrap;
  }

  .modal-detail-header {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 12px; padding: 20px;
    margin-bottom: 16px; position: relative; overflow: hidden;
  }

  .modal-detail-header::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, var(--accent), transparent);
  }

  body.modal-open { overflow: hidden; }

  @media (max-width: 600px) {
  .hero { padding: 32px 0 24px !important; }
  .counter-divider { display: none !important; }
  #kpi-block-pills { justify-content: flex-start !important; }
  .adsense-hero { display: none !important; }
  .excel-notice { margin-top: 16px !important; }
  [aria-label="Suscripción al newsletter"] { padding: 32px 0 !important; }
  [aria-label="Últimos artículos del blog"] { padding: 32px 0 0 !important; }
  [aria-label="Opiniones y preguntas frecuentes"] { padding: 32px 0 0 !important; }
  ins.adsbygoogle { min-height: 0 !important; }

    .modal-overlay { padding: 12px 8px; }
    .modal-panel { border-radius: 14px; }
    .modal-body { padding: 16px; }
    .modal-kpis-grid { grid-template-columns: 1fr; }
  }

  /* ─── HERO ─── */
  .hero { padding: 56px 0 40px; text-align: center; }

  .hero-label {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--accent-dim);
    border: 1px solid rgba(62,232,181,0.22);
    border-radius: 100px; padding: 5px 16px;
    font-family: 'DM Mono', 'Courier New', monospace;
    font-size: 10px; color: var(--accent);
    text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 22px;
  }

  .hero h1 {
    font-family: 'DM Serif Display', Georgia, 'Times New Roman', serif;
    font-size: clamp(32px, 5vw, 58px);
    line-height: 1.1; letter-spacing: -1px; margin-bottom: 14px;
  }

  .hero h1 em { font-style: italic; color: var(--accent); }

  .hero p {
    color: var(--text-soft);
    font-size: 15px; max-width: 500px;
    margin: 0 auto; line-height: 1.7;
  }

  .hero-stats {
    display: flex; justify-content: center; gap: 32px;
    margin-top: 32px; flex-wrap: wrap;
  }

  .stat-item { text-align: center; }

  .stat-num {
    font-family: 'DM Mono', 'Courier New', monospace;
    font-size: 28px; font-weight: 500;
    color: var(--accent); line-height: 1;
  }

  .stat-label {
    font-size: 11px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 1px; margin-top: 4px;
  }

  .stat-divider {
    width: 1px; background: var(--border);
    align-self: stretch; margin: 4px 0;
  }

  /* Excel notice banner */
  .excel-notice {
    display: inline-flex; align-items: center; gap: 10px;
    margin-top: 48px; cursor: pointer;
    background: rgba(62,232,181,0.06);
    border: 1px solid rgba(62,232,181,0.2);
    border-radius: 10px; padding: 10px 20px;
    transition: all 0.2s; max-width: 520px;
  }
  .excel-notice:hover {
    background: rgba(62,232,181,0.12);
    border-color: rgba(62,232,181,0.4);
  }
  .excel-notice-icon { font-size: 18px; flex-shrink: 0; }
  .excel-notice-title {
    font-size: 12px; font-weight: 600;
    color: var(--accent); margin-bottom: 2px;
  }
  .excel-notice-desc {
    font-size: 11px; color: var(--text-muted); line-height: 1.4;
  }
  .excel-notice-arrow {
    font-size: 13px; color: var(--accent); flex-shrink: 0; opacity: 0.7;
  }

  /* ─── BLOCK CARDS ─── */
  .blocks-section { padding-bottom: 80px; }

  .blocks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px; margin-top: 32px;
  }

  .block-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px;
    cursor: pointer;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
    position: relative; overflow: hidden;
  }

  .block-card::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg, var(--accent-dim) 0%, transparent 60%);
    opacity: 0; transition: opacity 0.3s;
    pointer-events: none;
  }

  .block-card:hover { border-color: rgba(62,232,181,0.35); transform: translateY(-4px); box-shadow: 0 16px 40px rgba(0,0,0,0.35); }
  .block-card:hover::after { opacity: 1; }

  .block-accent-bar {
    position: absolute; top: 0; left: 0; right: 0; height: 2px;
    opacity: 0; transition: opacity 0.3s;
  }

  .block-number {
    font-family: 'DM Mono', 'Courier New', monospace;
    font-size: 10px; color: var(--accent);
    letter-spacing: 2px; text-transform: uppercase; margin-bottom: 10px;
  }

  .block-title {
    font-family: 'DM Serif Display', Georgia, 'Times New Roman', serif;
    font-size: 20px; line-height: 1.2; margin-bottom: 10px;
  }

  .block-desc {
    font-size: 12.5px; color: var(--text-soft);
    line-height: 1.6; margin-bottom: 20px;
  }

  .block-meta { display: flex; align-items: center; justify-content: space-between; }

  .kpi-count {
    background: var(--accent-dim);
    border: 1px solid rgba(62,232,181,0.2);
    border-radius: 6px; padding: 3px 10px;
    font-family: 'DM Mono', 'Courier New', monospace;
    font-size: 11px; color: var(--accent);
  }

  .arrow-icon { color: var(--text-muted); transition: all 0.3s; font-size: 16px; }
  .block-card:hover .arrow-icon { color: var(--accent); transform: translateX(5px); }

  /* ─── KPI LIST ─── */
  .back-btn {
    display: inline-flex; align-items: center; gap: 7px;
    background: var(--surface2); border: 1px solid var(--border);
    color: var(--text-soft); padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer; font-family: 'Outfit', sans-serif;
    font-size: 13px; transition: all 0.2s; margin-bottom: 28px;
  }

  .back-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

  .section-tag {
    font-family: 'DM Mono', 'Courier New', monospace;
    font-size: 10px; color: var(--accent);
    letter-spacing: 2px; text-transform: uppercase; margin-bottom: 6px;
  }

  .section-title {
    font-family: 'DM Serif Display', Georgia, 'Times New Roman', serif;
    font-size: clamp(24px, 4vw, 40px); line-height: 1.1;
  }

  .kpis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 12px;
  }

  .kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px; padding: 16px 18px;
    cursor: pointer; transition: all 0.2s;
    display: flex; align-items: flex-start; gap: 14px;
  }

  .kpi-card:hover {
    border-color: rgba(62,232,181,0.25);
    background: var(--surface2);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  }

  .kpi-num {
    width: 34px; height: 34px; flex-shrink: 0;
    background: var(--accent-dim);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-family: 'DM Mono', 'Courier New', monospace;
    font-size: 12px; color: var(--accent); font-weight: 500;
  }

  .kpi-info { flex: 1; min-width: 0; }

  .kpi-name { font-size: 13.5px; font-weight: 600; line-height: 1.3; margin-bottom: 4px; }

  .kpi-short { font-size: 11.5px; color: var(--text-muted); line-height: 1.4; }

  /* ─── KPI DETAIL ─── */
  .detail-badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--accent-dim);
    border: 1px solid rgba(62,232,181,0.2);
    border-radius: 6px; padding: 4px 12px;
    font-family: 'DM Mono', 'Courier New', monospace;
    font-size: 10px; color: var(--accent); margin-bottom: 14px;
  }

  .pill-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }

  .pill {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 100px; padding: 3px 11px;
    font-size: 11px; color: var(--text-muted);
    font-family: 'DM Mono', 'Courier New', monospace;
  }

  .detail-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 14px; margin-bottom: 20px;
  }

  @media (max-width: 680px) { .detail-grid { grid-template-columns: 1fr; } }

  .spain-note {
    background: var(--yellow-dim);
    border: 1px solid rgba(245,200,66,0.18);
    border-radius: 12px; padding: 18px;
  }

  .spain-note-label {
    font-family: 'DM Mono', 'Courier New', monospace;
    font-size: 10px; color: var(--yellow);
    text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 8px;
  }

  .spain-note p { font-size: 12.5px; color: var(--text-soft); line-height: 1.65; }

  .action-plan {
    background: var(--accent-dim);
    border: 1px solid rgba(62,232,181,0.18);
    border-radius: 12px; padding: 18px;
  }

  .action-plan-label {
    font-family: 'DM Mono', 'Courier New', monospace;
    font-size: 10px; color: var(--accent);
    text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 8px;
  }

  .action-plan p { font-size: 12.5px; color: var(--text-soft); line-height: 1.65; }

  .formula-box {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 12px; padding: 18px; margin-bottom: 20px;
  }

  .formula-label {
    font-family: 'DM Mono', 'Courier New', monospace;
    font-size: 10px; color: var(--accent);
    text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px;
  }

  .formula-text {
    font-family: 'DM Mono', 'Courier New', monospace;
    font-size: 13.5px; color: var(--text); line-height: 1.6;
    background: rgba(0,0,0,0.25); padding: 14px 16px;
    border-radius: 8px; border-left: 3px solid var(--accent);
    word-break: break-word;
  }

  /* ─── CALCULATOR ─── */
  .calculator {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius); padding: 26px; margin-bottom: 24px;
  }

  .calc-header {
    display: flex; align-items: flex-start;
    justify-content: space-between; gap: 16px;
    margin-bottom: 20px; flex-wrap: wrap;
  }

  .calc-title { font-family: 'DM Serif Display', Georgia, 'Times New Roman', serif; font-size: 18px; margin-bottom: 3px; }

  .calc-subtitle { font-size: 12.5px; color: var(--text-muted); }

  .calc-reset-btn {
    background: transparent; border: 1px solid var(--border);
    color: var(--text-muted); padding: 6px 13px;
    border-radius: var(--radius-sm);
    cursor: pointer; font-family: 'DM Mono', 'Courier New', monospace;
    font-size: 11px; transition: all 0.2s; white-space: nowrap; flex-shrink: 0;
  }

  .calc-reset-btn:hover { border-color: var(--red); color: var(--red); }

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

  .input-group { display: flex; flex-direction: column; gap: 5px; }

  .input-group label { font-size: 11.5px; color: var(--text-soft); font-weight: 500; line-height: 1.3; }

  .input-group input {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 13px; color: var(--text);
    font-family: 'DM Mono', 'Courier New', monospace; font-size: 14px;
    outline: none; transition: border-color 0.2s, background 0.2s; width: 100%;
  }

  .input-group input:focus { border-color: var(--accent); background: var(--surface3); }
  .input-group input.input-error { border-color: var(--red); animation: shake 0.3s ease; }
  .input-group input::placeholder { color: var(--text-muted); opacity: 0.45; font-size: 12px; }

  @keyframes shake {
    0%,100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
  }

  .calc-actions { display: flex; gap: 10px; flex-wrap: wrap; }

  .calc-btn {
    background: var(--accent); color: #0b0d12;
    border: none; border-radius: 10px; padding: 11px 26px;
    font-family: 'Outfit', sans-serif; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: all 0.2s;
    display: flex; align-items: center; gap: 7px;
  }

  .calc-btn:hover { background: #62edca; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(62,232,181,0.35); }
  .calc-btn:active { transform: translateY(0); }

  /* ─── RESULT PANEL ─── */
  .result-panel {
    display: none; background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 12px; padding: 22px; margin-top: 18px;
  }

  .result-panel.show {
    display: grid; grid-template-columns: auto auto 1fr;
    gap: 24px; align-items: center;
    animation: resultIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

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

  .result-label {
    font-family: 'DM Mono', 'Courier New', monospace;
    font-size: 10px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 1.2px; margin-bottom: 5px;
  }

  .result-value {
    font-family: 'DM Mono', 'Courier New', monospace;
    font-size: 38px; font-weight: 500; line-height: 1;
    margin-bottom: 5px; transition: color 0.3s;
  }

  .result-note { font-size: 11.5px; color: var(--text-muted); }

  /* ─── SEMÁFORO ─── */
  .semaforo { display: flex; flex-direction: column; align-items: center; gap: 6px; }

  .semaforo-body {
    background: #12151f; border: 2px solid var(--border2);
    border-radius: 22px; padding: 10px 8px;
    display: flex; flex-direction: column;
    gap: 7px; align-items: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.04);
  }

  .semaforo-luz {
    width: 26px; height: 26px; border-radius: 50%;
    background: #0a0c14; border: 1px solid var(--border);
    transition: all 0.45s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.6);
  }

  .semaforo-luz.active-red { background: var(--red); box-shadow: 0 0 10px var(--red), 0 0 22px rgba(232,92,92,0.45), inset 0 1px 0 rgba(255,255,255,0.25); }
  .semaforo-luz.active-yellow { background: var(--yellow); box-shadow: 0 0 10px var(--yellow), 0 0 22px rgba(245,200,66,0.45), inset 0 1px 0 rgba(255,255,255,0.25); }
  .semaforo-luz.active-green { background: var(--green); box-shadow: 0 0 10px var(--green), 0 0 22px rgba(62,232,181,0.45), inset 0 1px 0 rgba(255,255,255,0.25); }

  .semaforo-label {
    font-family: 'DM Mono', 'Courier New', monospace;
    font-size: 11px; text-transform: uppercase;
    letter-spacing: 1px; text-align: center;
    color: var(--text-muted); transition: color 0.3s;
  }

  .semaforo-label.red { color: var(--red); }
  .semaforo-label.yellow { color: var(--yellow); }
  .semaforo-label.green { color: var(--green); }

  .result-interpretation { min-width: 0; }

  .interp-status { font-size: 13.5px; font-weight: 600; margin-bottom: 5px; transition: color 0.3s; }
  .interp-status.green { color: var(--green); }
  .interp-status.yellow { color: var(--yellow); }
  .interp-status.red { color: var(--red); }

  .interp-text { font-size: 12.5px; color: var(--text-soft); line-height: 1.55; margin-bottom: 14px; }

  .ranges-bar { background: rgba(0,0,0,0.2); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }

  .ranges-label {
    font-size: 10px; color: var(--text-muted);
    font-family: 'DM Mono', 'Courier New', monospace;
    text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px;
  }

  .ranges-track {
    height: 6px; border-radius: 3px;
    background: linear-gradient(to right, var(--red) 0%, var(--red) 33%, var(--yellow) 33%, var(--yellow) 66%, var(--green) 66%, var(--green) 100%);
    margin-bottom: 5px; position: relative;
  }

  .ranges-marker {
    position: absolute; top: -5px;
    width: 14px; height: 14px; border-radius: 50%;
    background: white; transform: translateX(-50%);
    border: 2px solid var(--bg); box-shadow: 0 2px 6px rgba(0,0,0,0.5);
    transition: left 0.5s ease; display: none;
  }

  .ranges-legend {
    display: flex; justify-content: space-between;
    font-size: 9.5px; color: var(--text-muted);
    font-family: 'DM Mono', 'Courier New', monospace;
  }

  .result-status-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 6px;
    font-family: 'DM Mono', 'Courier New', monospace;
    font-size: 10px; text-transform: uppercase;
    letter-spacing: 1px; margin-bottom: 6px; transition: all 0.3s;
  }

  .result-status-badge.green { background: rgba(62,232,181,0.12); color: var(--green); border: 1px solid rgba(62,232,181,0.25); }
  .result-status-badge.yellow { background: rgba(245,200,66,0.12); color: var(--yellow); border: 1px solid rgba(245,200,66,0.25); }
  .result-status-badge.red { background: rgba(232,92,92,0.12); color: var(--red); border: 1px solid rgba(232,92,92,0.25); }

  /* ─── RESPONSIVE ─── */
  @media (max-width: 760px) {
    .blocks-grid { grid-template-columns: 1fr; }
    .kpis-grid { grid-template-columns: 1fr; }
    .result-panel.show { grid-template-columns: auto 1fr; grid-template-rows: auto auto; }
    .result-value-block { grid-column: 1; grid-row: 1; }
    .semaforo { grid-column: 2; grid-row: 1; }
    .result-interpretation { grid-column: 1 / -1; grid-row: 2; }
    .detail-grid { grid-template-columns: 1fr; }
    .inputs-grid { grid-template-columns: 1fr 1fr; }
    .hero-stats { gap: 16px; }
    .stat-divider { display: none; }
  }

  @media (max-width: 480px) {
    .container { padding: 0 14px; }
    .inputs-grid { grid-template-columns: 1fr; }
    .hero h1 { font-size: 28px; }
    .result-panel.show { grid-template-columns: 1fr; }
    .semaforo { flex-direction: row; }
    .semaforo-body { flex-direction: row; border-radius: 12px; padding: 7px 10px; }
  }

  /* ─── RESPONSIVE: HEADER ─── */
  @media (max-width: 600px) {
    .header-inner { gap: 8px; }
    .logo-text { font-size: 15px; }
    .logo-sub { display: none; }
    .logo-mark { width: 30px; height: 30px; font-size: 11px; }
    /* Stack header buttons on very small screens */
    .header-inner > div:last-child { gap: 6px; }
    .header-inner > div:last-child button { padding: 4px 8px; font-size: 11px; }
    .breadcrumb { font-size: 10px; max-width: 160px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  }

  @media (max-width: 380px) {
    .header-inner > div:last-child { flex-wrap: wrap; justify-content: flex-end; }
  }

  /* ─── RESPONSIVE: HERO ─── */
  @media (max-width: 600px) {
    .hero { padding: 36px 0 28px; }
    .hero p { font-size: 13.5px; }
    .hero-label { font-size: 11px; padding: 4px 12px; }
    .stat-num { font-size: 22px; }
    .stat-label { font-size: 10px; }
    .hero-stats { gap: 12px; }
    /* Excel notice */
    .hero > div[onclick] { flex-direction: column; text-align: center; padding: 12px 16px; }
    .hero > div[onclick] > span:last-child { display: none; }
  }

  /* ─── RESPONSIVE: BLOCK CARDS ─── */
  @media (max-width: 760px) {
    .blocks-grid { grid-template-columns: 1fr; gap: 12px; }
    .block-card { padding: 18px; }
    .block-title { font-size: 18px; }
    .block-desc { font-size: 12px; }
  }

  /* ─── RESPONSIVE: MODAL ─── */
  @media (max-width: 760px) {
    .modal-overlay { padding: 8px 8px 16px; align-items: flex-start; }
    .modal-panel { border-radius: 14px; max-height: 95vh; overflow-y: auto; }
    .modal-header { padding: 14px 16px 12px; }
    .modal-body { padding: 14px 16px; }
    .modal-kpi-title { font-size: 18px; }
    .modal-kpis-grid { grid-template-columns: 1fr; gap: 8px; }
    .modal-kpi-card { padding: 11px 13px; }
  }

  /* ─── RESPONSIVE: KPI DETAIL IN MODAL ─── */
  @media (max-width: 600px) {
    .modal-detail-header { padding: 14px; }
    .detail-grid { grid-template-columns: 1fr; gap: 10px; }
    .spain-note, .action-plan { padding: 14px; }
    .formula-box { padding: 14px; }
    .formula-text { font-size: 12px; padding: 11px 13px; }
  }

  /* ─── RESPONSIVE: CALCULATOR ─── */
  @media (max-width: 600px) {
    .calculator { padding: 16px; }
    .calc-header { gap: 10px; }
    .calc-title { font-size: 16px; }
    .inputs-grid { grid-template-columns: 1fr; gap: 10px; }
    .calc-btn { width: 100%; justify-content: center; padding: 12px; }
  }

  /* ─── RESPONSIVE: RESULT PANEL ─── */
  @media (max-width: 600px) {
    .result-panel.show {
      grid-template-columns: 1fr;
      grid-template-rows: auto auto auto;
      gap: 16px;
    }
    .result-value-block { grid-column: 1; grid-row: 1; text-align: center; }
    .result-value { font-size: 28px; }
    .semaforo { grid-column: 1; grid-row: 2; flex-direction: row; align-items: center; justify-content: center; gap: 10px; }
    .semaforo-body { flex-direction: row; border-radius: 12px; padding: 8px 12px; gap: 10px; }
    .result-interpretation { grid-column: 1; grid-row: 3; }
    .ranges-legend { font-size: 11px; }
  }

  /* ─── RESPONSIVE: FOOTER ─── */
  @media (max-width: 760px) {
    footer > div > div:first-child { flex-direction: column; gap: 16px; }
    footer > div > div:first-child > div[style*="width:1px"] { display: none; }
  }

  @media (max-width: 480px) {
    footer { padding: 20px 0; }
  }

  /* ─── RESPONSIVE: SCROLL TOP ─── */
  @media (max-width: 480px) {
    .scroll-top { bottom: 16px; right: 14px; width: 36px; height: 36px; font-size: 14px; }
  }

  /* ─── RESPONSIVE: TOAST ─── */
  @media (max-width: 480px) {
    .toast { font-size: 11px; padding: 8px 14px; max-width: 90vw; white-space: normal; text-align: center; }
  }

  /* ─── GLOBAL MOBILE FIXES ─── */
  @media (max-width: 380px) {
    .container { padding: 0 12px; }
    .modal-header { padding: 12px; }
    .modal-body { padding: 12px; }
    .pill-tags { gap: 5px; }
    .pill { padding: 2px 8px; font-size: 10px; }
  }

  /* ─── TOAST ─── */
  .toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(10px);
    background: var(--surface3); border: 1px solid var(--red);
    color: var(--red); padding: 10px 20px; border-radius: 10px;
    font-size: 13px; font-family: 'DM Mono', 'Courier New', monospace;
    opacity: 0; transition: all 0.3s; pointer-events: none;
    z-index: 9999; white-space: nowrap;
  }

  .toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

  .scroll-top {
    position: fixed; bottom: 24px; right: 24px;
    width: 40px; height: 40px;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 10px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 16px;
    opacity: 0; pointer-events: none; transition: all 0.3s; z-index: 50;
  }

  .scroll-top.visible { opacity: 1; pointer-events: auto; }
  .scroll-top:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

  .no-results {
    text-align: center; padding: 40px 20px;
    color: var(--text-muted); font-size: 14px; display: none;
  }

  /* ─── HEADER BUTTONS ─── */
  .hdr-btn-reset, .hdr-btn-excel {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: 8px;
    font-family: 'DM Mono', 'Courier New', monospace;
    font-size: 11px; font-weight: 500;
    letter-spacing: 0.4px;
    cursor: pointer; transition: all 0.2s;
    white-space: nowrap;
  }

  .hdr-btn-reset {
    background: transparent;
    border: 1px solid var(--border2);
    color: var(--text-muted);
  }

  .hdr-btn-reset:hover {
    background: var(--red-dim);
    border-color: var(--red);
    color: var(--red);
  }

  .hdr-btn-excel {
    background: rgba(62,232,181,0.1);
    border: 1px solid rgba(62,232,181,0.3);
    color: var(--accent);
  }

  .hdr-btn-excel:hover {
    background: rgba(62,232,181,0.2);
    border-color: rgba(62,232,181,0.6);
    box-shadow: 0 0 14px rgba(62,232,181,0.15);
  }

  @media (max-width: 480px) {
    .hdr-btn-reset span, .hdr-btn-excel span { display: none; }
    .hdr-btn-reset, .hdr-btn-excel { padding: 7px 10px; }
  }

  /* Footer legal links */
  .footer-legal-link {
    font-family: 'DM Mono', 'Courier New', monospace;
    font-size: 11px; color: var(--text-muted);
    text-decoration: none; transition: color 0.2s;
  }
  .footer-legal-link:hover, .footer-legal-link:focus {
    color: var(--accent);
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
  }

  /* Focus styles for keyboard navigation (WCAG 2.4.7) */
  .block-card:focus,
  .modal-kpi-card:focus,
  .calc-btn:focus,
  .modal-close:focus,
  .hdr-btn-reset:focus,
  .hdr-btn-excel:focus,
  .modal-back-btn:focus,
  .back-btn:focus {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
  }

  .input-group input:focus {
    outline: none;
    border-color: var(--accent);
  }
  /* ─── NEW BADGE ─── */
  .badge-new {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: linear-gradient(135deg, #3ee8b5, #22c98a);
    color: #0b0d12;
    font-family: 'DM Mono', 'Courier New', monospace;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    animation: pulse-new 2s ease-in-out infinite;
    vertical-align: middle;
    margin-left: 6px;
    flex-shrink: 0;
  }
  @keyframes pulse-new {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(0.96); }
  }
  .block-card .badge-new {
    position: absolute;
    top: 14px;
    right: 14px;
  }

  /* ─── GLOBAL OVERFLOW SAFETY ─── */
  img, video, iframe, embed { max-width: 100%; height: auto; }
  * { min-width: 0; }

/* ─── BREADCRUMB ─── */
  /* ─── BREADCRUMB ─── */
  .breadcrumb {
    display: none; /* JS lo mostrará al navegar */
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    padding: 0 12px;
    overflow: hidden;
  }
  @media (max-width: 600px) {
    .breadcrumb { display: none !important; }
  }

  /* ─── MODAL PANEL FOCUSABLE ─── */
  .modal-panel { outline: none; }
