/* Paleta central. Cambiar estas variables actualiza todos los componentes. */
:root {
    color-scheme: light;
    --navy: #10243a;
    --accent: #00b8ad;
    --bg: #f4f7fa;
    --surface: #ffffff;
    --text: #10243a;
    --muted: #65758b;
    --border: #e3eaf1;
    --shadow: 0 6px 24px #10243a06;
    --sidebar-width: 250px;
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #091726;
    --surface: #12283e;
    --text: #edf5fc;
    --muted: #a2b5ca;
    --border: #263d53;
    --shadow: none;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: "Segoe UI", Arial, sans-serif; font-size: 15px; line-height: 1.5; }
button, input { font: inherit; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
button, summary { cursor: pointer; }
a { color: #008e91; text-decoration: none; }
[data-theme="dark"] a { color: #4bd9d3; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
button { color: inherit; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(25px, 3vw, 32px); line-height: 1.25; margin-bottom: 6px; letter-spacing: -.7px; }
h2 { font-size: 18px; }
p { color: var(--muted); }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width); display: flex; flex-direction: column; padding: 24px 16px; background: var(--navy); color: #fff; z-index: 30; transition: width .2s, transform .2s; }
.brand { display: block; background: white; border-radius: 12px; padding: 10px; margin-bottom: 28px; }
.brand img { width: 100%; display: block; }
.nav-caption { font-size: 10px; color: #91a8bc; letter-spacing: 1.5px; margin: 0 12px 14px; white-space: nowrap; }
nav a, .sidebar-bottom a { display: flex; gap: 13px; align-items: center; padding: 12px 14px; margin-bottom: 6px; border-radius: 9px; color: #d6e3ef !important; white-space: nowrap; }
nav a:hover, .sidebar-bottom a:hover { background: #ffffff10; }
nav a.active { background: var(--accent); color: #062a38 !important; font-weight: 650; }
.nav-icon { font-size: 22px; width: 23px; text-align: center; line-height: 1; flex-shrink: 0; }
.sidebar-bottom { border-top: 1px solid #ffffff20; margin-top: auto; padding-top: 18px; }
.sidebar-bottom small { display: block; text-align: center; color: #91a8bc; font-size: 11px; margin-top: 20px; }
.workspace { margin-left: var(--sidebar-width); min-height: 100dvh; display: flex; flex-direction: column; transition: margin-left .2s; }
.topbar { min-height: 80px; display: flex; align-items: center; gap: 20px; background: var(--surface); border-bottom: 1px solid var(--border); padding: 12px 32px; }
.breadcrumb { color: var(--muted); font-size: 13px; }
.breadcrumb span { padding: 0 12px; opacity: .5; }
.topbar-right { margin-left: auto; display: flex; gap: 20px; align-items: center; }
.icon-button { border: 1px solid var(--border); background: transparent; border-radius: 10px; width: 40px; height: 40px; font-size: 23px; display: grid; place-items: center; }
.menu-toggle { border-color: transparent; color: var(--muted); }
.menu-toggle:hover { background: var(--border); color: var(--text); }
.menu-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.menu-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.menu-toggle[aria-expanded="false"] svg { transform: rotate(180deg); }
.theme-sun, [data-theme="dark"] .theme-moon { display: none; }
[data-theme="dark"] .theme-sun { display: inline; }
.profile { position: relative; }
.profile summary { list-style: none; display: flex; align-items: center; gap: 10px; }
.profile summary::-webkit-details-marker { display: none; }
.avatar { display: grid; place-items: center; border-radius: 50%; width: 42px; height: 42px; background: #007eaa; color: #fff; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.profile-text strong, .profile-text small { display: block; }
.profile-text small { color: var(--muted); font-size: 11px; }
.profile-popup { position: absolute; right: 0; top: 56px; width: 240px; padding: 20px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); border-radius: 12px; z-index: 40; }
.profile-popup p { font-size: 13px; margin: 8px 0; }
main { width: 100%; max-width: 1600px; padding: 32px; margin: 0 auto; flex: 1; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-heading p { margin-bottom: 0; }
.eyebrow { font-size: 10px; color: var(--muted); letter-spacing: 2px; font-weight: 700; margin-bottom: 10px !important; }
.wave { color: var(--accent); }
.demo-badge { font-size: 11px; border: 1px solid var(--border); background: var(--surface); border-radius: 20px; padding: 6px 12px; color: var(--muted); white-space: nowrap; }
.hero { position: relative; overflow: hidden; display: flex; background: linear-gradient(110deg, #10243a, #06455b); border-radius: 18px; padding: 32px 36px 52px; min-height: 280px; color: white; }
.hero-copy { z-index: 1; max-width: 65%; }
.hero-tag { font-size: 10px; letter-spacing: 2px; color: #64e5dc; }
.hero h2 { font-size: clamp(25px, 3vw, 38px); line-height: 1.15; margin: 12px 0; max-width: 520px; letter-spacing: -.8px; }
.hero p { color: #c1d3e2; max-width: 470px; font-size: 14px; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 20px; padding: 11px 18px; background: var(--accent); color: #062a38 !important; border-radius: 9px; font-size: 13px; font-weight: 700; }
.hero-art { position: absolute; right: 7%; top: 30px; width: 210px; height: 210px; display: grid; place-items: center; transform: rotate(-12deg); }
.hero-ball { border: 15px solid #00b8ad; border-radius: 50%; width: 165px; height: 165px; display: grid; place-items: center; font-size: 72px; font-weight: 900; color: #d6fafa; background: #10243a; box-shadow: 0 0 0 10px #ffffff0d; }
.orbit { position: absolute; inset: -15px; border: 1px solid #ffffff25; border-radius: 50%; }
.spark { position: absolute; right: -10px; top: -35px; color: #00d6ca; font-size: 75px; }
.slider-controls { position: absolute; bottom: 14px; left: 36px; display: flex; gap: 10px; align-items: center; }
.slider-controls button { color: white; background: transparent; border: 0; min-width: 28px; height: 28px; font-size: 22px; }
.slider-controls .dot { padding: 0; height: 7px; width: 7px; min-width: 7px; border-radius: 10px; background: #ffffff55; }
.slider-controls .dot.selected { width: 22px; background: var(--accent); }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 22px 0; }
.stat, .panel { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.stat { display: flex; align-items: center; gap: 18px; padding: 20px; }
.stat-icon { background: #00b8ad13; color: var(--accent); font-size: 34px; width: 58px; height: 58px; border-radius: 13px; display: grid; place-items: center; flex-shrink: 0; }
.stat span:not(.stat-icon) { color: var(--muted); font-size: 12px; }
.stat strong { display: block; font-size: 28px; line-height: 1.25; }
.stat small { color: var(--muted); font-size: 10px; }
.heart { color: #f2637a; background: #f2637a12; }
.dashboard-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 22px; }
.panel { padding: 22px; min-width: 0; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.panel-heading h2 { margin: 0; font-size: 16px; }
.panel-heading a { font-size: 11px; white-space: nowrap; }
.panel-note { font-size: 10px; margin: 7px 0 13px; }
.result-row, .predictor-row { display: flex; gap: 12px; align-items: center; padding: 19px 0; border-top: 1px solid var(--border); }
.lottery-mark { width: 40px; height: 40px; border-radius: 11px; background: #00b8ad12; color: var(--accent); font-weight: 800; display: grid; place-items: center; flex-shrink: 0; }
.result-name, .predictor-name { min-width: 0; flex: 1; }
.result-name strong, .predictor-name strong { font-size: 12px; display: block; }
.result-name small, .predictor-name small, .accuracy small { display: block; font-size: 10px; color: var(--muted); }
.balls { display: flex; gap: 7px; }
.balls span { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: #007eaa; color: white; font-weight: 750; box-shadow: inset 0 3px 5px #ffffff33; }
.balls span:nth-child(2) { background: #00a9a7; }
.balls span:nth-child(3) { background: #e6edf3; color: #10243a; }
.soft { background: #00b8ad20; color: var(--accent); }
.predictor-name .stars { color: #eead2a; letter-spacing: 1px; margin-top: 3px; }
.accuracy { text-align: right; }
.accuracy strong { color: var(--accent); font-size: 18px; }
.discovery { display: flex; align-items: center; gap: 18px; padding: 22px; border: 1px solid var(--border); margin-top: 22px; border-radius: 14px; }
.discovery > span { font-size: 38px; color: var(--accent); }
.discovery h2 { font-size: 15px; margin: 0 0 4px; }
.discovery p { font-size: 12px; margin: 0; }
.discovery a { margin-left: auto; white-space: nowrap; font-size: 12px; }
footer { padding: 10px 32px 24px; text-align: right; color: var(--muted); font-size: 10px; }
.placeholder { margin-top: 24px; padding: 40px; }
.placeholder p { max-width: 600px; }
.placeholder h2 { margin-top: 20px; }
.menu-backdrop { display: none; }
.sidebar-collapsed { --sidebar-width: 82px; }
.sidebar-collapsed .nav-label, .sidebar-collapsed .nav-caption, .sidebar-collapsed .brand { display: none; }
.sidebar-collapsed .sidebar { padding: 24px 10px; }
.sidebar-collapsed nav a, .sidebar-collapsed .sidebar-bottom a { justify-content: center; padding: 12px 5px; }
.loading { padding: 40px; text-align: center; }
#blazor-error-ui { display: none; position: fixed; bottom: 0; width: 100%; background: #fff0b3; color: #10243a; z-index: 100; padding: 14px; }
.skip-link { position: fixed; top: -100px; left: 10px; z-index: 100; padding: 12px; background: var(--surface); }
.skip-link:focus { top: 10px; }
@media (max-width: 1200px) {
    :root { --sidebar-width: 220px; }
    .sidebar-collapsed { --sidebar-width: 82px; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .hero-art { right: 3%; opacity: .65; }
    .stat { gap: 12px; padding: 16px; }
    .stat small { display: none; }
}
/* Móvil: el menú pasa a ser un panel superpuesto; la preferencia de escritorio se conserva. */
@media (max-width: 800px) {
    .workspace { margin-left: 0; }
    .sidebar, .sidebar-collapsed .sidebar { width: 260px; transform: translateX(-100%); padding: 24px 16px; }
    .sidebar-collapsed .nav-label, .sidebar-collapsed .nav-caption, .sidebar-collapsed .brand { display: block; }
    .sidebar-collapsed nav a, .sidebar-collapsed .sidebar-bottom a { justify-content: flex-start; padding: 12px 14px; }
    .menu-open .sidebar { transform: translateX(0); }
    .menu-open .menu-backdrop { display: block; position: fixed; inset: 0; background: #0008; border: 0; z-index: 25; }
    .topbar { padding: 12px 18px; min-height: 72px; gap: 12px; }
    .breadcrumb { font-weight: 700; }
    .breadcrumb span { display: none; }
    .topbar-right { gap: 12px; }
    .profile-text { display: none; }
    main { padding: 24px 18px; }
    .demo-badge { display: none; }
    .hero { padding: 26px 24px 54px; min-height: 310px; }
    .hero-copy { max-width: 85%; }
    .hero-art { right: -85px; top: 80px; opacity: .15; }
    .hero h2 { font-size: 30px; }
    .slider-controls { left: 24px; }
    .stats-grid { gap: 9px; margin: 16px 0; }
    .stat { display: block; padding: 12px; }
    .stat-icon { font-size: 25px; height: 38px; width: 38px; margin-bottom: 10px; }
    .stat span:not(.stat-icon) { font-size: 10px; }
    .stat strong { font-size: 24px; }
    .panel { padding: 18px 14px; }
    .result-row, .predictor-row { gap: 9px; }
    .balls { gap: 5px; }
    .balls span { width: 32px; height: 32px; font-size: 13px; }
    .lottery-mark { width: 32px; height: 32px; font-size: 12px; }
    .result-name small { font-size: 9px; }
    .panel-heading h2 { font-size: 14px; }
    .discovery { align-items: flex-start; flex-wrap: wrap; padding: 18px; }
    .discovery div { flex: 1; }
    .discovery a { margin-left: 0; }
    footer { text-align: center; padding: 0 18px 20px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

/* Revisión 2: cabecera persistente y marca azul en todos los dispositivos. */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: 0 3px 14px #00000008;
}
.brand { background: #10243a; padding: 0; }
.mobile-brand { display: none; }
#main-content { scroll-margin-top: 100px; }
@media (max-width: 800px) {
    .topbar { gap: 10px; }
    .breadcrumb { display: none; }
    .mobile-brand {
        display: block;
        width: clamp(116px, 34vw, 180px);
        background: #10243a;
        border-radius: 8px;
        padding: 5px;
        flex-shrink: 1;
    }
    .mobile-brand img { width: 100%; display: block; }
    .topbar-right { gap: 8px; }
    .topbar .icon-button { width: 36px; height: 36px; flex-shrink: 0; }
    .topbar .avatar { width: 36px; height: 36px; }
}

/* Control lateral en escritorio; hamburguesa en móvil. */
.sidebar-toggle { position: absolute; top: 12px; right: 8px; width: 28px; height: 28px; border-radius: 50%; background: #ffffff12; color: #b8d9eb; }
.sidebar-toggle:hover { background: #ffffff24; color: #fff; }
.sidebar .brand { margin-top: 24px; }
.brand .brand-icon { display: none; }
@media (min-width: 801px) {
    .sidebar-collapsed .brand { display: block; width: 56px; align-self: center; margin: 0 0 20px; flex-shrink: 0; }
    .sidebar-collapsed .brand .brand-full { display: none; }
    .sidebar-collapsed .brand .brand-icon { display: block; border-radius: 10px; }
}
.sidebar-collapsed .sidebar-toggle { position: static; align-self: center; flex-shrink: 0; margin-bottom: 20px; }
.mobile-menu-toggle { display: none; }
.session-button { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; background: var(--surface); color: var(--text); font-size: 13px; }
.session-button:hover { border-color: var(--accent); }
.session-button small { color: var(--muted); }
.profile-popup .session-button { display: block; margin-top: 12px; width: 100%; }
@media (max-width: 800px) {
    .sidebar-toggle, .sidebar-collapsed .sidebar-toggle { display: none; }
    .mobile-menu-toggle { display: grid; }
    .sidebar .brand { margin-top: 0; }
    .session-button { padding: 8px; font-size: 12px; }
    .session-button small { display: none; }
}
