:root {
    --bg-paper: #fdfbf7;
    --ink-primary: #111111;
    --ink-secondary: #555555;
    --accent-crimson: #a61c1c;
    --accent-gold: #c5a059;
    --border-subtle: #eaddcf;
    --card-hover-bg: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(253,251,247,0.9) 100%);
    --font-serif: 'EB Garamond', serif;
    --font-sans: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --card-shadow: 0 10px 30px -10px rgba(0,0,0,0.05);

    /* Legacy Mappings */
    --primary: var(--accent-crimson);
    --primary-dark: #8a1717;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
    --gray-50: var(--bg-paper);
    --gray-100: #f3f4f6;
    --gray-200: var(--border-subtle);
    --gray-300: #d1d5db;
    --gray-600: var(--ink-secondary);
    --gray-800: var(--ink-primary);
}

.dark-mode {
    --bg-paper: #1a1a1a;
    --ink-primary: #eaddcf;
    --ink-secondary: #a0a0a0;
    --accent-crimson: #ff6b6b;
    --border-subtle: #333;
    --card-hover-bg: linear-gradient(180deg, rgba(32,32,32,0.98) 0%, rgba(26,26,26,0.92) 100%);
    --card-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
}

.fun-mode {
    --bg-paper: #111111;
    --ink-primary: #ffffff;
    --ink-secondary: #e1e1e1;
    --accent-crimson: #ff0097;
    --accent-gold: #e3a21a;
    --border-subtle: #333;
    --card-hover-bg: #1f1f1f;
    --font-serif: 'Inter', sans-serif; /* Modern sans everywhere */
    --card-shadow: 5px 5px 0px 0px rgba(255, 255, 255, 0.2); /* Pop shadow */
}

.fun-mode .card {
    background-color: #1f1f1f;
    border: 2px solid transparent;
}

.fun-mode .card:hover {
    transform: translate(-2px, -2px);
    box-shadow: 7px 7px 0px 0px var(--accent-crimson);
    border-color: var(--accent-crimson);
}

