/* ═══════════════════════════════════════════════════════════════
   HabitLab — Redesigned CSS v7000
   Aesthetic: Premium editorial · Warm off-white · Strong type
═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;0,9..40,800;1,9..40,400&family=DM+Mono:wght@400;500&display=swap');

/* ─── TOKENS ─── */
:root {
    --primary:       #5B4CF5;      /* Richer indigo */
    --primary-light: #EDE9FE;
    --primary-dark:  #3730A3;
    --accent:        #E040A0;
    --bg:            #F4F2EF;      /* Warm off-white — premium feel */
    --surface:       #FFFFFF;
    --surface-2:     #FAF9F7;
    --text:          #1A1A2E;
    --text-2:        #64748B;
    --text-3:        #94A3B8;
    --border:        #E8E4DC;      /* Slightly warm border */
    --border-2:      #F1EDE8;
    --success:       #059669;
    --success-bg:    #D1FAE5;
    --danger:        #DC2626;
    --danger-bg:     #FEE2E2;
    --warning:       #D97706;
    --warning-bg:    #FEF3C7;
    --radius-sm:     8px;
    --radius:        14px;
    --radius-lg:     20px;
    --radius-xl:     24px;
    --shadow-sm:     0 1px 3px rgba(26,26,46,0.06), 0 1px 2px rgba(26,26,46,0.04);
    --shadow:        0 4px 12px rgba(26,26,46,0.08), 0 1px 3px rgba(26,26,46,0.04);
    --shadow-md:     0 8px 24px rgba(26,26,46,0.10), 0 2px 6px rgba(26,26,46,0.05);
    --shadow-lg:     0 20px 40px rgba(26,26,46,0.15), 0 4px 12px rgba(26,26,46,0.06);
    --font-sans:     'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono:     'DM Mono', 'Courier New', monospace;
}

/* ─── RESET & BASE ─── */
*, *::before, *::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    background: #ffffff;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    background: #ffffff;
    color: var(--text);
    padding-bottom: 0;
    font-size: 14px;
    line-height: 1.5;
    overscroll-behavior-y: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-font-smoothing: antialiased;
}

/* ─── LAYOUT ─── */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px 16px 65px;
    width: 100%;
}

/* ─── CARDS ─── */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-2);
    width: 100%;
}

.card--xp {
    padding: 16px 20px;
    border: 1px solid var(--primary-light);
    background: linear-gradient(135deg, #FAFAFE 0%, #F5F3FF 100%);
}

.card--dark {
    background: linear-gradient(160deg, #1E1B3A 0%, #0F0D1F 100%);
    border: 1px solid rgba(255,255,255,0.06);
    color: white;
}

.card--vacation {
    background: linear-gradient(135deg, #F0FDF4, #DCFCE7);
    border: 1px solid #86EFAC;
}

.card--danger-border {
    border: 1px solid #FECACA;
}

/* Tinted wrapper cards for the action buttons */
#btn-goto-admin.card {
    background: linear-gradient(135deg, #FFFBEB, #FEF3C7);
    border: 1px solid #FDE68A;
}

#btn-goto-super.card {
    background: linear-gradient(135deg, #EDE9FE, #DDD6FE);
    border: 1px solid #C4B5FD;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.card-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

/* ─── HEADER ─── */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    background: #ffffff;
    box-shadow: 0 1px 0 0 #ffffff;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-logo-small {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-light);
    box-shadow: 0 2px 8px rgba(91,76,245,0.15);
}

.app-logo-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 20px;
    border: 3px solid var(--primary-light);
    box-shadow: 0 4px 16px rgba(91,76,245,0.2);
}

.app-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
}

.app-date {
    font-size: 0.72rem;
    color: var(--text-2);
    font-weight: 500;
    margin-top: 1px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.68rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.help-btn {
    background: var(--primary-light);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    color: var(--primary);
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s;
}
.help-btn:hover { background: #DDD6FE; }

/* ─── FORM ELEMENTS ─── */
.inp, select {
    width: 100%;
    padding: 11px 14px;
    margin-bottom: 10px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: var(--font-sans);
    background: var(--surface-2);
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}
.inp:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(91,76,245,0.12);
    background: white;
}

.field-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.section-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin: 0 0 8px;
}

.pass-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 10px;
}
.pass-wrapper input {
    margin-bottom: 0;
    padding-right: 42px;
}
.pass-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    opacity: 0.5;
    font-size: 1rem;
}

input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
    min-height: 44px;
    display: block;
    width: 100%;
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    font-family: var(--font-sans);
}

