/* ==========================================================================
   RankRep — Responsive Mobile & PC Stylesheet (Dark Athletic Glass UI)
   ========================================================================== */

:root {
    --bg: #080b11;
    --bg-elevated: #0e131e;
    --card: #121826;
    --card-2: #171f31;
    --border: rgba(148, 163, 184, 0.14);
    --border-strong: rgba(148, 163, 184, 0.25);
    --text: #f3f6fc;
    --text-soft: #cbd5e1;
    --muted: #8a9bb5;

    --emerald: #10b981;
    --cyan: #06b6d4;
    --gradient-primary: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    --amber: #f59e0b;
    --orange: #f97316;
    --red: #ef4444;
    --purple: #8b5cf6;

    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --shadow-card: 0 12px 32px rgba(0, 0, 0, 0.34);
    --sidebar-w: 260px;
    --bottom-nav-h: 68px;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-image:
        radial-gradient(ellipse 80% 45% at 50% -15%, rgba(16, 185, 129, 0.14), transparent 70%),
        radial-gradient(ellipse 55% 40% at 95% 15%, rgba(6, 182, 212, 0.09), transparent 70%);
    background-attachment: fixed;
}

a { color: var(--cyan); text-decoration: none; }
button, input, select { font-family: inherit; }

/* Boot Loader */
.boot-loader {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: var(--muted);
}

.boot-spinner {
    width: 42px;
    height: 42px;
    border: 3px solid rgba(16, 185, 129, 0.2);
    border-top-color: var(--emerald);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ==========================================================================
   Auth & Onboarding Layout
   ========================================================================== */

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(24px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: rgba(18, 24, 38, 0.92);
    backdrop-filter: blur(18px);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.55);
}

.auth-card.wide {
    max-width: 640px;
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.brand-lockup.center {
    justify-content: center;
}

.brand-icon {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    flex-shrink: 0;
}

.brand-name {
    font-size: 1.45rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.brand-tagline {
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 1px;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--bg-elevated);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 18px;
}

.auth-tab {
    border: none;
    background: transparent;
    color: var(--muted);
    font-weight: 700;
    font-size: 0.9rem;
    padding: 10px;
    border-radius: 9px;
    cursor: pointer;
    transition: all 0.18s ease;
}

.auth-tab.active {
    background: var(--card-2);
    color: var(--text);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.oauth-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}

.btn-oauth {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid var(--border-strong);
    transition: transform 0.12s ease, filter 0.15s ease, opacity 0.15s ease;
}

.btn-oauth:active { transform: scale(0.985); }

.btn-oauth-google {
    background: #ffffff;
    color: #111827;
    border-color: rgba(255, 255, 255, 0.85);
}

.btn-oauth-apple {
    background: #000000;
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.22);
}

.btn-oauth.unconfigured {
    opacity: 0.72;
}

.oauth-badge-tag {
    font-size: 0.68rem;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.2);
    color: inherit;
    font-weight: 600;
}

.divider-line {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 0.78rem;
    margin: 16px 0;
}

.divider-line::before, .divider-line::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Forms */
.field {
    margin-bottom: 14px;
}

.field label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-soft);
    margin-bottom: 6px;
}

.input, .select {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    color: var(--text);
    border-radius: 11px;
    padding: 11px 14px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.input:focus, .select:focus {
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}

.field-hint {
    font-size: 0.76rem;
    color: var(--muted);
    margin-top: 5px;
    line-height: 1.4;
}

.field-hint.ok { color: var(--emerald); }
.field-hint.err { color: #fca5a5; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 12px;
    padding: 12px 18px;
    font-weight: 700;
    font-size: 0.93rem;
    cursor: pointer;
    transition: transform 0.12s ease, filter 0.15s ease, background 0.15s ease;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
    background: var(--gradient-primary);
    color: #031510;
    font-weight: 800;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.07); }

.btn-secondary {
    background: var(--card-2);
    color: var(--text);
    border: 1px solid var(--border-strong);
}
.btn-secondary:hover:not(:disabled) { background: #1e283e; }

.btn-danger {
    background: rgba(239, 68, 68, 0.14);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.35);
}
.btn-danger:hover:not(:disabled) { background: rgba(239, 68, 68, 0.24); }