.fun-mode .card:nth-child(1n) { border-top: 6px solid #00aba9; }
.fun-mode .card:nth-child(2n) { border-top: 6px solid #ff0097; }
.fun-mode .card:nth-child(3n) { border-top: 6px solid #a200ff; }
.fun-mode .card:nth-child(4n) { border-top: 6px solid #da532c; }

.fun-mode .sidebar {
    background-color: #181818;
    border-right: 1px solid #333;
}

.fun-mode .nav-item:hover, .fun-mode .nav-item.active {
    background-color: var(--accent-crimson);
    color: white;
    padding-left: 12px;
    border-radius: 0; /* Square corners for Metro */
}

/* --- Midnight Library Theme --- */
.midnight-library {
    --bg-paper: #0a1628;
    --ink-primary: #f4e4c1;
    --ink-secondary: #c9b896;
    --ink-tertiary: #8b7355;
    --accent-crimson: #c45a3a;
    --accent-gold: #d4a853;
    --border-subtle: #1e3a5f;
    --card-hover-bg: linear-gradient(180deg, rgba(26, 45, 71, 0.74) 0%, rgba(18, 40, 64, 0.9) 100%);
    --card-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.7), 0 0 40px rgba(212, 168, 83, 0.08);
    --lamp-glow: radial-gradient(ellipse at 30% 20%, rgba(212, 168, 83, 0.15) 0%, transparent 50%);
}

.midnight-library body {
    background:
        var(--lamp-glow),
        radial-gradient(ellipse at 70% 80%, rgba(196, 90, 58, 0.08) 0%, transparent 40%),
        linear-gradient(180deg, #0a1628 0%, #0d1f3c 50%, #0a1628 100%);
    background-attachment: fixed;
}

.midnight-library .noise-overlay {
    opacity: 0.06;
}

/* Wood grain sidebar */
.midnight-library .sidebar {
    background:
        repeating-linear-gradient(
            90deg,
            transparent 0px,
            rgba(139, 115, 85, 0.03) 2px,
            transparent 4px,
            rgba(139, 115, 85, 0.02) 8px,
            transparent 12px
        ),
        linear-gradient(180deg, #0d1a2d 0%, #122238 100%);
    border-right: 1px solid #1e3a5f;
    position: relative;
}

.midnight-library .sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, rgba(212, 168, 83, 0.03) 0%, transparent 30%, transparent 70%, rgba(212, 168, 83, 0.03) 100%);
    pointer-events: none;
}

/* Leather-textured brand block */
.midnight-library .brand-block {
    background: linear-gradient(135deg, #1a2d47 0%, #122840 50%, #1a2d47 100%);
    border: 1px solid rgba(212, 168, 83, 0.2);
    box-shadow:
        inset 0 1px 0 rgba(212, 168, 83, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.3),
        0 8px 24px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
}

.midnight-library .brand-block::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: repeating-linear-gradient(
        45deg,
        transparent 0px,
        transparent 2px,
        rgba(212, 168, 83, 0.02) 2px,
        rgba(212, 168, 83, 0.02) 4px
    );
    pointer-events: none;
}

.midnight-library .logo {
    color: #d4a853;
    text-shadow: 0 0 30px rgba(212, 168, 83, 0.3);
    position: relative;
}

.midnight-library .dedication {
    color: #9a8a6a;
    font-style: italic;
}

/* Elegant nav items */
.midnight-library .nav-item {
    color: #c9b896;
    border-left: 2px solid transparent;
    padding-left: 14px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.midnight-library .nav-item::before {
    display: none;
}

.midnight-library .nav-item:hover,
.midnight-library .nav-item.active {
    color: #f4e4c1;
    border-left-color: #d4a853;
    background: linear-gradient(90deg, rgba(212, 168, 83, 0.1) 0%, transparent 100%);
    transform: translateX(4px);
    text-shadow: 0 0 20px rgba(212, 168, 83, 0.2);
}

/* Books on a shelf card style */
.midnight-library .card {
    background:
        linear-gradient(180deg, rgba(26, 45, 71, 0.6) 0%, rgba(18, 40, 64, 0.8) 100%);
    border: 1px solid rgba(212, 168, 83, 0.15);
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(212, 168, 83, 0.1);
    position: relative;
    overflow: hidden;
}

.midnight-library .card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #c45a3a 0%, #d4a853 50%, #c45a3a 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.midnight-library .card:hover::before {
    opacity: 1;
}

.midnight-library .card:hover {
    transform: translateY(-4px);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(212, 168, 83, 0.1),
        inset 0 1px 0 rgba(212, 168, 83, 0.15);
    border-color: rgba(212, 168, 83, 0.25);
}

.midnight-library .card-header {
    color: #d4a853;
    text-shadow: 0 0 15px rgba(212, 168, 83, 0.2);
}

.midnight-library .card-title {
    color: #f4e4c1;
    text-shadow: 0 0 30px rgba(244, 228, 193, 0.1);
}

/* Illuminated fuel card */
.midnight-library .fuel-card {
    background:
        radial-gradient(ellipse at 50% 0%, rgba(212, 168, 83, 0.12) 0%, transparent 50%),
        linear-gradient(180deg, rgba(26, 45, 71, 0.5) 0%, rgba(18, 40, 64, 0.7) 100%);
    border: 1px solid rgba(212, 168, 83, 0.2);
}

.midnight-library .fuel-icon {
    filter: drop-shadow(0 0 8px rgba(212, 168, 83, 0.5));
}

.midnight-library .fuel-quote {
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.15) 0%, rgba(196, 90, 58, 0.08) 100%);
    border-left-color: #d4a853;
    box-shadow: inset 0 0 30px rgba(212, 168, 83, 0.05);
}

.midnight-library .fuel-quote::before {
    color: #d4a853;
    opacity: 0.4;
    text-shadow: 0 0 20px rgba(212, 168, 83, 0.3);
}

/* Glowing inputs */
.midnight-library .fuel-textarea,
.midnight-library .auth-input {
    background: rgba(10, 22, 40, 0.6);
    border-color: rgba(212, 168, 83, 0.2);
    color: #f4e4c1;
}

.midnight-library .fuel-textarea:focus,
.midnight-library .auth-input:focus {
    border-color: #d4a853;
    box-shadow:
        0 0 0 3px rgba(212, 168, 83, 0.15),
        0 0 20px rgba(212, 168, 83, 0.1);
    background: rgba(10, 22, 40, 0.8);
}

.midnight-library .fuel-textarea::placeholder,
.midnight-library .auth-input::placeholder {
    color: #5a4a3a;
}

/* Elegant buttons */
.midnight-library .btn-text {
    border-color: #d4a853;
    color: #d4a853;
    background: transparent;
    box-shadow: 0 0 20px rgba(212, 168, 83, 0.1);
}

.midnight-library .btn-text::before {
    background: linear-gradient(90deg, #d4a853 0%, #c9a043 100%);
}

.midnight-library .fuel-btn-save {
    background: linear-gradient(135deg, #d4a853 0%, #c9a043 100%);
    box-shadow: 0 4px 15px rgba(212, 168, 83, 0.3);
}

.midnight-library .fuel-btn-save:hover:not(:disabled) {
    background: linear-gradient(135deg, #e0b863 0%, #d4a853 100%);
    box-shadow: 0 6px 20px rgba(212, 168, 83, 0.4);
}

.midnight-library .fuel-show-btn {
    background: rgba(26, 45, 71, 0.9);
    border-color: rgba(212, 168, 83, 0.3);
    color: #d4a853;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.midnight-library .fuel-show-btn:hover {
    background: rgba(26, 45, 71, 0.95);
    border-color: #d4a853;
    box-shadow: 0 6px 25px rgba(212, 168, 83, 0.2);
}

/* Toast notifications with warm glow */
.midnight-library .toast {
    background: rgba(26, 45, 71, 0.95);
    border-color: rgba(212, 168, 83, 0.2);
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(212, 168, 83, 0.1);
}

.midnight-library .toast.success {
    border-color: rgba(212, 168, 83, 0.4);
}

.midnight-library .toast.error {
    border-color: rgba(196, 90, 58, 0.4);
}

.midnight-library .toast-title {
    color: #f4e4c1;
}

.midnight-library .toast-message {
    color: #c9b896;
}

/* Hero stat with glow */
.midnight-library .hero-stat {
    color: #d4a853;
    text-shadow: 0 0 40px rgba(212, 168, 83, 0.3);
}

/* Cold call meter with embers */
.midnight-library .cold-call-meter {
    background: rgba(30, 58, 95, 0.5);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

.midnight-library .cold-call-fill {
    background: linear-gradient(90deg, #8b3a3a 0%, #c45a3a 50%, #d4a853 100%);
    box-shadow: 0 0 10px rgba(196, 90, 58, 0.5);
}

/* Work indicators with jewel tones */
.midnight-library .work-indicator.complete {
    background: rgba(212, 168, 83, 0.2);
    color: #d4a853;
    border: 1px solid rgba(212, 168, 83, 0.4);
}

.midnight-library .work-indicator.incomplete {
    background: rgba(196, 90, 58, 0.2);
    color: #c45a3a;
    border: 1px solid rgba(196, 90, 58, 0.4);
}

/* Action buttons */
.midnight-library .action-btn:hover {
    color: #d4a853;
    text-shadow: 0 0 10px rgba(212, 168, 83, 0.3);
}

/* Toggle switch */
.midnight-library .toggle-container:hover {
    color: #f4e4c1;
}

/* Dean's list */
.midnight-library .deans-list {
    border-top-color: rgba(212, 168, 83, 0.2);
}

.midnight-library .leaderboard-item {
    color: #c9b896;
    border-bottom: 1px solid rgba(212, 168, 83, 0.1);
}

.midnight-library .leaderboard-item:hover {
    background: rgba(212, 168, 83, 0.05);
}

/* Main content area */
.midnight-library .main {
    position: relative;
}

.midnight-library .main::before {
    content: '';
    position: fixed;
    top: 0;
    right: 0;
    width: 60%;
    height: 100%;
    background: radial-gradient(ellipse at 80% 20%, rgba(212, 168, 83, 0.03) 0%, transparent 50%);
    pointer-events: none;
}

/* Subtle stars pattern in background */
.midnight-library body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(1px 1px at 20px 30px, rgba(212, 168, 83, 0.3) 50%, transparent 100%),
        radial-gradient(1px 1px at 40px 70px, rgba(212, 168, 83, 0.2) 50%, transparent 100%),
        radial-gradient(1.5px 1.5px at 50px 160px, rgba(244, 228, 193, 0.3) 50%, transparent 100%),
        radial-gradient(1px 1px at 90px 40px, rgba(212, 168, 83, 0.2) 50%, transparent 100%),
        radial-gradient(2px 2px at 130px 80px, rgba(244, 228, 193, 0.2) 50%, transparent 100%),
        radial-gradient(1px 1px at 160px 120px, rgba(212, 168, 83, 0.3) 50%, transparent 100%);
    background-size: 200px 200px;
    background-position: 0 0, 40px 60px, 80px 30px, 120px 90px, 160px 150px, 60px 120px;
    pointer-events: none;
    opacity: 0.4;
    animation: twinkle 8s ease-in-out infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.5; }
}

/* --- MARGINALIA MODE --- */
.marginalia-mode {
    --bg-paper: #fff6d6;
    --ink-primary: #1f1a17;
    --ink-secondary: #5b574e;
    --ink-tertiary: #857c70;
    --accent-crimson: #c1121f; /* red pen */
    --accent-gold: #f59e0b; /* highlighter */
    --border-subtle: rgba(83, 69, 60, 0.18);
    --card-hover-bg: linear-gradient(180deg, rgba(255,255,255,0.92) 0%, rgba(255,246,214,0.92) 100%);
    --card-shadow: 0 18px 46px -26px rgba(31, 26, 23, 0.55);
    --marginalia-line: rgba(37, 99, 235, 0.12); /* blue ruling */
    --marginalia-highlight: rgba(245, 158, 11, 0.22);
}

/* Legal-pad ruling + warm light */
.marginalia-mode body {
    background:
        repeating-linear-gradient(
            180deg,
            rgba(0, 0, 0, 0) 0px,
            rgba(0, 0, 0, 0) 26px,
            var(--marginalia-line) 26px,
            var(--marginalia-line) 27px
        ),
        radial-gradient(circle at 18% 8%, rgba(245, 158, 11, 0.10) 0%, transparent 55%),
        radial-gradient(circle at 82% 18%, rgba(193, 18, 31, 0.06) 0%, transparent 60%),
        var(--bg-paper);
    background-attachment: fixed;
}

.marginalia-mode .noise-overlay {
    opacity: 0.05;
}

.marginalia-mode .sidebar,
.marginalia-mode .right-pane {
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(8px);
}

.marginalia-mode .brand-block {
    background: rgba(255, 255, 255, 0.70);
    border: 1px solid rgba(193, 18, 31, 0.18);
    box-shadow: 0 14px 30px -26px rgba(31, 26, 23, 0.55);
    position: relative;
}

.marginalia-mode .brand-block::before {
    content: '';
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 12px;
    width: 2px;
    background: rgba(193, 18, 31, 0.22);
    border-radius: 2px;
}

.marginalia-mode .logo {
    color: var(--accent-crimson);
    text-shadow: 0 10px 30px rgba(193, 18, 31, 0.12);
}

.marginalia-mode .nav-item:hover,
.marginalia-mode .nav-item.active {
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.22) 0%, rgba(245, 158, 11, 0.08) 70%, transparent 100%);
    border-radius: 10px;
    padding-left: 12px;
    color: var(--ink-primary);
}

.marginalia-mode .card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.86) 0%, rgba(255, 246, 214, 0.86) 100%);
    border-color: rgba(83, 69, 60, 0.22);
    box-shadow: 0 12px 28px -22px rgba(31, 26, 23, 0.45);
}

