/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg-navy: #0a1128;
    --bg-surface: rgba(16, 25, 48, 0.6);
    --bg-input: #0d1a30;
    --border: rgba(0, 240, 255, 0.1);
    --border-hover: rgba(0, 240, 255, 0.4);
    --accent-cyan: #00f0ff;
    --accent-glow: rgba(0, 240, 255, 0.25);
    --accent-glow-strong: rgba(0, 240, 255, 0.5);
    --status-green: #00ff66;
    --status-yellow: #ffdd00;
    --status-red: #ff3333;
    --text: #ffffff;
    --text-muted: #8ba2c4;
    --radius: 12px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    --font-main: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Roboto Mono', monospace;
}

body {
    font-family: var(--font-main);
    background: var(--bg-navy);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(0, 240, 255, .04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(0, 120, 255, .03) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 100%, rgba(0, 60, 180, .04) 0%, transparent 40%);
    background-attachment: fixed;
}

/* Circuit board grid overlay */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(0, 240, 255, .025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 240, 255, .025) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

body > * { position: relative; z-index: 1; }

a { color: var(--accent-cyan); text-decoration: none; }

/* === Screens === */
.screen { display: flex; min-height: 100vh; }
.hidden { display: none !important; }

/* === Login === */
.login-screen {
    background:
        radial-gradient(circle at 50% 40%, rgba(0, 240, 255, .08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 100%, rgba(0, 60, 180, .06) 0%, transparent 40%),
        var(--bg-navy);
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.login-card {
    max-width: 420px;
    width: 90%;
    padding: 2.5rem 2rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow), 0 0 40px rgba(0, 240, 255, 0.08);
    text-align: center;
    backdrop-filter: blur(12px);
}

.login-logo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
    box-shadow: 0 0 30px rgba(0, 240, 255, .3), 0 0 60px rgba(0, 240, 255, .1);
    border: 2px solid rgba(0, 240, 255, .3);
    animation: login-pulse 3s ease-in-out infinite;
}

/* 1. Login logo pulsing glow */
@keyframes login-pulse {
    0%, 100% { box-shadow: 0 0 30px rgba(0, 240, 255, .3), 0 0 60px rgba(0, 240, 255, .1); }
    50% { box-shadow: 0 0 40px rgba(0, 240, 255, .5), 0 0 80px rgba(0, 240, 255, .25), 0 0 120px rgba(0, 240, 255, .1); }
}

.login-title {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 3px;
    margin-bottom: .25rem;
}

.accent { color: var(--accent-cyan); text-shadow: 0 0 12px var(--accent-glow); }

.login-card .subtitle {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: .9rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}
.login-card form { text-align: left; }
.login-card label {
    display: block;
    font-size: .8rem;
    color: var(--text-muted);
    margin-bottom: .25rem;
    margin-top: .75rem;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.login-card input {
    width: 100%;
    padding: .65rem .75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: .9rem;
    transition: border-color .2s, box-shadow .2s;
}
.login-card input:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 12px var(--accent-glow);
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1.1rem;
    border: none;
    border-radius: 8px;
    font-family: var(--font-main);
    font-size: .9rem;
    cursor: pointer;
    transition: background .15s, box-shadow .2s, transform .1s;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
    background: var(--accent-cyan);
    color: var(--bg-navy);
    width: 100%;
    justify-content: center;
    margin-top: 1.25rem;
    font-weight: 600;
    letter-spacing: .5px;
}
.btn-primary:hover {
    background: #33f3ff;
    box-shadow: 0 0 20px var(--accent-glow), 0 0 40px rgba(0, 240, 255, 0.15);
}
.btn-text { background: none; color: var(--text-muted); padding: .35rem .5rem; }
.btn-text:hover { color: var(--text); }
.btn-icon { background: none; color: var(--text); font-size: 1.2rem; position: relative; padding: .35rem; }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; border-radius: 6px; }
.btn-success { background: var(--status-green); color: var(--bg-navy); font-weight: 600; }
.btn-warning { background: var(--status-yellow); color: var(--bg-navy); font-weight: 600; }
.btn-danger { background: var(--status-red); color: #fff; font-weight: 600; }

/* === 3-Column Layout === */
#app-screen {
    display: grid;
    grid-template-columns: 240px 1fr 280px;
    min-height: 100vh;
}

