/* ============================================
   Dark Purple Theme - Modern Sleek UI
   ============================================ */

:root {
    --bg-primary: #0a0612;
    --bg-secondary: #120a1f;
    --bg-card: rgba(20, 12, 35, 0.7);
    --bg-card-hover: rgba(30, 18, 50, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.05);

    --purple-100: #e9d5ff;
    --purple-200: #d8b4fe;
    --purple-300: #c084fc;
    --purple-400: #a855f7;
    --purple-500: #9333ea;
    --purple-600: #7e22ce;
    --purple-700: #6b21a8;
    --purple-800: #581c87;
    --purple-900: #3b0764;

    --accent-primary: #a855f7;
    --accent-secondary: #7c3aed;
    --accent-glow: rgba(168, 85, 247, 0.4);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border-color: rgba(168, 85, 247, 0.2);
    --border-glow: rgba(168, 85, 247, 0.5);

    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px var(--accent-glow);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: auto;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ============================================
   Animated Background
   ============================================ */

.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(ellipse at bottom, #1a0b2e 0%, #0a0612 50%, #05030a 100%);
    contain: strict;
}

.orb {
    position: absolute;
    border-radius: 50%;
    will-change: transform;
    contain: layout style;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(126, 34, 206, 0.45), transparent 65%);
    top: -100px;
    left: -100px;
    animation: float 25s infinite ease-in-out;
}

.orb-2 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(109, 40, 217, 0.4), transparent 65%);
    top: 50%;
    right: -50px;
    animation: float 30s infinite ease-in-out -5s;
}

.orb-3 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(76, 29, 149, 0.4), transparent 65%);
    bottom: -100px;
    left: 30%;
    animation: float 22s infinite ease-in-out -10s;
}

.orb-4 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.35), transparent 65%);
    top: 20%;
    left: 60%;
    animation: float 28s infinite ease-in-out -15s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(50px, -30px) scale(1.1);
    }
    50% {
        transform: translate(-30px, 50px) scale(0.9);
    }
    75% {
        transform: translate(30px, 30px) scale(1.05);
    }
}

@media (prefers-reduced-motion: reduce) {
    .orb {
        animation: none !important;
    }
    .flash {
        transition: none !important;
    }
    .stat-card,
    .widget-card,
    .card {
        transition: none !important;
    }
    .btn {
        transition: none !important;
    }
}



/* ============================================
   Flash Messages
   ============================================ */

.flash-messages {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.flash {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    backdrop-filter: blur(12px);
    border: 1px solid;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.flash-error {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.flash-success {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
    color: #86efac;
}

.flash-info {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

.flash-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flash-close:hover {
    opacity: 1;
}

/* Toast notifications - center top with fade */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    backdrop-filter: blur(12px);
    border: 1px solid;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    animation: toastFadeIn 0.4s ease forwards;
    min-width: 280px;
    max-width: 500px;
}

.toast.fade-out {
    animation: toastFadeOut 0.4s ease forwards;
}

@keyframes toastFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes toastFadeOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
}

.toast-success {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.4);
    color: #86efac;
}

.toast-error {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

.toast-info {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.4);
    color: #93c5fd;
}

.toast-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-close:hover {
    opacity: 1;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all var(--transition-base);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--purple-500), var(--purple-700));
    color: white;
    box-shadow: 0 4px 15px rgba(147, 51, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(147, 51, 234, 0.6);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    border-color: var(--border-glow);
    background: var(--bg-glass);
    box-shadow: var(--shadow-glow);
}

.btn-full {
    width: 100%;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    transition: all var(--transition-base);
}

.btn-secondary:hover {
    background: rgba(168, 85, 247, 0.15);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.2);
    transform: translateY(-2px);
}

.btn-secondary:active {
    transform: translateY(0);
}

/* Stylised Back Button */
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background: var(--bg-glass);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.btn-back::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.1), transparent);
    transition: left 0.5s ease;
}

.btn-back:hover::before {
    left: 100%;
}

.btn-back:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.2);
    transform: translateX(-2px);
}

.btn-back:hover i {
    transform: translateX(-3px);
}

.btn-back i {
    transition: transform var(--transition-base);
}

.btn-back:active {
    transform: translateX(0);
}

/* ============================================
   Forms
   ============================================ */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group label i {
    color: var(--accent-primary);
    font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="url"],
.form-group input[type="date"],
.form-group select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all var(--transition-base);
    outline: none;
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.form-group select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
    background: rgba(255, 255, 255, 0.08);
}

.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-right: 44px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    transition: color var(--transition-fast);
}

.toggle-password:hover {
    color: var(--text-primary);
}

.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    font-size: 0.85rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-secondary);
}

.checkbox-label input {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.checkmark::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 10px;
    color: white;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.checkbox-label input:checked + .checkmark {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.checkbox-label input:checked + .checkmark::after {
    opacity: 1;
}

.forgot-link {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.forgot-link:hover {
    color: var(--purple-300);
    text-decoration: underline;
}

/* ============================================
   Auth Pages
   ============================================ */

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 40px;
    background: rgba(20, 12, 35, 0.95);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg), 0 0 40px rgba(168, 85, 247, 0.1);
    animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 15px rgba(147, 51, 234, 0.4));
}

.auth-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--text-primary), var(--purple-200));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.auth-tagline {
    font-size: 0.85rem !important;
    font-style: italic;
    color: var(--text-muted) !important;
    margin-bottom: 4px !important;
}

.auth-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.auth-footer strong {
    color: var(--purple-300);
    font-weight: 600;
}

.auth-top-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    font-size: 0.85rem;
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
}

.auth-top-text {
    color: var(--text-muted);
}

.auth-links {
    margin-top: 20px;
    text-align: center;
}

.form-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

