:root {
    --bg: #07111f;
    --bg-2: #0d1728;
    --bg-3: #111f34;
    --surface: rgba(16, 28, 45, 0.82);
    --surface-strong: rgba(19, 33, 52, 0.94);
    --surface-soft: rgba(255, 255, 255, 0.04);
    --card-highlight: rgba(255, 255, 255, 0.08);
    --ink: #f7f1e7;
    --ink-soft: #d6cec1;
    --muted: #8f9aae;
    --line: rgba(232, 222, 208, 0.1);
    --line-strong: rgba(232, 222, 208, 0.16);
    --accent: #c9932d;
    --accent-soft: rgba(201, 147, 45, 0.16);
    --bull: #18a06f;
    --bull-soft: rgba(24, 160, 111, 0.14);
    --bear: #c35b67;
    --bear-soft: rgba(195, 91, 103, 0.16);
    --wait: #b98636;
    --wait-soft: rgba(185, 134, 54, 0.14);
    --shadow-xl: 0 28px 80px rgba(0, 0, 0, 0.34);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.28);
    --radius-xl: 32px;
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 14px;
    --font-ui: "Sora", "Avenir Next", "Segoe UI", sans-serif;
    --font-mono: "IBM Plex Mono", monospace;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--ink);
    font-family: var(--font-ui);
    background:
        radial-gradient(circle at 10% 12%, rgba(201, 147, 45, 0.2), transparent 24%),
        radial-gradient(circle at 88% 16%, rgba(24, 160, 111, 0.13), transparent 20%),
        radial-gradient(circle at 78% 80%, rgba(195, 91, 103, 0.12), transparent 20%),
        linear-gradient(180deg, #0a1220 0%, #07111f 36%, #091524 100%);
    min-height: 100vh;
}

body.fullscreen-lock {
    overflow: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 72px 72px;
    mask-image: radial-gradient(circle at center, black 40%, transparent 92%);
    opacity: 0.32;
}

.app-shell {
    position: relative;
    max-width: 1540px;
    margin: 0 auto;
    padding: 28px 24px 44px;
}

.topbar,
.hero-card,
.panel,
.login-card {
    position: relative;
    border: 1px solid var(--line);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015)),
        var(--surface);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow-lg);
}

.topbar::after,
.hero-card::after,
.panel::after,
.login-card::after {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.025);
}

.topbar {
    overflow: hidden;
    border-radius: 34px;
    padding: 28px 30px;
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-end;
    margin-bottom: 22px;
    background:
        radial-gradient(circle at top right, rgba(201, 147, 45, 0.16), transparent 24%),
        radial-gradient(circle at left center, rgba(24, 160, 111, 0.08), transparent 18%),
        linear-gradient(180deg, rgba(18, 29, 46, 0.95), rgba(10, 18, 32, 0.96));
}

.topbar h1,
.panel h3,
.hero-card h2,
.login-card h2 {
    margin: 0;
}

.topbar h1 {
    max-width: 760px;
    font-size: clamp(2rem, 4vw, 3.6rem);
    line-height: 0.98;
    letter-spacing: -0.04em;
}

.topbar .eyebrow {
    color: var(--accent);
}

.eyebrow {
    margin: 0 0 10px;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
}

.topbar-actions,
.meta-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

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

.hero-grid > .hero-card:nth-child(1) { grid-column: span 4; }
.hero-grid > .hero-card:nth-child(2) { grid-column: span 3; }
.hero-grid > .hero-card:nth-child(3) { grid-column: span 3; }
.hero-grid > .hero-card:nth-child(4) { grid-column: span 2; }

.bottom-grid > .panel:nth-child(1) { grid-column: span 5; }
.bottom-grid > .panel:nth-child(2) { grid-column: span 4; }
.bottom-grid > .panel:nth-child(3) { grid-column: span 3; }

.hero-card,
.panel {
    border-radius: var(--radius-xl);
    padding: 22px;
}

.price-card {
    background:
        radial-gradient(circle at top left, rgba(201, 147, 45, 0.18), transparent 24%),
        linear-gradient(180deg, rgba(18, 29, 46, 0.96), rgba(13, 23, 40, 0.96));
}

.card-label {
    margin: 0 0 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 11px;
    font-weight: 700;
}

.price-line {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.price-value {
    font-size: clamp(40px, 5vw, 70px);
    line-height: 0.92;
    letter-spacing: -0.05em;
    font-weight: 700;
}

.price-change,
.pill,
.badge,
.level-price,
.signal-price,
.result-grid strong,
.monitor-grid strong {
    font-family: var(--font-mono);
}

.price-change {
    font-size: 15px;
    padding-bottom: 9px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.05);
    color: var(--ink-soft);
    font-size: 11px;
}

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