/* === Left Sidebar === */
.sidebar {
    background: rgba(10, 17, 40, 0.85);
    border-right: 1px solid var(--border);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 0 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(0, 240, 255, .3);
    box-shadow: 0 0 15px rgba(0, 240, 255, .2);
    flex-shrink: 0;
}

.brand-title {
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: 2px;
    line-height: 1.2;
}

.badge {
    display: inline-block;
    color: var(--text-muted);
    font-size: .7rem;
    letter-spacing: .5px;
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 .75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .7rem 1rem;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    border-radius: 0 8px 8px 0;
    color: var(--text-muted);
    font-family: var(--font-main);
    font-size: .9rem;
    cursor: pointer;
    transition: all .2s;
    width: 100%;
    text-align: left;
    position: relative;
}
.nav-item:hover {
    color: var(--text);
    background: rgba(0, 240, 255, .05);
}
.nav-item.active {
    color: var(--accent-cyan);
    border-left-color: var(--accent-cyan);
    background: rgba(0, 240, 255, .08);
    text-shadow: 0 0 8px var(--accent-glow);
}
.nav-item.active svg { filter: drop-shadow(0 0 4px var(--accent-glow)); }

.nav-badge {
    background: var(--status-red);
    color: #fff;
    font-size: .65rem;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-left: auto;
    box-shadow: 0 0 8px rgba(255, 51, 51, .4);
}

.sidebar-footer {
    padding: .75rem;
    border-top: 1px solid var(--border);
    margin-top: .5rem;
}

.nav-logout { color: var(--text-muted); opacity: .7; }
.nav-logout:hover { color: var(--status-red); opacity: 1; }

/* === Main Content === */
.main-content {
    padding: 1.5rem 2rem;
    overflow-y: auto;
    height: 100vh;
}

/* 5. Fade-in transition between tabs */
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}
.section-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.loading { color: var(--text-muted); text-align: center; padding: 2rem; }
.loading-sm { color: var(--text-muted); font-size: .8rem; }

/* === Card Grid (Athletes) === */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    backdrop-filter: blur(12px);
    transition: border-color .25s, box-shadow .25s, transform .15s;
}
.card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.15), 0 0 30px rgba(0, 240, 255, 0.05);
    cursor: pointer;
    transform: translateY(-2px);
}
.card-no-hover:hover {
    border-color: var(--border);
    cursor: default;
    box-shadow: none;
    transform: none;
}

/* === Athlete Card === */
.athlete-card {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    gap: 0;
    align-items: start;
}

.athlete-card .athlete-info { grid-column: 1; }
.athlete-card .donut-container {
    grid-column: 2;
    grid-row: 1 / 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.athlete-card .name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: .15rem;
}
.athlete-card .meta {
    font-size: .8rem;
    color: var(--text-muted);
    margin-bottom: .5rem;
}
.athlete-card .meta .mono {
    font-family: var(--font-mono);
    font-size: .78rem;
}
.athlete-card .stats {
    display: flex;
    gap: .75rem;
    font-size: .82rem;
}
.athlete-card .stat-value {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--accent-cyan);
}

/* === Donut Chart (SVG) === */
.donut-container svg { filter: drop-shadow(0 0 6px var(--accent-glow)); }

.donut-bg {
    fill: none;
    stroke: rgba(0, 240, 255, 0.08);
    stroke-width: 4;
}
.donut-fill {
    fill: none;
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dashoffset .6s ease;
}
.donut-text {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    fill: var(--text);
    text-anchor: middle;
    dominant-baseline: central;
}
.donut-label {
    font-family: var(--font-main);
    font-size: 5px;
    fill: var(--text-muted);
    text-anchor: middle;
}

