@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@300..800&display=swap");

:root {
    color-scheme: light;
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-alt: #f8fafc;
    --text: #17202a;
    --muted: #65717d;
    --border: #dfe5ea;
    --accent: #174ea6;
    --accent-hover: #113d85;
    --positive: #14804a;
    --positive-bg: #e9f7ef;
    --negative: #c5352d;
    --negative-bg: #fff0ef;
    --warning: #9b6500;
    --warning-bg: #fff7df;
    --shadow: 0 14px 40px rgba(27, 39, 51, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-width: 320px;
    background: var(--bg);
    color: var(--text);
    font-family: "Manrope", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.45;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.app-shell {
    width: min(1480px, calc(100% - 36px));
    margin: 0 auto;
    padding: 34px 0 60px;
}

.topbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.eyebrow {
    margin: 0 0 5px;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 750;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 5px;
    font-size: clamp(1.9rem, 3.5vw, 3rem);
    letter-spacing: -0.045em;
    line-height: 1.05;
}

h2 {
    margin-bottom: 3px;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
}

.subtitle,
.panel-header p,
.drawer-header p,
.notice {
    color: var(--muted);
}

.subtitle {
    margin-bottom: 0;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.last-update {
    max-width: 250px;
    color: var(--muted);
    font-size: 0.84rem;
    text-align: right;
}

.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 10px 16px;
    font-weight: 700;
    text-decoration: none;
    transition: 160ms ease;
}

.button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.button-primary {
    background: var(--accent);
    color: #fff;
}

.button-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.button-icon {
    font-size: 1.2rem;
}

.button.is-loading .button-icon {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.summary-card {
    min-height: 128px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface);
    padding: 20px;
    box-shadow: 0 7px 24px rgba(27, 39, 51, 0.045);
}

.summary-label {
    display: block;
    margin-bottom: 9px;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 650;
}

.summary-value {
    display: block;
    margin-bottom: 4px;
    font-size: clamp(1.65rem, 3vw, 2.35rem);
    letter-spacing: -0.045em;
    line-height: 1;
}

.summary-small {
    font-size: clamp(1.3rem, 2.4vw, 1.85rem);
}

.summary-note {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
}

.positive {
    color: var(--positive);
}

.negative {
    color: var(--negative);
}

.panel {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

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

.panel-header p {
    margin-bottom: 0;
    font-size: 0.86rem;
}

.filters {
    display: flex;
    gap: 10px;
}

.search-control input,
.select-control select {
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
    color: var(--text);
    padding: 8px 12px;
    outline: none;
}

.search-control input {
    width: min(280px, 36vw);
}

.select-control select {
    min-width: 190px;
}

.search-control input:focus,
.select-control select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(23, 78, 166, 0.12);
}

.status-message {
    display: none;
    padding: 12px 22px;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
}

.status-message.visible {
    display: block;
}

.status-message.info {
    background: #edf4ff;
    color: #184b8a;
}

.status-message.success {
    background: var(--positive-bg);
    color: var(--positive);
}

.status-message.error {
    background: var(--negative-bg);
    color: var(--negative);
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    min-width: 1140px;
    border-collapse: collapse;
}

th,
td {
    border-bottom: 1px solid var(--border);
    padding: 15px 14px;
    text-align: left;
    vertical-align: middle;
}

th {
    background: var(--surface-alt);
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 750;
    letter-spacing: 0.045em;
    text-transform: uppercase;
}

tbody tr[data-code] {
    transition: background 120ms ease;
}

tbody tr[data-code]:hover {
    background: #f7faff;
}

tbody tr[data-code] td {
    cursor: pointer;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.numeric {
    text-align: right;
}

.company-cell {
    min-width: 250px;
}

.company-line {
    display: flex;
    align-items: center;
    gap: 11px;
}

.symbol-badge {
    display: grid;
    width: 48px;
    height: 34px;
    flex: 0 0 48px;
    place-items: center;
    border-radius: 9px;
    background: #eef3f8;
    color: #314250;
    font-size: 0.72rem;
    font-weight: 800;
}

.company-name {
    display: block;
    font-weight: 700;
}

.company-category {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
}

.price {
    font-variant-numeric: tabular-nums;
    font-weight: 760;
    white-space: nowrap;
}

.change {
    display: inline-flex;
    min-width: 72px;
    justify-content: flex-end;
    border-radius: 8px;
    padding: 4px 7px;
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
    font-weight: 750;
}

.change.positive {
    background: var(--positive-bg);
    color: var(--positive);
}

.change.negative {
    background: var(--negative-bg);
    color: var(--negative);
}

.change.neutral {
    color: var(--muted);
}

.pending-badge {
    display: inline-flex;
    border-radius: 999px;
    background: var(--warning-bg);
    color: var(--warning);
    padding: 5px 8px;
    font-size: 0.74rem;
    font-weight: 750;
}

.sparkline {
    display: block;
    width: 104px;
    height: 34px;
}

.sparkline path {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.date-cell {
    color: var(--muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

.empty-state {
    padding: 34px;
    color: var(--muted);
    text-align: center;
}

.notice {
    margin-top: 16px;
    border: 1px solid #eadca9;
    border-radius: 14px;
    background: #fffaf0;
    padding: 14px 16px;
    font-size: 0.86rem;
}

.notice strong {
    color: var(--text);
}

.drawer-backdrop {
    position: fixed;
    z-index: 40;
    inset: 0;
    background: rgba(10, 18, 25, 0.42);
    backdrop-filter: blur(2px);
}

.drawer {
    position: fixed;
    z-index: 50;
    top: 0;
    right: 0;
    width: min(620px, 94vw);
    height: 100%;
    overflow-y: auto;
    border-left: 1px solid var(--border);
    background: var(--surface);
    padding: 26px;
    box-shadow: -20px 0 60px rgba(13, 25, 36, 0.16);
    transform: translateX(102%);
    transition: transform 220ms ease;
}

.drawer.open {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.drawer-header h2 {
    font-size: 1.8rem;
}

.drawer-header p {
    margin-bottom: 0;
}

.icon-button {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--text);
    font-size: 1.6rem;
    line-height: 1;
}

.period-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 22px;
}

.period-tabs button {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--muted);
    padding: 8px 12px;
    font-weight: 650;
}

.period-tabs button.active {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.chart-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.chart-summary > div {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-alt);
    padding: 14px;
}

.chart-summary span {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 0.78rem;
}

.chart-summary strong {
    font-size: 1.35rem;
}

.chart-container {
    min-height: 340px;
}

.history-svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.history-svg .grid-line {
    stroke: var(--border);
    stroke-width: 1;
}

.history-svg .axis-label {
    fill: var(--muted);
    font-size: 11px;
}

.history-svg .line {
    fill: none;
    stroke: var(--accent);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.history-svg .area {
    fill: rgba(23, 78, 166, 0.10);
}

.chart-range {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.78rem;
}

.installer {
    width: min(720px, calc(100% - 32px));
    margin: 54px auto;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--surface);
    padding: 30px;
    box-shadow: var(--shadow);
}

.check-list {
    margin: 24px 0;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}

.check-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    padding: 13px 15px;
}

.check-row:last-child {
    border-bottom: 0;
}

.ok {
    color: var(--positive);
}

.error {
    color: var(--negative);
}

.success-box,
.error-box {
    border-radius: 12px;
    padding: 13px 15px;
}

.success-box {
    background: var(--positive-bg);
    color: var(--positive);
}

.error-box {
    background: var(--negative-bg);
    color: var(--negative);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

@media (max-width: 980px) {
    .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-actions {
        width: 100%;
        justify-content: space-between;
    }

    .last-update {
        text-align: left;
    }
}

@media (max-width: 700px) {
    .app-shell {
        width: min(100% - 20px, 1480px);
        padding-top: 22px;
    }

    .topbar-actions,
    .panel-header,
    .filters {
        align-items: stretch;
        flex-direction: column;
    }

    .button,
    .search-control input,
    .select-control select {
        width: 100%;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .summary-card {
        min-height: 105px;
    }

    .drawer {
        width: 100%;
        padding: 20px;
    }

    .chart-summary {
        grid-template-columns: 1fr;
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --bg: #10151a;
        --surface: #182027;
        --surface-alt: #121a20;
        --text: #edf3f7;
        --muted: #9eabb5;
        --border: #2c3942;
        --accent: #78a9ff;
        --accent-hover: #94baff;
        --positive: #62d394;
        --positive-bg: #173729;
        --negative: #ff8c86;
        --negative-bg: #402321;
        --warning: #f0c464;
        --warning-bg: #3a321e;
        --shadow: 0 14px 40px rgba(0, 0, 0, 0.25);
    }

    .button-primary {
        color: #0b1b2e;
    }

    tbody tr[data-code]:hover {
        background: #202b33;
    }

    .symbol-badge {
        background: #26333c;
        color: #d8e3ea;
    }

    .notice {
        border-color: #5a4d2a;
        background: #292317;
    }

    .history-svg .area {
        fill: rgba(120, 169, 255, 0.12);
    }
}

/* ===== Versión 2: fecha de actualización y mapa ponderado ===== */
.update-info {
    display: flex;
    min-width: 245px;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    text-align: right;
}

.update-info-label {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.045em;
    text-transform: uppercase;
}

.last-update {
    max-width: none;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 750;
    text-align: inherit;
}

.market-date {
    color: var(--muted);
    font-size: 0.78rem;
}

.weight-value {
    display: inline-flex;
    min-width: 58px;
    justify-content: flex-end;
    font-variant-numeric: tabular-nums;
    font-weight: 760;
}

.view-switcher {
    display: inline-flex;
    gap: 4px;
    margin-bottom: 14px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface);
    padding: 4px;
}

.view-tab {
    min-height: 40px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    padding: 8px 15px;
    font-weight: 750;
    transition: 150ms ease;
}

.view-tab:hover {
    color: var(--text);
}

.view-tab.active {
    background: var(--accent);
    color: #fff;
}

.view-section[hidden] {
    display: none !important;
}

.status-message {
    margin-bottom: 14px;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 12px 16px;
}

.status-message.info {
    border-color: #cbdcf5;
}

.status-message.success {
    border-color: #bde6ce;
}

.status-message.error {
    border-color: #efc5c2;
}

.heatmap-panel {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: #172027;
    box-shadow: var(--shadow);
}

.heatmap-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    background: #11191f;
    color: #fff;
    padding: 17px 20px;
}

.heatmap-header h2 {
    margin-bottom: 2px;
}

.heatmap-header p {
    margin-bottom: 0;
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.84rem;
}

.heatmap-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.78rem;
}

.heatmap-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.positive-dot {
    background: hsl(130 52% 37%);
}

.neutral-dot {
    background: hsl(210 9% 43%);
}

.negative-dot {
    background: hsl(2 65% 43%);
}

.treemap {
    position: relative;
    width: 100%;
    height: clamp(540px, calc(100vh - 315px), 850px);
    min-height: 540px;
    overflow: hidden;
    background: #10171c;
}

.treemap-category-label {
    position: absolute;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #172027;
    color: rgba(255, 255, 255, 0.92);
    padding: 2px 7px;
    font-size: clamp(0.63rem, 0.9vw, 0.74rem);
    font-weight: 780;
    line-height: 1;
    white-space: nowrap;
}

.treemap-category-label strong {
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.68rem;
}

.treemap-item {
    position: absolute;
    z-index: 1;
    display: flex;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 1px solid rgba(14, 20, 24, 0.62);
    border-radius: 0;
    color: #fff;
    padding: clamp(5px, 1vw, 13px);
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.24);
    transition: filter 120ms ease, box-shadow 120ms ease;
}

.treemap-item:not(:disabled):hover,
.treemap-item:not(:disabled):focus-visible {
    z-index: 4;
    filter: brightness(1.12);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.88);
}