.bias-value {
    font-size: clamp(24px, 2.6vw, 34px);
    line-height: 1.02;
    letter-spacing: -0.04em;
    margin-bottom: 10px;
}

.card-copy {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
    font-size: 14px;
}

.mini-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.mini-metrics div,
.monitor-grid div,
.usage-row,
.level-row,
.context-item,
.monitor-card,
.signal-row,
.result-grid div {
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025));
}

.mini-metrics div {
    padding: 14px;
    border-radius: 20px;
}

.mini-metrics span,
.monitor-grid span,
.result-grid span,
.signal-meta,
.signal-time {
    display: block;
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.mini-metrics strong {
    font-size: 21px;
    color: var(--ink);
}

.plan-usage {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.usage-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    font-size: 12px;
    color: var(--ink-soft);
}

.status-strip {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(360px, 0.82fr);
    gap: 18px;
    margin-bottom: 18px;
    align-items: start;
}

.sidebar {
    display: grid;
    gap: 18px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.panel-head h3 {
    font-size: 1.35rem;
    letter-spacing: -0.03em;
}

.chart-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.trend-summary {
    max-width: 300px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
    text-align: right;
}

.chart-frame {
    position: relative;
    height: 760px;
    min-height: 760px;
    width: 100%;
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid var(--line);
    background:
        linear-gradient(180deg, rgba(7, 17, 31, 0.8), rgba(17, 31, 52, 0.7)),
        rgba(255, 255, 255, 0.02);
}

.chart-panel.fullscreen-mode {
    position: fixed;
    inset: 12px;
    z-index: 9999;
    margin: 0;
    border-radius: 30px;
    box-shadow: 0 32px 120px rgba(0, 0, 0, 0.58);
}

.chart-panel.fullscreen-mode .chart-frame {
    height: calc(100vh - 150px);
    min-height: calc(100vh - 150px);
}

.chart-root {
    position: absolute;
    inset: 0;
}

.chart-error {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--muted);
    font-size: 14px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.chart-frame::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.tv-levels-overlay {
    position: absolute;
    inset: 0;
    pointer-events: auto;
    z-index: 8;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.tv-levels-overlay.hidden {
    opacity: 0;
}

.tv-levels-overlay svg {
    width: 100%;
    height: 100%;
}

.draw-toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.btn-ghost {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--ink-soft);
}

.draw-tool.active,
.btn-ghost:hover {
    background: rgba(224, 166, 53, 0.18);
    border-color: rgba(224, 166, 53, 0.45);
    color: #f6d79a;
}

.tv-overlay-line {
    stroke-width: 1.2;
    stroke-dasharray: 6 4;
    opacity: 0.9;
}

.tv-overlay-label {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    paint-order: stroke;
    stroke-linejoin: round;
}

.drawing-line {
    stroke: #f3cb84;
    stroke-width: 1.6;
    fill: none;
}

.drawing-line.preview,
.drawing-rect.preview {
    opacity: 0.72;
    stroke-dasharray: 5 4;
}

.drawing-rect {
    stroke: #60a5fa;
    stroke-width: 1.35;
    fill: rgba(96, 165, 250, 0.12);
}

.drawing-hline {
    stroke: #f59e0b;
    stroke-width: 1.15;
    stroke-dasharray: 6 4;
}

.drawing-label {
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 700;
    paint-order: stroke;
    stroke: rgba(7, 17, 31, 0.95);
    stroke-width: 3;
    fill: #f8f4ee;
}

.levels-list,
.planner-results,
.context-box,
.plan-box,
.monitor-box,
.checklist-box {
    display: grid;
    gap: 12px;
}

.level-row,
.context-item,
.monitor-card,
.signal-row {
    border-radius: 20px;
    padding: 14px;
}

.level-head,
.level-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.level-price {
    font-size: 21px;
    font-weight: 600;
    color: var(--ink);
}

.level-note,
.context-item p,
.plan-box p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 11px;
    color: var(--ink-soft);
    background: rgba(255, 255, 255, 0.05);
}

.badge.bull {
    color: #75e3bc;
    background: var(--bull-soft);
}

.badge.bear {
    color: #f0a0a9;
    background: var(--bear-soft);
}

.badge.wait {
    color: #f0c781;
    background: var(--wait-soft);
}

.planner-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.planner-grid label,
.login-card label {
    display: grid;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

input,
select,
.btn {
    font: inherit;
}

input,
.control-select {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--ink);
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

input:focus,
.control-select:focus {
    border-color: rgba(201, 147, 45, 0.45);
    background: rgba(255, 255, 255, 0.09);
    transform: translateY(-1px);
}

.btn {
    border: 1px solid transparent;
    border-radius: 16px;
    padding: 12px 16px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

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

.btn-primary {
    color: #08111e;
    background: linear-gradient(135deg, #d7a442, #c9932d);
    box-shadow: 0 14px 28px rgba(201, 147, 45, 0.28);
}

.btn-secondary {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
}

.btn-small {
    padding: 8px 12px;
    font-size: 12px;
}

.btn-full {
    width: 100%;
}

#estebanOverlayBtn.active {
    background: rgba(201, 147, 45, 0.16);
    border-color: rgba(201, 147, 45, 0.26);
    color: #f3cb84;
    box-shadow: inset 0 0 0 1px rgba(201, 147, 45, 0.08);
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.result-grid div {
    padding: 14px;
    border-radius: 18px;
}

.result-grid strong {
    color: var(--ink);
}

.context-item h4 {
    margin: 0 0 8px;
    font-size: 1rem;
    letter-spacing: -0.02em;
}

.monitor-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.monitor-grid div {
    padding: 12px;
    border-radius: 18px;
}

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

.signal-main {
    display: grid;
    gap: 6px;
}

.signal-title {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.signal-price {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
}

.source-list {
    display: grid;
    gap: 8px;
}

.source-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    color: var(--ink-soft);
}

.checklist-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    padding: 13px 14px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02));
}

.checklist-copy {
    display: grid;
    gap: 4px;
}

.checklist-copy strong {
    font-size: 13px;
    color: var(--ink);
}

.checklist-copy span {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.5;
}

.checklist-state {
    flex-shrink: 0;
    min-width: 84px;
    text-align: center;
}

.overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(2, 8, 17, 0.66);
    backdrop-filter: blur(16px);
}