/* === Detail View === */
.detail-header {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.25rem;
}
.detail-header h2 { font-size: 1.3rem; font-weight: 600; margin-bottom: .25rem; }
.detail-header .meta { color: var(--text-muted); font-size: .85rem; }
.detail-header .meta strong { color: var(--accent-cyan); font-family: var(--font-mono); }

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}
.detail-grid .card h4 {
    font-size: .85rem;
    color: var(--accent-cyan);
    margin-bottom: .75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.wellness-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem .75rem;
}
.wellness-item { font-size: .85rem; }
.wellness-item .label { color: var(--text-muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .5px; }
.wellness-item .value { font-family: var(--font-mono); font-weight: 600; font-size: 1.05rem; }

/* === Send Message === */
.send-msg-card { margin-top: 1rem; }
.send-msg-card h4 {
    font-size: .85rem;
    color: var(--text-muted);
    margin-bottom: .5rem;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.send-msg-row { display: flex; gap: .5rem; }
.send-msg-row input {
    flex: 1;
    padding: .55rem .75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--font-main);
    font-size: .9rem;
    transition: border-color .2s, box-shadow .2s;
}
.send-msg-row input:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 12px var(--accent-glow);
}

/* === Right Sidebar: AI Command Center === */
.command-center {
    background: rgba(10, 17, 40, 0.85);
    border-left: 1px solid var(--border);
    backdrop-filter: blur(12px);
    padding: 1.5rem 1.25rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.cc-title {
    font-size: .75rem;
    color: var(--accent-cyan);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    text-shadow: 0 0 8px var(--accent-glow);
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border);
}

.cc-metric {
    margin-bottom: 1.5rem;
    text-align: center;
}
.cc-metric-label {
    display: block;
    font-size: .7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: .35rem;
}
.cc-metric-value {
    display: block;
    font-family: var(--font-mono);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-cyan);
    text-shadow: 0 0 20px var(--accent-glow), 0 0 40px rgba(0, 240, 255, 0.1);
    line-height: 1;
}

.cc-divider {
    height: 1px;
    background: var(--border);
    margin: 1rem 0;
}

.cc-subtitle {
    font-size: .7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: .75rem;
}

.cc-alerts { display: flex; flex-direction: column; gap: .5rem; }

.cc-alert-item {
    padding: .6rem .75rem;
    background: rgba(16, 25, 48, 0.5);
    border-radius: 8px;
    font-size: .78rem;
    border-left: 3px solid transparent;
    transition: background .2s;
}
.cc-alert-item:hover { background: rgba(16, 25, 48, 0.8); }
.cc-alert-item.cc-critical {
    border-left-color: var(--status-red);
    background: rgba(255, 51, 51, 0.05);
}
.cc-alert-item.cc-warning {
    border-left-color: var(--status-yellow);
    background: rgba(255, 221, 0, 0.03);
}
.cc-alert-item.cc-info {
    border-left-color: var(--accent-cyan);
}
.cc-alert-name { font-weight: 600; font-size: .78rem; margin-bottom: .1rem; }
.cc-alert-type { color: var(--text-muted); font-size: .72rem; }

/* === Alerts Tab === */
.alert-summary { display: flex; gap: .75rem; }
.alert-summary .pill {
    padding: .25rem .7rem;
    border-radius: 12px;
    font-size: .8rem;
    font-weight: 600;
    font-family: var(--font-mono);
}
.pill-critical { background: rgba(255, 51, 51, .12); color: var(--status-red); }
.pill-warning { background: rgba(255, 221, 0, .1); color: var(--status-yellow); }
.pill-info { background: rgba(0, 240, 255, .1); color: var(--accent-cyan); }

.alerts-list { display: flex; flex-direction: column; gap: .5rem; }

.alert-item {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .85rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(8px);
    transition: border-color .2s;
}
/* 4. Pulsing red glow on critical alerts */
.alert-item.sev-critical {
    border-left: 3px solid var(--status-red);
    box-shadow: inset 0 0 20px rgba(255, 51, 51, 0.03);
    animation: critical-pulse 2.5s ease-in-out infinite;
}
@keyframes critical-pulse {
    0%, 100% { box-shadow: inset 0 0 20px rgba(255, 51, 51, 0.03); }
    50% { box-shadow: inset 0 0 20px rgba(255, 51, 51, 0.03), 0 0 12px rgba(255, 51, 51, 0.15); }
}
.alert-item.sev-warning {
    border-left: 3px solid var(--status-yellow);
}
.alert-item.sev-info {
    border-left: 3px solid var(--accent-cyan);
}