.treemap-item.disabled {
    cursor: default;
    opacity: 0.94;
}

.treemap-code {
    display: block;
    max-width: 100%;
    overflow: hidden;
    font-size: clamp(1.15rem, 2.8vw, 3rem);
    font-weight: 500;
    letter-spacing: -0.045em;
    line-height: 0.98;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.treemap-name {
    display: block;
    max-width: 100%;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.84);
    font-size: clamp(0.65rem, 1vw, 0.84rem);
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.treemap-price {
    display: block;
    max-width: 100%;
    overflow: hidden;
    margin-top: 4px;
    font-size: clamp(0.76rem, 1.45vw, 1.35rem);
    font-variant-numeric: tabular-nums;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.treemap-change {
    display: block;
    margin-top: 2px;
    font-size: clamp(0.78rem, 1.55vw, 1.45rem);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.treemap-weight {
    display: block;
    margin-top: clamp(2px, 0.6vw, 8px);
    color: rgba(255, 255, 255, 0.82);
    font-size: clamp(0.62rem, 0.9vw, 0.78rem);
    font-weight: 720;
}

.treemap-item.compact {
    gap: 1px;
    padding: 5px;
}

.treemap-item.compact .treemap-code {
    font-size: clamp(0.88rem, 1.8vw, 1.5rem);
}

.treemap-item.compact .treemap-name,
.treemap-item.compact .treemap-price {
    display: none;
}

.treemap-item.compact .treemap-change {
    font-size: clamp(0.68rem, 1.2vw, 1rem);
}

.treemap-item.compact .treemap-weight {
    margin-top: 1px;
    font-size: 0.62rem;
}

.treemap-item.micro {
    gap: 1px;
    padding: 2px;
}

.treemap-item.micro .treemap-code {
    font-size: clamp(0.59rem, 1vw, 0.82rem);
    font-weight: 800;
}

.treemap-item.micro .treemap-name,
.treemap-item.micro .treemap-price,
.treemap-item.micro .treemap-change {
    display: none;
}

.treemap-item.micro .treemap-weight {
    margin-top: 0;
    font-size: 0.57rem;
}

.heatmap-footer {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    background: #11191f;
    color: rgba(255, 255, 255, 0.66);
    padding: 11px 16px;
    font-size: 0.76rem;
}

@media (max-width: 980px) {
    .update-info {
        align-items: flex-start;
        text-align: left;
    }

    .treemap {
        height: 650px;
    }
}

@media (max-width: 700px) {
    .view-switcher {
        display: flex;
        width: 100%;
    }

    .view-tab {
        flex: 1;
        padding-inline: 8px;
    }

    .heatmap-header,
    .heatmap-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .heatmap-legend {
        justify-content: flex-start;
    }

    .treemap {
        height: 720px;
        min-height: 620px;
    }
}

@media (prefers-color-scheme: dark) {
    .view-tab.active {
        color: #0b1b2e;
    }

    .status-message.info {
        border-color: #315172;
    }

    .status-message.success {
        border-color: #2d6446;
    }

    .status-message.error {
        border-color: #70413e;
    }
}

/* ===== Versión 3: seguimiento de inversión y cartera inicial fija ===== */
.button-secondary {
    border-color: var(--border);
    background: var(--surface);
    color: var(--text);
}

.button-secondary:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

.button-danger {
    border-color: color-mix(in srgb, var(--negative) 45%, var(--border));
    background: var(--negative-bg);
    color: var(--negative);
}

.investment-hero {
    margin-bottom: 18px;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
    border-radius: 22px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.investment-hero-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 24px 18px;
    border-bottom: 1px solid var(--border);
}

.investment-hero-header h2 {
    margin-bottom: 4px;
    font-size: clamp(1.25rem, 2vw, 1.65rem);
}

.investment-hero-header p:last-child {
    margin-bottom: 0;
    color: var(--muted);
}

.investment-empty {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 22px 24px;
    background: var(--surface-alt);
}

.investment-empty p {
    margin: 4px 0 0;
    color: var(--muted);
}

.investment-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.investment-metric {
    min-width: 0;
    padding: 22px 24px;
    border-right: 1px solid var(--border);
}

.investment-metric:last-child {
    border-right: 0;
}

.investment-metric.featured {
    background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}

.investment-metric span,
.investment-comparison span {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 680;
}

.investment-metric strong {
    display: block;
    overflow: hidden;
    margin-bottom: 7px;
    font-size: clamp(1.35rem, 2.5vw, 2rem);
    letter-spacing: -0.04em;
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.investment-metric small {
    display: block;
    color: var(--muted);
    font-size: 0.77rem;
}

.investment-alert {
    border-top: 1px solid color-mix(in srgb, var(--warning) 30%, var(--border));
    background: var(--warning-bg);
    color: var(--warning);
    padding: 11px 24px;
    font-size: 0.82rem;
}

.market-summary {
    margin-bottom: 20px;
}

.investment-detail-panel {
    margin-bottom: 18px;
}

.investment-panel-header,
.comparison-legend {
    flex-wrap: wrap;
}

.comparison-legend {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--muted);
    font-size: 0.8rem;
}

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

.line-swatch {
    display: inline-block;
    width: 24px;
    height: 3px;
    border-radius: 999px;
}

.official-line {
    background: var(--accent);
}

.theoretical-line {
    background: var(--positive);
}

.investment-chart {
    min-height: 360px;
    padding: 18px 20px 8px;
    background: var(--surface);
}

.investment-svg {
    display: block;
    width: 100%;
    height: auto;
    min-height: 300px;
}

.investment-line {
    fill: none;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.investment-line.official {
    stroke: var(--accent);
}

.investment-line.theoretical {
    stroke: var(--positive);
    stroke-dasharray: 8 6;
}

.investment-comparison {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-top: 1px solid var(--border);
    background: var(--surface-alt);
}

.investment-comparison > div {
    padding: 15px 20px;
    border-right: 1px solid var(--border);
}

.investment-comparison > div:last-child {
    border-right: 0;
}

.investment-comparison strong {
    display: block;
    font-size: 1.05rem;
}

.positions-panel .company-category {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.position-status {
    display: inline-flex;
    align-items: center;
    width: max-content;
    border-radius: 999px;
    padding: 2px 7px;
    font-size: 0.66rem;
    font-weight: 720;
}

.position-status.ready {
    background: var(--positive-bg);
    color: var(--positive);
}

.position-status.pending {
    background: var(--warning-bg);
    color: var(--warning);
}

.position-status.neutral {
    background: color-mix(in srgb, var(--muted) 12%, var(--surface));
    color: var(--muted);
}

.position-entry strong,
.position-entry small,
td.numeric > small,
.result-stack strong,
.result-stack small {
    display: block;
}

.position-entry small,
td.numeric > small,
.result-stack small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.72rem;
}

.result-stack {
    display: inline-block;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(10, 16, 22, 0.54);
    backdrop-filter: blur(3px);
}

.modal {
    position: fixed;
    z-index: 80;
    top: 50%;
    left: 50%;
    width: min(620px, calc(100% - 30px));
    max-height: calc(100vh - 34px);
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--surface);
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.28);
    opacity: 0;
    transform: translate(-50%, -47%) scale(0.98);
    pointer-events: none;
    transition: 180ms ease;
}

.modal.open {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    padding: 21px 22px 17px;
}

.investment-form {
    display: grid;
    gap: 18px;
    padding: 22px;
}

.investment-form label > span {
    display: block;
    margin-bottom: 7px;
    font-size: 0.85rem;
    font-weight: 720;
}

.money-input,
.date-input {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    padding: 10px 12px;
}

.money-input:focus-within,
.date-input:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.money-input > span {
    color: var(--muted);
    font-weight: 760;
}

.money-input input,
.date-input input {
    display: block;
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    padding: 0;
    font-size: 1rem;
}

.form-explanation {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-alt);
    padding: 14px 15px;
}

.form-explanation p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.84rem;
}