.overlay.show {
    display: flex;
}

.app-toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 40;
    max-width: min(360px, calc(100vw - 32px));
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(201, 147, 45, 0.24);
    background: rgba(7, 17, 31, 0.92);
    color: var(--ink);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    font-size: 13px;
    line-height: 1.5;
}

.app-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.login-card {
    width: min(430px, 100%);
    border-radius: 28px;
    padding: 30px;
    display: grid;
    gap: 14px;
    background:
        radial-gradient(circle at top right, rgba(201, 147, 45, 0.18), transparent 26%),
        linear-gradient(180deg, rgba(16, 28, 45, 0.96), rgba(11, 20, 34, 0.98));
}

.error-text {
    min-height: 20px;
    margin: 0;
    color: #f0a0a9;
    font-size: 13px;
}

@media (max-width: 1240px) {
    .hero-grid > .hero-card:nth-child(1),
    .hero-grid > .hero-card:nth-child(2),
    .hero-grid > .hero-card:nth-child(3),
    .hero-grid > .hero-card:nth-child(4),
    .bottom-grid > .panel:nth-child(1),
    .bottom-grid > .panel:nth-child(2),
    .bottom-grid > .panel:nth-child(3) {
        grid-column: span 6;
    }
}

@media (max-width: 1100px) {
    .main-grid,
    .planner-grid,
    .monitor-grid,
    .result-grid {
        grid-template-columns: 1fr;
    }

    .hero-grid,
    .bottom-grid {
        grid-template-columns: 1fr;
    }

    .hero-grid > .hero-card:nth-child(1),
    .hero-grid > .hero-card:nth-child(2),
    .hero-grid > .hero-card:nth-child(3),
    .hero-grid > .hero-card:nth-child(4),
    .bottom-grid > .panel:nth-child(1),
    .bottom-grid > .panel:nth-child(2),
    .bottom-grid > .panel:nth-child(3) {
        grid-column: auto;
    }

    .topbar {
        padding: 24px;
        flex-direction: column;
        align-items: stretch;
    }

    .topbar h1 {
        max-width: none;
    }

    .trend-summary {
        max-width: none;
        text-align: left;
    }

    .chart-frame {
        height: 600px;
        min-height: 600px;
    }

    .chart-panel.fullscreen-mode .chart-frame {
        height: calc(100vh - 150px);
        min-height: calc(100vh - 150px);
    }
}

@media (max-width: 720px) {
    .app-shell {
        padding: 16px 14px 30px;
    }

    .topbar,
    .hero-card,
    .panel,
    .login-card {
        border-radius: 24px;
    }

    .topbar,
    .hero-card,
    .panel {
        padding: 18px;
    }

    .price-value {
        font-size: 42px;
    }

    .chart-frame {
        height: 460px;
        min-height: 460px;
    }

    .chart-panel.fullscreen-mode {
        inset: 8px;
        border-radius: 22px;
    }

    .chart-panel.fullscreen-mode .chart-frame {
        height: calc(100vh - 138px);
        min-height: calc(100vh - 138px);
    }

    .mini-metrics {
        grid-template-columns: 1fr;
    }

    .app-toast {
        right: 14px;
        bottom: 14px;
    }
}