.marginalia-mode .card::after {
    content: '';
    position: absolute;
    top: 14px;
    right: 16px;
    width: 74px;
    height: 18px;
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.35) 0%, rgba(245, 158, 11, 0.12) 100%);
    border: 1px solid rgba(245, 158, 11, 0.22);
    border-radius: 7px;
    transform: rotate(7deg);
    pointer-events: none;
    mix-blend-mode: multiply;
}

.marginalia-mode .card:hover {
    border-color: rgba(193, 18, 31, 0.55);
    box-shadow: 0 24px 60px -40px rgba(31, 26, 23, 0.55);
    transform: translateY(-4px) rotate(-0.15deg);
}

.marginalia-mode .dashboard-docket {
    background: rgba(255, 255, 255, 0.55);
    border-style: dashed;
}

.marginalia-mode .work-indicator {
    background: rgba(255, 255, 255, 0.40);
}

.marginalia-mode .work-indicator.incomplete {
    border-color: rgba(193, 18, 31, 0.24);
    background: rgba(193, 18, 31, 0.06);
}

.marginalia-mode #themeSelector {
    background: rgba(255, 255, 255, 0.65);
    border: 1px dashed rgba(83, 69, 60, 0.35);
}

.marginalia-mode #themeSelector:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--marginalia-highlight);
}

@media (prefers-reduced-motion: reduce) {
    .marginalia-mode .card,
    .marginalia-mode .nav-item {
        transition: none !important;
    }
}

/* --- DISCO MODE --- */
.disco-mode {
    --bg-paper: #0a0a0a;
    --ink-primary: #ffffff;
    --ink-secondary: #e0e0e0;
    --ink-tertiary: #a0a0a0;
    --accent-crimson: #ff006e;
    --accent-gold: #ffbe0b;
    --border-subtle: #333;
    --card-hover-bg: linear-gradient(180deg, rgba(18,18,18,0.98) 0%, rgba(10,10,10,0.94) 100%);
    --card-shadow: 0 8px 32px rgba(255, 0, 110, 0.3);
}