.form-error {
    border-radius: 12px;
    background: var(--negative-bg);
    color: var(--negative);
    padding: 11px 13px;
    font-size: 0.84rem;
}

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    border-top: 1px solid var(--border);
    padding-top: 18px;
}

.modal-spacer {
    flex: 1;
}

@media (max-width: 1050px) {
    .investment-metrics,
    .investment-comparison {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .investment-metric:nth-child(2),
    .investment-comparison > div:nth-child(2) {
        border-right: 0;
    }

    .investment-metric:nth-child(-n+2),
    .investment-comparison > div:nth-child(-n+2) {
        border-bottom: 1px solid var(--border);
    }
}

@media (max-width: 700px) {
    .investment-hero-header,
    .investment-empty {
        align-items: stretch;
        flex-direction: column;
    }

    .investment-metrics,
    .investment-comparison {
        grid-template-columns: 1fr;
    }

    .investment-metric,
    .investment-comparison > div {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .investment-metric:last-child,
    .investment-comparison > div:last-child {
        border-bottom: 0;
    }

    .investment-chart {
        min-height: 280px;
        padding-inline: 8px;
    }

    .investment-svg {
        min-height: 240px;
    }

    .modal-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .modal-spacer {
        display: none;
    }

    .modal-actions .button {
        width: 100%;
    }
}

@media (prefers-color-scheme: dark) {
    .investment-metric.featured {
        background: color-mix(in srgb, var(--accent) 9%, var(--surface));
    }

    .modal-backdrop {
        background: rgba(0, 0, 0, 0.68);
    }
}

/* ===== Versión 3.1: gráfico de evolución más legible e interactivo ===== */
.investment-detail-panel {
    isolation: isolate;
}

.investment-panel-header {
    background: linear-gradient(180deg, color-mix(in srgb, var(--surface-alt) 72%, var(--surface)), var(--surface));
}

.comparison-legend {
    gap: 8px;
}

.comparison-legend span {
    min-height: 34px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    padding: 6px 11px;
    color: var(--text);
    font-weight: 720;
    box-shadow: 0 3px 10px rgba(27, 39, 51, 0.04);
}

.line-swatch {
    width: 26px;
    height: 4px;
}

.theoretical-line.line-swatch {
    background: repeating-linear-gradient(90deg, var(--positive) 0 7px, transparent 7px 11px);
}

.investment-chart {
    position: relative;
    min-height: 420px;
    overflow: hidden;
    padding: 20px 22px 0;
    border-bottom: 1px solid var(--border);
    background:
        radial-gradient(circle at 18% 4%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 36%),
        linear-gradient(180deg, color-mix(in srgb, var(--surface-alt) 82%, var(--surface)), var(--surface));
}

.investment-chart-stage {
    position: relative;
}

.investment-svg {
    display: block;
    width: 100%;
    height: auto;
    min-height: 330px;
    overflow: visible;
}

.investment-plot-background {
    fill: color-mix(in srgb, var(--surface) 92%, var(--accent) 8%);
    stroke: color-mix(in srgb, var(--border) 80%, var(--accent) 20%);
    stroke-width: 1;
}

.investment-grid-line {
    stroke: color-mix(in srgb, var(--border) 84%, transparent);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.investment-grid-vertical {
    stroke-dasharray: 3 7;
    opacity: 0.58;
}

.investment-axis-label {
    fill: var(--muted);
    font-size: 12px;
    font-weight: 620;
    font-variant-numeric: tabular-nums;
}

.investment-axis-x {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.investment-area {
    pointer-events: none;
}

.investment-area.official {
    fill: url(#officialAreaGradient);
}

.investment-area.theoretical {
    fill: url(#theoreticalAreaGradient);
}

.investment-line {
    fill: none;
    stroke-width: 3.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
}

.investment-line.official {
    stroke: var(--accent);
}

.investment-line.theoretical {
    stroke: var(--positive);
    stroke-width: 3;
    stroke-dasharray: 9 7;
}

.investment-capital-line {
    stroke: color-mix(in srgb, var(--text) 42%, transparent);
    stroke-width: 1;
    stroke-dasharray: 5 6;
    vector-effect: non-scaling-stroke;
}

.investment-capital-label rect {
    fill: color-mix(in srgb, var(--surface) 92%, transparent);
    stroke: var(--border);
}

.investment-capital-label text {
    fill: var(--muted);
    font-size: 10px;
    font-weight: 760;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.investment-end-point,
.investment-hover-point {
    vector-effect: non-scaling-stroke;
}

.investment-end-point.official,
.investment-hover-point.official {
    fill: var(--surface);
    stroke: var(--accent);
    stroke-width: 3;
}

.investment-end-point.theoretical,
.investment-hover-point.theoretical {
    fill: var(--surface);
    stroke: var(--positive);
    stroke-width: 3;
}

.investment-crosshair {
    opacity: 0;
    stroke: color-mix(in srgb, var(--text) 36%, transparent);
    stroke-width: 1;
    stroke-dasharray: 4 5;
    vector-effect: non-scaling-stroke;
    transition: opacity 100ms ease;
}

.investment-crosshair.visible {
    opacity: 1;
}

.investment-hover-point {
    opacity: 0;
    transition: opacity 100ms ease;
}

.investment-hover-point.visible {
    opacity: 1;
}

.investment-hit-area {
    fill: transparent;
    cursor: crosshair;
    pointer-events: all;
}

.investment-chart-tooltip {
    position: absolute;
    z-index: 3;
    min-width: 220px;
    border: 1px solid color-mix(in srgb, var(--border) 76%, var(--accent) 24%);
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    padding: 11px 13px;
    box-shadow: 0 14px 36px rgba(21, 31, 41, 0.14);
    backdrop-filter: blur(10px);
    pointer-events: none;
    transform: translateX(-50%);
}

.investment-tooltip-date {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 800;
}

.investment-tooltip-row {
    display: grid;
    grid-template-columns: 9px 1fr auto;
    align-items: center;
    gap: 8px;
    min-height: 24px;
    color: var(--muted);
    font-size: 0.76rem;
}

.investment-tooltip-row i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.investment-tooltip-row.official i {
    background: var(--accent);
}

.investment-tooltip-row.theoretical i {
    border: 2px solid var(--positive);
    background: transparent;
}

.investment-tooltip-row b {
    color: var(--text);
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}

.investment-chart-footer {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0 -22px;
    border-top: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface-alt) 72%, var(--surface));
}

.investment-chart-stat {
    position: relative;
    min-width: 0;
    padding: 14px 18px 16px;
    border-right: 1px solid var(--border);
}

.investment-chart-stat:last-child {
    border-right: 0;
}

.investment-chart-stat::before {
    position: absolute;
    top: 0;
    left: 18px;
    width: 30px;
    height: 3px;
    border-radius: 0 0 999px 999px;
    background: color-mix(in srgb, var(--muted) 50%, transparent);
    content: "";
}

.investment-chart-stat.official::before {
    background: var(--accent);
}

.investment-chart-stat.theoretical::before {
    background: var(--positive);
}

.investment-chart-stat span {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
}

.investment-chart-stat strong {
    display: block;
    overflow: hidden;
    color: var(--text);
    font-size: 0.92rem;
    font-variant-numeric: tabular-nums;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .investment-chart-footer {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .investment-chart-stat:nth-child(2) {
        border-right: 0;
    }

    .investment-chart-stat:nth-child(-n+2) {
        border-bottom: 1px solid var(--border);
    }
}

@media (max-width: 700px) {
    .comparison-legend span {
        flex: 1 1 auto;
        justify-content: center;
    }

    .investment-chart {
        min-height: 330px;
        padding: 12px 8px 0;
    }

    .investment-svg {
        min-height: 260px;
    }

    .investment-chart-footer {
        margin: 0 -8px;
    }

    .investment-chart-tooltip {
        min-width: 190px;
    }
}

@media (prefers-color-scheme: dark) {
    .investment-chart-tooltip {
        box-shadow: 0 18px 42px rgba(0, 0, 0, 0.32);
    }

    .comparison-legend span {
        box-shadow: none;
    }
}

/* ===== Versión 3.2: movimientos de capital y módulo compacto ===== */
.investment-hero {
    margin-bottom: 14px;
    border-radius: 18px;
}

.investment-hero-header {
    gap: 14px;
    padding: 14px 18px 12px;
}

.investment-hero-header .eyebrow {
    margin-bottom: 2px;
    font-size: 0.68rem;
}

.investment-hero-header h2 {
    margin-bottom: 2px;
    font-size: clamp(1.05rem, 1.6vw, 1.35rem);
}

.investment-hero-header p:last-child {
    font-size: 0.79rem;
    line-height: 1.35;
}

.investment-hero-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
}

.button-compact {
    min-height: 34px;
    padding: 7px 11px;
    border-radius: 10px;
    font-size: 0.78rem;
}

.investment-empty {
    gap: 16px;
    padding: 15px 18px;
}

.investment-empty p {
    font-size: 0.8rem;
}

.investment-metric {
    padding: 14px 16px 13px;
}

.investment-metric span,
.investment-comparison span {
    margin-bottom: 4px;
    font-size: 0.7rem;
}

.investment-metric strong {
    margin-bottom: 4px;
    font-size: clamp(1.08rem, 1.9vw, 1.5rem);
    letter-spacing: -0.035em;
}

.investment-metric small {
    font-size: 0.7rem;
    line-height: 1.35;
}

.investment-flow-summary {
    overflow: hidden;
    margin-top: 2px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.investment-alert {
    padding: 8px 18px;
    font-size: 0.75rem;
}

.movements-panel {
    margin-bottom: 18px;
}

.movements-panel-header {
    gap: 14px;
    padding-block: 15px;
}

.movements-table-wrap {
    max-height: 330px;
    overflow: auto;
}

.movements-table th,
.movements-table td {
    padding-block: 10px;
    font-size: 0.78rem;
}

.movements-table td > strong,
.movements-table td > small {
    display: block;
}

.movements-table td > small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.68rem;
}

.movement-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 0.68rem;
    font-weight: 780;
    white-space: nowrap;
}

.movement-badge.initial {
    background: color-mix(in srgb, var(--accent) 12%, var(--surface));
    color: var(--accent);
}

.movement-badge.deposit {
    background: var(--positive-bg);
    color: var(--positive);
}

.movement-badge.withdrawal {
    background: var(--negative-bg);
    color: var(--negative);
}

.movement-application {
    display: block;
    line-height: 1.45;
    white-space: nowrap;
}

.movement-warning {
    display: inline-block;
    margin-top: 3px;
    border-radius: 999px;
    background: var(--warning-bg);
    color: var(--warning);
    padding: 2px 6px;
    font-size: 0.64rem;
    font-weight: 720;
}

.movement-delete {
    width: 30px;
    height: 30px;
    color: var(--negative);
    font-size: 1.05rem;
}

.muted {
    color: var(--muted);
}

.modal-small {
    width: min(560px, calc(100% - 30px));
}

.movement-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.movement-type-fieldset {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
    margin: 0;
    border: 0;
    padding: 0;
}

.movement-type-fieldset legend {
    grid-column: 1 / -1;
    margin-bottom: 1px;
    font-size: 0.85rem;
    font-weight: 720;
}

.movement-type-option {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    padding: 10px 11px;
    cursor: pointer;
}

.movement-type-option:has(input:checked) {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 7%, var(--surface));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 12%, transparent);
}

.movement-type-option input {
    margin-top: 3px;
    accent-color: var(--accent);
}

.movement-type-option > span {
    display: block;
    margin: 0 !important;
}

.movement-type-option strong,
.movement-type-option small {
    display: block;
}

.movement-type-option small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.71rem;
    font-weight: 500;
    line-height: 1.35;
}

.text-input {
    display: block;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: 0;
    background: var(--surface);
    color: var(--text);
    padding: 10px 12px;
    font-size: 0.92rem;
}

.text-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.form-explanation.compact {
    padding: 10px 12px;
}

.form-explanation.compact p {
    margin: 0;
    font-size: 0.78rem;
}

.investment-movement-marker {
    pointer-events: none;
}

.investment-movement-marker line {
    stroke-width: 1;
    stroke-dasharray: 3 6;
    vector-effect: non-scaling-stroke;
    opacity: 0.52;
}

.investment-movement-marker circle {
    stroke: var(--surface);
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
}

.investment-movement-marker text {
    font-size: 9px;
    font-weight: 800;
    paint-order: stroke;
    stroke: var(--surface);
    stroke-width: 3px;
    stroke-linejoin: round;
}

.investment-movement-marker.deposit line {
    stroke: var(--positive);
}

.investment-movement-marker.deposit circle {
    fill: var(--positive);
}

.investment-movement-marker.deposit text {
    fill: var(--positive);
}

.investment-movement-marker.withdrawal line {
    stroke: var(--negative);
}

.investment-movement-marker.withdrawal circle {
    fill: var(--negative);
}

.investment-movement-marker.withdrawal text {
    fill: var(--negative);
}

.investment-tooltip-flow {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 5px;
    border-top: 1px solid var(--border);
    padding-top: 6px;
    font-size: 0.73rem;
}

.investment-tooltip-flow.deposit b {
    color: var(--positive);
}

.investment-tooltip-flow.withdrawal b {
    color: var(--negative);
}

@media (max-width: 700px) {
    .investment-hero-header {
        gap: 10px;
        padding: 12px 14px;
    }

    .investment-hero-actions {
        width: 100%;
    }

    .investment-hero-actions .button {
        flex: 1;
    }

    .investment-metric {
        padding: 11px 14px;
    }

    .movement-form-grid,
    .movement-type-fieldset {
        grid-template-columns: 1fr;
    }

    .movements-panel-header {
        align-items: stretch;
        flex-direction: column;
    }

    .movements-panel-header .button {
        width: 100%;
    }

    .investment-movement-marker text {
        display: none;
    }
}

/* =========================================================
   Acceso privado · v3.3
   ========================================================= */
.topbar-session {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-left: 1px solid var(--border);
    padding-left: 12px;
}

.topbar-user {
    max-width: 160px;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-button {
    min-height: 36px;
    padding: 7px 11px;
    font-size: 0.78rem;
}

.security-warning {
    margin: -10px 0 18px;
    border: 1px solid color-mix(in srgb, var(--warning) 35%, var(--border));
    border-radius: 12px;
    background: var(--warning-bg);
    padding: 10px 13px;
    color: var(--warning);
    font-size: 0.82rem;
}

.security-warning code,
.login-help code {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-alt);
    padding: 2px 5px;
    color: var(--text);
    font-size: 0.82em;
}

.login-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 14% 18%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 34%),
        radial-gradient(circle at 84% 78%, color-mix(in srgb, var(--positive) 8%, transparent), transparent 32%),
        var(--bg);
}