/* ─── BUTTONS ─── */
.btn {
    width: 100%;
    padding: 13px 20px;
    background: linear-gradient(135deg, var(--primary) 0%, #7C3AED 100%);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 700;
    font-family: var(--font-sans);
    cursor: pointer;
    margin-top: 10px;
    position: relative;
    transition: transform 0.15s, box-shadow 0.15s;
    letter-spacing: 0.01em;
    box-shadow: 0 2px 8px rgba(91,76,245,0.3);
}
.btn:active { transform: scale(0.98); }
.btn:hover { box-shadow: 0 4px 14px rgba(91,76,245,0.35); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn.loading { color: transparent !important; pointer-events: none; }
.btn.loading::after {
    content: "";
    position: absolute;
    left: 50%; top: 50%;
    width: 18px; height: 18px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    transform: translate(-50%, -50%);
}

.btn.ghost, .btn.outline {
    background: transparent;
    color: var(--text-2);
    border: 1.5px solid var(--border);
    box-shadow: none;
}
.btn.ghost:hover { background: var(--surface-2); }

.btn.sm {
    padding: 7px 14px;
    font-size: 0.75rem;
    width: auto;
    margin: 0;
}

.btn.danger { background: var(--danger-bg); color: var(--danger); box-shadow: none; border: 1.5px solid #FECACA; }
.btn.success { background: var(--success-bg); color: var(--success); box-shadow: none; }

.btn--save {
    background: linear-gradient(135deg, #5B4CF5 0%, #E040A0 100%);
    box-shadow: 0 4px 14px rgba(91,76,245,0.3);
}

/* Group Dashboard — warm amber/gold, feels like a "team" action */
.btn--admin {
    background: linear-gradient(135deg, #92400E 0%, #D97706 60%, #F59E0B 100%);
    box-shadow: 0 4px 14px rgba(217,119,6,0.35);
    color: white;
    border: none;
    position: relative;
    overflow: hidden;
}
.btn--admin::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, transparent 60%);
    pointer-events: none;
}

/* Super Console — electric indigo/violet, feels elevated & powerful */
.btn--super {
    background: linear-gradient(135deg, #1E1B4B 0%, #4F46E5 60%, #7C3AED 100%);
    box-shadow: 0 4px 16px rgba(79,70,229,0.4);
    color: white;
    border: none;
    position: relative;
    overflow: hidden;
}
.btn--super::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 60%);
    pointer-events: none;
}

.btn--danger-outline {
    background: transparent;
    color: var(--danger);
    border: 1.5px solid #FECACA;
    box-shadow: none;
}

.btn--logout {
    background: transparent;
    color: var(--danger);
    border: 1.5px solid #FECACA;
    box-shadow: none;
}

@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* ─── AUTH SCREEN ─── */
#auth-screen {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 20000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.auth-wrap {
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.auth-brand {
    text-align: center;
}

.auth-logo {
    width: 72px;
    height: 72px;
    border-radius: 22px;
    object-fit: cover;
    border: 2px solid var(--primary-light);
    box-shadow: 0 8px 24px rgba(91,76,245,0.2);
    margin-bottom: 14px;
}

.auth-title {
    margin: 0 0 6px;
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.04em;
}

.auth-sub {
    margin: 0;
    font-size: 0.88rem;
    color: var(--text-2);
    font-weight: 400;
}

.auth-card {
    background: var(--surface);
    padding: 26px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-2);
    width: 100%;
    max-width: 500px;
    text-align: center;
    max-height: 88vh;
    overflow-y: auto;
}

.auth-card--floating {
    box-shadow: var(--shadow-lg);
}

.form-heading {
    margin: 0 0 20px;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.03em;
    text-align: left;
}

.auth-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.auth-link {
    font-size: 0.85rem;
    color: var(--text-2);
    cursor: pointer;
    transition: color 0.15s;
}
.auth-link:hover { color: var(--text); }
.auth-link--primary { color: var(--primary); font-weight: 700; }
.auth-divider { color: var(--text-3); }

/* ─── PENDING / NO-GROUP SCREENS ─── */
#no-group-screen {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#pending-screen {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pending-wrap {
    text-align: center;
    max-width: 300px;
    padding: 20px;
}

.pending-icon {
    font-size: 4rem;
    animation: float 3s ease-in-out infinite;
    display: block;
    margin-bottom: 16px;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.pending-title {
    margin: 0 0 10px;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.pending-sub {
    color: var(--text-2);
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0 0 24px;
}

.pending-logout {
    width: auto;
    padding: 10px 24px;
}

/* ─── STREAK CARD ─── */
.streak-card {
    background: linear-gradient(145deg, #1E1B3A 0%, #0F0D1F 100%);
    color: white;
    padding: 22px 22px 16px;
    border-radius: var(--radius-xl);
    margin-bottom: 14px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.05);
    transition: transform 0.15s;
}
.streak-card::before {
    content: '';
    position: absolute;
    top: -40px; right: -40px;
    width: 160px; height: 160px;
    background: radial-gradient(circle, rgba(91,76,245,0.3) 0%, transparent 70%);
    pointer-events: none;
}
.streak-card:active { transform: scale(0.99); }

.streak-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.streak-info {}

.freeze-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(56,189,248,0.15);
    border: 1px solid rgba(56,189,248,0.3);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #7DD3FC;
    margin-bottom: 8px;
}

.streak-count-large {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, #fff 0%, #94A3B8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.streak-label {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
    font-weight: 600;
    margin-top: 3px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.streak-img-3d {
    width: 76px;
    height: 76px;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
    transform: rotate(12deg);
}

.streak-hint {
    margin-top: 12px;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.3);
    letter-spacing: 0.03em;
}

/* ─── ANNOUNCEMENT BANNER ─── */
.announce-banner {
    background: linear-gradient(135deg, #5B4CF5 0%, #9333EA 50%, #E040A0 100%);
    color: white;
    padding: 16px 18px;
    border-radius: var(--radius-lg);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(91,76,245,0.35);
}

.announce-orb {
    position: absolute;
    top: -30px; right: -30px;
    width: 100px; height: 100px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    pointer-events: none;
}

.announce-icon {
    font-size: 1.4rem;
    background: rgba(255,255,255,0.15);
    width: 42px; height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    flex-shrink: 0;
    backdrop-filter: blur(10px);
}

.announce-body { flex: 1; position: relative; z-index: 1; }

.announce-eyebrow {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.7;
    margin-bottom: 3px;
}

.announce-text {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.4;
}

.announce-edit {
    background: rgba(255,255,255,0.9);
    color: var(--primary);
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
    flex-shrink: 0;
    font-family: var(--font-sans);
    transition: background 0.15s;
}
.announce-edit:hover { background: white; }

/* ─── SLIDERS & CHECKLIST ─── */
.slider-card {
    background: var(--surface-2);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    border: 1.5px solid var(--border-2);
    transition: border-color 0.2s, background 0.2s;
}
.slider-card.locked {
    border-color: var(--success);
    background: #F0FDF4;
}
.slider-card.locked .slider-head::after {
    content: "✅ Saved";
    font-size: 0.72rem;
    color: var(--success);
    font-weight: 700;
}

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

.slider-val {
    background: var(--primary);
    color: white;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    min-width: 58px;
    text-align: center;
}

input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 10px;
    background: var(--border);
    outline: none;
    cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(91,76,245,0.3);
}

.check-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
}

.check-item {
    padding: 13px 10px;
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    text-align: center;
    color: var(--text-2);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.3;
}
.check-item:active { transform: scale(0.97); }
.check-item.selected {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}
.check-item.negative.selected {
    background: var(--danger-bg);
    border-color: var(--danger);
    color: var(--danger);
}