.btn-block { width: 100%; }
.btn-sm { padding: 8px 12px; font-size: 0.82rem; border-radius: 9px; }

/* Onboarding Level Cards */
.level-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

@media (max-width: 520px) {
    .level-grid { grid-template-columns: 1fr; }
}

.level-option {
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: 14px;
    padding: 13px 14px;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.16s ease, background 0.16s ease, transform 0.12s ease;
    color: var(--text);
}

.level-option:hover { border-color: var(--border-strong); }
.level-option.selected {
    border-color: var(--emerald);
    background: rgba(16, 185, 129, 0.1);
}

.level-option-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.level-title { font-weight: 800; font-size: 0.96rem; }
.level-rank-pill {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
}

.level-desc {
    font-size: 0.77rem;
    color: var(--muted);
    line-height: 1.4;
}

/* Toggle Switch */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 12px 14px;
    margin-bottom: 14px;
}

.toggle-title { font-weight: 700; font-size: 0.9rem; }
.toggle-sub { font-size: 0.77rem; color: var(--muted); margin-top: 2px; }

.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 27px;
    flex-shrink: 0;
}

.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
    position: absolute;
    inset: 0;
    background: #273249;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease;
}
.switch-slider::before {
    content: '';
    position: absolute;
    width: 21px;
    height: 21px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
}
.switch input:checked + .switch-slider { background: var(--emerald); }
.switch input:checked + .switch-slider::before { transform: translateX(21px); }

/* ==========================================================================
   Main Authenticated App Shell (Desktop Sidebar + Mobile Bottom Nav)
   ========================================================================== */

.shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: rgba(12, 16, 26, 0.94);
    backdrop-filter: blur(18px);
    border-right: 1px solid var(--border);
    padding: 22px 16px;
    flex-direction: column;
    z-index: 40;
}

.sidebar-mini-rank {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    margin: 6px 0 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-mini-rank .user-name {
    font-weight: 800;
    font-size: 0.94rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-mini-rank .user-elo {
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 2px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    border: none;
    background: transparent;
    color: var(--muted);
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.16s ease;
    text-align: left;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.nav-item.active {
    background: rgba(16, 185, 129, 0.14);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }

/* Mobile Header */
.mobile-header {
    position: sticky;
    top: 0;
    z-index: 35;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: max(12px, env(safe-area-inset-top)) 16px 12px;
    background: rgba(8, 11, 17, 0.86);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.mobile-header-left {
    display: flex;
    align-items: center;
    gap: 9px;
}

.mobile-header-left img { width: 30px; height: 30px; border-radius: 9px; }

.elo-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--card);
    border: 1px solid var(--border-strong);
    padding: 6px 11px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 800;
}

/* Main Content Area */
.main-content {
    flex: 1;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 18px 16px calc(var(--bottom-nav-h) + 28px + env(safe-area-inset-bottom));
}

/* Bottom Mobile Navigation */
.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: rgba(12, 16, 26, 0.94);
    backdrop-filter: blur(18px);
    border-top: 1px solid var(--border);
    padding: 6px 6px max(8px, env(safe-area-inset-bottom));
}

.bottom-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 6px 4px;
    border-radius: 12px;
    cursor: pointer;
    transition: color 0.15s ease;
}

.bottom-nav-btn svg { width: 22px; height: 22px; }
.bottom-nav-btn.active { color: #34d399; }

@media (min-width: 860px) {
    .sidebar { display: flex; }
    .mobile-header, .bottom-nav { display: none; }
    .main-content {
        margin-left: var(--sidebar-w);
        max-width: calc(100% - var(--sidebar-w));
        padding: 30px 36px 48px;
    }
    .page-inner {
        max-width: 1040px;
        margin: 0 auto;
    }
}

/* ==========================================================================
   Cards, Alerts & Typography
   ========================================================================== */

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.page-title {
    margin: 0;
    font-size: 1.55rem;
    font-weight: 900;
    letter-spacing: -0.025em;
}

.page-subtitle {
    margin: 4px 0 0;
    font-size: 0.88rem;
    color: var(--muted);
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-card);
    margin-bottom: 16px;
}