@media (max-width: 480px) {
    .form-actions-row {
        flex-direction: column;
    }

    .form-actions-row .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   Landing Page
   ============================================ */

.landing-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.landing-content {
    text-align: center;
    max-width: 700px;
    animation: fadeInUp 0.8s ease;
}

.landing-badge {
    display: inline-block;
    padding: 6px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: 100px;
    font-size: 0.85rem;
    color: var(--purple-300);
    margin-bottom: 24px;
}

.landing-title {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 20px;
    letter-spacing: -0.02em;
}

.gradient-text {
    background: linear-gradient(135deg, var(--purple-400), var(--purple-600));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.landing-desc {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
    line-height: 1.7;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.landing-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.scroll-hint {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
    animation: bounceDown 2s ease infinite;
}

.scroll-hint i {
    font-size: 1rem;
    color: var(--purple-400);
}

@keyframes bounceDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

/* ============================================
   Explainer Sections
   ============================================ */

.explainer-section {
    padding: 80px 24px;
    position: relative;
}

.explainer-section:nth-child(even) {
    background: rgba(20, 12, 35, 0.4);
}

.explainer-inner {
    max-width: 960px;
    margin: 0 auto;
    text-align: center;
}

.explainer-icon {
    font-size: 2.5rem;
    color: var(--purple-400);
    margin-bottom: 16px;
}

.explainer-heading {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: -0.01em;
}

.explainer-text {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.8;
    max-width: 640px;
    margin: 0 auto;
}

.explainer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-top: 32px;
}

.explainer-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    text-align: center;
    transition: transform var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
}

.explainer-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.explainer-card-icon {
    font-size: 1.8rem;
    color: var(--purple-400);
    margin-bottom: 12px;
}

.explainer-card h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.explainer-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.explainer-cta {
    background: linear-gradient(180deg, transparent 0%, rgba(168, 85, 247, 0.08) 100%);
}

.explainer-cta .explainer-heading {
    font-size: 2.2rem;
}

.explainer-cta .landing-actions {
    margin-top: 28px;
}

.btn-secondary {
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 28px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background var(--transition-base), border-color var(--transition-base);
}

.btn-secondary:hover {
    background: rgba(168, 85, 247, 0.15);
    border-color: var(--accent-primary);
}

/* ============================================
   Dashboard Layout
   ============================================ */

.dashboard {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: rgba(18, 10, 31, 0.92);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: width 0.3s ease, transform var(--transition-base);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
    contain: layout style;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.sidebar-brand {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    color: inherit;
    transition: padding 0.3s ease, gap 0.3s ease;
}

.sidebar-brand i {
    color: var(--accent-primary);
    font-size: 1.5rem;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-tagline {
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    opacity: 0;
    max-height: 0;
    margin: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, max-height 0.3s ease, margin 0.3s ease;
}

.sidebar-tagline.visible {
    opacity: 1;
    max-height: 40px;
    margin-bottom: 2px;
}

.sidebar-tagline.fade-out {
    opacity: 0;
    max-height: 0;
    margin: 0;
    transition: opacity 1.5s ease, max-height 0.5s ease 1.5s, margin 0.5s ease 1.5s;
}

.sidebar-logo-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
    transition: width 0.3s ease, height 0.3s ease;
}

.sidebar-nav {
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 500px;
    transition: max-height var(--transition-base), opacity var(--transition-fast), padding var(--transition-fast);
    opacity: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.nav-item:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(124, 58, 237, 0.1));
    color: var(--purple-300);
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.nav-item i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.sidebar-section {
    padding: 8px 0;
}

.sidebar-section + .sidebar-section {
    border-top: 1px solid var(--border-color);
}

.section-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 20px 4px;
    color: inherit;
}

.section-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.section-chevron {
    font-size: 0.6rem;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.sidebar-section.collapsed .section-chevron {
    transform: rotate(-90deg);
}

.sidebar-section.collapsed .sidebar-nav {
    max-height: 0;
    overflow: hidden;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--border-color);
}

.sidebar-toggle {
    width: 100%;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 8px;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    color: var(--accent-primary);
    background: var(--bg-glass);
}

html.sidebar-collapsed .sidebar {
    width: 60px;
}

html.sidebar-collapsed .sidebar .sidebar-brand {
    justify-content: center;
    padding: 16px 4px;
}

html.sidebar-collapsed .sidebar .sidebar-brand-text {
    display: none;
}

html.sidebar-collapsed .sidebar .sidebar-logo-img {
    width: 44px;
    height: 44px;
}

html.sidebar-collapsed .sidebar .nav-text,
html.sidebar-collapsed .sidebar .section-label,
html.sidebar-collapsed .sidebar .section-chevron,
html.sidebar-collapsed .sidebar .sidebar-tagline {
    display: none;
}

html.sidebar-collapsed .sidebar .section-toggle {
    display: none;
}

html.sidebar-collapsed .sidebar .sidebar-section {
    padding: 2px 0;
}

html.sidebar-collapsed .sidebar .sidebar-section + .sidebar-section {
    border-top: 1px solid var(--border-color);
}

html.sidebar-collapsed .sidebar .sidebar-nav {
    padding: 4px 6px;
    gap: 2px;
    max-height: none;
}

/* When sidebar is collapsed, force all nav items visible regardless of section collapse state */
html.sidebar-collapsed .sidebar .sidebar-section.collapsed .sidebar-nav {
    max-height: none;
    overflow: visible;
    opacity: 1;
    padding-top: 0;
    padding-bottom: 0;
}

html.sidebar-collapsed .sidebar .sidebar-footer {
    padding: 8px 4px;
}

html.sidebar-collapsed .sidebar .nav-item {
    position: relative;
    justify-content: center;
    padding: 8px 4px;
}

html.sidebar-collapsed .sidebar .nav-item i {
    width: auto;
    font-size: 1.05rem;
}

html.sidebar-collapsed .sidebar .nav-item::after {
    content: attr(title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
    margin-left: 8px;
    border: 1px solid var(--border-color);
    z-index: 200;
}

html.sidebar-collapsed .sidebar .nav-item:hover::after {
    opacity: 1;
}

html.sidebar-collapsed .sidebar .sidebar-toggle {
    padding: 6px 4px;
}

html.sidebar-collapsed .sidebar .sidebar-toggle i {
    transform: rotate(180deg);
}

html.sidebar-collapsed .dashboard .main-content {
    margin-left: 60px;
    max-width: calc(100vw - 60px);
}

.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
    max-width: calc(100vw - 260px);
    transition: margin-left 0.3s ease, max-width 0.3s ease;
    contain: layout style;
}

.topbar {
    height: 64px;
    background: rgba(20, 12, 35, 0.92);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 8px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
    justify-content: flex-end;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    max-width: 300px;
    width: 100%;
}

.search-box:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
}