.alert-body { flex: 1; }
.alert-body .alert-title { font-size: .9rem; font-weight: 600; }
.alert-body .alert-msg { font-size: .82rem; color: var(--text-muted); margin-top: .15rem; }
.alert-body .alert-time { font-family: var(--font-mono); font-size: .7rem; color: var(--text-muted); margin-top: .3rem; }
.alert-actions { display: flex; gap: .35rem; flex-shrink: 0; }

/* === Config Form === */
.config-form { max-width: 500px; }
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: .8rem;
    margin-bottom: .25rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}
.form-group input[type="number"] {
    width: 100%;
    padding: .55rem .75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: .9rem;
    transition: border-color .2s, box-shadow .2s;
}
.form-group input[type="number"]:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 12px var(--accent-glow);
}
.form-group small { display: block; color: var(--text-muted); font-size: .72rem; margin-top: .2rem; }
.checkbox-group label {
    display: flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text);
    font-size: .88rem;
}
.checkbox-group input[type="checkbox"] { accent-color: var(--accent-cyan); width: 16px; height: 16px; }

.error { color: var(--status-red); font-size: .85rem; margin-top: .5rem; }
.success { color: var(--status-green); font-size: .85rem; margin-top: .5rem; }

/* === Adherence Bars (Detail View) === */
.adherence-bars { display: flex; align-items: flex-end; gap: 4px; height: 80px; margin-top: .5rem; }
.adherence-bar {
    flex: 1;
    border-radius: 4px 4px 0 0;
    min-width: 30px;
    position: relative;
    transition: height .3s;
}
.adherence-bar-label {
    position: absolute;
    bottom: -18px;
    left: 0; right: 0;
    text-align: center;
    font-family: var(--font-mono);
    font-size: .6rem;
    color: var(--text-muted);
}
.adherence-bar-value {
    position: absolute;
    top: -16px;
    left: 0; right: 0;
    text-align: center;
    font-family: var(--font-mono);
    font-size: .68rem;
    font-weight: 600;
}

/* === Progress Bar (Detail View) === */
.progress-bar {
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
    margin-top: .4rem;
}
.progress-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width .3s;
    box-shadow: 0 0 8px var(--accent-glow);
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 240, 255, .15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 240, 255, .3); }

/* === Responsive === */
@media (max-width: 1100px) {
    #app-screen {
        grid-template-columns: 60px 1fr 240px;
    }
    .sidebar-brand > div,
    .nav-item span:not(.nav-badge),
    .sidebar-footer .nav-item span { display: none; }
    .nav-item { justify-content: center; padding: .7rem; }
    .nav-item svg { margin: 0; }
    .sidebar-brand { justify-content: center; padding: 0 0 1rem; }
    .sidebar-nav { padding: 0 .25rem; }
    .sidebar-footer { padding: .5rem .25rem; }
    /* Hide text in nav items but keep SVG */
    .nav-item { font-size: 0; gap: 0; border-left-width: 2px; }
    .nav-badge { font-size: .65rem; position: absolute; top: 2px; right: 2px; }
}

@media (max-width: 860px) {
    #app-screen {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }
    .sidebar {
        position: relative;
        height: auto;
        flex-direction: row;
        padding: .5rem 1rem;
        border-right: none;
        border-bottom: 1px solid var(--border);
        overflow-x: auto;
    }
    .sidebar-brand { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
    .sidebar-brand > div { display: none; }
    .sidebar-nav { flex-direction: row; gap: 0; padding: 0; }
    .nav-item { border-left: none; border-bottom: 2px solid transparent; border-radius: 0; padding: .5rem .75rem; font-size: .82rem; }
    .nav-item.active { border-bottom-color: var(--accent-cyan); border-left-color: transparent; }
    .sidebar-footer { display: none; }

    .command-center {
        position: relative;
        height: auto;
        border-left: none;
        border-top: 1px solid var(--border);
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: .75rem;
        padding: 1rem;
    }
    .cc-title { grid-column: 1 / -1; margin-bottom: .5rem; }
    .cc-divider { display: none; }
    .cc-subtitle { grid-column: 1 / -1; }
    .cc-metric { margin-bottom: .5rem; }
    .cc-metric-value { font-size: 1.8rem; }

    .main-content { height: auto; padding: 1rem; }
    .card-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .scan-line { display: none; }
}

/* 3. Avatar initials circle */
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0, 240, 255, .2), rgba(0, 120, 255, .15));
    border: 1px solid rgba(0, 240, 255, .25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: .78rem;
    font-weight: 700;
    color: var(--accent-cyan);
    flex-shrink: 0;
    text-shadow: 0 0 6px var(--accent-glow);
}
.athlete-card .athlete-info { display: flex; gap: .65rem; align-items: flex-start; }