/* Disco ball background */
.disco-mode body {
    background:
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        linear-gradient(45deg, #0a0a0a 0%, #1a1a2e 25%, #16213e 50%, #0f0f23 75%, #0a0a0a 100%);
    background-size: 100% 100%, 400% 400%;
    animation: discoBg 16s ease infinite; /* Slowed down */
    overflow-x: hidden;
}

@keyframes discoBg {
    0%, 100% { background-position: 50% 50%, 0% 50%; }
    25% { background-position: 50% 50%, 100% 50%; }
    50% { background-position: 50% 50%, 100% 100%; }
    75% { background-position: 50% 50%, 0% 100%; }
}

/* Sparkle particles */
.disco-mode body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(2px 2px at 20px 30px, #ff006e 50%, transparent 100%),
        radial-gradient(2px 2px at 40px 70px, #ffbe0b 50%, transparent 100%),
        radial-gradient(3px 3px at 50px 160px, #00f5d4 50%, transparent 100%),
        radial-gradient(2px 2px at 90px 40px, #8338ec 50%, transparent 100%),
        radial-gradient(3px 3px at 130px 80px, #ff006e 50%, transparent 100%),
        radial-gradient(2px 2px at 160px 120px, #3a86ff 50%, transparent 100%);
    background-size: 200px 200px;
    background-position: 0 0, 40px 60px, 80px 30px, 120px 90px, 160px 150px, 60px 120px;
    pointer-events: none;
    opacity: 0.8;
    animation: sparkle 5s linear infinite; /* Slowed down */
}

@keyframes sparkle {
    0% { opacity: 0.4; transform: translateY(0); }
    50% { opacity: 1; }
    100% { opacity: 0.4; transform: translateY(-20px); }
}

.disco-mode .noise-overlay {
    display: none;
}

/* Rainbow sidebar & Right Pane */
.disco-mode .sidebar,
.disco-mode .right-pane {
    background: linear-gradient(180deg,
        rgba(255, 0, 110, 0.1) 0%,
        rgba(255, 190, 11, 0.1) 14%,
        rgba(0, 245, 212, 0.1) 28%,
        rgba(131, 56, 236, 0.1) 42%,
        rgba(58, 134, 255, 0.1) 57%,
        rgba(255, 0, 110, 0.1) 71%,
        rgba(255, 190, 11, 0.1) 85%,
        rgba(0, 245, 212, 0.1) 100%
    );
    background-size: 100% 400%;
    animation: rainbowScroll 8s linear infinite; /* Slowed down */
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}

@keyframes rainbowScroll {
    0% { background-position: 0% 0%; }
    100% { background-position: 0% 400%; }
}

.disco-mode .brand-block {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 20px rgba(255, 0, 110, 0.5), inset 0 0 20px rgba(255, 255, 255, 0.1);
    animation: discoGlow 2s ease-in-out infinite alternate; /* Slowed down */
}

@keyframes discoGlow {
    0% { box-shadow: 0 0 20px rgba(255, 0, 110, 0.5), inset 0 0 20px rgba(255, 255, 255, 0.1); }
    25% { box-shadow: 0 0 20px rgba(255, 190, 11, 0.5), inset 0 0 20px rgba(255, 255, 255, 0.1); }
    50% { box-shadow: 0 0 20px rgba(0, 245, 212, 0.5), inset 0 0 20px rgba(255, 255, 255, 0.1); }
    75% { box-shadow: 0 0 20px rgba(131, 56, 236, 0.5), inset 0 0 20px rgba(255, 255, 255, 0.1); }
    100% { box-shadow: 0 0 20px rgba(58, 134, 255, 0.5), inset 0 0 20px rgba(255, 255, 255, 0.1); }
}

.disco-mode .logo {
    color: #ffffff;
    text-shadow:
        0 0 10px #ff006e,
        0 0 20px #ffbe0b,
        0 0 30px #00f5d4;
    animation: logoDisco 1.5s ease-in-out infinite alternate;
}

@keyframes logoDisco {
    0% { text-shadow: 0 0 10px #ff006e, 0 0 20px #ff006e, 0 0 30px #ff006e; transform: scale(1); }
    25% { text-shadow: 0 0 10px #ffbe0b, 0 0 20px #ffbe0b, 0 0 30px #ffbe0b; transform: scale(1.02); }
    50% { text-shadow: 0 0 10px #00f5d4, 0 0 20px #00f5d4, 0 0 30px #00f5d4; transform: scale(1); }
    75% { text-shadow: 0 0 10px #8338ec, 0 0 20px #8338ec, 0 0 30px #8338ec; transform: scale(1.02); }
    100% { text-shadow: 0 0 10px #3a86ff, 0 0 20px #3a86ff, 0 0 30px #3a86ff; transform: scale(1); }
}

.disco-mode .nav-item {
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 4px;
    transition: all 0.2s;
}

.disco-mode .nav-item::before { display: none; }

.disco-mode .nav-item:hover,
.disco-mode .nav-item.active {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05) translateX(4px);
    animation: navDisco 1s ease-in-out infinite;
}

@keyframes navDisco {
    0%, 100% { box-shadow: 0 0 10px #ff006e; }
    25% { box-shadow: 0 0 10px #ffbe0b; }
    50% { box-shadow: 0 0 10px #00f5d4; }
    75% { box-shadow: 0 0 10px #8338ec; }
}

/* Disco cards with rainbow borders */
.disco-mode .card {
    background: rgba(20, 20, 20, 0.95);
    border: 3px solid transparent;
    background-clip: padding-box;
    position: relative;
    animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards, cardPulse 4s ease-in-out infinite;
    isolation: isolate;
}

.disco-mode .card::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(45deg, #ff006e, #ffbe0b, #00f5d4, #8338ec, #3a86ff, #ff006e);
    background-size: 300% 300%;
    border-radius: 14px;
    z-index: -1;
    animation: rainbowBorder 6s linear infinite;
}

@keyframes rainbowBorder {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

@keyframes cardPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.002); }
}

.disco-mode .card:hover {
    transform: translateY(-4px);
    box-shadow: 0 0 40px rgba(255, 0, 110, 0.6), 0 0 80px rgba(255, 190, 11, 0.4);
}

.disco-mode .card-header {
    color: #ffbe0b;
    text-shadow: 0 0 10px #ffbe0b;
    animation: headerGlow 2s ease-in-out infinite alternate;
}

@keyframes headerGlow {
    0% { color: #ff006e; text-shadow: 0 0 10px #ff006e; }
    33% { color: #ffbe0b; text-shadow: 0 0 10px #ffbe0b; }
    66% { color: #00f5d4; text-shadow: 0 0 10px #00f5d4; }
    100% { color: #8338ec; text-shadow: 0 0 10px #8338ec; }
}

.disco-mode .card-title {
    color: #ffffff;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
}

/* Disco fuel card */
.disco-mode .fuel-card {
    background: rgba(20, 20, 20, 0.9);
    border: 3px solid transparent;
    animation: fuelDisco 3s ease-in-out infinite;
}

@keyframes fuelDisco {
    0% { border-color: #ff006e; box-shadow: 0 0 20px #ff006e, inset 0 0 20px rgba(255, 0, 110, 0.2); }
    25% { border-color: #ffbe0b; box-shadow: 0 0 20px #ffbe0b, inset 0 0 20px rgba(255, 190, 11, 0.2); }
    50% { border-color: #00f5d4; box-shadow: 0 0 20px #00f5d4, inset 0 0 20px rgba(0, 245, 212, 0.2); }
    75% { border-color: #8338ec; box-shadow: 0 0 20px #8338ec, inset 0 0 20px rgba(131, 56, 236, 0.2); }
    100% { border-color: #3a86ff; box-shadow: 0 0 20px #3a86ff, inset 0 0 20px rgba(58, 134, 255, 0.2); }
}

.disco-mode .fuel-icon {
    animation: iconBounce 1.5s ease-in-out infinite;
}

@keyframes iconBounce {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.2) rotate(-10deg); }
    75% { transform: scale(1.2) rotate(10deg); }
}

.disco-mode .fuel-quote {
    background: linear-gradient(135deg, rgba(255, 0, 110, 0.2) 0%, rgba(255, 190, 11, 0.2) 50%, rgba(0, 245, 212, 0.2) 100%);
    border-left: 4px solid;
    border-image: linear-gradient(180deg, #ff006e, #ffbe0b, #00f5d4, #8338ec) 1;
    animation: quoteDisco 4s linear infinite;
}

@keyframes quoteDisco {
    0% { border-image-source: linear-gradient(180deg, #ff006e, #ffbe0b, #00f5d4, #8338ec); }
    25% { border-image-source: linear-gradient(180deg, #ffbe0b, #00f5d4, #8338ec, #3a86ff); }
    50% { border-image-source: linear-gradient(180deg, #00f5d4, #8338ec, #3a86ff, #ff006e); }
    75% { border-image-source: linear-gradient(180deg, #8338ec, #3a86ff, #ff006e, #ffbe0b); }
    100% { border-image-source: linear-gradient(180deg, #3a86ff, #ff006e, #ffbe0b, #00f5d4); }
}

/* Disco inputs */
.disco-mode .fuel-textarea,
.disco-mode .auth-input {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid;
    border-image: linear-gradient(90deg, #ff006e, #ffbe0b, #00f5d4) 1;
    color: #ffffff;
    animation: inputDisco 6s linear infinite;
}

@keyframes inputDisco {
    0% { border-image-source: linear-gradient(90deg, #ff006e, #ffbe0b, #00f5d4); }
    33% { border-image-source: linear-gradient(90deg, #ffbe0b, #00f5d4, #8338ec); }
    66% { border-image-source: linear-gradient(90deg, #00f5d4, #8338ec, #3a86ff); }
    100% { border-image-source: linear-gradient(90deg, #8338ec, #3a86ff, #ff006e); }
}

.disco-mode .fuel-textarea:focus,
.disco-mode .auth-input:focus {
    animation: focusDisco 0.5s linear infinite;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.5);
}

@keyframes focusDisco {
    0% { border-color: #ff006e; box-shadow: 0 0 30px #ff006e; }
    25% { border-color: #ffbe0b; box-shadow: 0 0 30px #ffbe0b; }
    50% { border-color: #00f5d4; box-shadow: 0 0 30px #00f5d4; }
    75% { border-color: #8338ec; box-shadow: 0 0 30px #8338ec; }
    100% { border-color: #3a86ff; box-shadow: 0 0 30px #3a86ff; }
}

/* Disco buttons */
.disco-mode .btn-text {
    background: linear-gradient(90deg, #ff006e, #ffbe0b, #00f5d4, #8338ec, #3a86ff);
    background-size: 300% 100%;
    border: none;
    color: #ffffff;
    animation: btnDisco 4s linear infinite;
}

@keyframes btnDisco {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

.disco-mode .fuel-btn-save {
    background: linear-gradient(90deg, #ff006e, #ffbe0b, #00f5d4);
    background-size: 200% 100%;
    animation: btnDisco 2s linear infinite;
    color: #ffffff;
    font-weight: bold;
}

.disco-mode .fuel-show-btn {
    background: linear-gradient(90deg, #ff006e, #ffbe0b, #00f5d4, #8338ec);
    background-size: 300% 100%;
    animation: btnDisco 4s linear infinite;
    border: none;
    color: #ffffff;
}

/* Disco toasts */
.disco-mode .toast {
    background: rgba(20, 20, 20, 0.95);
    border: 2px solid;
    animation: toastDisco 2s linear infinite;
}

@keyframes toastDisco {
    0% { border-color: #ff006e; box-shadow: 0 0 20px #ff006e; }
    25% { border-color: #ffbe0b; box-shadow: 0 0 20px #ffbe0b; }
    50% { border-color: #00f5d4; box-shadow: 0 0 20px #00f5d4; }
    75% { border-color: #8338ec; box-shadow: 0 0 20px #8338ec; }
    100% { border-color: #3a86ff; box-shadow: 0 0 20px #3a86ff; }
}

/* Disco hero stat */
.disco-mode .hero-stat {
    background: linear-gradient(90deg, #ff006e, #ffbe0b, #00f5d4, #8338ec, #3a86ff, #ff006e);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: heroDisco 6s linear infinite;
}

@keyframes heroDisco {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

/* Disco cold call meter */
.disco-mode .cold-call-meter {
    background: rgba(0, 0, 0, 0.5);
    animation: meterDisco 4s linear infinite;
}

@keyframes meterDisco {
    0% { box-shadow: inset 0 0 10px #ff006e; }
    25% { box-shadow: inset 0 0 10px #ffbe0b; }
    50% { box-shadow: inset 0 0 10px #00f5d4; }
    75% { box-shadow: inset 0 0 10px #8338ec; }
    100% { box-shadow: inset 0 0 10px #3a86ff; }
}

.disco-mode .cold-call-fill {
    background: linear-gradient(90deg, #ff006e, #ffbe0b, #00f5d4, #8338ec);
    background-size: 300% 100%;
    animation: btnDisco 2s linear infinite;
    box-shadow: 0 0 20px currentColor;
}

/* Disco work indicators */
.disco-mode .work-indicator.complete {
    background: linear-gradient(90deg, #ff006e, #ffbe0b);
    color: #ffffff;
    animation: badgeDisco 1.5s ease-in-out infinite alternate;
}

.disco-mode .work-indicator.incomplete {
    background: linear-gradient(90deg, #8338ec, #3a86ff);
    color: #ffffff;
    animation: badgeDisco 1.5s ease-in-out infinite alternate-reverse;
}

@keyframes badgeDisco {
    0% { transform: scale(1); box-shadow: 0 0 10px currentColor; }
    100% { transform: scale(1.05); box-shadow: 0 0 20px currentColor; }
}

/* Disco leaderboard */
.disco-mode .leaderboard-item {
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    animation: leaderDisco 8s ease-in-out infinite;
}

@keyframes leaderDisco {
    0%, 100% { text-shadow: 0 0 5px rgba(255, 255, 255, 0.5); }
    50% { text-shadow: 0 0 15px rgba(255, 255, 255, 0.8); }
}

.disco-mode .leaderboard-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.02);
}

/* Disco selector */
.disco-mode #themeSelector {
    background: linear-gradient(90deg, #ff006e, #ffbe0b, #00f5d4, #8338ec);
    background-size: 300% 100%;
    animation: btnDisco 6s linear infinite;
    border: none;
    color: #ffffff;
    font-weight: bold;
}

/* Main Content Transparency */
.disco-mode .main {
    background: transparent;
}

/* Everything dances in disco mode */

/* The Grain - Adds texture without an image file */
.noise-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background-color: var(--bg-paper);
    color: var(--ink-primary);
    font-family: var(--font-serif);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.5s, color 0.5s;
}

h1, h2, h3, h4, .serif, .logo, .card-title, .hero-stat {
    font-family: var(--font-serif);
}

/* --- Typography --- */
h1, h2, h3, .serif {
    font-family: var(--font-serif);
    font-feature-settings: "onum", "pnum"; /* Old-style figures */
}

/* --- Layout --- */
.grid-layout {
    display: grid;
    grid-template-columns: 280px 1fr 340px;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    border-right: 1px solid var(--border-subtle);
    padding: 40px 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto; /* Allow scrolling if content is tall */
}

.right-pane {
    border-left: 1px solid var(--border-subtle);
    padding: 40px 24px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand-block {
    background: #fdfbf7;
    border: 1px solid rgba(166, 28, 28, 0.12);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 20px;
    box-shadow: 0 8px 18px -14px rgba(0,0,0,0.25);
}

.logo {
    font-size: 1.25rem;
    font-weight: 650;
    letter-spacing: -0.015em;
    margin: 0 0 2px;
    display: block;
    color: #7a0f0f;
}

.dedication {
    font-family: var(--font-serif);
    font-size: 0.82rem;
    color: #5a4a3f;
    margin: 0;
    line-height: 1.3;
    letter-spacing: 0.01em;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    color: var(--ink-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-family: var(--font-serif);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: -16px;
    top: 50%;
    transform: translateY(-50%) scaleX(0);
    width: 4px;
    height: 4px;
    background: var(--accent-crimson);
    border-radius: 50%;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-item:hover, .nav-item.active {
    color: var(--ink-primary);
    font-weight: 500;
    transform: translateX(4px);
}

.nav-item:hover::before, .nav-item.active::before {
    transform: translateY(-50%) scaleX(1);
}

.toggle-container {
    display: flex;
    align-items: center;
    margin-top: 20px;
    cursor: pointer;
    color: var(--ink-secondary);
    font-size: 0.9rem;
}

.toggle-container:hover { color: var(--ink-primary); }
.toggle-icon { margin-right: 8px; font-size: 1.2rem; }

/* --- Dean's List --- */
.deans-list {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
}

.deans-list h4 {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: var(--accent-crimson);
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    margin-bottom: 8px;
    padding: 4px 0;
    border-bottom: 1px dashed var(--border-subtle);
}

.leaderboard-item:last-child { border-bottom: none; }

/* --- Student Badge --- */
.student-badge {
    margin-top: 40px; /* Push to bottom */
    padding: 16px;
    background: rgba(0,0,0,0.03); /* More subtle for dark mode compat */
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
}

.badge-photo {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    margin: 0 auto 12px;
    border: 1px solid var(--accent-crimson);
}

.badge-code {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--ink-secondary);
    text-transform: uppercase;
}

.badge-name {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 600;
}

.action-btn {
    margin-top: 12px;
    font-size: 0.7rem;
    border: none;
    background: none;
    text-decoration: underline;
    cursor: pointer;
    color: var(--ink-secondary);
    display: block;
    padding: 0;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.action-btn:hover {
    color: var(--accent-crimson);
    text-underline-offset: 4px;
}

/* --- Main Content --- */
.main {
    padding: 60px 80px;
    max-width: 1200px;
}

.hero-stat {
    font-size: 4rem;
    font-weight: 400;
    line-height: 1;
    margin-bottom: 8px;
}

.stat-label {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-secondary);
}

/* --- Fuel Card (Motivation) --- */
.fuel-card {
    margin: 0 0 36px 0;
    position: relative;
    transition: all 0.3s ease;
}

.fuel-card.hidden {
    display: none;
}

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

.fuel-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fuel-icon {
    font-size: 1.1rem;
    opacity: 0.6;
}

.fuel-header h3 {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--ink-primary);
    margin: 0;
}

.fuel-dismiss {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    color: var(--ink-tertiary);
    font-size: 1.2rem;
    line-height: 1;
    border-radius: 6px;
    transition: all 0.2s;
}

.fuel-dismiss:hover {
    background: rgba(0,0,0,0.05);
    color: var(--ink-primary);
}

/* Collapsed state */
.fuel-collapsed .fuel-prompt {
    font-size: 0.85rem;
    color: var(--ink-tertiary);
    margin: 6px 0;
    line-height: 1.4;
}

.fuel-collapsed .fuel-prompt em {
    font-style: italic;
    color: var(--ink-tertiary);
}

.fuel-empty-btn {
    background: rgba(0,0,0,0.04);
    border: 1px solid var(--border-subtle);
    color: var(--ink-primary);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-serif);
    font-size: 0.85rem;
    transition: all 0.2s;
}

.fuel-empty-btn:hover {
    background: rgba(0,0,0,0.08);
    border-color: var(--ink-secondary);
}

/* Saved quote display */
.fuel-quote {
    position: relative;
    padding: 20px 24px;
    margin: 12px 0;
    background: linear-gradient(135deg, rgba(197, 160, 89, 0.06) 0%, rgba(197, 160, 89, 0.02) 100%);
    border-left: 3px solid var(--accent-gold);
    border-radius: 0 12px 12px 0;
}

.fuel-quote::before {
    content: '"';
    position: absolute;
    top: 8px;
    left: 12px;
    font-family: var(--font-serif);
    font-size: 2.5rem;
    color: var(--accent-gold);
    opacity: 0.3;
    line-height: 1;
}

.fuel-quote-text {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    color: var(--ink-primary);
    line-height: 1.6;
    margin: 0;
    padding-left: 20px;
}

.fuel-edit-btn {
    background: none;
    border: none;
    color: var(--ink-tertiary);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 4px 0;
    font-family: var(--font-mono);
    transition: color 0.2s;
}

.fuel-edit-btn:hover {
    color: var(--accent-gold);
}

/* Expanded (editing) state */
.fuel-expanded {
    animation: fuelExpand 0.25s ease;
}

@keyframes fuelExpand {
    from { opacity: 0.8; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.fuel-hint {
    font-size: 0.85rem;
    color: var(--ink-tertiary);
    margin: 8px 0 12px;
    line-height: 1.5;
}

.fuel-textarea {
    width: 100%;
    min-height: 38px;
    max-height: 80px;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-paper);
    font-family: var(--font-serif);
    font-size: 0.9rem;
    color: var(--ink-primary);
    resize: none;
    line-height: 1.3;
    transition: all 0.2s;
}

.fuel-textarea:focus {
    outline: none;
    border-color: var(--accent-crimson);
    box-shadow: 0 0 0 3px rgba(166, 28, 28, 0.1);
}

.fuel-textarea::placeholder {
    color: var(--ink-tertiary);
}

.fuel-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
}

.fuel-status {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--ink-tertiary);
}

.fuel-status.saving {
    color: var(--ink-secondary);
}

.fuel-status.error {
    color: var(--accent-crimson);
}

.fuel-status.saved {
    color: var(--accent-gold);
}

.fuel-btns {
    display: flex;
    gap: 8px;
}

.fuel-btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-family: var(--font-serif);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.fuel-btn-cancel {
    background: transparent;
    border-color: var(--border-subtle);
    color: var(--ink-secondary);
}

.fuel-btn-cancel:hover {
    background: rgba(0,0,0,0.04);
    border-color: var(--ink-tertiary);
}

.fuel-btn-save {
    background: var(--ink-primary);
    border: none;
    color: var(--bg-paper);
}

.fuel-btn-save:hover:not(:disabled) {
    background: var(--accent-crimson);
}

.fuel-btn-save:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Show fuel button (when card is dismissed) */
.fuel-show-btn {
    position: fixed;
    bottom: 24px;
    left: 24px;
    background: var(--bg-paper);
    border: 1px solid var(--border-subtle);
    padding: 10px 16px;
    border-radius: 99px;
    font-family: var(--font-serif);
    font-size: 0.85rem;
    color: var(--ink-secondary);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: all 0.2s;
    z-index: 100;
}

.fuel-show-btn:hover {
    color: var(--accent-gold);
    border-color: var(--accent-gold);
    box-shadow: 0 6px 16px rgba(197, 160, 89, 0.2);
}

.fuel-show-btn.hidden {
    display: none;
}

/* --- Toast Notifications --- */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    min-width: 300px;
    max-width: 420px;
    padding: 14px 18px;
    border-radius: 10px;
    background: var(--bg-paper);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 10px 40px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.02);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateX(40px);
}

.toast.removing {
    animation: toastSlideOut 0.25s ease-in forwards;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(20px) scale(0.95);
    }
}

.toast-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 12px;
}

.toast.success .toast-icon {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

.toast.error .toast-icon {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

.toast.info .toast-icon {
    background: rgba(59, 130, 246, 0.15);
    color: #2563eb;
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--ink-primary);
    margin: 0 0 2px 0;
    line-height: 1.3;
}

.toast-message {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: var(--ink-secondary);
    margin: 0;
    line-height: 1.4;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    color: var(--ink-tertiary);
    font-size: 18px;
    line-height: 1;
    border-radius: 4px;
    transition: all 0.15s;
}

.toast-close:hover {
    background: rgba(0,0,0,0.05);
    color: var(--ink-primary);
}

/* --- Enhanced Animations --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton {
    background: linear-gradient(90deg,
        var(--bg-paper) 0%,
        rgba(0,0,0,0.04) 25%,
        var(--bg-paper) 50%,
        rgba(0,0,0,0.04) 75%,
        var(--bg-paper) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 6px;
}

/* Legacy support */
.motivation-card {
    margin: 0 0 36px 0;
    gap: 12px;
}

.pill-btn {
    background: var(--ink-primary);
    color: var(--bg-paper);
    border: none;
    padding: 10px 16px;
    border-radius: 999px;
    cursor: pointer;
    font-family: var(--font-serif);
    font-size: 0.9rem;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    box-shadow: 0 8px 18px -12px rgba(0,0,0,0.35);
}

.pill-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 30px -14px rgba(0,0,0,0.4);
}

.pill-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* --- Charts --- */
.chart-section {
    margin-bottom: 60px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--border-subtle);
}

.chart-container {
    position: relative; 
    height: 300px; 
    width: 100%;
    margin-top: 20px;
}

/* --- Cards --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 40px;
}

.card {
    background: var(--bg-paper); /* For dark mode */
    border: 1px solid var(--border-subtle);
    padding: 22px;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.5s;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: auto;
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255,255,255,0.9) 0%, rgba(253,251,247,0.85) 100%);
}

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

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-shadow);
    border-color: var(--ink-primary);
    background: var(--card-hover-bg);
}

.card-header {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-crimson);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: none;
    padding: 0;
}

.card-title {
    font-size: 1.5rem;
    margin-bottom: 8px;
    font-weight: 400;
    height: auto; /* Allow variable height for invoices */
    line-height: 1.2;
    overflow: hidden;
}

.card-meta {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.85rem;
    color: var(--ink-secondary);
    display: flex;
    justify-content: space-between;
}

/* Collapsible cards (details/summary) */
details.card > summary {
    list-style: none;
}

details.card > summary::-webkit-details-marker {
    display: none;
}

details.card {
    padding: 0;
}

details.card > summary.card-header {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0;
    padding: 22px;
}

details.card[open] > summary.card-header {
    margin-bottom: 0;
    padding-bottom: 12px;
}

.collapsible-indicator {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--ink-secondary);
    transition: transform 0.15s ease;
}

details.card[open] > summary.card-header .collapsible-indicator {
    transform: rotate(180deg);
}

.collapsible-body {
    padding: 0 22px 22px;
}

/* Expense detail documentation */
.doc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.doc-item {
    border: 1px dashed var(--border-subtle);
    border-radius: 12px;
    padding: 0.75rem 0.85rem;
    background: rgba(255, 255, 255, 0.35);
}

.doc-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.doc-link {
    color: var(--primary);
    text-decoration: none;
}

.doc-link:hover {
    text-decoration: underline;
}

.doc-meta {
    margin-top: 0.25rem;
    color: var(--ink-secondary);
    font-size: 0.85rem;
    font-family: var(--font-mono);
}

.doc-email {
    margin-top: 0.6rem;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.25);
}

.doc-email summary {
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    font-family: var(--font-sans);
    font-weight: 500;
}

.doc-email-meta {
    margin-top: 8px;
    color: var(--ink-secondary);
    font-size: 0.85rem;
}

.code-block {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    white-space: pre-wrap;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 12px;
    overflow: auto;
    max-height: 480px;
}

/* --- Login Overlay --- */
.auth-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-paper);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.auth-container {
    width: 100%;
    max-width: 320px;
    text-align: center;
}

.auth-input {
    width: 100%;
    padding: 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--ink-primary);
    font-family: var(--font-mono);
    font-size: 1.5rem;
    text-align: center;
    outline: none;
    color: var(--ink-primary);
    margin-bottom: 24px;
    transition: border-color 0.3s;
}

.auth-input::placeholder { opacity: 0.3; }
.auth-input:focus { border-bottom-color: var(--accent-crimson); }

.btn-text {
    background: none;
    border: 1px solid var(--ink-primary);
    padding: 12px 32px;
    font-family: var(--font-serif);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.btn-text::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--ink-primary);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: -1;
}

.btn-text:hover {
    color: white;
    border-color: var(--ink-primary);
}

.btn-text:hover::before {
    transform: scaleX(1);
    transform-origin: left;
}

.hidden { display: none !important; }

/* --- Cold Call Widget (Adapted for Budget/Risk) --- */
.cold-call-meter {
    height: 4px;
    background: var(--border-subtle);
    margin-top: 8px;
    position: relative;
}
.cold-call-fill {
    height: 100%;
    background: var(--accent-crimson);
    width: 0%;
    transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Work Indicators --- */
.work-indicators {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.work-indicator {
    color: #999;
    opacity: 0.5;
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: rgba(0,0,0,0.02);
}

.work-indicator.incomplete {
    color: var(--accent-crimson);
    opacity: 1;
    font-weight: 500;
    border-color: rgba(166, 28, 28, 0.2);
    background: rgba(166, 28, 28, 0.06);
}

.work-indicator.complete {
    color: #1a7f37;
    border-color: rgba(26, 127, 55, 0.25);
    background: rgba(26, 127, 55, 0.08);
    font-weight: 500;
    opacity: 1;
}

.work-indicator.muted {
    opacity: 0.35;
    color: #777;
    background: transparent;
}

/* Dashboard Performance Docket */
.dashboard-docket {
    margin-top: 20px;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 14px 16px 6px;
    background: rgba(255,255,255,0.6);
}

.docket-item {
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--border-subtle);
}
.docket-item:last-child { border-bottom: none; }

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

.docket-title {
    font-family: var(--font-serif);
    font-size: 1rem;
    color: var(--ink-primary);
}

/* --- Docket Matrix (Compact) --- */
.docket-list {
    display: flex;
    flex-direction: column;
    gap: 8px; /* Tighter gap */
}

.docket-item-compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-bottom: 1px dashed var(--border-subtle);
    font-size: 0.85rem;
}

.docket-item-compact:last-child { border-bottom: none; }

.docket-class-info {
    display: flex;
    flex-direction: column;
    min-width: 0; /* Allow text truncate */
    margin-right: 12px;
}

.docket-class-num {
    font-family: var(--font-mono);
    color: var(--ink-secondary);
    font-size: 0.75rem;
    margin-bottom: 2px;
}

.docket-class-title {
    font-family: var(--font-serif);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--ink-primary);
}

.docket-scores {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.score-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 36px;
    border-radius: 6px;
    background: rgba(0,0,0,0.03);
    border: 1px solid var(--border-subtle);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--ink-tertiary);
    line-height: 1;
}

.score-badge.completed {
    font-weight: 600;
}

.score-badge.high { /* 90+ */
    background: rgba(26, 127, 55, 0.1);
    border-color: rgba(26, 127, 55, 0.2);
    color: #1a7f37;
}

.score-badge.med { /* 70-89 */
    background: rgba(212, 168, 83, 0.1);
    border-color: rgba(212, 168, 83, 0.3);
    color: #b58900;
}

.score-badge.low { /* <70 */
    background: rgba(166, 28, 28, 0.08);
    border-color: rgba(166, 28, 28, 0.2);
    color: #a61c1c;
}

.score-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    margin-bottom: 2px;
    opacity: 0.7;
}

/* HTMX indicators */
.htmx-indicator {
    opacity: 0;
    transition: opacity 200ms ease-in;
}

.htmx-request .htmx-indicator {
    opacity: 1;
}

.htmx-request.htmx-indicator {
    opacity: 1;
}

/* --- Restored Utility Classes for Invoice App --- */

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    font-size: 0.875rem;
    font-family: var(--font-sans);
}

input[type="text"], 
input[type="number"], 
input[type="date"], 
input[type="password"],
select, 
textarea {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.5);
    color: var(--ink-primary);
    transition: all 0.2s;
}

.dark-mode input, .dark-mode select, .dark-mode textarea {
    background: rgba(0, 0, 0, 0.2);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(197, 160, 89, 0.15);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
    font-family: var(--font-sans);
}

.btn-primary {
    background: var(--accent-crimson);
    color: white;
    border-color: var(--accent-crimson);
}

.btn-primary:hover {
    background: #8a1717; /* Darker crimson */
}

.btn-secondary {
    background: transparent;
    border-color: var(--border-subtle);
    color: var(--ink-secondary);
}

.btn-secondary:hover {
    background: rgba(0,0,0,0.05);
    color: var(--ink-primary);
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-success {
    background: #16a34a;
    color: white;
}

.btn-sm {
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
}

/* --- Agent Dock --- */
.agent-dock {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    font-family: var(--font-mono);
}

.agent-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 999px;
    background: linear-gradient(135deg, #1a1d26 0%, #0f1219 100%);
    color: #f3ede2;
    border: 1px solid rgba(197, 160, 89, 0.35);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.agent-toggle::before {
    content: ">_";
    color: var(--accent-gold);
    font-weight: 600;
}

.agent-dock:not(.is-collapsed) .agent-toggle {
    display: none;
}

.agent-panel {
    width: min(520px, calc(100vw - 32px));
    background: linear-gradient(160deg, #0c1118 0%, #0f1622 50%, #0b0f14 100%);
    color: #f0e8d6;
    border: 1px solid rgba(197, 160, 89, 0.22);
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    opacity: 0;
    transform: translateY(12px) scale(0.98);
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.agent-dock:not(.is-collapsed) .agent-panel {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    visibility: visible;
}

.agent-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 14px 16px;
    background: linear-gradient(90deg, rgba(197, 160, 89, 0.16) 0%, rgba(197, 160, 89, 0.02) 60%, transparent 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.agent-title {
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent-gold);
}

.agent-subtitle {
    font-size: 0.72rem;
    color: rgba(240, 232, 214, 0.7);
    margin-top: 6px;
    max-width: 260px;
}

.agent-actions {
    display: flex;
    gap: 8px;
}

.agent-action {
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: #f0e8d6;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
}

.agent-action:hover {
    border-color: rgba(197, 160, 89, 0.6);
    color: #ffffff;
}

.agent-terminal {
    padding: 14px 16px 6px;
    max-height: 280px;
    overflow-y: auto;
    background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.04), transparent 55%);
}

.agent-line {
    position: relative;
    padding-left: 72px;
    margin-bottom: 10px;
    font-size: 0.78rem;
    line-height: 1.6;
    white-space: pre-wrap;
    color: #f0e8d6;
}

.agent-line::before {
    position: absolute;
    left: 0;
    top: 0;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(197, 160, 89, 0.8);
}

.agent-line.user::before {
    content: "you";
}

.agent-line.agent::before {
    content: "zlaude";
    color: rgba(196, 90, 58, 0.95);
}

.agent-line.error {
    color: #f3b5b5;
}

.agent-line.error::before {
    content: "error";
    color: #f08a8a;
}

.agent-line.status {
    color: rgba(240, 232, 214, 0.7);
}

.agent-line.status::before {
    content: "status";
}

.agent-form {
    padding: 12px 16px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
}

.agent-label {
    display: block;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(240, 232, 214, 0.6);
    margin-bottom: 6px;
}

.agent-input {
    width: 100%;
    min-height: 90px;
    resize: vertical;
    background: #0c1118;
    color: #f3ede2;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 10px 12px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.agent-input:focus {
    border-color: rgba(197, 160, 89, 0.7);
    box-shadow: 0 0 0 3px rgba(197, 160, 89, 0.15);
    outline: none;
}

.agent-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    gap: 12px;
}

.agent-hint {
    font-size: 0.7rem;
    color: rgba(240, 232, 214, 0.6);
}

@media (max-width: 720px) {
    .agent-dock {
        right: 12px;
        left: 12px;
        align-items: stretch;
    }

    .agent-panel {
        width: 100%;
    }

    .agent-terminal {
        max-height: 220px;
    }
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-warning { background: #fef3c7; color: #d97706; }
.badge-success { background: #d1fae5; color: #16a34a; }
.badge-danger { background: #fee2e2; color: #dc2626; }
.badge-info { background: #dbeafe; color: #2563eb; }

/* Grid & Layout Utilities */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

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

.flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mt-2 { margin-top: 0.5rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th { 
    text-align: left; 
    padding: 0.75rem; 
    font-family: var(--font-mono); 
    font-size: 0.75rem; 
    text-transform: uppercase; 
    letter-spacing: 0.05em; 
    color: var(--ink-secondary);
    border-bottom: 1px solid var(--border-subtle);
}
td { 
    padding: 0.75rem; 
    border-bottom: 1px dashed var(--border-subtle);
}

/* --- Restored Stats Grid for Projects --- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--bg-paper); border: 1px solid var(--border-subtle); border-radius: 8px; padding: 1.5rem; box-shadow: var(--card-shadow); }
.stat-value { font-size: 2rem; font-weight: bold; color: var(--accent-crimson); }
.stat-label { color: var(--ink-secondary); font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.05em; }


/* --- Authentication Overlay --- */
.auth-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--bg-paper); z-index: 10000; display: flex; align-items: center; justify-content: center; flex-direction: column; }
.auth-overlay.hidden { display: none; }
.auth-container { width: 100%; max-width: 320px; text-align: center; padding: 20px; }
.auth-input { width: 100%; padding: 16px; background: transparent; border: none; border-bottom: 2px solid var(--ink-primary); font-family: var(--font-mono); font-size: 1.5rem; text-align: center; outline: none; color: var(--ink-primary); margin-bottom: 24px; transition: border-color 0.3s; }
.auth-input::placeholder { opacity: 0.3; }
.auth-input:focus { border-bottom-color: var(--accent-crimson); }
.auth-error { color: var(--danger); font-family: var(--font-serif); margin-top: 1rem; min-height: 1.5rem; }