.login-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 28px 18px;
}

.login-card {
    width: min(100%, 430px);
    border: 1px solid var(--border);
    border-radius: 24px;
    background: var(--surface);
    padding: clamp(26px, 5vw, 42px);
    box-shadow: var(--shadow);
}

.login-brand {
    display: grid;
    width: 46px;
    height: 46px;
    margin-bottom: 22px;
    place-items: center;
    border-radius: 14px;
    background: var(--accent);
    color: #fff;
    font-size: 1.35rem;
    font-weight: 800;
}

.login-card h1 {
    margin-bottom: 10px;
    font-size: clamp(1.65rem, 6vw, 2.25rem);
    line-height: 1.08;
}

.login-subtitle {
    margin-bottom: 24px;
    color: var(--muted);
}

.login-form {
    display: grid;
    gap: 15px;
}

.login-form label {
    display: grid;
    gap: 7px;
}

.login-form label > span {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.login-form input {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: none;
    background: var(--surface-alt);
    padding: 10px 13px;
    color: var(--text);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.login-form input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.login-button {
    width: 100%;
    margin-top: 3px;
}

.login-error,
.login-notice {
    margin-bottom: 17px;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.84rem;
}

.login-error {
    border: 1px solid color-mix(in srgb, var(--negative) 30%, var(--border));
    background: var(--negative-bg);
    color: var(--negative);
}

.login-notice {
    border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
    background: color-mix(in srgb, var(--accent) 8%, var(--surface));
    color: var(--accent);
}

.login-help {
    margin: 22px 0 0;
    color: var(--muted);
    font-size: 0.78rem;
    text-align: center;
}

@media (max-width: 1100px) {
    .topbar-actions {
        flex-wrap: wrap;
    }

    .topbar-session {
        margin-left: auto;
    }
}

@media (max-width: 700px) {
    .topbar-session {
        width: 100%;
        justify-content: space-between;
        border-top: 1px solid var(--border);
        border-left: 0;
        padding-top: 10px;
        padding-left: 0;
    }

    .topbar-session .button {
        width: auto;
    }

    .security-warning {
        margin-top: -6px;
    }

    .login-card {
        border-radius: 19px;
        padding: 25px 20px;
    }
}

/* =========================================================
   Rediseño visual glassmorphism · v3.4
   Solo estilos: no modifica estructura, navegación ni lógica.
   ========================================================= */
:root {
    color-scheme: dark;
    --bg: #080a0d;
    --surface: rgba(29, 31, 35, 0.68);
    --surface-alt: rgba(255, 255, 255, 0.045);
    --surface-strong: rgba(36, 38, 43, 0.82);
    --text: #f5f7f8;
    --muted: #a9b0b8;
    --border: rgba(255, 255, 255, 0.13);
    --border-strong: rgba(255, 255, 255, 0.22);
    --accent: #f47a24;
    --accent-hover: #ff974f;
    --accent-soft: rgba(244, 122, 36, 0.16);
    --positive: #69d982;
    --positive-bg: rgba(47, 177, 88, 0.14);
    --negative: #ff7770;
    --negative-bg: rgba(224, 68, 61, 0.15);
    --warning: #ffd06d;
    --warning-bg: rgba(255, 183, 57, 0.13);
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.34), 0 1px 0 rgba(255, 255, 255, 0.06) inset;
    --glass-highlight: linear-gradient(135deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.018) 42%, rgba(244, 122, 36, 0.035));
    --glass-blur: blur(22px) saturate(135%);
}