/* 7. Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}
.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: .75rem;
    opacity: .4;
    filter: grayscale(.5);
}
.empty-state-text { font-size: .9rem; }
.empty-state-sub { font-size: .78rem; margin-top: .25rem; opacity: .6; }

/* 9. Scan line animation */
.scan-line {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, rgba(0, 240, 255, .15) 20%, rgba(0, 240, 255, .3) 50%, rgba(0, 240, 255, .15) 80%, transparent 100%);
    z-index: 9999;
    pointer-events: none;
    animation: scanMove 8s linear infinite;
    opacity: .6;
}
@keyframes scanMove {
    0% { top: 0; }
    100% { top: 100vh; }
}

/* 10. Skeleton shimmer */
.skeleton {
    background: linear-gradient(90deg, rgba(16, 25, 48, 0.6) 25%, rgba(0, 240, 255, 0.04) 50%, rgba(16, 25, 48, 0.6) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-card { height: 110px; }
.skeleton-alert { height: 60px; margin-bottom: .5rem; }
.skeleton-metric { height: 50px; width: 100%; margin-bottom: 1rem; }

/* 6. Clickable CC alerts */
.cc-alert-item.cc-clickable { cursor: pointer; }
.cc-alert-item.cc-clickable:hover { background: rgba(0, 240, 255, 0.06); }

/* === AS-25 to AS-29: New Detail Cards === */

/* Full-width rows in detail grid */
.detail-grid-wide {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}
.detail-card-full {
    min-width: 0; /* prevent overflow in grid */
}

/* SVG Charts — responsive container */
.svg-chart {
    width: 100%;
    overflow: hidden;
    margin-top: .5rem;
}
.svg-chart svg {
    width: 100%;
    height: auto;
    display: block;
}
.chart-axis-label {
    font-family: var(--font-mono);
    font-size: 9px;
    fill: var(--text-muted);
    text-anchor: middle;
}

/* === AS-25: Load Chart === */
.chart-legend {
    display: flex;
    gap: 1rem;
    margin-bottom: .5rem;
    flex-wrap: wrap;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}
.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* === AS-26: Periodization === */
.period-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1.25rem;
    font-size: .82rem;
    color: var(--text-muted);
    margin-bottom: .75rem;
    align-items: center;
}
.period-meta strong { color: var(--text); font-family: var(--font-mono); }
.period-objetivo {
    font-size: .8rem;
    color: var(--accent-cyan);
    font-style: italic;
}
.phase-timeline {
    display: flex;
    width: 100%;
    height: 36px;
    border-radius: 6px;
    overflow: hidden;
    gap: 2px;
    background: rgba(16, 25, 48, 0.5);
    padding: 2px;
}
.phase-block {
    flex-shrink: 0;
    border-radius: 4px;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    overflow: hidden;
    transition: opacity .2s, transform .15s;
    cursor: default;
}
.phase-block:hover { opacity: .85; transform: scaleY(1.05); }
.phase-block-active {
    box-shadow: 0 0 8px currentColor;
}
.phase-block-label {
    font-family: var(--font-mono);
    font-size: .62rem;
    font-weight: 700;
    color: var(--bg-navy);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 4px;
}
.phase-block:not(.phase-block-active) .phase-block-label {
    color: var(--text-muted);
}
.period-progress {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-top: .5rem;
}
.period-pct {
    font-family: var(--font-mono);
    font-size: .72rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}
.period-progress .progress-bar { flex: 1; margin-top: 0; }

/* === AS-27: Weight Chart === */
.weight-summary {
    display: flex;
    gap: .5rem 1rem;
    flex-wrap: wrap;
    margin-bottom: .25rem;
}
.weight-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.weight-stat-label {
    font-size: .65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .4px;
}
.weight-stat-val {
    font-family: var(--font-mono);
    font-size: .95rem;
    font-weight: 700;
    color: var(--text);
}
.weight-stat-val.weight-up { color: var(--status-red); }
.weight-stat-val.weight-down { color: var(--status-green); }

/* === AS-28: Race Timeline === */
.race-timeline {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    margin-top: .25rem;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 2px;
}
.race-card {
    display: flex;
    gap: .65rem;
    align-items: flex-start;
    padding: .65rem .75rem;
    background: rgba(16, 25, 48, 0.45);
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: border-color .2s;
}
.race-card:hover { border-color: rgba(0, 240, 255, 0.25); }
.race-card-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 4px;
    flex-shrink: 0;
    box-shadow: 0 0 6px currentColor;
}
.race-card-body { flex: 1; min-width: 0; }
.race-card-name {
    font-size: .88rem;
    font-weight: 600;
    margin-bottom: .2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.race-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem .6rem;
    align-items: center;
    font-size: .75rem;
    color: var(--text-muted);
}
.race-date { font-family: var(--font-mono); font-size: .72rem; }
.race-time { color: var(--accent-cyan); }
.race-pos { color: var(--status-yellow); }
.race-pace { font-size: .75rem; color: var(--text-muted); margin-top: .15rem; }