.card-title {
    margin: 0 0 14px;
    font-size: 1.02rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.banner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 15px;
    margin-bottom: 16px;
    font-size: 0.87rem;
    line-height: 1.45;
}

.banner.info {
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.35);
    color: #cffafe;
}

.banner.warn {
    background: rgba(245, 158, 11, 0.13);
    border: 1px solid rgba(245, 158, 11, 0.38);
    color: #fef3c7;
}

.banner.err {
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fecaca;
}

.banner-close {
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: inherit;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    font-weight: 700;
}

/* ==========================================================================
   Dashboard (Today)
   ========================================================================== */

.hero-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 16px;
    margin-bottom: 18px;
}

@media (max-width: 780px) {
    .hero-grid { grid-template-columns: 1fr; }
}

.rank-hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(145deg, #131b2c 0%, #0e1422 100%);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 16px;
}

.rank-hero-top {
    display: flex;
    align-items: center;
    gap: 16px;
}

.rank-crest {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45));
}

.rank-crest.sm { width: 38px; height: 38px; }
.rank-crest.xs { width: 28px; height: 28px; }

.rank-meta-label {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 700;
}

.rank-meta-title {
    font-size: 1.55rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.rank-elo-line {
    font-size: 0.92rem;
    color: var(--text-soft);
    margin-top: 3px;
    font-weight: 700;
}

.progress-track {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--gradient-primary);
    transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.rank-progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.77rem;
    color: var(--muted);
    margin-top: 6px;
    font-weight: 600;
}

.pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 6px 11px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    color: var(--text-soft);
}

.stat-pill.fire { color: #fbbf24; border-color: rgba(251, 191, 36, 0.28); background: rgba(251, 191, 36, 0.08); }
.stat-pill.adapt { color: #67e8f9; border-color: rgba(34, 211, 238, 0.28); background: rgba(34, 211, 238, 0.08); }

/* Daily Ring Card */
.daily-ring-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 18px;
}

.ring-wrap {
    position: relative;
    width: 106px;
    height: 106px;
    flex-shrink: 0;
}

.ring-wrap svg {
    width: 106px;
    height: 106px;
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 10;
}

.ring-fg {
    fill: none;
    stroke: url(#ringGrad);
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.ring-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.ring-pct { font-size: 1.35rem; font-weight: 900; line-height: 1; }
.ring-sub { font-size: 0.68rem; color: var(--muted); margin-top: 2px; font-weight: 700; }

.daily-summary-stats {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.daily-summary-title {
    font-weight: 800;
    font-size: 1rem;
}

.daily-summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.84rem;
    color: var(--muted);
}

.daily-summary-row strong { color: var(--text); }

/* Exercise Task Cards */
.tasks-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}

@media (max-width: 700px) {
    .tasks-grid { grid-template-columns: 1fr; }
}

.task-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.task-card.done {
    border-color: rgba(16, 185, 129, 0.55);
    background: linear-gradient(160deg, rgba(16, 185, 129, 0.11) 0%, var(--card) 58%);
    box-shadow: 0 10px 28px rgba(16, 185, 129, 0.12);
}

.task-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.task-title-wrap {
    display: flex;
    align-items: center;
    gap: 11px;
}

.task-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.task-card.done .task-icon {
    background: rgba(16, 185, 129, 0.22);
}

.task-name { font-weight: 800; font-size: 1.03rem; }
.task-elo-tag {
    font-size: 0.74rem;
    font-weight: 800;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.14);
    color: #34d399;
    white-space: nowrap;
}

.task-card.done .task-elo-tag {
    background: var(--emerald);
    color: #031510;
}

.task-counter-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 8px;
}

.task-reps-big {
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.task-reps-big span {
    font-size: 0.95rem;
    color: var(--muted);
    font-weight: 600;
}

.task-pct-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--muted);
}