html {
    min-height: 100%;
    background: #080a0d;
}

body {
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 78% 2%, rgba(224, 91, 13, 0.20), transparent 31rem),
        radial-gradient(circle at 7% 66%, rgba(121, 54, 17, 0.17), transparent 34rem),
        radial-gradient(circle at 88% 82%, rgba(244, 122, 36, 0.10), transparent 27rem),
        linear-gradient(145deg, #07090c 0%, #111317 44%, #08090c 100%);
    color: var(--text);
    font-family: "Manrope", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-feature-settings: "tnum" 1, "ss01" 1;
}

body::before,
body::after {
    position: fixed;
    z-index: -2;
    inset: 0;
    pointer-events: none;
    content: "";
}

body::before {
    background:
        radial-gradient(ellipse at 68% 18%, rgba(255, 134, 48, 0.13) 0%, transparent 27%),
        radial-gradient(ellipse at 21% 90%, rgba(184, 74, 16, 0.10) 0%, transparent 32%),
        linear-gradient(110deg, transparent 0 53%, rgba(255, 255, 255, 0.018) 53.2% 53.5%, transparent 53.7% 100%);
}

body::after {
    z-index: -1;
    opacity: 0.18;
    background-image:
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 4px),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 6px);
    mix-blend-mode: soft-light;
}

::selection {
    background: rgba(244, 122, 36, 0.34);
    color: #fff;
}

.app-shell {
    position: relative;
}

.topbar {
    align-items: center;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025));
    padding: 18px 20px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    -webkit-backdrop-filter: blur(18px) saturate(130%);
    backdrop-filter: blur(18px) saturate(130%);
}

.eyebrow {
    color: #ff9b54;
    text-shadow: 0 0 20px rgba(244, 122, 36, 0.24);
}

h1 {
    background: linear-gradient(100deg, #ffffff 0%, #eff0f2 54%, #ffc08e 112%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 680;
    text-wrap: balance;
}

h2 {
    color: #f4f5f6;
    font-weight: 620;
}

.subtitle,
.panel-header p,
.drawer-header p,
.notice,
.update-info-label,
.market-date,
.topbar-user {
    color: var(--muted);
}

.last-update {
    color: #f4f5f6;
}

.update-info {
    border-right: 1px solid rgba(255, 255, 255, 0.11);
    padding-right: 14px;
}

.button {
    position: relative;
    overflow: hidden;
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.10);
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

.button::before {
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.12), transparent 38%);
    pointer-events: none;
    content: "";
}

.button:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.24);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.button-primary {
    border-color: rgba(255, 169, 105, 0.42);
    background: linear-gradient(135deg, #e96712 0%, #f78532 52%, #d9570a 100%);
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.16);
}

.button-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #f47a24 0%, #ff9b54 56%, #e86611 100%);
}

.button-secondary,
.icon-button,
.period-tabs button,
.view-switcher {
    border-color: rgba(255, 255, 255, 0.13);
    background: rgba(255, 255, 255, 0.055);
    color: #eff1f3;
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.button-secondary:hover:not(:disabled),
.icon-button:hover,
.period-tabs button:hover {
    border-color: rgba(244, 122, 36, 0.52);
    background: rgba(244, 122, 36, 0.11);
    color: #ffab6f;
}

.button-danger {
    border-color: rgba(255, 119, 112, 0.34);
    background: linear-gradient(135deg, rgba(224, 68, 61, 0.20), rgba(224, 68, 61, 0.10));
}

/* Superficies de vidrio principales */
.investment-hero,
.summary-card,
.panel,
.heatmap-panel,
.installer,
.modal,
.drawer,
.login-card,
.chart-summary > div {
    border-color: var(--border);
    background: var(--glass-highlight), var(--surface);
    box-shadow: var(--shadow);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
}

.investment-hero,
.panel,
.heatmap-panel,
.installer,
.modal,
.login-card {
    border-radius: 24px;
}

.investment-hero,
.panel,
.summary-card,
.heatmap-panel,
.login-card {
    position: relative;
}

.investment-hero::before,
.panel::before,
.summary-card::before,
.heatmap-panel::before,
.login-card::before {
    position: absolute;
    z-index: 0;
    top: 0;
    right: 13%;
    left: 13%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.38), transparent);
    pointer-events: none;
    content: "";
}

.investment-hero > *,
.panel > *,
.summary-card > *,
.heatmap-panel > *,
.login-card > * {
    position: relative;
    z-index: 1;
}

.summary-grid {
    gap: 12px;
}

.summary-card {
    min-height: 116px;
    border-radius: 20px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.025)),
        rgba(28, 30, 34, 0.61);
    padding: 18px;
}

.summary-card:hover {
    border-color: rgba(255, 255, 255, 0.20);
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.105), rgba(244, 122, 36, 0.035)),
        rgba(31, 33, 37, 0.66);
}

.summary-label {
    color: #b6bcc3;
    font-weight: 600;
}

.summary-value {
    color: #fafafa;
    font-weight: 620;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.18);
}

.investment-hero {
    border-color: rgba(244, 122, 36, 0.22);
    background:
        radial-gradient(circle at 82% -20%, rgba(244, 122, 36, 0.14), transparent 34%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.022)),
        rgba(28, 30, 34, 0.68);
}

.investment-hero-header,
.panel-header,
.modal-header {
    border-color: rgba(255, 255, 255, 0.10);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.005));
}

.investment-empty,
.investment-comparison,
.form-explanation {
    background: rgba(255, 255, 255, 0.035);
}

.investment-metric {
    border-color: rgba(255, 255, 255, 0.09);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.035), transparent 70%);
}

