.top-bar {
    display: block;
    padding: 0;
    background: transparent;
    border-bottom: 0;
    backdrop-filter: none;
}

.top-bar-inner {
    width: min(100%, 980px);
    height: 68px;
    margin: 0 auto;
    padding: 0 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(11, 29, 51, .97);
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    backdrop-filter: blur(12px);
}

.top-actions {
    display: flex;
    align-items: center;
}

.theme-toggle {
    width: 42px;
    height: 42px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 2px solid transparent;
    border-radius: 13px;
    appearance: none;
    cursor: pointer;
    transition: background-color .16s ease, border-color .16s ease, transform .16s ease;
}

.theme-toggle:hover {
    transform: translateY(-1px);
}

.theme-toggle:focus-visible {
    outline: 3px solid #ffd21a;
    outline-offset: 3px;
}

.theme-icon {
    grid-area: 1 / 1;
    display: block;
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.rate-card {
    display: flex;
    flex-direction: column;
}

.rate-card .card-action {
    margin-top: auto;
}

html:not([data-theme="dark"]) .top-bar-inner .theme-toggle {
    background: #ffffff;
    border-color: rgba(255, 255, 255, .72);
    color: #0b1d33;
}

html:not([data-theme="dark"]) .top-bar-inner .theme-icon-moon {
    display: block;
}

html:not([data-theme="dark"]) .top-bar-inner .theme-icon-sun {
    display: none;
}

html[data-theme="dark"] .top-bar {
    background: transparent;
}

html[data-theme="dark"] .top-bar-inner {
    background: #f3f5f8;
    border-color: rgba(11, 29, 51, .14);
}

html[data-theme="dark"] .top-bar-inner .brand-copy,
html[data-theme="dark"] .top-bar-inner .theme-toggle {
    color: #0b1d33;
}

html[data-theme="dark"] .top-bar-inner .theme-toggle {
    background: #0b1d33;
    border: 2px solid #0b1d33;
    color: #ffd21a;
}

html[data-theme="dark"] .top-bar-inner .theme-toggle:hover {
    background: #061426;
}

html[data-theme="dark"] .top-bar-inner .theme-icon-moon {
    display: none;
}

html[data-theme="dark"] .top-bar-inner .theme-icon-sun {
    display: block;
    color: #ffd21a;
}

@media (min-width: 700px) {
    .top-bar-inner {
        border-radius: 0 0 18px 18px;
    }
}

/* Sistema visual GLB. Esta capa es la autoridad final para ambos temas. */
html:not([data-theme="dark"]) {
    color-scheme: light;
    --ink: #0b1d33;
    --muted: #667388;
    --surface: #0b1d33;
    --background: #f3f5f8;
    --border: rgba(243, 245, 248, .22);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --ink: #f3f5f8;
    --muted: #b9c2cf;
    --surface: #f3f5f8;
    --background: #061426;
    --border: rgba(11, 29, 51, .16);
}

html,
body,
.app-shell {
    background: var(--background);
}

body {
    color: var(--ink);
    transition: background-color .2s ease, color .2s ease;
}

/* Tema claro: azul como superficie principal, gris y amarillo para contraste. */
html:not([data-theme="dark"]) .rate-card,
html:not([data-theme="dark"]) .calculator-card,
html:not([data-theme="dark"]) .result-card {
    background: #0b1d33;
    border-color: rgba(243, 245, 248, .22);
    color: #f3f5f8;
}

html:not([data-theme="dark"]) .rate-route,
html:not([data-theme="dark"]) .rate-value span,
html:not([data-theme="dark"]) .minimum-note,
html:not([data-theme="dark"]) .result-line span,
html:not([data-theme="dark"]) .calculator-card .field-label {
    color: #f3f5f8;
}

html:not([data-theme="dark"]) .rate-value strong,
html:not([data-theme="dark"]) .result-label {
    color: #ffd21a;
}

html:not([data-theme="dark"]) .rate-card .card-action {
    border-top-color: rgba(243, 245, 248, .22);
    color: #f3f5f8;
}

html:not([data-theme="dark"]) .rate-card .card-action span {
    color: #ffd21a;
}

html:not([data-theme="dark"]) .official-section {
    background: #0b1d33;
    color: #f3f5f8;
}

html:not([data-theme="dark"]) .official-section .official-country,
html:not([data-theme="dark"]) .official-section .official-card {
    background: #f3f5f8;
    border-color: rgba(243, 245, 248, .32);
    color: #0b1d33;
}

html:not([data-theme="dark"]) .official-section .official-country strong,
html:not([data-theme="dark"]) .official-section .official-country a,
html:not([data-theme="dark"]) .official-section .official-country > div span,
html:not([data-theme="dark"]) .official-section .official-card .official-name,
html:not([data-theme="dark"]) .official-section .official-card > strong,
html:not([data-theme="dark"]) .official-section .official-card .official-card-action {
    color: #0b1d33;
}

html:not([data-theme="dark"]) .official-section .official-card .official-conversion,
html:not([data-theme="dark"]) .official-section .official-card .official-date {
    color: #667388;
}

html:not([data-theme="dark"]) .official-section .official-card .official-card-action {
    border-top-color: rgba(11, 29, 51, .16);
}

html:not([data-theme="dark"]) .official-section .official-card .official-card-action span {
    color: #a27c00;
}

html:not([data-theme="dark"]) .field-control,
html:not([data-theme="dark"]) .amount-input,
html:not([data-theme="dark"]) .direction-toggle {
    background: #f3f5f8;
    border-color: rgba(243, 245, 248, .34);
    color: #0b1d33;
}

html:not([data-theme="dark"]) .amount-input input,
html:not([data-theme="dark"]) .amount-input span,
html:not([data-theme="dark"]) .direction-toggle button {
    color: #0b1d33;
}

html:not([data-theme="dark"]) .direction-toggle button.active {
    background: #ffd21a;
    color: #0b1d33;
}

html:not([data-theme="dark"]) .result-line.featured {
    background: #f3f5f8;
}

html:not([data-theme="dark"]) .result-line.featured span,
html:not([data-theme="dark"]) .result-line.featured strong {
    color: #0b1d33;
}

html:not([data-theme="dark"]) .quote-disclaimer {
    background: rgba(243, 245, 248, .1);
    border-color: rgba(243, 245, 248, .24);
    color: #f3f5f8;
}

html:not([data-theme="dark"]) .bottom-nav {
    background: rgba(11, 29, 51, .98);
    border-color: rgba(243, 245, 248, .2);
}

html:not([data-theme="dark"]) .bottom-nav .nav-item {
    color: #b9c2cf;
}

html:not([data-theme="dark"]) .bottom-nav .nav-item.active {
    background: #f3f5f8;
    color: #0b1d33;
}

html:not([data-theme="dark"]) .bottom-nav .nav-item.active .nav-icon {
    color: #a27c00;
}

/* Tema oscuro: fondo profundo y tarjetas grises con texto azul. */
html[data-theme="dark"] .hero > p:last-child,
html[data-theme="dark"] .page-heading > p:last-child,
html[data-theme="dark"] .section-heading > span {
    color: #b9c2cf;
}

html[data-theme="dark"] .eyebrow {
    color: #ffd21a;
}

html[data-theme="dark"] .rate-card,
html[data-theme="dark"] .calculator-card,
html[data-theme="dark"] .result-card {
    background: #f3f5f8;
    border-color: rgba(11, 29, 51, .16);
    color: #0b1d33;
    box-shadow: 0 12px 36px rgba(0, 0, 0, .22);
}

html[data-theme="dark"] .rate-route,
html[data-theme="dark"] .rate-value span,
html[data-theme="dark"] .minimum-note,
html[data-theme="dark"] .result-line span,
html[data-theme="dark"] .calculator-card .field-label,
html[data-theme="dark"] .result-label {
    color: #0b1d33;
}

html[data-theme="dark"] .rate-value strong,
html[data-theme="dark"] .result-line strong {
    color: #0b1d33;
}

html[data-theme="dark"] .rate-card .card-action {
    border-top-color: rgba(11, 29, 51, .16);
    color: #0b1d33;
}

html[data-theme="dark"] .rate-card .card-action span {
    color: #a27c00;
}

html[data-theme="dark"] .official-section {
    background: #ffffff;
    color: #0b1d33;
}

html[data-theme="dark"] .official-section .section-heading h2 {
    color: #0b1d33;
}

html[data-theme="dark"] .official-section .official-country,
html[data-theme="dark"] .official-section .official-card {
    background: #0b1d33;
    border-color: rgba(11, 29, 51, .2);
    color: #f3f5f8;
}

html[data-theme="dark"] .official-section .official-country strong,
html[data-theme="dark"] .official-section .official-country > div span,
html[data-theme="dark"] .official-section .official-card .official-name,
html[data-theme="dark"] .official-section .official-card .official-card-action {
    color: #f3f5f8;
}

html[data-theme="dark"] .official-section .official-country a,
html[data-theme="dark"] .official-section .official-card > strong,
html[data-theme="dark"] .official-section .official-card .official-date,
html[data-theme="dark"] .official-section .official-card .official-card-action span {
    color: #ffd21a;
}

html[data-theme="dark"] .official-section .official-card .official-conversion {
    color: #b9c2cf;
}

html[data-theme="dark"] .official-section .official-card .official-card-action {
    border-top-color: rgba(243, 245, 248, .22);
}

html[data-theme="dark"] .official-section .official-country .country-flag {
    box-shadow: 0 0 0 2px rgba(255, 210, 26, .52);
}

html[data-theme="dark"] .official-section .official-unavailable {
    background: #0b1d33;
    border-color: rgba(11, 29, 51, .2);
    color: #f3f5f8;
}

html[data-theme="dark"] .official-section .official-stale-notice {
    background: #fff7cc;
    border-color: #ffd21a;
    color: #594500;
}

html[data-theme="dark"] .official-section .official-stale-notice strong {
    color: #0b1d33;
}

html[data-theme="dark"] .official-section .official-rates-overlay {
    background: rgba(11, 29, 51, .94);
    border-color: #ffd21a;
    color: #f3f5f8;
}

html:not([data-theme="dark"]) .official-section .official-rates-overlay {
    background: rgba(243, 245, 248, .95);
    border-color: #ffd21a;
    color: #0b1d33;
}

html:not([data-theme="dark"]) .official-section .official-rates-overlay strong {
    color: #705700;
}

html[data-theme="dark"] .field-control,
html[data-theme="dark"] .amount-input,
html[data-theme="dark"] .direction-toggle {
    background: #ffffff;
    border-color: rgba(11, 29, 51, .16);
    color: #0b1d33;
}

html[data-theme="dark"] .amount-input input,
html[data-theme="dark"] .amount-input span,
html[data-theme="dark"] .direction-toggle button {
    color: #0b1d33;
}

html[data-theme="dark"] .direction-toggle button.active {
    background: #0b1d33;
    color: #f3f5f8;
}

html[data-theme="dark"] .result-line.featured {
    background: #0b1d33;
}

html[data-theme="dark"] .result-line.featured span {
    color: #f3f5f8;
}

html[data-theme="dark"] .result-line.featured strong {
    color: #ffd21a;
}

html[data-theme="dark"] .quote-disclaimer {
    background: #ffffff;
    border-color: rgba(11, 29, 51, .16);
    color: #667388;
}

html[data-theme="dark"] .bottom-nav {
    background: rgba(243, 245, 248, .98);
    border-color: rgba(11, 29, 51, .16);
}

html[data-theme="dark"] .bottom-nav .nav-item {
    color: #667388;
}

html[data-theme="dark"] .bottom-nav .nav-item.active {
    background: #0b1d33;
    color: #f3f5f8;
}

html[data-theme="dark"] .bottom-nav .nav-item.active .nav-icon {
    color: #ffd21a;
}

html[data-theme="dark"] .stale-rates-notice {
    background: #fff7cc;
    border-color: #ffd21a;
    color: #594500;
}