.task-card.done .task-pct-label { color: #34d399; }

.task-controls {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.rep-btn {
    border: 1px solid var(--border-strong);
    background: var(--bg-elevated);
    color: var(--text);
    font-weight: 800;
    font-size: 0.84rem;
    padding: 9px 11px;
    border-radius: 10px;
    cursor: pointer;
    min-width: 44px;
    transition: background 0.14s ease, transform 0.1s ease;
}

.rep-btn:hover { background: var(--card-2); }
.rep-btn:active { transform: scale(0.95); }

.rep-btn.complete-btn {
    margin-left: auto;
    background: rgba(16, 185, 129, 0.18);
    border-color: rgba(16, 185, 129, 0.45);
    color: #6ee7b7;
    padding: 9px 14px;
}

.rep-btn.complete-btn:hover { background: rgba(16, 185, 129, 0.28); }

.rep-input-inline {
    width: 62px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    color: var(--text);
    border-radius: 10px;
    padding: 8px 6px;
    text-align: center;
    font-weight: 800;
    font-size: 0.9rem;
}

.next-rank-strip {
    background: rgba(18, 24, 38, 0.72);
    border: 1px dashed var(--border-strong);
    border-radius: 15px;
    padding: 13px 16px;
    font-size: 0.83rem;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.next-rank-strip strong { color: var(--text); }

/* ==========================================================================
   Calendar & Productivity Analytics
   ========================================================================== */

.cal-layout {
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    gap: 16px;
    align-items: start;
}

@media (max-width: 900px) {
    .cal-layout { grid-template-columns: 1fr; }
}

.cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.cal-month-title {
    font-size: 1.12rem;
    font-weight: 800;
    text-transform: capitalize;
}

.cal-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

@media (max-width: 560px) {
    .cal-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

.kpi-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 12px;
}

.kpi-val { font-size: 1.25rem; font-weight: 900; }
.kpi-lbl { font-size: 0.73rem; color: var(--muted); margin-top: 2px; font-weight: 600; }

.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-bottom: 6px;
    text-align: center;
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--muted);
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.cal-cell {
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
    background: var(--bg-elevated);
    color: var(--text-soft);
    transition: transform 0.12s ease, border-color 0.15s ease;
    position: relative;
}

.cal-cell:hover:not(.empty):not(.future):not(.before_signup) {
    transform: translateY(-2px);
    border-color: var(--text);
}

.cal-cell.empty {
    background: transparent;
    cursor: default;
}

.cal-cell.future, .cal-cell.before_signup {
    opacity: 0.28;
    cursor: default;
}

.cal-cell.complete {
    background: rgba(16, 185, 129, 0.24);
    border-color: rgba(16, 185, 129, 0.55);
    color: #a7f3d0;
}

.cal-cell.partial {
    background: rgba(6, 182, 212, 0.2);
    border-color: rgba(6, 182, 212, 0.5);
    color: #a5f3fc;
}

.cal-cell.low {
    background: rgba(249, 115, 22, 0.22);
    border-color: rgba(249, 115, 22, 0.55);
    color: #fed7aa;
}

.cal-cell.missed {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.45);
    color: #fecaca;
}

.cal-cell.pending_today {
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(255, 255, 255, 0.35);
}

.cal-cell.selected {
    box-shadow: 0 0 0 2px #fff;
}

.cal-cell-pct {
    font-size: 0.62rem;
    font-weight: 700;
    opacity: 0.9;
}

.cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 14px;
    font-size: 0.75rem;
    color: var(--muted);
}

.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; }

/* Weekday Bar Chart (Least Productive Days) */
.weekday-bars {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    align-items: end;
    height: 148px;
    padding-top: 14px;
    margin-bottom: 10px;
}

.wd-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    gap: 6px;
}

.wd-pct-top {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--muted);
}

.wd-bar-bg {
    width: 100%;
    max-width: 30px;
    height: 92px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}

.wd-bar-fill {
    width: 100%;
    border-radius: 8px;
    background: var(--gradient-primary);
    transition: height 0.35s ease;
}