/* ─── DATE TOGGLE ─── */
.date-toggle {
    display: flex;
    background: var(--surface-2);
    padding: 3px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.date-opt {
    padding: 5px 12px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 0.78rem;
    color: var(--text-2);
    font-weight: 600;
    transition: all 0.15s;
}
.date-opt.active {
    background: white;
    color: var(--primary);
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

/* ─── TOGGLE GROUP ─── */
.toggle-group {
    display: flex;
    background: var(--surface-2);
    padding: 3px;
    border-radius: 10px;
    margin-bottom: 18px;
    border: 1px solid var(--border);
}

.toggle-opt {
    flex: 1;
    text-align: center;
    padding: 9px;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 8px;
    color: var(--text-2);
    font-weight: 500;
    transition: all 0.15s;
    font-family: var(--font-sans);
}
.toggle-opt.active {
    background: white;
    color: var(--text);
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

/* ─── RANK TAB ─── */
.group-banner {
    background: linear-gradient(135deg, var(--primary) 0%, #7C3AED 100%);
    border-radius: var(--radius-xl);
    margin-bottom: 14px;
    padding: 22px 22px;
    box-shadow: 0 8px 24px rgba(91,76,245,0.3);
    position: relative;
    overflow: hidden;
}
.group-banner::after {
    content: '';
    position: absolute;
    bottom: -30px; right: -30px;
    width: 120px; height: 120px;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
    pointer-events: none;
}

.group-banner-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    color: white;
}

.group-banner-eyebrow {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.7;
    margin-bottom: 4px;
}

.group-banner-name {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
}

.group-banner-code {
    font-size: 0.75rem;
    background: rgba(255,255,255,0.15);
    padding: 4px 10px;
    border-radius: 20px;
    color: rgba(255,255,255,0.85);
    font-weight: 600;
    font-family: var(--font-mono);
    border: 1px solid rgba(255,255,255,0.2);
    white-space: nowrap;
}

/* ─── RANK ROWS ─── */
.rank-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    border: 1px solid var(--border-2);
    background: var(--surface-2);
    transition: background 0.15s;
}
.rank-row.highlight {
    background: linear-gradient(135deg, #EFF6FF, #F0F9FF);
    border: 1px solid #BFDBFE;
}
.rank-medal {
    width: 28px;
    font-size: 1.2rem;
    text-align: center;
    line-height: 1;
}
.rank-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    margin-right: 6px;
    text-transform: uppercase;
}

/* ─── PROFILE COMPONENTS ─── */
.vacation-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.vacation-title {
    margin: 0 0 3px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #166534;
}

.vacation-sub {
    font-size: 0.75rem;
    color: #15803D;
}

.dark-card-title {
    margin-top: 0;
    margin-bottom: 16px;
    color: #F8FAFC;
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dark-card-tag {
    font-size: 0.65rem;
    background: rgba(255,255,255,0.1);
    padding: 2px 8px;
    border-radius: 10px;
    color: #94A3B8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ─── NAVIGATION ─── */
.nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #ffffff;
    border-top: 1px solid var(--border-2);
    display: flex;
    justify-content: space-around;
    padding: 8px 0 env(safe-area-inset-bottom, 0px);
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(26,26,46,0.06);
}

.nav-item {
    border: none;
    background: none;
    color: var(--text-3);
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.62rem;
    font-weight: 600;
    font-family: var(--font-sans);
    padding: 4px 8px;
    flex: 1;
    cursor: pointer;
    transition: color 0.15s;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.nav-item.active { color: var(--primary); }
.nav-item svg { width: 21px; height: 21px; fill: currentColor; margin-bottom: 3px; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ─── TOOLS TAB ─── */
.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}

.stat-card {
    background: var(--surface-2);
    padding: 14px;
    border-radius: var(--radius-sm);
    text-align: center;
    border: 1px solid var(--border);
}

.stat-val {
    font-weight: 800;
    color: var(--primary);
    font-size: 1.1rem;
    margin-top: 4px;
}

.stat-label {
    font-size: 0.72rem;
    color: var(--text-2);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.macro-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-top: 14px;
}

.macro-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 8px;
    text-align: center;
}

.macro-val {
    font-weight: 800;
    color: var(--text);
    font-size: 1rem;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-2);
    margin-bottom: 12px;
}

.result-label { font-weight: 600; color: var(--text); }
.result-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--success);
}

.goal-insight {
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-2);
    border: 1px solid var(--border);
    margin-top: 12px;
}

.disclaimer-box {
    margin-top: 20px;
    font-size: 0.75rem;
    color: var(--text-3);
    background: var(--surface-2);
    padding: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    line-height: 1.6;
    text-align: left;
}

.bmi-track {
    position: relative;
    height: 10px;
    background: linear-gradient(90deg, #3b82f6 0%, #3b82f6 18.5%, #10b981 18.5%, #10b981 49.9%, #f59e0b 50%, #f59e0b 69.9%, #ef4444 70%, #ef4444 100%);
    border-radius: 10px;
    margin: 14px 0 5px;
    width: 100%;
}
.bmi-marker {
    position: absolute;
    top: -7px;
    width: 4px; height: 24px;
    background: var(--text);
    border: 1px solid white;
    transform: translateX(-50%);
    border-radius: 2px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: left 0.5s ease-out;
}
.bmi-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--text-3);
    margin-bottom: 14px;
}
.bmi-labels span {
    font-size: 0.65rem;
    width: 20%;
    text-align: center;
}

.meal-split-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}
.meal-card {
    background: white;
    border: 1px solid var(--border);
    padding: 10px 5px;
    border-radius: var(--radius-sm);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.meal-title { font-size: 0.7rem; color: var(--text-2); margin-bottom: 2px; }
.meal-val { font-weight: 700; color: var(--text); font-size: 0.9rem; }

/* ─── CALENDAR / STREAK MODAL ─── */
#calendar-modal {
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 20px;
}

.glass-modal {
    background: linear-gradient(180deg, #1E1B3A 0%, #0F0D1F 100%);
    color: white;
    padding: 26px 26px 28px;
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 30px 60px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.08);
    /* Critical: prevent the modal card itself from ever clipping content */
    overflow: visible;
    /* Make it scroll as a unit on very small phones */
    max-height: 92dvh;
    overflow-y: auto;
    /* Hide the scrollbar visually but still allow scroll */
    scrollbar-width: none;
}
.glass-modal::-webkit-scrollbar { display: none; }