.search-box i {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.search-box input {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    width: 100%;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 1rem;
}

.icon-btn:hover {
    border-color: var(--border-glow);
    color: var(--text-primary);
    background: rgba(168, 85, 247, 0.1);
}

.icon-btn .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    background: var(--error);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
    position: relative;
    user-select: none;
}

.user-menu:hover {
    background: var(--bg-glass);
}

.user-menu.active {
    background: var(--bg-glass);
}

.user-menu-chevron {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.user-menu.active .user-menu-chevron {
    transform: rotate(180deg);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: rgba(20, 12, 35, 0.95);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    padding: 6px;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: all var(--transition-fast);
    z-index: 200;
}

.user-menu.active .user-dropdown {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

.dropdown-item i {
    font-size: 0.9rem;
    width: 18px;
    text-align: center;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--purple-500), var(--purple-700));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
}

.user-menu span {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.content-area {
    flex: 1;
    padding: 24px;
    contain: content;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ============================================
   Stats Grid
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: rgba(20, 12, 35, 0.92);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--transition-base);
}

.stat-card:hover {
    border-color: var(--border-glow);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-card:hover {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-icon.users {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
}

.stat-icon.revenue {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.stat-icon.orders {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.stat-icon.growth {
    background: rgba(168, 85, 247, 0.15);
    color: var(--accent-primary);
}

.stat-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.stat-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stat-trend {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
}

.stat-trend.up {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.stat-trend.down {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

/* ============================================
   Cards
   ============================================ */

.card {
    background: rgba(20, 12, 35, 0.92);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--transition-base);
}

.card:hover {
    border-color: var(--border-glow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.card-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.select-sm {
    padding: 6px 12px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    outline: none;
}

.select-sm:focus {
    border-color: var(--accent-primary);
}

/* ============================================
   Dashboard Grid
   ============================================ */

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.dashboard-grid .full-width {
    grid-column: 1 / -1;
}

/* Activity Card */

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.activity-item:hover {
    background: var(--bg-glass);
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.activity-icon.user {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
}

.activity-icon.cart {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.activity-icon.dollar {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.activity-icon.comment {
    background: rgba(168, 85, 247, 0.15);
    color: var(--accent-primary);
}

.activity-icon.server {
    background: rgba(100, 116, 139, 0.15);
    color: var(--text-muted);
}

.activity-details {
    flex: 1;
}

.activity-action {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 2px;
}

.activity-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Chart Card */

.chart-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 20px 0;
}

.mini-chart {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 150px;
    width: 100%;
    justify-content: center;
}

.mini-chart .bar {
    width: 24px;
    background: linear-gradient(to top, var(--purple-700), var(--purple-400));
    border-radius: 4px 4px 0 0;
    transition: all var(--transition-base);
    animation: growBar 1s ease forwards;
    transform-origin: bottom;
    transform: scaleY(0);
}

.mini-chart .bar:nth-child(1) { animation-delay: 0.1s; }
.mini-chart .bar:nth-child(2) { animation-delay: 0.2s; }
.mini-chart .bar:nth-child(3) { animation-delay: 0.3s; }
.mini-chart .bar:nth-child(4) { animation-delay: 0.4s; }
.mini-chart .bar:nth-child(5) { animation-delay: 0.5s; }
.mini-chart .bar:nth-child(6) { animation-delay: 0.6s; }
.mini-chart .bar:nth-child(7) { animation-delay: 0.7s; }

@keyframes growBar {
    to {
        transform: scaleY(1);
    }
}

.mini-chart .bar:hover {
    background: linear-gradient(to top, var(--purple-600), var(--purple-300));
    box-shadow: 0 0 15px var(--accent-glow);
}

.chart-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ============================================
   Empty State
   ============================================ */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 20px;
    background: rgba(20, 12, 35, 0.92);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
}

.empty-state:hover {
    border-color: var(--border-glow);
}

.empty-icon {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(124, 58, 237, 0.1));
    border: 1px solid rgba(168, 85, 247, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--accent-primary);
    margin-bottom: 24px;
}

.empty-state h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    max-width: 400px;
}

.empty-state.compact {
    padding: 40px 20px;
}

/* ============================================
   To-Do List
   ============================================ */

.todo-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.todo-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: var(--bg-glass);
    border: 1px solid transparent;
    transition: all var(--transition-fast);
}

.todo-item:hover {
    border-color: var(--border-color);
}

.todo-item.completed .todo-title {
    text-decoration: line-through;
    color: var(--text-muted);
}

.todo-item.completed .todo-check {
    color: var(--success);
}

.todo-toggle-form,
.todo-delete-form {
    display: flex;
    flex-shrink: 0;
}

.todo-check {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast);
    margin-top: 2px;
}

.todo-check:hover {
    color: var(--accent-primary);
}

.todo-content {
    flex: 1;
    min-width: 0;
}

.todo-title {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    word-break: break-word;
}

.shared-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-glow);
    color: var(--accent-primary);
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    margin-left: 6px;
    vertical-align: middle;
}

.todo-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    word-break: break-word;
}

.todo-due {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.todo-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast);
    opacity: 0;
}

.todo-item:hover .todo-delete {
    opacity: 1;
}

.todo-delete:hover {
    color: var(--error);
}

/* Task Notes */
.task-notes {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    margin-bottom: 8px;
}