/* Sport badge — generic pill */
.sport-badge {
    display: inline-block;
    padding: .1rem .45rem;
    border: 1px solid;
    border-radius: 10px;
    font-size: .65rem;
    font-family: var(--font-mono);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .3px;
    line-height: 1.6;
}

/* === AS-29: Upcoming Workouts === */
.upcoming-calendar {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    margin-top: .25rem;
    max-height: 340px;
    overflow-y: auto;
    padding-right: 2px;
}
.workout-day {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
}
.workout-day-label {
    font-family: var(--font-mono);
    font-size: .72rem;
    color: var(--text-muted);
    min-width: 72px;
    text-align: right;
    padding-top: .45rem;
    flex-shrink: 0;
    text-transform: capitalize;
}
.workout-day-items {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .3rem;
}
.workout-day-item {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    padding: .4rem .65rem;
    border-radius: 6px;
}
.workout-status-icon {
    font-size: .85rem;
    font-weight: 700;
    flex-shrink: 0;
    line-height: 1.5;
    font-family: var(--font-mono);
}
.workout-day-info {
    flex: 1;
    min-width: 0;
}
.workout-day-name {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.workout-day-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .2rem .5rem;
    align-items: center;
    margin-top: .15rem;
    font-size: .72rem;
    color: var(--text-muted);
}
.workout-day-meta .mono {
    font-family: var(--font-mono);
    font-size: .7rem;
}

/* === AS-21: Monthly Report === */
.report-card {
    margin-top: 1rem;
}
.report-card h4 {
    font-size: .85rem;
    color: var(--accent-cyan);
    margin-bottom: .75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.report-controls {
    display: flex;
    gap: .75rem;
    align-items: center;
    flex-wrap: wrap;
}
.report-month-input {
    padding: .5rem .75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: .85rem;
    transition: border-color .2s, box-shadow .2s;
    color-scheme: dark;
}
.report-month-input:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 12px var(--accent-glow);
}
.btn-report {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem 1rem;
    background: rgba(0, 240, 255, 0.1);
    border: 1px solid var(--accent-cyan);
    border-radius: 8px;
    color: var(--accent-cyan);
    font-family: var(--font-main);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, box-shadow .2s, transform .1s;
}
.btn-report:hover {
    background: rgba(0, 240, 255, 0.2);
    box-shadow: 0 0 15px var(--accent-glow);
}
.btn-report:active {
    transform: scale(0.97);
}
.btn-report:disabled {
    opacity: .5;
    cursor: not-allowed;
}
.btn-report svg {
    flex-shrink: 0;
}

/* Responsive adjustments for new wide grid */
@media (max-width: 860px) {
    .detail-grid-wide {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 600px) {
    .weight-summary { gap: .5rem; justify-content: space-between; }
    .race-card-meta { gap: .2rem .4rem; }
    .workout-day-label { min-width: 56px; font-size: .65rem; }
}