/* Close button inside glass-modal must always be white & visible */
.glass-modal .btn.ghost,
.btn--cal-close {
    display: block;
    width: 100%;
    margin-top: 20px;
    background: rgba(255,255,255,0.10) !important;
    color: white !important;
    border: 1px solid rgba(255,255,255,0.22) !important;
    box-shadow: none !important;
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: background 0.15s;
}
.glass-modal .btn.ghost:hover,
.btn--cal-close:hover {
    background: rgba(255,255,255,0.18) !important;
}

.streak-modal-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    margin: 18px 0;
}

.streak-modal-stat { text-align: center; }

.streak-modal-num {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.streak-modal-lbl {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 600;
}

.streak-modal-divider {
    width: 1px;
    height: 40px;
    background: rgba(255,255,255,0.1);
}

.cal-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.cal-title {
    font-size: 1rem;
    font-weight: 700;
}

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

.cal-day-name {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.4);
    font-weight: 700;
    text-transform: uppercase;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.cal-day {
    width: 34px; height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin: 0 auto;
    background: rgba(255,255,255,0.04);
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255,255,255,0.4);
    border: 2px solid transparent;
    transition: all 0.2s;
}
.cal-day.active {
    background: rgba(251,191,36,0.12) !important;
    border: 2px solid #FBBF24 !important;
    color: white;
    box-shadow: 0 0 14px rgba(251,191,36,0.4);
    font-size: 1.1rem;
    transform: scale(1.1);
}
.cal-day.freeze {
    background: rgba(56,189,248,0.12) !important;
    border: 2px solid #38BDF8 !important;
    color: #7DD3FC;
    box-shadow: 0 0 10px rgba(56,189,248,0.25);
}
.cal-day.vacation {
    background: rgba(16,185,129,0.12) !important;
    border: 2px solid #10B981 !important;
    color: #6EE7B7;
    box-shadow: 0 0 10px rgba(16,185,129,0.25);
}

.cal-btn {
    background: rgba(255,255,255,0.08);
    border: none;
    color: white;
    width: 32px; height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    transition: background 0.15s;
}
.cal-btn:hover { background: rgba(255,255,255,0.15); }

/* ─── MODALS ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,10,20,0.75);
    z-index: 30000;
    padding: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    text-align: left;
}

.modal-icon {
    font-size: 1.6rem;
    background: var(--primary-light);
    width: 48px; height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.modal-title {
    margin: 0 0 4px;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text);
}

.modal-sub {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-2);
}

.modal-divider {
    border: none;
    border-top: 1px solid var(--border-2);
    margin: 18px 0 14px;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
}

.vac-used-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 16px;
}
.vac-used-label {
    font-size: 0.78rem;
    color: var(--primary-dark);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.vac-used-count {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.feat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 6px;
}

.feat-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 10px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
}

/* ─── PAGINATION ─── */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    align-items: center;
    margin-top: 14px;
}
.pagination span {
    font-size: 0.82rem;
    color: var(--text-2);
    font-weight: 600;
}

/* ─── PENDING REQUESTS ─── */
#pending-card {
    border: 1px solid var(--warning);
    background: var(--warning-bg);
    margin-bottom: 14px;
}
#pending-card h3 {
    color: var(--warning);
    margin-top: 0;
}

/* ─── ATTENDANCE TABLE ─── */
.table-container { width: 100%; overflow-x: hidden; margin-bottom: 5px; }
/* ─── ATTENDANCE MODERN ─── */
.att-modern {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface);
}
.att-row {
    display: grid;
    grid-template-columns: 130px repeat(7, 1fr);
    align-items: center;
    border-bottom: 1px solid var(--border-2);
    background: white;
    transition: background 0.1s;
}
.att-row:last-child { border-bottom: none; }
.att-row-alt { background: #fafbfc; }
.att-row:not(.att-header):hover { background: #f0f4ff; }
.att-header {
    background: var(--surface-2) !important;
    border-bottom: 2px solid var(--border) !important;
    position: sticky; top: 0; z-index: 5;
}
.att-name-col {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 8px;
    position: sticky; left: 0;
    background: inherit;
    z-index: 4;
    border-right: 1px solid var(--border-2);
    min-width: 0;
}
.att-avatar {
    width: 20px; height: 20px;
    border-radius: 50%;
    font-size: 0.5rem;
    font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}
.att-uname {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}
.att-week-score {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-3);
    background: var(--surface-2);
    border-radius: 4px;
    padding: 1px 4px;
    white-space: nowrap;
    flex-shrink: 0;
}
.att-day-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5px 1px;
    position: relative;
}
.att-today-col { background: rgba(91,76,245,0.04); }
.att-dname {
    display: block;
    font-size: 0.5rem;
    color: var(--text-3);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1;
    margin-bottom: 2px;
}
.att-dnum {
    display: block;
    font-size: 0.72rem;
    color: var(--text-2);
    font-weight: 700;
    line-height: 1;
}
.att-today-num {
    color: #5B4CF5;
    background: rgba(91,76,245,0.12);
    border-radius: 4px;
    padding: 1px 3px;
}
.att-pip {
    display: block;
    width: 9px; height: 9px;
    border-radius: 50%;
    background: #e2e8f0;
    transition: transform 0.15s;
}
.att-pip-on {
    background: #10b981;
    box-shadow: 0 0 0 2.5px rgba(16,185,129,0.2);
    transform: scale(1.15);
}
/* Legacy compat - keep dot for any old code */
.att-dot { display:inline-block; width:8px; height:8px; border-radius:50%; background:var(--border); }
.att-dot.present { background:var(--success); box-shadow:0 0 0 2px var(--success-bg); }
.att-day-name { display:block; font-size:0.5rem; color:var(--text-3); font-weight:600; line-height:1; margin-bottom:2px; }
.att-day-num { display:block; font-size:0.7rem; color:var(--text); font-weight:800; line-height:1; }


/* ─── ATTENDANCE PAGINATION ─── */
.att-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface-2);
    border-top: 1px solid var(--border);
}
.att-pg-btn {
    width: 28px; height: 28px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: white;
    color: var(--text-2);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
    line-height: 1;
}
.att-pg-btn:hover:not(:disabled) { background: #5B4CF5; color: white; border-color: #5B4CF5; }
.att-pg-btn:disabled { opacity: 0.35; cursor: default; }
.att-pg-info {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-3);
    min-width: 70px;
    text-align: center;
}