.task-note {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(168, 85, 247, 0.08);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.task-note-text {
    flex: 1;
    word-break: break-word;
}

.task-note-delete-form {
    display: flex;
    flex-shrink: 0;
}

.task-note-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast);
}

.task-note-delete:hover {
    color: var(--error);
}

.task-note-form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.task-note-form input[type="text"] {
    flex: 1;
    padding: 6px 10px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8rem;
    outline: none;
    transition: border-color var(--transition-fast);
}

.task-note-form input[type="text"]:focus {
    border-color: var(--accent-primary);
}

.task-note-form input[type="text"]::placeholder {
    color: var(--text-muted);
}

.task-note-add-btn {
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    color: var(--accent-primary);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.task-note-add-btn:hover {
    background: var(--accent-primary);
    color: #fff;
    border-color: var(--accent-primary);
}

/* Routine Actions */
.routine-actions {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.routine-timeline-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--accent-primary);
    text-decoration: none;
    padding: 4px 10px;
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.routine-timeline-link:hover {
    background: var(--accent-primary);
    color: #fff;
    border-color: var(--accent-primary);
}

.routine-skip-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.routine-skip-btn:hover {
    background: var(--warning);
    color: #000;
    border-color: var(--warning);
}

.routine-skip-info {
    font-size: 0.8rem;
    color: var(--warning);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.skip-reason {
    color: var(--text-secondary);
    font-style: italic;
}

.todo-item.skipped .todo-check {
    color: var(--warning);
}

.todo-item.skipped .todo-title {
    color: var(--text-secondary);
}

.btn-warning {
    background: var(--warning);
    color: #000;
    border: 1px solid var(--warning);
    font-weight: 600;
}

.btn-warning:hover {
    background: #d97706;
    border-color: #d97706;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

/* Routine Stats */
.routine-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.routine-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* Timeline */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    padding-left: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--border-color);
    border-radius: 2px;
}

.timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 0;
    position: relative;
}

.timeline-marker {
    position: absolute;
    left: -24px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 2px solid var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
    font-size: 0.75rem;
    flex-shrink: 0;
    z-index: 1;
}

.timeline-content {
    flex: 1;
    padding-left: 18px;
}

.timeline-date {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.timeline-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.timeline-skipped .timeline-marker {
    border-color: var(--warning);
    color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
}

.timeline-skip-label {
    font-size: 0.8rem;
    color: var(--warning);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.timeline-skip-reason {
    color: var(--text-secondary);
    font-style: italic;
}

.back-link {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
}

.badge-soft {
    padding: 4px 12px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--purple-300);
}

.hidden {
    display: none !important;
}

.inline-form {
    display: inline-flex;
}

/* ============================================
   Notes, Documents, Snippets
   ============================================ */

.notes-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.note-item {
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    transition: all var(--transition-fast);
}

.note-item:hover {
    border-color: var(--border-glow);
}

.note-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 12px;
}

.note-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.note-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.note-content {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
    white-space: pre-wrap;
    word-break: break-word;
}

.note-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.edit-form {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.edit-form .form-group {
    margin-bottom: 12px;
}

.code-block {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 12px;
    overflow-x: auto;
    position: relative;
}

.code-block .code-block-header {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
}

.code-block code {
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: pre;
    word-break: normal;
    overflow-wrap: normal;
    line-height: 1.6;
}

.code-block-edit-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 12, 35, 0.9);
    border: 1px solid rgba(168, 85, 247, 0.25);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    opacity: 0;
    transform: translateY(-2px);
    transition: all var(--transition-fast);
    backdrop-filter: blur(6px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.code-block:hover .code-block-edit-btn {
    opacity: 1;
    transform: translateY(0);
}

.code-block-edit-btn:hover {
    color: var(--purple-300);
    border-color: var(--border-glow);
    background: rgba(168, 85, 247, 0.2);
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.25);
}

.code-block-lang-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #000000;
    background: rgba(168, 85, 247, 0.25);
    border: 1px solid rgba(168, 85, 247, 0.4);
    border-radius: var(--radius-sm);
    padding: 2px 8px;
    margin-right: 6px;
    pointer-events: none;
}

/* Line-numbered blocks: raise header above gutter */
.code-block.line-numbers .code-block-header {
    z-index: 10;
}

/* ============================================
   Sidebar Sub-items
   ============================================ */

.nav-item.sub-item {
    padding-left: 32px;
    font-size: 0.85rem;
}

.nav-item.sub-item i {
    font-size: 1rem;
    width: 20px;
}

/* ============================================
   Profile
   ============================================ */

.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all var(--transition-base);
    outline: none;
    resize: vertical;
    min-height: 100px;
}

.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
    background: rgba(255, 255, 255, 0.08);
}

/* ============================================
   Kanban Board
   ============================================ */

.kanban-board {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.kanban-add {
    background: rgba(20, 12, 35, 0.92);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
}

.kanban-form {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.kanban-form input[type="text"] {
    flex: 1;
    min-width: 180px;
    padding: 10px 14px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: all var(--transition-fast);
}

.kanban-form input[type="text"]::placeholder {
    color: var(--text-muted);
}

.kanban-form input[type="text"]:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
}

.kanban-form select {
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    min-width: 140px;
}

.kanban-form select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.kanban-form select:focus {
    border-color: var(--accent-primary);
}

.kanban-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.kanban-column {
    background: rgba(20, 12, 35, 0.92);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    min-height: 300px;
    transition: all var(--transition-base);
}

.kanban-column:hover {
    border-color: var(--border-glow);
}

.column-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.column-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    flex: 1;
}

.column-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.column-dot.todo {
    background: var(--text-muted);
}