.wd-col.weakest .wd-bar-fill {
    background: linear-gradient(180deg, #f97316, #ef4444);
}

.wd-col.weakest .wd-lbl,
.wd-col.weakest .wd-pct-top {
    color: #fca5a5;
    font-weight: 900;
}

.wd-lbl { font-size: 0.74rem; font-weight: 700; color: var(--muted); }

.unprod-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.unprod-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.85rem;
    transition: border-color 0.15s ease;
}

.unprod-item:hover { border-color: rgba(239, 68, 68, 0.55); }

/* ==========================================================================
   Leaderboard
   ========================================================================== */

.podium-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    align-items: end;
    margin-bottom: 18px;
}

@media (max-width: 600px) {
    .podium-grid { gap: 8px; }
}

.podium-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.podium-card.first {
    border-color: rgba(250, 204, 21, 0.55);
    background: linear-gradient(180deg, rgba(250, 204, 21, 0.14), var(--card) 68%);
    padding-top: 22px;
    padding-bottom: 20px;
}

.podium-card.second {
    border-color: rgba(203, 213, 225, 0.42);
    background: linear-gradient(180deg, rgba(203, 213, 225, 0.1), var(--card) 68%);
}

.podium-card.third {
    border-color: rgba(217, 138, 60, 0.45);
    background: linear-gradient(180deg, rgba(217, 138, 60, 0.11), var(--card) 68%);
}

.podium-medal { font-size: 1.45rem; }
.podium-name {
    font-weight: 800;
    font-size: 0.92rem;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.podium-elo { font-size: 0.82rem; font-weight: 800; color: #34d399; }

.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e293b, #334155);
    border: 2px solid var(--border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.92rem;
    color: var(--text);
    overflow: hidden;
    flex-shrink: 0;
}

.avatar-circle img { width: 100%; height: 100%; object-fit: cover; }

.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.filter-bar .input { flex: 1; min-width: 200px; }

.tier-chips {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 6px;
    margin-bottom: 14px;
}

.tier-chip {
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--muted);
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.tier-chip.active {
    background: rgba(16, 185, 129, 0.18);
    border-color: var(--emerald);
    color: #6ee7b7;
}

.lb-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lb-row {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.lb-row.me {
    border-color: rgba(16, 185, 129, 0.55);
    background: rgba(16, 185, 129, 0.1);
}

.lb-pos {
    font-weight: 900;
    font-size: 1rem;
    text-align: center;
    color: var(--muted);
}

.lb-user {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.lb-user-meta { min-width: 0; }
.lb-username {
    font-weight: 800;
    font-size: 0.94rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-sub {
    font-size: 0.75rem;
    color: var(--muted);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.lb-right {
    text-align: right;
    display: flex;
    align-items: center;
    gap: 10px;
}

.lb-elo-val { font-weight: 900; font-size: 1rem; }
.lb-rank-lbl { font-size: 0.73rem; font-weight: 700; }

/* ==========================================================================
   Profile & Settings
   ========================================================================== */

.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 820px) {
    .profile-grid { grid-template-columns: 1fr; }
}

.notif-status-pill {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 999px;
}
.notif-status-pill.granted { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.notif-status-pill.default { background: rgba(245, 158, 11, 0.2); color: #fde68a; }
.notif-status-pill.denied { background: rgba(239, 68, 68, 0.2); color: #fecaca; }

/* ==========================================================================
   Toasts & Modals
   ========================================================================== */

.toast-container {
    position: fixed;
    top: max(16px, env(safe-area-inset-top));
    right: 16px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 340px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: rgba(18, 24, 38, 0.96);
    border: 1px solid var(--border-strong);
    color: var(--text);
    padding: 12px 15px;
    border-radius: 13px;
    font-size: 0.87rem;
    font-weight: 600;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
    animation: slideIn 0.24s ease;
}

.toast.ok { border-color: rgba(16, 185, 129, 0.6); }
.toast.err { border-color: rgba(239, 68, 68, 0.6); }

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(4, 6, 12, 0.76);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 90;
    animation: fadeIn 0.2s ease;
}

.modal-box {
    width: 100%;
    max-width: 420px;
    background: var(--card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    text-align: center;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.6);
    animation: popIn 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