/* ─── ATTENDANCE NAV ─── */
.att-nav-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 6px;
}
.att-month-nav, .att-week-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}
.att-nav-btn {
    width: 26px; height: 26px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.1s;
    line-height: 1;
}
.att-nav-btn:hover { background: #5B4CF5; color: white; border-color: #5B4CF5; }
.att-nav-lbl {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text);
    min-width: 70px;
    text-align: center;
    background: var(--surface-2);
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

/* ─── VACATION CARDS ─── */
.vac-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.vac-info { display: flex; flex-direction: column; gap: 3px; }
.vac-date { font-weight: 700; color: var(--text); font-size: 0.9rem; }
.vac-days { font-size: 0.72rem; color: var(--text-2); background: var(--surface-2); padding: 2px 8px; border-radius: 10px; width: fit-content; }

/* ─── XP BAR ─── */
.xp-track {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.xp-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 10px;
    transition: width 0.8s ease-out;
}

/* ─── LEVEL MAP ─── */
.level-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text-3);
}
.level-row.unlocked {
    background: white;
    color: var(--text);
    border-color: var(--border);
}
.level-row.current {
    background: #F0F9FF;
    border: 1px solid #BAE6FD;
    color: #0369A1;
    box-shadow: 0 2px 8px rgba(14,165,233,0.12);
}

/* ─── TOAST NOTIFICATIONS ─── */
#toast-container {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    width: 90%;
    max-width: 380px;
}
.toast {
    background: var(--text);
    color: white;
    padding: 12px 18px;
    border-radius: 50px;
    font-size: 0.88rem;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(26,26,46,0.25);
    opacity: 0;
    transform: translateY(16px);
    transition: all 0.25s ease;
    text-align: center;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-sans);
}
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* ─── SKELETON ─── */
.skeleton {
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--border-2) 50%, var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
    color: transparent !important;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ─── PLAN BADGES ─── */
.plan-elite { background: #FFFBEB; color: #B45309; border-color: #FCD34D; }
.plan-pro   { background: #EFF6FF; color: #1D4ED8; border-color: #93C5FD; }
.plan-basic { background: #F0FDF4; color: #15803D; border-color: #86EFAC; }

/* ═══════════════════════════════════════════════════
   BADGES (Profile Tab) — Redesigned grid
═══════════════════════════════════════════════════ */

/* Outer wrapper injected by gamification.js */
#profile-badges-area > div {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 10px !important;
    padding: 4px 0 !important;
}

/* Each badge item (the inline div rendered by renderProfileBadges) */
#profile-badges-area [style*="text-align:center"],
#profile-badges-area [style*="text-align: center"] {
    background: rgba(255,255,255,0.06) !important;
    border-radius: 12px !important;
    padding: 12px 6px !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    transition: transform 0.15s, box-shadow 0.15s !important;
    min-height: 80px;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Earned badge glow — applied via opacity:1 filter:none from gamification.js */
#profile-badges-area [style*="opacity: 1"],
#profile-badges-area [style*="opacity:1"] {
    background: rgba(255,255,255,0.1) !important;
    border: 1px solid rgba(255,255,255,0.18) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important;
}

/* Badge icon size */
#profile-badges-area [style*="font-size:1.5rem"],
#profile-badges-area [style*="font-size: 1.5rem"] {
    font-size: 1.6rem !important;
    margin-bottom: 5px !important;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

/* Badge name */
#profile-badges-area [style*="font-size:0.6rem"],
#profile-badges-area [style*="font-size: 0.6rem"] {
    font-size: 0.62rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.02em !important;
    color: rgba(255,255,255,0.9) !important;
}

/* Badge status (Earned / Lvl N) */
#profile-badges-area [style*="font-size:0.55rem"],
#profile-badges-area [style*="font-size: 0.55rem"] {
    font-size: 0.56rem !important;
    color: rgba(255,255,255,0.45) !important;
}

/* ═══════════════════════════════════════════════════
   HALL OF FAME (Trophy Room) — Redesigned 3-col grid
═══════════════════════════════════════════════════ */

#trophy-room-container > div {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 10px !important;
    width: 100% !important;
}

.trophy-card {
    padding: 14px 8px;
    border-radius: 14px;
    text-align: center;
    color: white;
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.18);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 90px;
    transition: transform 0.15s, box-shadow 0.15s;
}
.trophy-card:not(.locked):hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(0,0,0,0.3);
}

.season-icon {
    font-size: 1.6rem;
    margin-bottom: 5px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.35));
}
.season-rank {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.2;
}
.season-xp {
    font-size: 0.6rem;
    margin-top: 5px;
    background: rgba(0,0,0,0.25);
    padding: 2px 7px;
    border-radius: 10px;
    display: inline-block;
}
.season-date { font-size: 0.6rem; opacity: 0.75; margin-bottom: 4px; }