.column-dot.in_progress {
    background: var(--warning);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.column-dot.done {
    background: var(--success);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

.column-count {
    padding: 2px 10px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.column-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.column-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.kanban-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    transition: all var(--transition-fast);
}

.kanban-card:hover {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.kanban-card.completed {
    opacity: 0.7;
    border-color: rgba(34, 197, 94, 0.3);
}

.kanban-card.completed .card-title {
    text-decoration: line-through;
    color: var(--text-muted);
}

.card-title {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-primary);
    word-break: break-word;
}

.card-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    word-break: break-word;
}

.card-actions {
    display: flex;
    gap: 2px;
    justify-content: flex-end;
    align-items: center;
}

.card-actions form {
    display: flex;
}

.card-move {
    background: none;
    border: none;
    color: var(--accent-primary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-move:hover {
    background: rgba(168, 85, 247, 0.15);
}

.card-move.back {
    color: var(--text-muted);
}

.card-move.back:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

.card-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast);
}

.card-delete:hover {
    color: var(--error);
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    /* ---- Sidebar: off-canvas drawer ---- */
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        z-index: 200;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Sidebar overlay backdrop */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 199;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* Override sidebar-collapsed on mobile — always show full sidebar */
    html.sidebar-collapsed .sidebar {
        width: 280px;
    }

    html.sidebar-collapsed .sidebar .sidebar-brand {
        justify-content: flex-start;
        padding: 20px;
        gap: 12px;
    }

    html.sidebar-collapsed .sidebar .sidebar-brand-text {
        display: flex;
    }

    html.sidebar-collapsed .sidebar .sidebar-logo-img {
        width: 36px;
        height: 36px;
    }

    html.sidebar-collapsed .sidebar .nav-text,
    html.sidebar-collapsed .sidebar .section-label,
    html.sidebar-collapsed .sidebar .section-chevron,
    html.sidebar-collapsed .sidebar .sidebar-tagline {
        display: block;
    }

    html.sidebar-collapsed .sidebar .section-chevron {
        display: inline;
    }

    html.sidebar-collapsed .sidebar .section-toggle {
        display: flex;
    }

    html.sidebar-collapsed .sidebar .sidebar-section {
        padding: 8px 0;
    }

    html.sidebar-collapsed .sidebar .sidebar-nav {
        padding: 8px 12px;
        gap: 4px;
    }

    html.sidebar-collapsed .sidebar .nav-item {
        justify-content: flex-start;
        padding: 12px 16px;
    }

    html.sidebar-collapsed .sidebar .nav-item i {
        width: 24px;
        font-size: 1.1rem;
    }

    html.sidebar-collapsed .sidebar .nav-item::after {
        display: none;
    }

    html.sidebar-collapsed .sidebar .sidebar-footer {
        padding: 16px 12px;
    }

    /* ---- Main content: full width on mobile ---- */
    .main-content {
        margin-left: 0;
        max-width: 100vw;
    }

    html.sidebar-collapsed .dashboard .main-content {
        margin-left: 0;
        max-width: 100vw;
    }

    .menu-toggle {
        display: block;
    }

    .search-box {
        display: none;
    }

    /* ---- Landing page ---- */
    .landing-title {
        font-size: 2.5rem;
    }

    .explainer-heading {
        font-size: 1.6rem;
    }

    .explainer-section {
        padding: 56px 20px;
    }

    .explainer-grid {
        grid-template-columns: 1fr;
    }

    /* ---- Stats ---- */
    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* ---- Auth ---- */
    .auth-card {
        padding: 28px;
    }

    /* ---- Topbar user menu ---- */
    .user-menu span {
        display: none;
    }

    .user-menu-chevron {
        display: none;
    }

    /* ---- Kanban ---- */
    .kanban-columns {
        grid-template-columns: 1fr;
    }

    .kanban-form {
        flex-direction: column;
        align-items: stretch;
    }

    .kanban-form input[type="text"],
    .kanban-form select {
        width: 100%;
    }

    /* ---- Cards & content ---- */
    .content-area {
        padding: 16px;
    }

    .page-header h1 {
        font-size: 1.4rem;
    }

    .card {
        padding: 16px;
    }

    .card-header {
        flex-wrap: wrap;
        gap: 12px;
    }

    /* ---- Dashboard grid ---- */
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    /* ---- Modals ---- */
    .modal-content {
        max-width: calc(100vw - 32px);
        margin: 16px;
        max-height: 85vh;
    }

    .modal-sm {
        max-width: calc(100vw - 32px);
    }

    .modal-md {
        max-width: calc(100vw - 32px);
    }

    /* ---- Forms ---- */
    .form-group input[type="text"],
    .form-group input[type="password"],
    .form-group input[type="email"],
    .form-group input[type="url"],
    .form-group input[type="date"],
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Prevent iOS zoom on focus */
    }

    /* ---- Doc list header ---- */
    .doc-list-header {
        flex-direction: column;
        align-items: stretch;
    }

    .doc-list-header .search-box {
        max-width: 100%;
    }

    /* ---- Notes list ---- */
    .notes-list {
        grid-template-columns: 1fr;
    }

    /* ---- Flash messages ---- */
    .flash-messages {
        left: 12px;
        right: 12px;
        max-width: none;
    }

    /* ---- Toast ---- */
    .toast {
        min-width: auto;
        max-width: calc(100vw - 32px);
        left: 50%;
    }

    /* ---- AI Chat Widget ---- */
    .ai-chat-widget {
        bottom: 12px;
        right: 12px;
    }

    .ai-chat-panel {
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
        height: 60vh;
        max-height: 60vh;
    }

    /* ---- Buttons ---- */
    .btn {
        padding: 10px 16px;
        font-size: 0.875rem;
    }

    /* ---- Tables ---- */
    .admin-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* ---- Project detail layout ---- */
    .project-header-actions {
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }

    .project-header-actions .btn {
        width: 100%;
        justify-content: center;
    }

    /* ---- Note actions wrap on mobile ---- */
    .note-actions {
        flex-wrap: wrap;
        gap: 6px;
    }

    .note-header {
        flex-wrap: wrap;
    }

    .note-date {
        white-space: normal;
    }

    /* ---- Auth top bar ---- */
    .auth-top-bar {
        position: static;
        justify-content: center;
        padding: 12px 16px;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border-color);
    }

    /* ---- Auth container ---- */
    .auth-container {
        padding: 16px;
    }

    .auth-card {
        padding: 24px 20px;
        border-radius: var(--radius-lg);
    }

    /* ---- Tag filter bar ---- */
    .tag-filter-bar {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
    }

    .tag-filter-bar::-webkit-scrollbar {
        height: 4px;
    }

    /* ---- Breadcrumb ---- */
    .breadcrumb {
        flex-wrap: wrap;
        font-size: 0.8rem;
    }

    /* ---- Inline forms ---- */
    .inline-form {
        display: inline-block;
    }

    /* ---- User dropdown ---- */
    .user-dropdown {
        right: -8px;
        min-width: 160px;
    }

    /* ---- Document editor ---- */
    .doc-editor {
        margin: 0;
    }

    .doc-editor-area {
        min-height: 300px;
        padding: 12px;
    }

    /* ---- Report editor toolbar ---- */
    .editor-toolbar {
        flex-wrap: wrap;
        gap: 4px;
    }

    .toolbar-group {
        flex-wrap: wrap;
    }

    /* ---- Two-factor auth pages ---- */
    .twofa-setup-code {
        font-size: 1.2rem;
        word-break: break-all;
    }

    /* ---- Routine stats ---- */
    .routine-stats {
        grid-template-columns: 1fr;
    }

    /* ---- Kanban column min-width ---- */
    .kanban-column {
        min-height: 200px;
    }

    .kanban-board {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* ---- Custom days checkboxes ---- */
    .custom-days-checkboxes {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .landing-title {
        font-size: 2rem;
    }

    .explainer-heading {
        font-size: 1.35rem;
    }

    .explainer-section {
        padding: 40px 16px;
    }

    .explainer-card {
        padding: 20px 16px;
    }

    .landing-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-lg {
        width: 100%;
        justify-content: center;
    }

    .content-area {
        padding: 12px;
    }

    .stat-card {
        padding: 14px;
        gap: 12px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .topbar {
        padding: 0 12px;
        height: 56px;
    }

    .page-header h1 {
        font-size: 1.2rem;
    }

    .card {
        padding: 12px;
        border-radius: var(--radius-md);
    }

    .widget-grid.stats-row {
        grid-template-columns: 1fr;
    }

    /* Sidebar slightly narrower on very small screens */
    .sidebar {
        width: 260px;
    }

    html.sidebar-collapsed .sidebar {
        width: 260px;
    }

    /* Ensure modals don't overflow */
    .modal-content {
        margin: 8px;
        max-width: calc(100vw - 16px);
        border-radius: var(--radius-md);
    }

    .modal-header {
        padding: 12px 16px;
    }

    .modal-body {
        padding: 16px;
    }

    /* Kanban cards compact */
    .kanban-card {
        padding: 10px 12px;
    }

    /* Activity items compact */
    .activity-item {
        padding: 8px;
        gap: 10px;
    }

    .activity-icon {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    /* Flash messages */
    .flash-messages {
        left: 8px;
        right: 8px;
    }

    .flash {
        padding: 10px 14px;
        font-size: 0.85rem;
    }

    /* Note actions stack on very small screens */
    .note-actions {
        flex-direction: column;
    }

    .note-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .note-actions form {
        width: 100%;
    }

    .note-actions form .btn {
        width: 100%;
        justify-content: center;
    }

    /* Auth card compact */
    .auth-card {
        padding: 20px 16px;
    }

    .auth-header h1 {
        font-size: 1.4rem;
    }

    /* Kanban column compact */
    .kanban-column {
        min-width: 0;
    }

    /* Doc view header */
    .doc-view-header {
        flex-direction: column;
        gap: 12px;
    }

    .doc-meta h1 {
        font-size: 1.3rem;
    }

    .doc-actions {
        width: 100%;
    }

    .doc-actions .btn {
        flex: 1;
        justify-content: center;
        min-width: 0;
    }

    /* Report image grid */
    .report-image-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

/* ============================================
   Modal Base Styles
   ============================================ */

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1001;
}

.modal-content {
    position: relative;
    z-index: 1002;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalFadeIn 0.2s ease;
    box-shadow: var(--shadow-lg);
}

/* ============================================
   Document Editor & Viewer
   ============================================ */

.doc-list-item .note-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.doc-list-item .note-title a:hover {
    color: var(--accent-primary);
}

.doc-editor {
    margin: 0 24px;
}

.doc-editor .form-group input[type="text"] {
    width: 100%;
}

.doc-editor-area {
    width: 100%;
    min-height: 400px;
    padding: 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.7;
    font-family: inherit;
    outline: none;
    transition: all var(--transition-base);
    overflow-y: auto;
    resize: vertical;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.doc-editor-area:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
    background: rgba(255, 255, 255, 0.08);
}

.doc-editor-area:empty:before {
    content: attr(placeholder);
    color: var(--text-muted);
    pointer-events: none;
}

.doc-editor-area p {
    margin-bottom: 12px;
}

.doc-editor-area pre.code-block {
    margin: 16px 0;
}

.editor-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    padding: 8px 12px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(20, 12, 35, 0.95);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1;
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
    transition: color var(--transition-fast);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 12px 20px 20px;
}

/* Modal Code Preview */
.modal-code-preview {
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow-x: auto;
}

.modal-code-preview-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Delete Modal */
.modal-sm {
    max-width: 420px;
}

.delete-modal-text {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.5;
}

.delete-modal-text strong {
    color: var(--accent-primary);
}

.delete-modal-hint {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
}

/* Danger Button */
.btn-danger {
    background: var(--error);
    color: #fff;
    border: 1px solid var(--error);
}

.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

/* Share Modal */
.modal-md {
    max-width: 520px;
}

.share-loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 1rem;
}

.share-loading i {
    margin-right: 0.5rem;
    color: var(--accent-primary);
}

.share-section {
    margin-bottom: 1.5rem;
}

.share-section h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.share-section h4 i {
    margin-right: 0.5rem;
    color: var(--accent-primary);
}

.share-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.share-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.75rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.share-item:hover {
    background: rgba(168, 85, 247, 0.08);
    border-color: var(--border-glow);
}

.share-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.share-item-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.share-item-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.share-empty-msg {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0.5rem 0;
}

.share-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.share-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(168, 85, 247, 0.1);
}

