.codes-body {
    background:
        radial-gradient(circle at 12% 2%, rgba(125, 148, 212, 0.28), transparent 24%),
        linear-gradient(180deg, #08111f 0%, #0a1424 20%, #edf3f8 20%, #edf3f8 100%);
}

.codes-page .site-header { background: linear-gradient(180deg, rgba(8, 17, 31, 0.96), rgba(8, 17, 31, 0.78)); }
.codes-page .brand-lockup { min-width: 210px; }
.codes-hero { padding: 72px 0 72px; color: var(--text-on-dark); }
.codes-hero-compact { padding-bottom: 58px; }
.codes-hero-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.56fr); gap: 36px; align-items: center; }
.codes-hero-copy h1 { margin: 14px 0 18px; max-width: 820px; font-family: "Aptos Display", "Bahnschrift", "Segoe UI", sans-serif; font-size: clamp(42px, 7vw, 76px); line-height: 0.95; letter-spacing: -0.055em; }
.codes-hero-copy .hero-lede { max-width: 780px; color: rgba(238, 245, 255, 0.82); font-size: clamp(18px, 2vw, 23px); line-height: 1.55; }
.codes-breadcrumb { display: flex; align-items: center; gap: 9px; margin-bottom: 18px; color: rgba(232, 240, 255, 0.68); font-size: 14px; }
.codes-breadcrumb a:hover { color: #ffffff; }
.codes-summary-card { padding: 28px; border: 1px solid rgba(185, 205, 240, 0.22); border-radius: var(--radius-xl); background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.06)); box-shadow: var(--hero-shadow); backdrop-filter: blur(16px); }
.codes-summary-card strong { display: block; margin-top: 18px; color: #ffffff; font-size: 23px; }
.codes-summary-card p, .codes-summary-card li, .quick-facts dd { color: rgba(236, 244, 255, 0.78); }
.codes-summary-card ul { margin: 18px 0 0; padding-left: 19px; line-height: 1.8; }
.quick-facts { display: grid; gap: 14px; margin: 20px 0 0; }
.quick-facts div { padding-bottom: 12px; border-bottom: 1px solid rgba(202, 218, 246, 0.16); }
.quick-facts dt { color: rgba(245, 248, 255, 0.66); font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; }
.quick-facts dd { margin: 3px 0 0; font-weight: 700; }
.codes-disclaimer { margin-top: 16px; color: rgba(235, 242, 255, 0.64); font-size: 14px; }

.codes-section, .codes-search-section { padding: 72px 0; }
.codes-section-soft { background: rgba(255,255,255,0.45); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.codes-search-card, .codes-content-card, .code-card, .mini-card, .calculator-panel, .download-panel { border: 1px solid var(--line); border-radius: var(--radius-xl); background: rgba(255,255,255,0.92); box-shadow: var(--card-shadow-soft); }
.codes-search-card { display: grid; grid-template-columns: minmax(0, .9fr) minmax(280px, .75fr); gap: 28px; align-items: end; padding: 30px; }
.codes-search-card h2, .codes-content-card h2, .download-panel h2, .calculator-copy h3 { margin: 6px 0 12px; font-family: "Aptos Display", "Bahnschrift", "Segoe UI", sans-serif; font-size: clamp(28px, 4vw, 44px); letter-spacing: -0.035em; }
.codes-search-card p, .codes-content-card p, .code-card p, .mini-card p, .download-panel p, .calculator-copy p { color: var(--text-soft); line-height: 1.7; }
.codes-search-box { display: grid; gap: 9px; }
.codes-search-box span, .form-grid label span { color: var(--text); font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.codes-search-box input, .form-grid input, .form-grid select { width: 100%; min-height: 48px; border: 1px solid rgba(43, 72, 109, 0.2); border-radius: 14px; background: #fff; padding: 0 14px; color: var(--text); font: inherit; outline: none; }
.codes-search-box input:focus, .form-grid input:focus, .form-grid select:focus { border-color: rgba(93, 120, 199, 0.68); box-shadow: 0 0 0 4px rgba(125, 148, 212, 0.14); }
.search-results { grid-column: 1 / -1; color: var(--text-soft); }
.search-results ul { margin: 14px 0 0; padding: 0; display: grid; gap: 8px; list-style: none; }
.search-results a { display: block; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--page-surface-soft); color: var(--accent-deep); font-weight: 700; }
mark.r001-mark { border-radius: 5px; padding: 0 3px; background: rgba(255, 210, 86, 0.5); color: inherit; }

.codes-two-column { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .55fr); gap: 28px; align-items: start; }
.codes-content-card { padding: 32px; }
.codes-content-card h3 { margin-top: 0; font-size: 24px; }
.codes-toc-card { position: sticky; top: 110px; }
.toc-list { margin: 16px 0 0; padding-left: 22px; color: var(--text-soft); line-height: 1.9; }
.toc-list a { color: var(--accent-deep); font-weight: 800; }
.codes-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.codes-card-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.code-card { padding: 30px; display: flex; flex-direction: column; justify-content: space-between; gap: 24px; }
.code-card h3 { margin: 12px 0; font-size: 26px; line-height: 1.15; letter-spacing: -0.025em; }
.code-card-featured { grid-column: span 2; background: linear-gradient(135deg, #ffffff, #eef4ff); }
.code-card-muted { background: rgba(255,255,255,0.72); }
.code-tag, .zone-badge { display: inline-flex; width: fit-content; align-items: center; border-radius: 999px; padding: 8px 12px; font-size: 12px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }
.code-tag { background: var(--accent-soft); color: var(--accent-deep); }
.zone-badge { color: #fff; }
.zone-one { background: linear-gradient(135deg, #5d78c7, #2f487f); }
.zone-two { background: linear-gradient(135deg, #7090ac, #49697f); }
.inline-dl { display: flex; gap: 12px; margin: 18px 0 0; }
.inline-dl div { flex: 1; padding: 16px; border-radius: 18px; background: var(--page-surface-soft); }
.inline-dl dt { color: var(--text-soft); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.inline-dl dd { margin: 4px 0 0; font-size: 24px; font-weight: 900; color: var(--text); }
.table-scroll { overflow-x: auto; margin-top: 24px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; }
.codes-table { width: 100%; min-width: 720px; border-collapse: collapse; text-align: left; }
.codes-table caption { padding: 16px 18px; color: var(--text-soft); text-align: left; font-weight: 700; }
.codes-table th, .codes-table td { padding: 16px 18px; border-top: 1px solid var(--line); vertical-align: top; line-height: 1.6; }
.codes-table th { background: #f3f6fb; color: var(--text); font-size: 13px; text-transform: uppercase; letter-spacing: .07em; }
.compact-table .codes-table { min-width: 580px; }
.callout-card { background: linear-gradient(180deg, #ffffff, #eef4ff); }
.on-light { color: var(--accent-deep); border-color: rgba(93, 120, 199, 0.24); background: rgba(125, 148, 212, 0.1); }
.on-light:hover { background: rgba(125, 148, 212, 0.16); }
.usage-grid, .system-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.mini-card { padding: 24px; }
.mini-card strong { display: inline-block; color: var(--accent-deep); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.mini-card span { display: block; margin-top: 10px; color: var(--text); font-size: 24px; font-weight: 900; }
.mini-card h3 { margin: 10px 0 4px; font-size: 22px; }
.method-list { display: grid; gap: 14px; margin-top: 22px; }
.method-list article { padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--page-surface-soft); }
.method-list strong { color: var(--accent-deep); }
.formula-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.formula-card { padding: 20px; border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: var(--card-shadow-soft); }
.formula-card span { display: block; margin-bottom: 10px; color: var(--accent-deep); font-weight: 900; }
.formula-card code { white-space: nowrap; color: var(--text); font-family: "Cascadia Code", Consolas, monospace; }
.calculator-panel { margin-top: 28px; padding: 30px; display: grid; grid-template-columns: minmax(0, .6fr) minmax(0, 1fr); gap: 26px; align-items: start; }
.province-panel { grid-template-columns: minmax(0, .7fr) minmax(0, 1fr); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid-lookup { grid-template-columns: minmax(0, .75fr) minmax(0, 1fr); align-items: end; }
.form-grid label { display: grid; gap: 8px; }
.calculator-results, .result-card { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.calculator-results span, .result-card { padding: 16px; border-radius: 16px; background: var(--page-surface-soft); color: var(--text); font-weight: 800; }
.calculator-results small { display: block; margin-top: 4px; color: var(--text-soft); font-weight: 600; }
.result-card-large { display: block; margin-top: 0; line-height: 1.65; }
.result-card-large strong { color: var(--accent-deep); }
.checklist { margin: 18px 0 0; padding-left: 22px; color: var(--text-soft); line-height: 1.9; }
.checklist li::marker { color: var(--accent-deep); font-weight: 900; }
.download-panel { padding: 34px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.download-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.codes-faq { width: min(920px, 100%); margin: 0 auto; display: grid; gap: 14px; }
.codes-faq details { border: 1px solid var(--line); border-radius: 20px; background: #fff; padding: 18px 20px; box-shadow: var(--card-shadow-soft); }
.codes-faq summary { cursor: pointer; color: var(--text); font-weight: 900; }
.codes-faq p { color: var(--text-soft); line-height: 1.7; }
.codes-footer { padding: 48px 0; background: #08111f; color: #f4f8ff; }
.codes-footer .footer-grid { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.codes-footer p { color: rgba(232, 240, 255, 0.68); }
.codes-footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
.codes-footer a { color: rgba(232, 240, 255, 0.78); font-weight: 700; }
.codes-footer a:hover { color: #fff; }

@media (max-width: 1120px) {
    .codes-hero-grid, .codes-two-column, .calculator-panel, .province-panel, .codes-search-card { grid-template-columns: 1fr; }
    .usage-grid, .system-grid, .formula-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .codes-toc-card { position: static; }
}

@media (max-width: 720px) {
    .codes-hero { padding: 52px 0; }
    .codes-section, .codes-search-section { padding: 52px 0; }
    .codes-card-grid, .codes-card-grid-2, .usage-grid, .system-grid, .formula-grid, .form-grid, .form-grid-lookup, .calculator-results { grid-template-columns: 1fr; }
    .code-card-featured { grid-column: auto; }
    .download-panel, .codes-footer .footer-grid { align-items: flex-start; flex-direction: column; }
    .section-shell { width: min(100% - 28px, 1280px); }
    .codes-hero-copy h1 { font-size: clamp(38px, 12vw, 58px); }
}

/* Corrección visual: la biblioteca de códigos no debe depender de un gradiente de body con corte porcentual,
   porque en pantallas grandes el fondo claro invadía el hero. */
.codes-body {
    background: #edf3f8;
}
.codes-page .site-header {
    background: rgba(8, 17, 31, 0.96);
    border-bottom: 1px solid rgba(185, 205, 240, 0.14);
}
.codes-hero {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 12% 2%, rgba(125, 148, 212, 0.30), transparent 28%),
        radial-gradient(circle at 82% 12%, rgba(93, 120, 199, 0.18), transparent 30%),
        linear-gradient(180deg, #08111f 0%, #0a1424 100%);
    border-bottom: 1px solid rgba(185, 205, 240, 0.12);
}
.codes-hero::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 110px;
    background: linear-gradient(180deg, rgba(237, 243, 248, 0), rgba(237, 243, 248, 0.08));
    pointer-events: none;
}
.codes-hero > .section-shell {
    position: relative;
    z-index: 1;
}
.codes-section:first-of-type,
.codes-search-section:first-of-type {
    background: #edf3f8;
}
.inline-dl-wrap {
    flex-wrap: wrap;
}
.download-panel-vertical {
    flex-direction: column;
    align-items: flex-start;
}
.nsr-table-pair {
    margin-top: 24px;
}
.result-emphasis {
    outline: 2px solid rgba(93, 120, 199, 0.36);
    background: linear-gradient(135deg, #eef4ff, #ffffff) !important;
}
mark.code-mark,
mark.r001-mark {
    border-radius: 5px;
    padding: 0 3px;
    background: rgba(255, 210, 86, 0.5);
    color: inherit;
}
@media (max-width: 980px) {
    .site-nav a[href="/codigos/colombia"] { display: none; }
}


/* Header consistency for code/tool pages. Some generated pages used site-header-inner/brand;
   keep both supported so the brand never collapses against the left edge. */
.codes-page .site-header-shell,
.codes-page .site-header-inner {
    width: min(100% - 48px, 1280px);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.codes-page .brand,
.codes-page .brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    min-width: 190px;
    color: #f3f7ff;
    text-decoration: none;
}
.codes-page .brand span,
.codes-page .brand-copy strong {
    display: block;
    color: #f3f7ff;
    font-family: "Aptos Display", "Bahnschrift", "Segoe UI", sans-serif;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 0.01em;
}
.codes-page .brand small,
.codes-page .brand-copy span {
    display: block;
    margin-top: 2px;
    color: rgba(226, 236, 255, 0.74);
    font-size: 13px;
    font-weight: 600;
}
.codes-page .site-header-actions {
    flex: 0 0 auto;
}
.codes-page .site-nav {
    flex: 1 1 auto;
}
@media (max-width: 860px) {
    .codes-page .site-header-shell,
    .codes-page .site-header-inner {
        width: min(100% - 28px, 1280px);
        gap: 14px;
    }
    .codes-page .brand,
    .codes-page .brand-lockup {
        min-width: 0;
    }
    .codes-page .brand small,
    .codes-page .brand-copy span {
        display: none;
    }
    .codes-page .site-nav {
        display: none;
    }
}