/* League gradients */
.league-titan   { background: linear-gradient(145deg, #F59E0B 0%, #D97706 60%, #78350F 100%); border-color: rgba(251,191,36,0.6); box-shadow: 0 6px 20px rgba(245,158,11,0.35); }
.league-champ   { background: linear-gradient(145deg, #F43F5E 0%, #BE123C 60%, #881337 100%); border-color: rgba(244,63,94,0.5);  box-shadow: 0 6px 20px rgba(190,18,60,0.35); }
.league-master  { background: linear-gradient(145deg, #818CF8 0%, #4F46E5 60%, #312E81 100%); border-color: rgba(129,140,248,0.5); box-shadow: 0 6px 20px rgba(79,70,229,0.35); }
.league-crystal { background: linear-gradient(145deg, #E879F9 0%, #C026D3 60%, #7E22CE 100%); border-color: rgba(232,121,249,0.5); box-shadow: 0 6px 20px rgba(192,38,211,0.3); }
.league-gold    { background: linear-gradient(145deg, #FDE68A 0%, #FACC15 50%, #CA8A04 100%); border-color: rgba(250,204,21,0.6);  box-shadow: 0 6px 20px rgba(202,138,4,0.3); color: #1A1A00; }
.league-silver  { background: linear-gradient(145deg, #CBD5E1 0%, #94A3B8 60%, #475569 100%); border-color: rgba(203,213,225,0.5); box-shadow: 0 4px 12px rgba(71,85,105,0.3); }

.trophy-card.locked {
    filter: grayscale(1);
    opacity: 0.45;
    border: 1.5px dashed rgba(255,255,255,0.12) !important;
    background: rgba(255,255,255,0.04) !important;
    box-shadow: none !important;
    cursor: not-allowed;
}
.trophy-card.locked .season-rank { opacity: 0.5; }

/* ─── HELP MODAL ─── */
/* ─── PART 5: APP GUIDE MODAL — Frosted glass premium redesign ─── */
/* Modal shell: frosted glass */
#help-modal .auth-card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(91, 76, 245, 0.12);
    box-shadow: 0 24px 60px rgba(0,0,0,0.15), 0 0 0 1px rgba(255,255,255,0.6) inset;
    padding: 24px;
}
/* Accordion item */
.help-item {
    background: rgba(248, 247, 255, 0.8);
    border: 1px solid rgba(91, 76, 245, 0.10);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.help-item[open] {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 4px 18px rgba(91,76,245,0.13);
}
/* Summary row */
.help-item summary {
    padding: 14px 16px;
    cursor: pointer;
    font-weight: 700;
    color: var(--text);
    font-size: 0.88rem;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    user-select: none;
}
.help-item summary::-webkit-details-marker { display: none; }
/* Icon circle */
.help-item summary .guide-icon {
    width: 28px; height: 28px;
    background: linear-gradient(135deg, #ede9fe, #ddd6fe);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.help-item[open] summary .guide-icon {
    background: linear-gradient(135deg, #5B4CF5, #818cf8);
}
/* Chevron */
.help-item summary::after {
    content: "›";
    font-size: 1.4rem;
    color: var(--text-3);
    font-weight: 300;
    transform: rotate(90deg);
    transition: transform 0.25s ease;
    flex-shrink: 0;
    line-height: 1;
}
.help-item[open] summary::after {
    transform: rotate(270deg);
    color: var(--primary);
}
/* Body */
.help-body {
    padding: 4px 16px 16px;
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text-2);
    border-top: 1px solid rgba(91,76,245,0.08);
    animation: guideSlideIn 0.2s ease;
}
@keyframes guideSlideIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.help-body ul, .help-body ol { padding-left: 20px; margin: 10px 0; }
.help-body li { margin-bottom: 6px; }
.help-body p { margin: 8px 0; }

/* ─── MISC ─── */
.footer {
    text-align: center;
    color: var(--text-3);
    font-size: 0.72rem;
    padding: 24px 0 8px;
}

header h2 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* Admin panel specific */
#btn-super-float { bottom: 90px !important; right: 20px !important; z-index: 999; }

/* ─── MOBILE REFINEMENTS ─── */
@media (max-width: 380px) {
    .streak-count-large { font-size: 2.8rem; }
    .group-banner-name { font-size: 1.3rem; }
    .check-grid { grid-template-columns: 1fr 1fr; gap: 7px; }
}

/* ═══════════════════════════════════════════════════
   GROUP ADMIN PANEL — Override inline styles from admin.js
   Matches the visual design of the attached screenshot:
   Sales Demo (indigo) → Danger Zone (red) → Insights (amber)
   → Reports (blue) → Manage Group → Members → Attendance
═══════════════════════════════════════════════════ */

/* Admin container base — inside scrollable div, no overflow issues */
#app-admin .container {
    padding-top: 0 !important;
    padding-bottom: max(40px, env(safe-area-inset-bottom, 20px)) !important;
    overflow: visible !important;
}

/* Main app content container — bottom clearance handled by login.php inline style */

/* First card after the header should not have extra top margin */
#app-admin #admin-content-area > .card:first-child {
    margin-top: 0 !important;
}


/* All admin cards */
#app-admin .card {
    border-radius: var(--radius-lg) !important;
    padding: 18px !important;
    margin-bottom: 14px !important;
    box-shadow: var(--shadow-sm) !important;
}

/* ── Sales Demo card ── */
#app-admin .card[style*="linear-gradient(135deg, #4f46e5"],
#app-admin .card[style*="linear-gradient(135deg,#4f46e5"] {
    background: linear-gradient(135deg, #5B4CF5 0%, #818CF8 100%) !important;
    border: none !important;
    box-shadow: 0 6px 20px rgba(91,76,245,0.35) !important;
    border-radius: var(--radius-lg) !important;
}
#app-admin .card[style*="linear-gradient(135deg, #4f46e5"] h3,
#app-admin .card[style*="linear-gradient(135deg,#4f46e5"] h3 {
    font-size: 1rem !important;
    font-weight: 800 !important;
    letter-spacing: -0.01em !important;
}
/* "Create & Copy Link" button inside sales demo card */
#btn-gen-demo {
    border-radius: var(--radius-sm) !important;
    font-size: 0.9rem !important;
    font-weight: 800 !important;
    padding: 13px !important;
    letter-spacing: 0.01em !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18) !important;
}

/* ── Danger Zone card ── */
#app-admin .card[style*="border:1px solid #ef4444"],
#app-admin .card[style*="border: 1px solid #ef4444"] {
    background: #FFF5F5 !important;
    border: 1.5px solid #FECACA !important;
    border-radius: var(--radius-lg) !important;
}
#app-admin .card[style*="border:1px solid #ef4444"] h3 {
    font-size: 0.95rem !important;
    font-weight: 800 !important;
}
#app-admin .card[style*="border:1px solid #ef4444"] button.btn {
    border-radius: var(--radius-sm) !important;
    font-weight: 700 !important;
}

/* ── Pending card ── */
#pending-card {
    background: #FFFBEB !important;
    border: 1.5px solid #FCD34D !important;
    border-radius: var(--radius-lg) !important;
}
#pending-card h3 {
    color: #92400E !important;
    font-weight: 800 !important;
}

/* ── Coach's Insights card ── */
#app-admin .card[style*="border-left: 4px solid #f59e0b"],
#app-admin .card[style*="border-left:4px solid #f59e0b"] {
    border-left: 4px solid #F59E0B !important;
    border-radius: var(--radius-lg) !important;
    background: var(--surface) !important;
}
#app-admin #coach-insights {
    font-size: 0.87rem !important;
}
/* "Nudge" buttons inside coach insights */
#app-admin .card button.btn[onclick*="Nudge"],
#app-admin .card button[onclick*="nudge"] {
    background: #FEF3C7 !important;
    color: #92400E !important;
    border: 1px solid #FCD34D !important;
    box-shadow: none !important;
    font-size: 0.78rem !important;
    padding: 5px 12px !important;
    border-radius: 20px !important;
    width: auto !important;
    margin: 0 !important;
}