.share-btn.shared {
    border-color: var(--success);
    color: var(--success);
}

.share-btn.shared:hover {
    border-color: var(--error);
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.modal-code-preview pre {
    margin: 0;
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre;
    word-break: normal;
}

/* Syntax highlighting colors - global for editor, modal, and view */
.kw { color: #c084fc; }   /* keyword */
.str { color: #86efac; }   /* string */
.num { color: #fca5a5; }   /* number */
.cm { color: #64748b; }    /* comment */
.fn { color: #93c5fd; }   /* function */
.tag { color: #fca5a5; }  /* html tag */
.attr { color: #fdba74; } /* html attr */
.sel { color: #93c5fd; }  /* css selector */
.prop { color: #c084fc; }  /* css property */

/* Document View */
.doc-view {
    max-width: 900px;
}

.doc-view-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.doc-meta h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.doc-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.doc-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.doc-view-body {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-primary);
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.doc-view-body p {
    margin-bottom: 16px;
}

.doc-view-body pre,
.doc-view-body pre.code-block,
.doc-view-body .code-block {
    margin: 20px 0;
    white-space: pre-wrap;
    overflow-x: hidden;
    word-break: break-all;
    overflow-wrap: break-word;
    max-width: 100%;
}

.doc-view-body .code-block code,
.doc-view-body pre code {
    white-space: pre-wrap;
    word-break: break-all;
    overflow-wrap: break-word;
    max-width: 100%;
    line-height: 1.6;
}

/* ============================================
   Tags System
   ============================================ */

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(168, 85, 247, 0.15);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--purple-300);
    text-decoration: none;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.tag-chip:hover {
    background: rgba(168, 85, 247, 0.3);
    border-color: var(--purple-400);
    color: var(--purple-200);
    transform: translateY(-1px);
}

.tag-chip.active {
    background: rgba(168, 85, 247, 0.4);
    border-color: var(--purple-400);
    color: var(--purple-100);
}

.doc-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.doc-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 0 8px;
}

.tag-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.tag-filter-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.field-hint {
    display: block;
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Related Documents */
.doc-related {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.doc-related h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.related-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.related-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.related-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-glow);
    transform: translateY(-2px);
}

.related-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.related-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.related-tags {
    font-size: 0.75rem;
    color: var(--purple-300);
}

/* Search in doc list header */
.doc-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.doc-list-header .search-box {
    max-width: 320px;
    flex: 1;
}

/* ============================================
   Scrollbar Styling
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--purple-800);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--purple-700);
}

/* ============================================
   Selection Styling
   ============================================ */

::selection {
    background: rgba(168, 85, 247, 0.3);
    color: var(--text-primary);
}

/* ============================================
   Breadcrumbs
   ============================================ */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.breadcrumb a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.breadcrumb a:hover {
    color: var(--purple-300);
    text-decoration: underline;
}

.breadcrumb-sep {
    color: var(--text-muted);
    opacity: 0.6;
}

/* ============================================
   Project & Board Cards
   ============================================ */

.project-card .note-title a,
.board-card .note-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.project-card .note-title a:hover,
.board-card .note-title a:hover {
    color: var(--accent-primary);
}

.board-card {
    border-left: 3px solid var(--accent-primary);
}

/* ============================================
   Board Documents & Notes on Kanban Page
   ============================================ */

.board-section {
    margin-top: 24px;
}

.board-section .card-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
}

.board-section .card-header h2 i {
    color: var(--accent-primary);
}

.attach-bar {
    display: flex;
    gap: 10px;
    padding: 0 20px 12px;
    background: transparent;
    border: none;
}

.attach-bar .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ============================================
   Dashboard Widgets
   ============================================ */

.widget-grid {
    display: grid;
    gap: 20px;
    contain: content;
}

.widget-grid.stats-row {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 28px;
}

@media (max-width: 700px) {
    .widget-grid.stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        margin-bottom: 20px;
    }
}

@media (max-width: 480px) {
    .widget-grid.stats-row {
        grid-template-columns: 1fr;
    }
}

.widget-grid.main-widgets {
    grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 900px) {
    .widget-grid.main-widgets {
        grid-template-columns: 1fr;
    }
}

/* Stat Cards */
.stat-card {
    background: rgba(20, 12, 35, 0.92);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
    transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card:hover {
    border-color: var(--border-glow);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-icon.todo {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.stat-icon.note {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.stat-icon.doc {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
}

.stat-icon.routine {
    background: rgba(168, 85, 247, 0.15);
    color: var(--accent-primary);
}

.stat-icon.project {
    background: rgba(236, 72, 153, 0.15);
    color: #ec4899;
}

.stat-icon.diagram {
    background: rgba(20, 184, 166, 0.15);
    color: #14b8a6;
}

.stat-icon.report {
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
}

.stat-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* Widget Cards */
.widget-card {
    background: rgba(20, 12, 35, 0.92);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: border-color var(--transition-fast);
    min-height: 280px;
}

.widget-card:hover {
    border-color: var(--border-glow);
}

.widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.widget-header h2 {
    font-size: 1.05rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.widget-header h2 i {
    color: var(--accent-primary);
    font-size: 1rem;
}

.widget-link {
    font-size: 0.8rem;
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
    transition: opacity var(--transition-fast);
}

.widget-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.widget-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Widget List */
.widget-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.widget-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: var(--bg-glass);
    border: 1px solid transparent;
    transition: all var(--transition-fast);
    text-decoration: none;
    color: inherit;
}

.widget-list-item:hover {
    border-color: var(--border-color);
    background: var(--bg-hover);
    cursor: pointer;
}

.widget-list-item.completed .widget-item-title {
    text-decoration: line-through;
    opacity: 0.6;
}

.widget-item-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.widget-item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: capitalize;
    flex-shrink: 0;
}

.widget-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}

.widget-empty p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.widget-empty a {
    color: var(--accent-primary);
    text-decoration: none;
}

.widget-empty a:hover {
    text-decoration: underline;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-success {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* ============================================
   Reports
   ============================================ */

.report-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.report-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.report-section h3 i {
    color: var(--accent-primary);
}

.report-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.report-image-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition-base);
    position: relative;
}

.report-image-card:hover {
    border-color: var(--border-glow);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.report-image-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
    cursor: pointer;
}

.report-image-name {
    display: block;
    padding: 8px 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.report-image-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.report-image-card:hover .report-image-actions {
    opacity: 1;
}

.diagram-select-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
    padding: 4px;
}

.diagram-select-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-glass);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.diagram-select-item:hover {
    border-color: var(--border-color);
    background: var(--bg-card);
}

.diagram-select-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.diagram-select-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.diagram-select-info i {
    color: var(--accent-primary);
    font-size: 1rem;
}

.doc-description {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.modal-lg {
    max-width: 900px;
    width: 90%;
}

.modal-lg .modal-body img {
    display: block;
    margin: 0 auto;
    max-height: 70vh;
    object-fit: contain;
}

input[type="file"] {
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.9rem;
    width: 100%;
    cursor: pointer;
}

input[type="file"]:hover {
    border-color: var(--border-glow);
}

input[type="file"]::file-selector-button {
    background: var(--accent-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    margin-right: 12px;
    cursor: pointer;
    font-weight: 500;
    transition: background var(--transition-fast);
}

input[type="file"]::file-selector-button:hover {
    background: var(--accent-secondary);
}

/* ============================================
   Admin Pages
   ============================================ */

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    gap: 16px;
    flex-wrap: wrap;
}

.admin-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
}

.admin-header h1 i {
    color: var(--accent-primary);
}

.admin-section {
    margin-bottom: 36px;
}

.admin-section h2 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-section h2 i {
    color: var(--accent-primary);
    font-size: 1rem;
}

.admin-table-wrapper {
    background: rgba(20, 12, 35, 0.92);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table thead {
    background: rgba(168, 85, 247, 0.08);
}

.admin-table th {
    padding: 14px 16px;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.admin-table td {
    padding: 12px 16px;
    font-size: 0.9rem;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(168, 85, 247, 0.08);
    vertical-align: middle;
}

.admin-table tbody tr {
    transition: background var(--transition-fast);
}

.admin-table tbody tr:hover {
    background: rgba(168, 85, 247, 0.05);
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--purple-500), var(--purple-700));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: white;
    flex-shrink: 0;
}

.badge-admin {
    background: rgba(168, 85, 247, 0.2);
    color: var(--accent-primary);
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.badge-user {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.content-stats-mini {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.content-stats-mini span {
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.content-stats-mini i {
    font-size: 0.7rem;
    color: var(--accent-primary);
}

.action-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.78rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.btn-accent {
    background: linear-gradient(135deg, var(--purple-500), var(--purple-700));
    color: white;
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
}

.btn-accent:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(147, 51, 234, 0.4);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
    cursor: pointer;
    transition: all var(--transition-base);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
    transform: translateY(-1px);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.pagination-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Responsive admin table */
@media (max-width: 768px) {
    .admin-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-table-wrapper {
        overflow-x: auto;
    }

    .admin-table {
        min-width: 700px;
    }

    .content-stats-mini {
        flex-direction: column;
        gap: 4px;
    }

    .action-buttons {
        flex-direction: column;
        gap: 4px;
    }
}

/* ============================================
   AI Chat Widget (Admin Only)
   ============================================ */

.ai-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.ai-chat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--purple-500), var(--accent-secondary));
    border: none;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(168, 85, 247, 0.4);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-chat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.6);
}

.ai-chat-panel {
    width: 360px;
    max-width: calc(100vw - 40px);
    height: 480px;
    max-height: calc(100vh - 100px);
    background: rgba(20, 12, 35, 0.95);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1;
    animation: modalIn 0.2s ease;
}

.ai-chat-panel.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.96);
}

.ai-chat-header {
    padding: 14px 18px;
    background: rgba(168, 85, 247, 0.12);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.ai-chat-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 4px;
    transition: color var(--transition-fast);
}

.ai-chat-close:hover {
    color: var(--error);
}

.ai-chat-body {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-chat-msg {
    display: flex;
    max-width: 90%;
}

.ai-chat-bot {
    align-self: flex-start;
}

.ai-chat-user {
    align-self: flex-end;
}

.ai-chat-bubble {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    line-height: 1.45;
    white-space: pre-wrap;
}

.ai-chat-bot .ai-chat-bubble {
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.2);
    color: var(--text-primary);
}

.ai-chat-user .ai-chat-bubble {
    background: var(--accent-primary);
    color: #fff;
}

.ai-chat-controls {
    padding: 10px 14px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    align-items: center;
    background: rgba(10, 6, 18, 0.6);
}

.ai-chat-input {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 8px 12px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition-fast);
}

.ai-chat-input:focus {
    border-color: var(--accent-primary);
}

.ai-chat-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-primary);
    border: none;
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast), transform var(--transition-fast);
    flex-shrink: 0;
}

.ai-chat-send:hover {
    background: var(--purple-500);
    transform: scale(1.05);
}

.ai-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-chat-typing {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.ai-chat-typing span {
    width: 6px;
    height: 6px;
    background: var(--purple-300);
    border-radius: 50%;
    animation: typingBounce 1s infinite ease-in-out;
}

.ai-chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-chat-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

@media (max-width: 480px) {
    .ai-chat-panel {
        width: 100vw;
        max-width: 100vw;
        right: 0;
        left: 0;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
    }
}

.ai-chat-meta {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
    padding-left: 4px;
    opacity: 0.7;
}