.investment-metric.featured {
    background:
        radial-gradient(circle at 15% 20%, rgba(244, 122, 36, 0.15), transparent 58%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.045), transparent);
}

.investment-metric strong,
.investment-comparison strong {
    color: #fbfbfc;
    font-weight: 620;
}

.investment-alert,
.security-warning {
    border-color: rgba(255, 208, 109, 0.24);
    background: linear-gradient(90deg, rgba(255, 190, 62, 0.13), rgba(255, 190, 62, 0.055));
    color: #ffd886;
}

.view-switcher {
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.view-tab {
    color: #aeb4bb;
}

.view-tab:hover {
    color: #fff;
}

.view-tab.active,
.period-tabs button.active {
    border-color: rgba(255, 168, 103, 0.36);
    background: linear-gradient(135deg, rgba(244, 122, 36, 0.94), rgba(209, 79, 5, 0.94));
    color: #fff;
    box-shadow: 0 8px 20px rgba(189, 66, 4, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.status-message {
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.status-message.info,
.login-notice {
    border-color: rgba(244, 122, 36, 0.27);
    background: rgba(244, 122, 36, 0.11);
    color: #ffb47e;
}

.status-message.success,
.success-box {
    border-color: rgba(105, 217, 130, 0.27);
    background: rgba(47, 177, 88, 0.12);
}

.status-message.error,
.error-box,
.login-error,
.form-error {
    border-color: rgba(255, 119, 112, 0.27);
    background: rgba(224, 68, 61, 0.12);
}

/* Tablas */
table {
    color: #edf0f2;
}

th,
td {
    border-color: rgba(255, 255, 255, 0.075);
}

th {
    background: rgba(255, 255, 255, 0.035);
    color: #929aa3;
    font-weight: 690;
}

tbody tr[data-code],
.movements-table tbody tr {
    transition: background 140ms ease, box-shadow 140ms ease;
}

tbody tr[data-code]:hover,
.movements-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(244, 122, 36, 0.075), rgba(255, 255, 255, 0.018));
    box-shadow: inset 3px 0 0 rgba(244, 122, 36, 0.62);
}

.symbol-badge {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.035));
    color: #e9ecef;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.company-name,
.price {
    color: #f4f5f6;
}

.change,
.pending-badge,
.position-status,
.movement-badge,
.movement-warning {
    border: 1px solid rgba(255, 255, 255, 0.07);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.change.positive,
.position-status.ready,
.movement-badge.deposit {
    background: linear-gradient(135deg, rgba(47, 177, 88, 0.22), rgba(47, 177, 88, 0.10));
}

.change.negative,
.movement-badge.withdrawal {
    background: linear-gradient(135deg, rgba(224, 68, 61, 0.23), rgba(224, 68, 61, 0.10));
}

.pending-badge,
.position-status.pending,
.movement-warning {
    background: linear-gradient(135deg, rgba(255, 183, 57, 0.19), rgba(255, 183, 57, 0.08));
}

/* Gráfico principal */
.investment-panel-header {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.008));
}

.comparison-legend span {
    border-color: rgba(255, 255, 255, 0.11);
    background: rgba(255, 255, 255, 0.045);
    color: #e9ebed;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.official-line,
.investment-line.official {
    background: #f47a24;
    stroke: #f47a24;
}

.theoretical-line {
    background: repeating-linear-gradient(90deg, #5aa0ff 0 7px, transparent 7px 11px);
}

.investment-line.theoretical {
    stroke: #5aa0ff;
}

.investment-chart {
    border-color: rgba(255, 255, 255, 0.08);
    background:
        radial-gradient(circle at 15% 0%, rgba(244, 122, 36, 0.095), transparent 34%),
        radial-gradient(circle at 83% 100%, rgba(73, 137, 226, 0.075), transparent 30%),
        rgba(8, 10, 13, 0.20);
}

.investment-plot-background {
    fill: rgba(6, 8, 11, 0.28);
    stroke: rgba(255, 255, 255, 0.08);
}

.investment-grid-line,
.history-svg .grid-line {
    stroke: rgba(255, 255, 255, 0.075);
}

.investment-axis-label,
.history-svg .axis-label {
    fill: #969ea7;
}

.investment-capital-line {
    stroke: rgba(255, 255, 255, 0.40);
}

.investment-chart-tooltip {
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(24, 26, 30, 0.88);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.09);
    -webkit-backdrop-filter: blur(20px) saturate(135%);
    backdrop-filter: blur(20px) saturate(135%);
}

.investment-chart-footer,
.investment-comparison {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.028);
}

.investment-chart-stat {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.035);
}

/* Mapa del fondo */
.heatmap-panel {
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.015)),
        rgba(16, 19, 22, 0.78);
}