/* ── Reports card ── */
#app-admin .card[style*="background:#f0f9ff"],
#app-admin .card[style*="background: #f0f9ff"] {
    background: linear-gradient(135deg, #F0F9FF, #E0F2FE) !important;
    border: 1.5px solid #BAE6FD !important;
    border-radius: var(--radius-lg) !important;
}
#app-admin .card[style*="background:#f0f9ff"] h3 {
    color: #0369A1 !important;
    font-weight: 800 !important;
    font-size: 0.95rem !important;
}
/* Report buttons (2x2 grid) */
#app-admin .card[style*="background:#f0f9ff"] button.btn.sm {
    border-radius: 10px !important;
    padding: 10px 8px !important;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    width: 100% !important;
    border: 1.5px solid #BAE6FD !important;
    background: white !important;
    color: #0369A1 !important;
    box-shadow: var(--shadow-sm) !important;
}
/* Reset Today's Data button */
#btn-reset-lb {
    background: #FEE2E2 !important;
    color: #DC2626 !important;
    border: 1.5px solid #FECACA !important;
    box-shadow: none !important;
    border-radius: var(--radius-sm) !important;
    font-weight: 700 !important;
}

/* ── Manage Group card ── */
#app-admin .card #admin-code {
    background: var(--surface-2) !important;
    border-radius: var(--radius-sm) !important;
    border: 1.5px solid var(--border) !important;
    padding: 12px !important;
    font-family: var(--font-mono) !important;
    font-size: 1.1rem !important;
    letter-spacing: 0.12em !important;
    color: var(--primary) !important;
    font-weight: 700 !important;
}

/* ── Members search + list ── */
#app-admin .search-injected input {
    border-radius: var(--radius-sm) !important;
    border: 1.5px solid var(--border) !important;
    background: var(--surface-2) !important;
    font-size: 0.88rem !important;
}
#app-admin #list-members .rank-row {
    border-radius: var(--radius-sm) !important;
    background: var(--surface-2) !important;
    border: 1px solid var(--border-2) !important;
}

/* ── Attendance card ── */
#app-admin .card #attendance-grid {
    border-radius: var(--radius-sm) !important;
}

/* ── Nudge card ── */
#app-admin .card h3[id],
#app-admin .card h3 + #list-nudge {
    font-size: 0.85rem !important;
    color: var(--text-2) !important;
}

/* ── Activity Log card ── */
#app-admin #group-audit-body tr {
    border-bottom: 1px solid var(--border-2) !important;
}
#app-admin #group-audit-body td {
    font-size: 0.82rem !important;
    color: var(--text) !important;
    padding: 10px 8px !important;
}

/* ── Admin Back button + header ── */
#app-admin header .btn.sm.outline {
    border-color: var(--border) !important;
    color: var(--text-2) !important;
    border-radius: var(--radius-sm) !important;
    font-weight: 600 !important;
}


/* ═══════════════════════════════════════════════════════════════
   PART 11 — MOTIVATION UI: Podium, Badges, Hall of Fame
═══════════════════════════════════════════════════════════════ */

/* Podium container responsive */
#list-rank > div:first-child {
    overflow: hidden;
}

/* Podium: stack items vertically on very small screens */
@media (max-width: 360px) {
    #list-rank > div:first-child > div {
        flex-direction: column !important;
        align-items: center !important;
    }
    #list-rank > div:first-child > div > div {
        max-width: 100% !important;
        width: 100% !important;
    }
}

/* Badge card hover lift */
#profile-badges-area > div > div {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
#profile-badges-area > div > div:hover {
    transform: translateY(-2px) scale(1.04);
}

/* ─── PART 4: BADGES GRID REFINEMENT ─── */
/* Lifetime best pill — shown in card header via JS */
.badge-lifetime-pill {
    font-size: 0.65rem;
    background: linear-gradient(135deg, rgba(91,76,245,0.15), rgba(129,140,248,0.15));
    border: 1px solid rgba(91,76,245,0.25);
    color: #818cf8;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 700;
    letter-spacing: 0.3px;
    margin-left: auto;
    white-space: nowrap;
}
/* Badge grid: 4-col desktop, 2-col mobile, equal height */
.badge-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    width: 100%;
}
@media (max-width: 480px) {
    .badge-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}
/* Badge card */
.badge-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 12px 6px 10px;
    border-radius: 12px;
    min-height: 80px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: default;
}
.badge-card:hover {
    transform: translateY(-2px) scale(1.04);
}
.badge-card .badge-lock {
    position: absolute;
    top: 5px; right: 6px;
    font-size: 0.55rem;
    opacity: 0.45;
    line-height: 1;
}
.badge-card .badge-icon {
    font-size: 1.6rem;
    margin-bottom: 5px;
    line-height: 1;
}
.badge-card .badge-name {
    font-size: 0.62rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    letter-spacing: 0.2px;
}
.badge-card .badge-sub {
    font-size: 0.55rem;
    margin-top: 3px;
    font-weight: 500;
}

/* Hall of Fame card hover */
#trophy-room-container > div > div {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
#trophy-room-container > div > div:hover {
    transform: translateY(-2px);
}

/* Hall of Fame 2-col on mobile */
@media (max-width: 480px) {
    #trophy-room-container > div {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ─── PART 2: HALL OF FAME WINNERS ─── */
.hof-season {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
.hof-season:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.hof-season-title {
    font-size: 0.7rem;
    font-weight: 800;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 8px;
}
.hof-podium {
    display: flex;
    gap: 6px;
}
.hof-medal {
    flex: 1;
    background: rgba(255,255,255,0.06);
    border-radius: 10px;
    padding: 8px 4px;
    text-align: center;
    font-size: 0.72rem;
}
.hof-medal-icon { font-size: 1.1rem; display: block; margin-bottom: 3px; }
.hof-medal-name {
    color: rgba(255,255,255,0.85);
    font-weight: 700;
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
}

/* ═══════════════════════════════════════════════════════
   PARTS 1B + 2 + 3 + 4 + 5 — COACH INSIGHTS UPGRADE
   Risk sections, nudge pills, flame badge, trend block
   ═══════════════════════════════════════════════════════ */

/* ── Risk accordion (details/summary) ── */
.risk-section {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid transparent;
    transition: border-color 0.2s;
}
.risk-section[open] {
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
.risk-header {
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.82rem;
    user-select: none;
    border-radius: 10px;
    transition: background 0.15s;
}
.risk-header::-webkit-details-marker { display: none; }
.risk-header--high  { background: #fff5f5; color: #b91c1c; border: 1px solid #fecaca; }
.risk-header--medium{ background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.risk-section[open] .risk-header--high   { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.risk-section[open] .risk-header--medium { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.risk-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.1);
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 5px;
}
.risk-chevron {
    font-size: 1.2rem;
    font-weight: 300;
    color: inherit;
    opacity: 0.6;
    transform: rotate(90deg);
    transition: transform 0.22s ease;
    line-height: 1;
}
.risk-section[open] .risk-chevron { transform: rotate(270deg); }

/* ── Risk rows inside accordion body ── */
.risk-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 10px 10px;
    background: #fafafa;
    border: 1px solid #f1f5f9;
    border-top: none;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
    animation: riskBodyIn 0.18s ease;
}
@keyframes riskBodyIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Report download buttons ── */
.report-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    border: 1px solid #bae6fd;
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
    color: #0369a1;
    text-align: left;
    transition: box-shadow 0.15s, background 0.15s;
    width: 100%;
}
.report-btn:hover {
    background: #f0f9ff;
    box-shadow: 0 2px 8px rgba(14,165,233,0.12);
}
.member-action-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    cursor: pointer;
    transition: box-shadow 0.15s, opacity 0.15s;
    flex-shrink: 0;
    padding: 0;
}
.member-action-btn:hover { box-shadow: 0 2px 6px rgba(0,0,0,0.1); opacity: 0.85; }
.member-action-btn.member-action-pay {
    background: #10b981;
    border-color: #10b981;
    color: white;
    font-weight: 800;
    font-size: 1rem;
}

.nudge-btn {
    flex-shrink: 0;
    min-width: 72px;
    height: 34px;
    border-radius: 8px !important;
    padding: 0 12px !important;
    font-size: 0.78rem !important;
    font-weight: 700 !important;
    background: white !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: box-shadow 0.2s, opacity 0.2s;
    white-space: nowrap;
}
.nudge-active {
    background: #eff6ff !important;
    border-color: #93c5fd !important;
    color: #1d4ed8 !important;
    box-shadow: 0 0 0 0 rgba(99,102,241,0);
    animation: nudgePulse 2.4s ease-in-out infinite;
}
@keyframes nudgePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99,102,241,0.0); }
    50%       { box-shadow: 0 0 0 4px rgba(99,102,241,0.18); }
}
.nudge-cooldown {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
    color: #94a3b8 !important;
}

/* ── Nudge permission pills in member list ── */
.nudge-pill {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    letter-spacing: 0.2px;
    white-space: nowrap;
}
.nudge-pill--on {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}
.nudge-pill--off {
    background: #f1f5f9;
    color: #94a3b8;
    border: 1px solid #e2e8f0;
}

/* ── "Next Priority" flame badge in member list ── */
.flame-priority {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.6rem;
    font-weight: 800;
    color: #ef4444;
    background: #fff5f5;
    border: 1px solid #fecaca;
    padding: 2px 7px;
    border-radius: 10px;
    white-space: nowrap;
    animation: flamePop 1.8s ease-in-out infinite;
}
@keyframes flamePop {
    0%, 100% { opacity: 1;   transform: scale(1); }
    50%       { opacity: 0.8; transform: scale(1.04); }
}

/* ── Habit trend block (Part 4) ── */
.habit-trend-block {
    margin-top: 12px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    border-left: 4px solid #6366f1;
}
.habit-trend-label {
    font-size: 0.7rem;
    font-weight: 800;
    color: #6366f1;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════
   PARTS 1–4 — COACH ENGINE UPGRADE: KPI Strip, ESI Badge, Weekly Modal
   ════════════════════════════════════════════════════════════════════════ */

/* ── PART 4: KPI Strip ──────────────────────────────────────────────── */
.kpi-strip {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}
@media (max-width: 540px) {
    .kpi-strip { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 360px) {
    .kpi-strip { grid-template-columns: repeat(2, 1fr); }
}

.kpi-tile {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 6px 8px;
    text-align: center;
    transition: box-shadow 0.15s;
}
.kpi-tile:hover {
    box-shadow: 0 2px 8px rgba(91, 76, 245, 0.10);
    border-color: #c7d2fe;
}
.kpi-icon {
    font-size: 1.1rem;
    line-height: 1;
    margin-bottom: 4px;
}
.kpi-val {
    font-size: 1.15rem;
    font-weight: 900;
    color: #1e293b;
    line-height: 1.1;
    margin-bottom: 3px;
}
.kpi-val--name {
    font-size: 0.72rem;
    font-weight: 800;
    color: #5B4CF5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
}
.kpi-label {
    font-size: 0.58rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    line-height: 1.2;
}

/* ── PART 3: ESI Badge ──────────────────────────────────────────────── */
.esi-badge {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 10px;
    letter-spacing: 0.3px;
    white-space: nowrap;
    /* background and color set inline based on score tier */
}

/* ── PART 2: Weekly Summary Modal ───────────────────────────────────── */
#weekly-summary-modal .auth-card {
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid rgba(91, 76, 245, 0.10);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
    animation: wkSlideIn 0.25s ease;
}
@keyframes wkSlideIn {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)   scale(1);    }
}