.heatmap-header,
.heatmap-footer {
    border-color: rgba(255, 255, 255, 0.10);
    background: rgba(9, 12, 15, 0.43);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

.treemap {
    background: rgba(5, 8, 10, 0.38);
}

.treemap-category-label {
    border-color: rgba(255, 255, 255, 0.09);
    background: rgba(17, 22, 26, 0.78);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.treemap-item {
    border-color: rgba(7, 9, 11, 0.66);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), inset 0 -18px 34px rgba(0, 0, 0, 0.10);
}

/* Formularios, modal y panel lateral */
.drawer-backdrop,
.modal-backdrop {
    background: rgba(3, 5, 7, 0.66);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.drawer,
.modal {
    background:
        radial-gradient(circle at 100% 0%, rgba(244, 122, 36, 0.10), transparent 34%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
        rgba(24, 26, 30, 0.88);
}

.search-control input,
.select-control select,
.money-input,
.date-input,
.text-input,
.login-form input,
.movement-type-option {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.055);
    color: #f3f4f5;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.search-control input::placeholder,
.text-input::placeholder,
.login-form input::placeholder {
    color: #7f8790;
}

.search-control input:focus,
.select-control select:focus,
.money-input:focus-within,
.date-input:focus-within,
.text-input:focus,
.login-form input:focus {
    border-color: rgba(244, 122, 36, 0.68);
    box-shadow: 0 0 0 3px rgba(244, 122, 36, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.movement-type-option:has(input:checked) {
    border-color: rgba(244, 122, 36, 0.58);
    background: linear-gradient(135deg, rgba(244, 122, 36, 0.16), rgba(255, 255, 255, 0.04));
    box-shadow: 0 0 0 2px rgba(244, 122, 36, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1) opacity(0.72);
}

select option {
    background: #202328;
    color: #f2f3f4;
}

/* Acceso */
.login-page {
    background:
        radial-gradient(circle at 78% 16%, rgba(244, 122, 36, 0.24), transparent 28rem),
        radial-gradient(circle at 13% 84%, rgba(132, 52, 10, 0.18), transparent 31rem),
        linear-gradient(145deg, #07090c 0%, #121419 50%, #08090c 100%);
}

.login-card {
    border-color: rgba(255, 255, 255, 0.15);
    background:
        radial-gradient(circle at 100% 0%, rgba(244, 122, 36, 0.16), transparent 37%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.025)),
        rgba(28, 30, 34, 0.72);
}

.login-brand {
    border: 1px solid rgba(255, 180, 126, 0.36);
    background: linear-gradient(145deg, #ff9d56, #e35d0a);
    box-shadow: 0 12px 28px rgba(205, 74, 4, 0.27), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.login-help code,
.security-warning code {
    border-color: rgba(255, 255, 255, 0.11);
    background: rgba(255, 255, 255, 0.055);
    color: #f1f2f3;
}

.topbar-session {
    border-color: rgba(255, 255, 255, 0.10);
}

/* Compatibilidad: si backdrop-filter no está disponible, las superficies
   siguen siendo legibles gracias a una base más opaca. */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    .investment-hero,
    .summary-card,
    .panel,
    .heatmap-panel,
    .installer,
    .modal,
    .drawer,
    .login-card,
    .topbar {
        background-color: rgba(28, 30, 34, 0.96);
    }
}

@media (max-width: 1100px) {
    .topbar {
        align-items: flex-start;
    }

    .update-info {
        border-right: 0;
        padding-right: 0;
    }
}

@media (max-width: 700px) {
    body {
        background:
            radial-gradient(circle at 88% 4%, rgba(224, 91, 13, 0.17), transparent 19rem),
            linear-gradient(145deg, #07090c, #101216 52%, #08090c);
    }

    .topbar {
        border-radius: 19px;
        padding: 15px;
    }

    .investment-hero,
    .panel,
    .heatmap-panel,
    .login-card {
        border-radius: 19px;
    }

    .summary-card {
        border-radius: 17px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .button,
    tbody tr,
    .summary-card {
        transition: none !important;
    }
}

/* Tipografía financiera v3.7
   Manrope variable en toda la interfaz.
   La jerarquía se mantiene deliberadamente liviana y los números utilizan
   cifras tabulares para conservar la alineación al actualizar cotizaciones. */
:root {
    --font-ui: "Manrope", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html {
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body,
button,
input,
select,
textarea {
    font-family: var(--font-ui);
    font-optical-sizing: auto;
    font-variant-numeric: lining-nums tabular-nums;
    font-feature-settings: "lnum" 1, "tnum" 1, "kern" 1;
}

body {
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: -0.006em;
}

h1,
h2,
h3,
h4,
h5,
h6,
.panel-header h2,
.investment-hero-header h2,
.heatmap-header h2,
.drawer-header h2,
.modal-header h2,
.login-card h1,
.installer h1 {
    font-family: var(--font-ui);
    font-weight: 600;
    font-optical-sizing: auto;
}

h1 {
    letter-spacing: -0.034em;
}

h2,
h3,
.panel-header h2,
.investment-hero-header h2,
.heatmap-header h2,
.drawer-header h2,
.modal-header h2 {
    letter-spacing: -0.018em;
}

.subtitle,
.panel-header p,
.drawer-header p,
.notice,
.summary-note,
.company-category,
.movement-type-option small,
.login-help {
    font-weight: 400;
}

.eyebrow,
th,
.update-info-label {
    font-weight: 600;
}

.eyebrow {
    letter-spacing: 0.075em;
}

th,
.update-info-label {
    letter-spacing: 0.055em;
}

.button,
.view-tab,
.period-tabs button,
.investment-form label > span,
.login-form label > span,
.movement-type-fieldset legend {
    font-weight: 600;
}

.summary-label,
.investment-metric span,
.investment-chart-stat span,
.company-name,
.last-update,
.money-input > span {
    font-weight: 500;
}

.summary-value,
.investment-metric strong,
.investment-comparison strong,
.price,
.change,
.weight-value,
.investment-chart-stat strong,
.investment-tooltip-row b {
    font-weight: 600;
}

.summary-value,
.investment-metric strong,
.investment-comparison strong,
.price,
.change,
.weight-value,
.treemap-price,
.treemap-change,
.investment-chart-stat strong,
.investment-tooltip-row b,
.investment-axis-label,
.money-input input,
.date-input input,
.text-input,
td {
    font-variant-numeric: lining-nums tabular-nums;
    font-feature-settings: "lnum" 1, "tnum" 1;
}

.summary-value {
    letter-spacing: -0.032em;
}

.treemap-name {
    font-weight: 500;
    letter-spacing: -0.025em;
}

.treemap-code,
.treemap-weight,
.position-status,
.movement-badge,
.status-badge,
.warning-badge {
    font-weight: 650;
}

.investment-axis-label {
    font-weight: 500;
}

.investment-capital-label text,
.investment-tooltip-date,
.investment-movement-marker text {
    font-weight: 600;
}

/* Evita que controles nativos recuperen pesos o familias distintos. */
button,
input,
select,
textarea {
    letter-spacing: -0.005em;
}

/* =========================================================
   Paleta bull market · v3.8
   Solo color y fondo: conserva estructura, transparencias y funciones.
   ========================================================= */
:root {
    --bg: #020712;
    --surface: rgba(7, 18, 31, 0.63);
    --surface-alt: rgba(12, 33, 51, 0.38);
    --surface-strong: rgba(6, 18, 32, 0.84);
    --text: #effaff;
    --muted: #8faabd;
    --border: rgba(91, 204, 255, 0.18);
    --border-strong: rgba(91, 204, 255, 0.32);
    --accent: #19c8ff;
    --accent-hover: #65dcff;
    --accent-soft: rgba(25, 200, 255, 0.16);
    --accent-warm: #ff672d;
    --accent-warm-hover: #ff9864;
    --positive: #43e49a;
    --positive-bg: rgba(44, 206, 132, 0.14);
    --negative: #ff6259;
    --negative-bg: rgba(255, 75, 67, 0.15);
    --warning: #ffad57;
    --warning-bg: rgba(255, 123, 47, 0.14);
    --shadow: 0 24px 72px rgba(0, 4, 13, 0.48), 0 1px 0 rgba(126, 221, 255, 0.08) inset;
    --glass-highlight: linear-gradient(135deg, rgba(93, 211, 255, 0.105), rgba(255, 255, 255, 0.018) 43%, rgba(255, 103, 45, 0.055));
}

html {
    background: #020712;
}

body {
    background:
        linear-gradient(180deg, rgba(1, 6, 15, 0.58), rgba(1, 6, 15, 0.76)),
        radial-gradient(circle at 18% 44%, rgba(25, 200, 255, 0.10), transparent 42%),
        radial-gradient(circle at 78% 62%, rgba(255, 91, 36, 0.12), transparent 39%),
        url("../img/background.jpg") center center / cover fixed no-repeat;
}

body::before,
body::after {
    display: none;
}

::selection {
    background: rgba(25, 200, 255, 0.34);
    color: #fff;
}

/* Cabecera y superficies principales */
.topbar {
    border-color: rgba(90, 207, 255, 0.16);
    background: linear-gradient(135deg, rgba(12, 35, 54, 0.56), rgba(5, 15, 29, 0.46));
    box-shadow: 0 18px 48px rgba(0, 4, 15, 0.34), inset 0 1px 0 rgba(114, 222, 255, 0.10);
}

.eyebrow {
    color: #58d8ff;
    text-shadow: 0 0 22px rgba(25, 200, 255, 0.32);
}

h1 {
    background: linear-gradient(100deg, #ffffff 0%, #d9f7ff 55%, #ff9a69 112%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

h2 {
    color: #ecfaff;
}

.last-update,
.company-name,
.price,
.summary-value,
.investment-metric strong,
.investment-comparison strong {
    color: #f2fbff;
}

.update-info {
    border-color: rgba(83, 202, 255, 0.15);
}

.investment-hero,
.summary-card,
.panel,
.heatmap-panel,
.installer,
.modal,
.drawer,
.login-card,
.chart-summary > div {
    border-color: var(--border);
    background: var(--glass-highlight), var(--surface);
    box-shadow: var(--shadow);
}

.investment-hero::before,
.panel::before,
.summary-card::before,
.heatmap-panel::before,
.login-card::before {
    background: linear-gradient(90deg, transparent, rgba(116, 221, 255, 0.42), rgba(255, 112, 52, 0.24), transparent);
}

.summary-card {
    background:
        linear-gradient(145deg, rgba(71, 192, 238, 0.075), rgba(255, 255, 255, 0.018) 55%, rgba(255, 97, 39, 0.035)),
        rgba(6, 20, 35, 0.57);
}

.summary-card:hover {
    border-color: rgba(87, 211, 255, 0.28);
    background:
        linear-gradient(145deg, rgba(71, 192, 238, 0.105), rgba(255, 255, 255, 0.025) 52%, rgba(255, 97, 39, 0.055)),
        rgba(7, 23, 39, 0.64);
}

.summary-label {
    color: #9bb5c5;
}

.investment-hero {
    border-color: rgba(53, 203, 255, 0.24);
    background:
        radial-gradient(circle at 82% -18%, rgba(255, 103, 45, 0.15), transparent 35%),
        radial-gradient(circle at 8% 125%, rgba(25, 200, 255, 0.11), transparent 42%),
        linear-gradient(145deg, rgba(77, 197, 242, 0.075), rgba(255, 255, 255, 0.016)),
        rgba(6, 20, 35, 0.63);
}

.investment-hero-header,
.panel-header,
.modal-header,
.investment-panel-header {
    border-color: rgba(87, 209, 255, 0.11);
    background: linear-gradient(180deg, rgba(70, 192, 238, 0.045), rgba(255, 255, 255, 0.004));
}

.investment-empty,
.investment-comparison,
.form-explanation,
.investment-chart-footer {
    background: rgba(9, 29, 47, 0.38);
}

.investment-metric {
    border-color: rgba(86, 207, 255, 0.10);
    background: linear-gradient(145deg, rgba(75, 195, 240, 0.035), transparent 70%);
}

.investment-metric.featured {
    background:
        radial-gradient(circle at 15% 20%, rgba(25, 200, 255, 0.14), transparent 58%),
        radial-gradient(circle at 95% 85%, rgba(255, 103, 45, 0.07), transparent 44%),
        linear-gradient(145deg, rgba(83, 203, 247, 0.035), transparent);
}

/* Acentos y controles */
.button-primary {
    border-color: rgba(103, 220, 255, 0.43);
    background: linear-gradient(135deg, #079ed0 0%, #18c8ff 52%, #087cae 100%);
    color: #f7fdff;
    box-shadow: 0 10px 27px rgba(0, 145, 201, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.button-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #16b9eb 0%, #67ddff 55%, #0a91c7 100%);
}

.button-secondary,
.icon-button,
.period-tabs button,
.view-switcher {
    border-color: rgba(83, 202, 255, 0.14);
    background: rgba(11, 33, 51, 0.48);
    color: #e8f8ff;
}

.button-secondary:hover:not(:disabled),
.icon-button:hover,
.period-tabs button:hover {
    border-color: rgba(34, 204, 255, 0.55);
    background: rgba(25, 200, 255, 0.12);
    color: #7fe5ff;
}

.view-tab.active,
.period-tabs button.active {
    border-color: rgba(105, 222, 255, 0.40);
    background: linear-gradient(135deg, rgba(9, 167, 216, 0.96), rgba(25, 200, 255, 0.96));
    box-shadow: 0 8px 22px rgba(0, 145, 201, 0.27), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.view-tab:hover {
    color: #fff;
}

.status-message.info,
.login-notice {
    border-color: rgba(25, 200, 255, 0.29);
    background: rgba(25, 200, 255, 0.11);
    color: #83e6ff;
}

.investment-alert,
.security-warning {
    border-color: rgba(255, 119, 53, 0.28);
    background: linear-gradient(90deg, rgba(255, 94, 34, 0.14), rgba(255, 135, 65, 0.055));
    color: #ffb17e;
}

/* Tablas y filas */
th {
    background: rgba(10, 34, 54, 0.42);
    color: #85a8bc;
}

th,
td {
    border-color: rgba(91, 204, 255, 0.075);
}

tbody tr[data-code]:hover,
.movements-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(25, 200, 255, 0.085), rgba(255, 103, 45, 0.028));
    box-shadow: inset 3px 0 0 rgba(25, 200, 255, 0.68);
}

.symbol-badge {
    border-color: rgba(89, 207, 255, 0.13);
    background: linear-gradient(145deg, rgba(72, 195, 240, 0.13), rgba(255, 255, 255, 0.025));
    color: #e4f8ff;
}

.sparkline path {
    stroke: var(--accent);
}

/* Gráfico de evolución: naranja = fondo, cian = cartera fija */
.official-line,
.investment-line.official {
    background: var(--accent-warm);
    stroke: var(--accent-warm);
}

.theoretical-line {
    background: repeating-linear-gradient(90deg, var(--accent) 0 7px, transparent 7px 11px);
}

.investment-line.theoretical {
    stroke: var(--accent);
}

#officialAreaGradient stop:first-child {
    stop-color: var(--accent-warm);
}

#theoreticalAreaGradient stop:first-child {
    stop-color: var(--accent);
}

.investment-end-point.official,
.investment-hover-point.official {
    stroke: var(--accent-warm);
}

.investment-end-point.theoretical,
.investment-hover-point.theoretical {
    stroke: var(--accent);
}

.investment-tooltip-row.official i,
.investment-chart-stat.official::before {
    background: var(--accent-warm);
}

.investment-tooltip-row.theoretical i {
    border-color: var(--accent);
}

.investment-chart-stat.theoretical::before {
    background: var(--accent);
}

.investment-chart {
    border-color: rgba(79, 203, 255, 0.09);
    background:
        radial-gradient(circle at 15% 0%, rgba(25, 200, 255, 0.085), transparent 34%),
        radial-gradient(circle at 84% 100%, rgba(255, 103, 45, 0.085), transparent 31%),
        rgba(3, 12, 23, 0.28);
}

.investment-plot-background {
    fill: rgba(2, 10, 20, 0.36);
    stroke: rgba(78, 203, 255, 0.10);
}

.investment-grid-line,
.history-svg .grid-line {
    stroke: rgba(91, 204, 255, 0.075);
}

.investment-axis-label,
.history-svg .axis-label {
    fill: #829fb2;
}

.investment-chart-tooltip {
    border-color: rgba(79, 205, 255, 0.18);
    background: rgba(5, 20, 34, 0.90);
    box-shadow: 0 18px 44px rgba(0, 5, 16, 0.52), inset 0 1px 0 rgba(100, 220, 255, 0.10);
}

/* Mapa del fondo */
.heatmap-panel {
    background:
        linear-gradient(145deg, rgba(63, 188, 235, 0.065), rgba(255, 255, 255, 0.012)),
        rgba(4, 17, 29, 0.72);
}

.heatmap-header,
.heatmap-footer {
    border-color: rgba(83, 204, 255, 0.11);
    background: rgba(2, 13, 24, 0.52);
}

.treemap {
    background: rgba(2, 10, 19, 0.43);
}

.treemap-category-label {
    border-color: rgba(83, 204, 255, 0.11);
    background: rgba(5, 22, 37, 0.82);
}

.treemap-item {
    border-color: rgba(1, 8, 15, 0.72);
    box-shadow: inset 0 1px 0 rgba(155, 232, 255, 0.14), inset 0 -18px 34px rgba(0, 4, 11, 0.14);
}

/* Formularios, modal, drawer y login */
.drawer-backdrop,
.modal-backdrop {
    background: rgba(0, 5, 13, 0.70);
}

.drawer,
.modal {
    background:
        radial-gradient(circle at 100% 0%, rgba(255, 103, 45, 0.10), transparent 34%),
        radial-gradient(circle at 0% 100%, rgba(25, 200, 255, 0.08), transparent 36%),
        linear-gradient(145deg, rgba(69, 192, 238, 0.065), rgba(255, 255, 255, 0.012)),
        rgba(5, 20, 34, 0.90);
}

.search-control input,
.select-control select,
.money-input,
.date-input,
.text-input,
.login-form input,
.movement-type-option {
    border-color: rgba(83, 204, 255, 0.14);
    background: rgba(9, 31, 49, 0.54);
    color: #edfaff;
}

.search-control input::placeholder,
.text-input::placeholder,
.login-form input::placeholder {
    color: #68899d;
}

.search-control input:focus,
.select-control select:focus,
.money-input:focus-within,
.date-input:focus-within,
.text-input:focus,
.login-form input:focus {
    border-color: rgba(25, 200, 255, 0.72);
    box-shadow: 0 0 0 3px rgba(25, 200, 255, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.movement-type-option:has(input:checked) {
    border-color: rgba(25, 200, 255, 0.62);
    background: linear-gradient(135deg, rgba(25, 200, 255, 0.16), rgba(255, 103, 45, 0.035));
    box-shadow: 0 0 0 2px rgba(25, 200, 255, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

select option {
    background: #071b2c;
    color: #edfaff;
}

.login-page {
    background: transparent;
}

.login-card {
    border-color: rgba(83, 205, 255, 0.18);
    background:
        radial-gradient(circle at 100% 0%, rgba(255, 103, 45, 0.14), transparent 38%),
        radial-gradient(circle at 0% 100%, rgba(25, 200, 255, 0.11), transparent 42%),
        linear-gradient(145deg, rgba(70, 192, 238, 0.075), rgba(255, 255, 255, 0.016)),
        rgba(5, 20, 34, 0.69);
}

.login-brand {
    border-color: rgba(104, 222, 255, 0.43);
    background: linear-gradient(145deg, #4edcff, #078bb9);
    box-shadow: 0 12px 30px rgba(0, 147, 202, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.login-help code,
.security-warning code {
    border-color: rgba(83, 204, 255, 0.13);
    background: rgba(9, 31, 49, 0.56);
    color: #eaf9ff;
}

.topbar-session {
    border-color: rgba(83, 204, 255, 0.12);
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    .investment-hero,
    .summary-card,
    .panel,
    .heatmap-panel,
    .installer,
    .modal,
    .drawer,
    .login-card,
    .topbar {
        background-color: rgba(5, 20, 34, 0.96);
    }
}

@media (max-width: 700px) {
    body {
        background:
            linear-gradient(180deg, rgba(1, 6, 15, 0.62), rgba(1, 6, 15, 0.80)),
            radial-gradient(circle at 72% 24%, rgba(255, 103, 45, 0.11), transparent 42%),
            url("../img/background.jpg") 48% center / cover scroll no-repeat;
    }
}

/* =========================================================
   Entrada suave de módulos al hacer scroll · v3.9
   ========================================================= */
html.scroll-reveal-enabled .scroll-reveal {
    opacity: 0;
    transform: translate3d(0, 18px, 0);
    transition:
        opacity 620ms cubic-bezier(0.22, 1, 0.36, 1),
        transform 620ms cubic-bezier(0.22, 1, 0.36, 1);
    transition-delay: var(--reveal-delay, 0ms);
    will-change: opacity, transform;
}

html.scroll-reveal-enabled .scroll-reveal.is-visible {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    will-change: auto;
}

@media (prefers-reduced-motion: reduce) {
    html.scroll-reveal-enabled .scroll-reveal,
    html.scroll-reveal-enabled .scroll-reveal.is-visible {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

