/* Closet Studios Mail Server - Aqua Glass Theme */
/* Inspired by Outlook + Aqua Essence Pools branding */

:root {
    /* Aqua Essence Pools Color Palette */
    --ocean-deep: #004E7C;
    --ocean-medium: #006B96;
    --ocean-light: #7FDBFF;
    --aqua-cyan: #00B4D8;
    --aqua-teal: #0096C7;
    --gold-accent: #FFD700;
    --gold-hover: #FFA500;
    --cream: #FFF5E1;
    --dark-navy: #001a2e;

    /* Glass effect colors */
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-sidebar: rgba(0, 78, 124, 0.95);
    --glass-border: rgba(0, 107, 150, 0.2);
    --glass-hover: rgba(127, 219, 255, 0.15);

    /* Semantic colors */
    --bg: linear-gradient(135deg, #E0F7FA 0%, #B2EBF2 50%, #E0F7FA 100%);
    --bg-solid: #E8F6F8;
    --bg-card: var(--glass-bg);
    --text: #004E7C;
    --text-muted: #006B96;
    --text-light: #4A90A4;
    --primary: #006B96;
    --primary-hover: #004E7C;
    --danger: #d63031;
    --danger-hover: #b71c1c;
    --success: #00b894;
    --warning: #FFD700;
    --border: var(--glass-border);
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 78, 124, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 78, 124, 0.18);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0;
    padding-top: 56px; /* Offset for fixed navbar */
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    background-attachment: fixed;
    min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--ocean-deep); text-decoration: none; }

/* ============================================
   GLASS NAVBAR
   ============================================ */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
    background: linear-gradient(135deg, var(--ocean-deep) 0%, var(--ocean-medium) 100%);
    border-bottom: 1px solid rgba(127, 219, 255, 0.3);
    box-shadow: 0 2px 20px rgba(0, 78, 124, 0.3);
    backdrop-filter: blur(10px);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}
.nav-brand a {
    font-weight: 700;
    font-size: 18px;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
}
.nav-brand a::before {
    content: "";
    display: inline-block;
    width: 32px;
    height: 32px;
    background-image: url('/static/images/rtech_logo.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
.nav-brand a:hover { text-decoration: none; color: var(--ocean-light); }

/* Navigation Links - Slide-out menu on all screen sizes */
.nav-links {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100vh;
    background: linear-gradient(180deg, var(--ocean-deep) 0%, var(--ocean-medium) 100%);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 70px 0 20px;
    z-index: 1001;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
    transition: right 0.3s ease;
    overflow-y: auto;
}

.nav-links.nav-open {
    right: 0;
}

.nav-link {
    display: block;
    color: rgba(255, 255, 255, 0.85);
    font-size: 15px;
    font-weight: 500;
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
    transition: all 0.2s ease;
}
.nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}
/* Nav Groups (accordion menu sections) */
.nav-group {
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}
.nav-group-toggle {
    cursor: pointer;
    color: rgba(255, 255, 255, 0.85);
    font-size: 15px;
    font-weight: 500;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
}
.nav-group-toggle:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}
.nav-arrow {
    font-size: 18px;
    font-weight: 700;
    opacity: 0.5;
    transition: transform 0.2s ease;
    display: inline-block;
}
.nav-group.open .nav-arrow {
    transform: rotate(90deg);
}
.nav-group.open .nav-group-toggle {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}
.nav-group-items {
    display: none;
    background: rgba(0, 0, 0, 0.15);
}
.nav-group.open .nav-group-items {
    display: block;
}
.nav-group-items .nav-link {
    padding: 12px 24px 12px 40px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.nav-group-items .nav-link:last-child {
    border-bottom: none;
}
.nav-group-items .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.nav-user {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
}
.nav-logout {
    color: var(--gold-accent);
    font-weight: 500;
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-bottom: none;
}
.nav-logout:hover { color: var(--gold-hover); }

/* Hamburger Menu Button - Always visible */
.nav-hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 8px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    z-index: 1002;
    transition: background 0.2s ease;
}

.nav-hamburger:hover {
    background: rgba(255, 255, 255, 0.15);
}

.hamburger-line {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Hamburger animation when active */
.nav-hamburger.active .hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-hamburger.active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.nav-hamburger.active .hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Mobile nav overlay */
.nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-overlay.active {
    display: block;
    opacity: 1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .navbar {
        padding: 0 16px;
    }

    .container {
        padding: 16px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .header-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .nav-brand .nav-user {
        font-size: 10px;
        max-width: 160px;
    }
}

/* Extra small screens - full width slide-out */
@media (max-width: 480px) {
    .nav-brand .nav-user {
        max-width: 140px;
    }

    .nav-links {
        width: 100%;
        right: -100%;
    }
}

/* ============================================
   LAYOUT
   ============================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.page-header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--ocean-deep);
}
.header-actions { display: flex; gap: 8px; }

/* ============================================
   GLASS CARDS
   ============================================ */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
    box-shadow: var(--shadow-lg);
}
.card h2 {
    margin: 0 0 16px;
    font-size: 17px;
    color: var(--ocean-deep);
    font-weight: 600;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
}
.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--ocean-medium), var(--ocean-light));
}
.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--ocean-deep);
    line-height: 1.2;
}
.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin: 6px 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.stat-link {
    font-size: 12px;
    color: var(--primary);
    font-weight: 500;
}
.stat-ok { border-left: 4px solid var(--success); }
.stat-ok::before { background: var(--success); }
.stat-warn { border-left: 4px solid var(--warning); }
.stat-warn::before { background: var(--warning); }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
    background: linear-gradient(135deg, var(--ocean-medium) 0%, var(--ocean-deep) 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 107, 150, 0.35);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--ocean-deep) 0%, var(--dark-navy) 100%);
    box-shadow: 0 6px 16px rgba(0, 78, 124, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.8);
    color: var(--ocean-deep);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--ocean-medium);
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: #fff;
}
.btn-danger:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
}

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-full { width: 100%; }

.btn-icon {
    font-size: 14px;
}

/* ============================================
   FORMS
   ============================================ */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--ocean-deep);
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid rgba(0, 107, 150, 0.25);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
    transition: all 0.2s ease;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--ocean-medium);
    box-shadow: 0 0 0 3px rgba(0, 107, 150, 0.15);
    background: #fff;
}
.form-group input::placeholder { color: var(--text-light); }
.form-group textarea { resize: vertical; min-height: 100px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; display: block; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-inline { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-inline .form-group { margin-bottom: 0; }

/* ============================================
   TABLES
   ============================================ */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.data-table th, .data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(0, 107, 150, 0.1);
    font-size: 13px;
}
.data-table th {
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ocean-deep);
    background: rgba(0, 107, 150, 0.05);
    position: sticky;
    top: 0;
}
.data-table tbody tr {
    transition: background 0.15s ease;
}
.data-table tbody tr:hover {
    background: rgba(127, 219, 255, 0.1);
}
.actions { white-space: nowrap; }
.actions form { display: inline-block; margin-right: 6px; }

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.badge-ok { background: rgba(0, 184, 148, 0.15); color: #00a884; }
.badge-warn { background: rgba(255, 215, 0, 0.2); color: #d4a100; }
.badge-admin { background: rgba(127, 219, 255, 0.2); color: var(--ocean-deep); }
.badge-user { background: rgba(0, 107, 150, 0.1); color: var(--ocean-medium); }
.badge-status-new {
    background: linear-gradient(135deg, rgba(0, 180, 216, 0.2), rgba(127, 219, 255, 0.2));
    color: var(--ocean-deep);
}
.badge-status-open { background: rgba(255, 215, 0, 0.2); color: #b8860b; }
.badge-status-replied { background: rgba(0, 184, 148, 0.15); color: #00a884; }
.badge-status-closed { background: rgba(0, 78, 124, 0.1); color: #6c8fa4; }

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 13px;
    backdrop-filter: blur(10px);
    border: 1px solid;
}
.alert-error {
    background: rgba(214, 48, 49, 0.1);
    color: #c0392b;
    border-color: rgba(214, 48, 49, 0.2);
}
.alert-success {
    background: rgba(0, 184, 148, 0.1);
    color: #00a884;
    border-color: rgba(0, 184, 148, 0.2);
}
.alert-warn {
    background: rgba(255, 215, 0, 0.15);
    color: #b8860b;
    border-color: rgba(255, 215, 0, 0.3);
}

/* ============================================
   EMAIL CLIENT LAYOUT - GLASS THEME
   ============================================ */
.mail-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 20px;
    min-height: calc(100vh - 56px);
    margin: 0;
    padding: 20px;
}

/* Refined Sidebar - Rounded card style */
.mail-sidebar {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    padding: 0;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--radius);
    box-shadow: 0 4px 24px rgba(0, 78, 124, 0.1);
}

.sidebar-header {
    padding: 16px;
}

.compose-btn {
    margin-bottom: 16px;
    padding: 14px 20px;
    font-size: 14px;
    background: linear-gradient(135deg, var(--ocean-medium) 0%, var(--ocean-deep) 100%);
    box-shadow: 0 4px 12px rgba(0, 107, 150, 0.3);
}

.auto-fetch-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 12px;
    background: rgba(0, 184, 148, 0.08);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-light);
}

.status-dot.active {
    background: #00b894;
    box-shadow: 0 0 6px rgba(0, 184, 148, 0.5);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    flex: 1;
}

.fetch-form { width: 100%; }
.fetch-form .btn {
    width: 100%;
    background: linear-gradient(135deg, var(--ocean-medium) 0%, var(--ocean-deep) 100%);
    color: #fff;
    font-weight: 600;
    padding: 11px 18px;
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 8px rgba(0, 107, 150, 0.25);
    font-size: 13px;
}
.fetch-form .btn:hover {
    background: linear-gradient(135deg, var(--ocean-deep) 0%, var(--dark-navy) 100%);
    box-shadow: 0 4px 12px rgba(0, 78, 124, 0.35);
}

.folder-nav {
    padding: 8px 0;
}

.folder-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    margin: 1px 8px;
    color: var(--text);
    text-decoration: none;
    transition: all 0.15s ease;
    border-radius: 6px;
    border-left: none;
}

.folder-item:hover {
    background: rgba(0, 107, 150, 0.08);
    color: var(--ocean-deep);
    text-decoration: none;
}

.folder-item.active {
    background: rgba(0, 107, 150, 0.12);
    color: var(--ocean-deep);
    font-weight: 600;
}

.folder-icon {
    width: 24px;
    text-align: center;
    margin-right: 10px;
    font-size: 16px;
    opacity: 0.85;
}

.folder-name {
    flex: 1;
    font-size: 13px;
}

.folder-count {
    background: var(--ocean-medium);
    color: #fff;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.sidebar-divider {
    height: 1px;
    background: rgba(0, 107, 150, 0.1);
    margin: 8px 16px;
}

.sidebar-section {
    padding: 12px 16px;
}

.sidebar-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-light);
    margin: 0 0 10px;
    font-weight: 600;
    padding: 0 8px;
}

.sidebar-toggle {
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.15s ease;
}
.sidebar-toggle:hover {
    background: rgba(0, 107, 150, 0.06);
}
.sidebar-toggle input {
    accent-color: var(--ocean-medium);
    width: 16px;
    height: 16px;
}

.filter-links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0 8px;
}

.filter-link {
    display: inline-block;
    padding: 6px 12px;
    font-size: 12px;
    color: var(--text-muted);
    transition: all 0.15s ease;
    border-radius: 16px;
    background: transparent;
}

.filter-link:hover {
    background: rgba(0, 107, 150, 0.08);
    color: var(--ocean-deep);
    text-decoration: none;
}

.filter-link.active {
    background: var(--ocean-medium);
    color: #fff;
    font-weight: 500;
}

/* Main Content Area */
.mail-content {
    background: transparent;
    padding: 0;
    overflow-y: auto;
}

.message-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.header-left {
    display: flex;
    align-items: baseline;
    gap: 16px;
}

.folder-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--ocean-deep);
}

.message-count {
    font-size: 13px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.7);
    padding: 4px 12px;
    border-radius: 20px;
}

.dept-filter {
    padding: 8px 14px;
    font-size: 13px;
    border: 1px solid rgba(0, 107, 150, 0.2);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
    cursor: pointer;
}
.dept-filter:focus {
    outline: none;
    border-color: var(--ocean-medium);
}

/* Search Bar */
.search-bar {
    margin-bottom: 20px;
}

.search-form {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
    max-width: 500px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    opacity: 0.6;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 12px 40px 12px 42px;
    font-size: 14px;
    border: 1px solid rgba(0, 107, 150, 0.2);
    border-radius: var(--radius);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    color: var(--text);
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--ocean-medium);
    box-shadow: 0 0 0 3px rgba(0, 107, 150, 0.1);
    background: #fff;
}

.search-input::placeholder {
    color: var(--text-light);
}

.search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-muted);
    background: rgba(0, 107, 150, 0.1);
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.15s ease;
}

.search-clear:hover {
    background: rgba(0, 107, 150, 0.2);
    color: var(--ocean-deep);
    text-decoration: none;
}

@media (max-width: 768px) {
    .search-form {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input-wrapper {
        max-width: none;
    }
}

/* Glass Message List */
.message-list {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.message-item {
    display: grid;
    grid-template-columns: 40px 200px 1fr auto 90px;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(0, 107, 150, 0.08);
    color: var(--text);
    text-decoration: none;
    transition: all 0.15s ease;
    gap: 16px;
}

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

.message-item:hover {
    background: rgba(127, 219, 255, 0.08);
    text-decoration: none;
}

.message-item.unread {
    background: linear-gradient(90deg, rgba(127, 219, 255, 0.12) 0%, rgba(255, 255, 255, 0.5) 100%);
    border-left: 3px solid var(--ocean-light);
}

.message-item.unread .message-sender,
.message-item.unread .subject-text {
    font-weight: 700;
    color: var(--ocean-deep);
}

.message-star {
    font-size: 20px;
    color: rgba(0, 107, 150, 0.3);
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.message-star:hover {
    color: var(--gold-accent);
    transform: scale(1.2);
}

.message-item .message-star:has(★),
.starred .message-star {
    color: var(--gold-accent);
    text-shadow: 0 2px 4px rgba(255, 215, 0, 0.3);
}

.message-sender {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--ocean-deep);
}

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

.subject-text {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}

.message-snippet {
    font-size: 13px;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.8;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-end;
}

.message-alias {
    font-size: 10px;
    padding: 3px 8px;
    background: rgba(0, 107, 150, 0.1);
    border-radius: 4px;
    color: var(--ocean-medium);
    font-weight: 500;
}

.message-date {
    font-size: 12px;
    color: var(--text-light);
    text-align: right;
    white-space: nowrap;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}
.empty-state p {
    font-size: 15px;
    margin: 8px 0;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
}
.page-info {
    font-size: 13px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.7);
    padding: 6px 16px;
    border-radius: 20px;
}

/* ============================================
   THREAD VIEW
   ============================================ */
.thread-container { margin-bottom: 24px; }
.thread-message {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius);
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
}
.message-header {
    padding: 16px 20px;
    background: rgba(0, 107, 150, 0.05);
    border-bottom: 1px solid rgba(0, 107, 150, 0.1);
}
.message-meta { display: flex; justify-content: space-between; align-items: center; }
.message-header .message-date { font-size: 12px; color: var(--text-muted); }
.message-to { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.message-body {
    padding: 20px;
    font-size: 14px;
    line-height: 1.7;
    overflow-x: auto;
    word-wrap: break-word;
    color: var(--text);
}
.message-body img { max-width: 100%; height: auto; }

/* Reply card */
.reply-card { margin-top: 8px; }

/* Admin actions */
.admin-actions { margin-top: 24px; }
.action-buttons { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-body {
    background: linear-gradient(135deg, var(--ocean-deep) 0%, var(--ocean-medium) 50%, var(--aqua-cyan) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.login-body::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(127, 219, 255, 0.1) 0%, transparent 50%);
    animation: pulse 15s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}
.login-container { width: 100%; max-width: 400px; padding: 20px; position: relative; z-index: 1; }
.login-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}
.login-card h1 {
    margin: 0 0 8px;
    font-size: 26px;
    text-align: center;
    color: var(--ocean-deep);
}
.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin: 0 0 28px;
    font-size: 14px;
}

/* ============================================
   MISC COMPONENTS
   ============================================ */
/* Status table */
.status-table { width: 100%; }
.status-table td { padding: 10px 0; }
.status-table td:first-child { font-weight: 600; width: 200px; color: var(--ocean-deep); }

/* Filters bar */
.filters-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}
.filter-form { display: flex; gap: 10px; align-items: center; }
.filter-form select {
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid rgba(0, 107, 150, 0.2);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.9);
}
.filter-count { font-size: 13px; color: var(--text-muted); }

/* Message table */
.message-table .sender { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-table .subject a { font-weight: 500; color: var(--ocean-deep); }
.message-table .date { white-space: nowrap; font-size: 12px; color: var(--text-muted); }
.message-row.status-new .subject a { font-weight: 700; }

/* Checkbox labels for permissions */
.checkbox-label {
    display: flex;
    align-items: center;
    font-size: 13px;
    padding: 4px 0;
    cursor: pointer;
    color: var(--text);
}
.checkbox-label input {
    margin-right: 8px;
    accent-color: var(--ocean-medium);
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

/* ============================================
   USER MANAGEMENT - CARD LAYOUT
   ============================================ */
.user-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
}

.user-card {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 107, 150, 0.12);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.user-card:hover {
    box-shadow: 0 4px 20px rgba(0, 78, 124, 0.12);
}

.user-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: rgba(0, 107, 150, 0.05);
    border-bottom: 1px solid rgba(0, 107, 150, 0.08);
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ocean-medium), var(--ocean-deep));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--ocean-deep);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-username {
    font-size: 13px;
    color: var(--text-muted);
}

.user-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.user-card-body {
    padding: 16px 20px;
}

.permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.permission-section {
    background: rgba(0, 107, 150, 0.03);
    border-radius: var(--radius-sm);
    padding: 12px;
}

.permission-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--ocean-deep);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.permission-form {
    display: flex;
    flex-direction: column;
}

.checkbox-grid {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 150px;
    overflow-y: auto;
    margin-bottom: 10px;
    padding-right: 4px;
}

.checkbox-grid::-webkit-scrollbar {
    width: 4px;
}

.checkbox-grid::-webkit-scrollbar-thumb {
    background: rgba(0, 107, 150, 0.2);
    border-radius: 2px;
}

.permission-form .btn {
    align-self: flex-start;
}

.user-card-footer {
    display: flex;
    gap: 10px;
    padding: 14px 20px;
    background: rgba(0, 107, 150, 0.03);
    border-top: 1px solid rgba(0, 107, 150, 0.08);
    flex-wrap: wrap;
}

.reset-password-details {
    position: relative;
}

.reset-password-details summary {
    list-style: none;
    cursor: pointer;
}

.reset-password-details summary::-webkit-details-marker {
    display: none;
}

.reset-password-details[open] .reset-form {
    display: flex;
}

.reset-form {
    display: none;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.reset-form input {
    flex: 1;
    min-width: 150px;
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid rgba(0, 107, 150, 0.2);
    border-radius: var(--radius-sm);
    background: #fff;
}

.reset-form input:focus {
    outline: none;
    border-color: var(--ocean-medium);
}

/* Dark theme user cards */
body.theme-dark .user-card {
    background: rgba(26, 26, 46, 0.6);
    border-color: rgba(127, 219, 255, 0.12);
}

body.theme-dark .user-card-header {
    background: rgba(127, 219, 255, 0.05);
    border-color: rgba(127, 219, 255, 0.08);
}

body.theme-dark .user-avatar {
    background: linear-gradient(135deg, var(--ocean-medium), #16213e);
}

body.theme-dark .permission-section {
    background: rgba(127, 219, 255, 0.03);
}

body.theme-dark .user-card-footer {
    background: rgba(127, 219, 255, 0.03);
    border-color: rgba(127, 219, 255, 0.08);
}

body.theme-dark .reset-form input {
    background: rgba(22, 33, 62, 0.9);
    border-color: rgba(127, 219, 255, 0.2);
    color: var(--text);
}

/* Responsive user cards */
@media (max-width: 768px) {
    .user-cards-grid {
        grid-template-columns: 1fr;
    }

    .user-card-header {
        flex-wrap: wrap;
    }

    .user-badges {
        width: 100%;
        margin-top: 8px;
    }

    .permissions-grid {
        grid-template-columns: 1fr;
    }

    .user-card-footer {
        flex-direction: column;
    }

    .user-card-footer form,
    .user-card-footer .reset-password-details {
        width: 100%;
    }

    .user-card-footer .btn {
        width: 100%;
        justify-content: center;
    }

    .reset-form {
        width: 100%;
    }

    .reset-form input {
        width: 100%;
    }
}

/* Inline details for reset password */
.inline-details { display: inline-block; }
.inline-details summary { list-style: none; cursor: pointer; color: var(--primary); }
.inline-details summary::-webkit-details-marker { display: none; }
.inline-form {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    align-items: center;
}
.inline-form input {
    padding: 6px 10px;
    font-size: 12px;
    border: 1px solid rgba(0, 107, 150, 0.2);
    border-radius: var(--radius-sm);
    width: 150px;
}

/* Help details (collapsible instructions) */
.help-details {
    margin: 16px 0;
    padding: 16px;
    background: rgba(0, 107, 150, 0.05);
    border: 1px solid rgba(0, 107, 150, 0.15);
    border-radius: var(--radius-sm);
}
.help-details summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--ocean-deep);
}
.help-details summary:hover { color: var(--ocean-medium); }
.help-details ol, .help-details ul {
    margin: 12px 0 12px 20px;
    line-height: 1.7;
}
.help-details li { margin: 8px 0; }
.help-details code {
    background: rgba(0, 107, 150, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--ocean-deep);
}
.help-details pre {
    background: rgba(0, 107, 150, 0.08);
    padding: 14px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-size: 12px;
    margin: 12px 0;
}

.help-text {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.help-list {
    margin: 12px 0 12px 20px;
    line-height: 1.7;
}
.help-list li { margin: 8px 0; }

.status-display {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}
.status-display .form-hint {
    margin: 0;
}

/* Utility */
.text-muted { color: var(--text-muted); font-size: 12px; }

/* ============================================
   RESPONSIVE STYLES
   ============================================ */
@media (max-width: 992px) {
    .message-item {
        grid-template-columns: 36px 160px 1fr auto 80px;
    }
    .message-snippet {
        display: none;
    }
}

@media (max-width: 768px) {
    .navbar { padding: 0 16px; }
    .container { padding: 16px; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .filters-bar { flex-direction: column; align-items: flex-start; }
    .data-table { display: block; overflow-x: auto; }

    /* Mail layout mobile */
    .mail-layout {
        grid-template-columns: 1fr;
        padding: 12px;
        gap: 12px;
    }

    .mail-sidebar {
        display: none;
        position: fixed;
        top: 56px;
        left: 12px;
        right: 12px;
        bottom: 12px;
        z-index: 100;
        border-radius: var(--radius);
    }

    .mail-sidebar.open {
        display: block;
    }

    .mail-content {
        padding: 0;
    }

    .message-item {
        grid-template-columns: 1fr auto;
        gap: 8px;
        padding: 14px 16px;
    }

    .message-star {
        display: none;
    }

    .message-sender {
        grid-column: 1;
        font-size: 13px;
    }

    .message-date {
        grid-column: 2;
        grid-row: 1;
    }

    .message-subject {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .message-meta {
        grid-column: 1 / -1;
        grid-row: 3;
        justify-content: flex-start;
    }

    .message-snippet {
        display: none;
    }
}

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

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 107, 150, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 107, 150, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 107, 150, 0.35);
}

.mail-sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.mail-sidebar::-webkit-scrollbar-thumb {
    background: rgba(127, 219, 255, 0.3);
}

.mail-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(127, 219, 255, 0.5);
}

/* ============================================
   COMPOSE EMAIL PAGE
   ============================================ */
.compose-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px;
}

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

.compose-header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--ocean-deep);
}

.compose-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.compose-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius);
    padding: 0;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.compose-row {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid rgba(0, 107, 150, 0.08);
    gap: 12px;
}

.compose-row:last-child {
    border-bottom: none;
}

.compose-label {
    width: 70px;
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.compose-field {
    flex: 1;
    min-width: 0;
}

.compose-input,
.compose-select {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.5);
    color: var(--text);
    transition: all 0.2s ease;
}

.compose-input:focus,
.compose-select:focus {
    outline: none;
    border-color: var(--ocean-medium);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 107, 150, 0.1);
}

.compose-input::placeholder {
    color: var(--text-light);
}

.compose-actions {
    flex-shrink: 0;
}

.toggle-cc-btn {
    background: transparent;
    border: 1px solid rgba(0, 107, 150, 0.2);
    color: var(--text-muted);
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-cc-btn:hover {
    background: rgba(0, 107, 150, 0.08);
    border-color: var(--ocean-medium);
    color: var(--ocean-deep);
}

.cc-bcc-row {
    background: rgba(0, 107, 150, 0.02);
}

/* Editor Toolbar */
.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 16px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: var(--shadow);
    flex-wrap: wrap;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s ease;
}

.toolbar-btn:hover {
    background: rgba(0, 107, 150, 0.1);
    color: var(--ocean-deep);
}

.toolbar-btn:active {
    background: rgba(0, 107, 150, 0.2);
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: rgba(0, 107, 150, 0.15);
    margin: 0 8px;
}

.toolbar-select {
    padding: 6px 10px;
    font-size: 12px;
    border: 1px solid rgba(0, 107, 150, 0.2);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.8);
    color: var(--text);
    cursor: pointer;
}

.toolbar-select:focus {
    outline: none;
    border-color: var(--ocean-medium);
}

/* Rich Text Editor */
.compose-editor-wrapper {
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.compose-editor {
    min-height: 300px;
    padding: 20px;
    background: #fff;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
    outline: none;
    overflow-y: auto;
}

.compose-editor:focus {
    background: #fff;
}

.compose-editor:empty::before {
    content: "Write your message here...";
    color: var(--text-light);
    pointer-events: none;
}

/* Attachments */
.compose-attachments {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: var(--shadow);
}

.attachment-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(0, 107, 150, 0.08);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
    transition: all 0.2s ease;
}

.attachment-label:hover {
    background: rgba(0, 107, 150, 0.15);
    color: var(--ocean-deep);
}

.attachment-icon {
    font-size: 16px;
}

.attachment-list {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.attachment-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(0, 107, 150, 0.1);
    border-radius: 16px;
    font-size: 12px;
    color: var(--ocean-deep);
}

.attachment-name {
    font-weight: 500;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-size {
    color: var(--text-muted);
}

/* Compose Footer */
.compose-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
}

.footer-left {
    display: flex;
    gap: 12px;
}

.footer-right {
    display: flex;
    gap: 12px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 15px;
}

/* Responsive compose */
@media (max-width: 768px) {
    .compose-container {
        padding: 16px;
    }

    .compose-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .compose-row {
        flex-wrap: wrap;
        padding: 14px 16px;
    }

    .compose-label {
        width: 100%;
        margin-bottom: 6px;
    }

    .compose-field {
        width: 100%;
    }

    .compose-actions {
        width: 100%;
        margin-top: 8px;
    }

    .editor-toolbar {
        padding: 8px 12px;
    }

    .toolbar-btn {
        width: 32px;
        height: 32px;
    }

    .compose-footer {
        flex-direction: column;
        gap: 16px;
    }

    .footer-left,
    .footer-right {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   SETTINGS PAGE
   ============================================ */
.settings-container {
    max-width: 1000px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.settings-card {
    padding: 24px;
}

.settings-card h2 {
    margin: 0 0 8px;
    font-size: 18px;
    color: var(--ocean-deep);
}

.settings-description {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 20px;
}

/* Theme Options */
.theme-options {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    border: 2px solid rgba(0, 107, 150, 0.15);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 100px;
}

.theme-option:hover {
    border-color: var(--ocean-medium);
    background: rgba(0, 107, 150, 0.05);
}

.theme-option.selected {
    border-color: var(--ocean-medium);
    background: rgba(0, 107, 150, 0.1);
}

.theme-option input {
    display: none;
}

.theme-preview {
    width: 80px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.theme-preview-header {
    height: 12px;
    width: 100%;
}

.theme-preview-sidebar {
    position: absolute;
    left: 0;
    top: 12px;
    width: 25px;
    height: 48px;
}

.theme-preview-content {
    position: absolute;
    left: 25px;
    top: 12px;
    right: 0;
    bottom: 0;
}

/* Aqua theme preview */
.theme-preview-aqua .theme-preview-header { background: linear-gradient(135deg, #004E7C, #006B96); }
.theme-preview-aqua .theme-preview-sidebar { background: rgba(255, 255, 255, 0.9); }
.theme-preview-aqua .theme-preview-content { background: linear-gradient(135deg, #E0F7FA, #B2EBF2); }

/* Dark theme preview */
.theme-preview-dark .theme-preview-header { background: #1a1a2e; }
.theme-preview-dark .theme-preview-sidebar { background: #16213e; }
.theme-preview-dark .theme-preview-content { background: #0f0f23; }

/* Light theme preview */
.theme-preview-light .theme-preview-header { background: #4a90a4; }
.theme-preview-light .theme-preview-sidebar { background: #f8f9fa; }
.theme-preview-light .theme-preview-content { background: #ffffff; }

.theme-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.theme-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--ocean-deep);
}

.theme-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Signature Editor */
.signature-editor-wrapper {
    border: 1px solid rgba(0, 107, 150, 0.2);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 12px;
}

.signature-toolbar {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    background: rgba(0, 107, 150, 0.05);
    border-bottom: 1px solid rgba(0, 107, 150, 0.1);
}

.signature-editor {
    min-height: 120px;
    padding: 12px;
    background: #fff;
    font-size: 14px;
    line-height: 1.6;
    outline: none;
}

.signature-editor:focus {
    background: #fff;
}

.signature-toggle {
    margin-bottom: 16px !important;
}

.signature-preview-section {
    margin: 16px 0;
}

.signature-preview-section label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--ocean-deep);
}

.signature-preview {
    padding: 16px;
    background: rgba(0, 107, 150, 0.03);
    border: 1px dashed rgba(0, 107, 150, 0.2);
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.preview-divider {
    color: var(--text-muted);
    margin-bottom: 8px;
}

/* Form control for select */
.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid rgba(0, 107, 150, 0.25);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
}

.form-control:focus {
    outline: none;
    border-color: var(--ocean-medium);
    box-shadow: 0 0 0 3px rgba(0, 107, 150, 0.15);
}

.admin-link {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(0, 107, 150, 0.1);
}

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

    .theme-options {
        flex-direction: column;
    }

    .theme-option {
        flex-direction: row;
        gap: 16px;
    }

    .theme-preview {
        margin-bottom: 0;
    }

    .theme-info {
        align-items: flex-start;
        text-align: left;
    }
}

/* ============================================
   DARK THEME
   ============================================ */
body.theme-dark {
    --ocean-deep: #7FDBFF;
    --ocean-medium: #00B4D8;
    --ocean-light: #90E0EF;
    --text: #E0E0E0;
    --text-muted: #A0A0A0;
    --text-light: #808080;
    --bg: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #0f0f23 100%);
    --bg-solid: #0f0f23;
    --glass-bg: rgba(26, 26, 46, 0.95);
    --glass-border: rgba(127, 219, 255, 0.15);
    --border: rgba(127, 219, 255, 0.1);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

body.theme-dark .navbar {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-bottom-color: rgba(127, 219, 255, 0.2);
}

body.theme-dark .nav-links {
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
}

body.theme-dark .nav-overlay.active {
    background: rgba(0, 0, 0, 0.7);
}

body.theme-dark .card,
body.theme-dark .mail-sidebar,
body.theme-dark .message-list,
body.theme-dark .compose-card,
body.theme-dark .settings-card {
    background: rgba(26, 26, 46, 0.95);
    border-color: rgba(127, 219, 255, 0.15);
}

body.theme-dark .message-item:hover {
    background: rgba(127, 219, 255, 0.08);
}

body.theme-dark .message-item.unread {
    background: linear-gradient(90deg, rgba(127, 219, 255, 0.15) 0%, rgba(26, 26, 46, 0.95) 100%);
}

body.theme-dark .compose-editor,
body.theme-dark .signature-editor {
    background: #16213e;
    color: var(--text);
}

body.theme-dark .compose-input,
body.theme-dark .compose-select,
body.theme-dark .search-input,
body.theme-dark .form-control,
body.theme-dark .form-group input,
body.theme-dark .form-group select,
body.theme-dark .form-group textarea {
    background: rgba(22, 33, 62, 0.9);
    border-color: rgba(127, 219, 255, 0.2);
    color: var(--text);
}

body.theme-dark .btn-secondary {
    background: rgba(26, 26, 46, 0.9);
    color: var(--ocean-light);
    border-color: rgba(127, 219, 255, 0.3);
}

body.theme-dark .data-table th {
    background: rgba(127, 219, 255, 0.1);
}

body.theme-dark .data-table tbody tr:hover {
    background: rgba(127, 219, 255, 0.08);
}

body.theme-dark .folder-item:hover,
body.theme-dark .folder-item.active {
    background: rgba(127, 219, 255, 0.12);
}

body.theme-dark .signature-preview {
    background: rgba(22, 33, 62, 0.5);
    border-color: rgba(127, 219, 255, 0.2);
}

body.theme-dark .theme-option {
    border-color: rgba(127, 219, 255, 0.2);
}

body.theme-dark .theme-option:hover,
body.theme-dark .theme-option.selected {
    border-color: var(--ocean-medium);
    background: rgba(127, 219, 255, 0.1);
}

/* ============================================
   LIGHT THEME
   ============================================ */
body.theme-light {
    --ocean-deep: #2c3e50;
    --ocean-medium: #4a90a4;
    --ocean-light: #7ec8e3;
    --text: #2c3e50;
    --text-muted: #5d6d7e;
    --text-light: #85929e;
    --bg: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 50%, #f8f9fa 100%);
    --bg-solid: #f8f9fa;
    --glass-bg: rgba(255, 255, 255, 0.98);
    --glass-border: rgba(44, 62, 80, 0.1);
    --border: rgba(44, 62, 80, 0.1);
    --shadow: 0 4px 24px rgba(44, 62, 80, 0.1);
}

body.theme-light .navbar {
    background: linear-gradient(135deg, #4a90a4 0%, #5dade2 100%);
}

body.theme-light .card,
body.theme-light .mail-sidebar,
body.theme-light .message-list,
body.theme-light .compose-card,
body.theme-light .settings-card {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(44, 62, 80, 0.1);
    box-shadow: 0 2px 12px rgba(44, 62, 80, 0.08);
}

body.theme-light .btn-primary {
    background: linear-gradient(135deg, #4a90a4 0%, #2c3e50 100%);
}

/* ============================================
   RUFF TECH THEME
   Dark terminal-style with green/purple accents
   ============================================ */
body.theme-ruff {
    --ruff-bg-dark: #0f0f0f;
    --ruff-bg-medium: #1a1a1a;
    --ruff-bg-light: #2a2a2a;
    --ruff-green: #4ade80;
    --ruff-purple: #a855f7;
    --ruff-red: #ef4444;
    --ruff-text: #f4f4f5;
    --ruff-text-muted: #a1a1aa;
    --ruff-glass: rgba(255, 255, 255, 0.1);
    --ruff-glass-border: rgba(255, 255, 255, 0.2);

    /* Override semantic variables */
    --ocean-deep: var(--ruff-green);
    --ocean-medium: var(--ruff-purple);
    --ocean-light: #86efac;
    --text: var(--ruff-text);
    --text-muted: var(--ruff-text-muted);
    --text-light: #71717a;
    --bg: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 50%, #2a2a2a 100%);
    --bg-solid: #0f0f0f;
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.15);
    --border: rgba(255, 255, 255, 0.1);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    --primary: var(--ruff-green);
    --primary-hover: #22c55e;
}

body.theme-ruff .navbar {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    border-bottom: 1px solid rgba(74, 222, 128, 0.3);
}

body.theme-ruff .nav-brand a {
    color: var(--ruff-green);
}

body.theme-ruff .nav-links {
    background: linear-gradient(180deg, #1a1a1a 0%, #0f0f0f 100%);
}

body.theme-ruff .nav-link {
    color: var(--ruff-text);
}

body.theme-ruff .nav-link:hover {
    color: var(--ruff-green);
    background: rgba(74, 222, 128, 0.1);
}
body.theme-ruff .nav-group-toggle {
    color: var(--ruff-text);
}
body.theme-ruff .nav-group-toggle:hover {
    color: var(--ruff-green);
    background: rgba(74, 222, 128, 0.1);
}
body.theme-ruff .nav-group-items {
    background: rgba(0, 0, 0, 0.3);
}
body.theme-ruff .nav-group.open .nav-group-toggle {
    color: var(--ruff-green);
    background: rgba(74, 222, 128, 0.05);
}

body.theme-ruff .card,
body.theme-ruff .mail-sidebar,
body.theme-ruff .message-list,
body.theme-ruff .compose-card,
body.theme-ruff .settings-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.theme-ruff .card:hover {
    border-color: rgba(74, 222, 128, 0.3);
    box-shadow: 0 8px 32px rgba(74, 222, 128, 0.1);
}

body.theme-ruff .card-header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

body.theme-ruff .btn-primary {
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    color: #0f0f0f;
    font-weight: 600;
}

body.theme-ruff .btn-primary:hover {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.4);
}

body.theme-ruff .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--ruff-text);
}

body.theme-ruff .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--ruff-purple);
}

body.theme-ruff .btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

/* Forms */
body.theme-ruff .form-group input,
body.theme-ruff .form-group select,
body.theme-ruff .form-group textarea,
body.theme-ruff .form-control {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--ruff-text);
}

body.theme-ruff .form-group input::placeholder,
body.theme-ruff .form-group textarea::placeholder,
body.theme-ruff .form-control::placeholder {
    color: var(--ruff-text-muted);
}

body.theme-ruff .form-group input:focus,
body.theme-ruff .form-group select:focus,
body.theme-ruff .form-group textarea:focus,
body.theme-ruff .form-control:focus {
    border-color: var(--ruff-green);
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.2);
    outline: none;
}

/* Tables */
body.theme-ruff .admin-table,
body.theme-ruff .data-table {
    background: transparent;
}

body.theme-ruff .admin-table th,
body.theme-ruff .data-table th {
    background: rgba(74, 222, 128, 0.1);
    color: var(--ruff-green);
    border-bottom: 1px solid rgba(74, 222, 128, 0.3);
}

body.theme-ruff .admin-table td,
body.theme-ruff .data-table td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

body.theme-ruff .admin-table tbody tr:hover,
body.theme-ruff .data-table tbody tr:hover {
    background: rgba(74, 222, 128, 0.08);
}

/* Badges */
body.theme-ruff .badge-ok,
body.theme-ruff .status-active {
    background: rgba(74, 222, 128, 0.2);
    color: #4ade80;
}

body.theme-ruff .badge-admin {
    background: rgba(168, 85, 247, 0.2);
    color: #a855f7;
}

body.theme-ruff .badge-error,
body.theme-ruff .status-error {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* Stat cards */
body.theme-ruff .stat-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

body.theme-ruff .stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #4ade80, #a855f7);
}

/* Contact cards */
body.theme-ruff .contact-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.theme-ruff .contact-card:hover {
    border-color: rgba(74, 222, 128, 0.4);
    box-shadow: 0 8px 32px rgba(74, 222, 128, 0.15);
}

body.theme-ruff .contact-avatar {
    background: linear-gradient(135deg, #4ade80 0%, #a855f7 100%);
}

body.theme-ruff .contact-name {
    color: var(--ruff-text);
}

body.theme-ruff .contact-group {
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80;
}

/* Mail sidebar */
body.theme-ruff .folder-link {
    color: var(--ruff-text);
}

body.theme-ruff .folder-link:hover,
body.theme-ruff .folder-link.active {
    background: rgba(74, 222, 128, 0.15);
    color: var(--ruff-green);
}

/* Message list */
body.theme-ruff .message-row {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

body.theme-ruff .message-row:hover {
    background: rgba(74, 222, 128, 0.08);
}

body.theme-ruff .message-row.unread {
    background: rgba(74, 222, 128, 0.05);
}

/* Task cards */
body.theme-ruff .task-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.theme-ruff .task-card:hover {
    border-color: rgba(74, 222, 128, 0.3);
}

body.theme-ruff .task-priority-urgent {
    border-left-color: #ef4444;
}

body.theme-ruff .task-priority-high {
    border-left-color: #f97316;
}

body.theme-ruff .task-priority-medium {
    border-left-color: #4ade80;
}

body.theme-ruff .task-priority-low {
    border-left-color: #a855f7;
}

/* Alerts */
body.theme-ruff .alert {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.theme-ruff .alert-success {
    background: rgba(74, 222, 128, 0.15);
    border-color: rgba(74, 222, 128, 0.3);
    color: #4ade80;
}

body.theme-ruff .alert-info {
    background: rgba(168, 85, 247, 0.15);
    border-color: rgba(168, 85, 247, 0.3);
    color: #a855f7;
}

body.theme-ruff .alert-warning {
    background: rgba(251, 191, 36, 0.15);
    border-color: rgba(251, 191, 36, 0.3);
    color: #fbbf24;
}

body.theme-ruff .alert-error,
body.theme-ruff .alert-danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

/* Page header */
body.theme-ruff .page-header h1 {
    color: var(--ruff-text);
}

/* Empty state */
body.theme-ruff .empty-state {
    color: var(--ruff-text-muted);
}

body.theme-ruff .empty-icon {
    opacity: 0.5;
}

/* Scrollbar */
body.theme-ruff ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

body.theme-ruff ::-webkit-scrollbar-track {
    background: #1a1a1a;
}

body.theme-ruff ::-webkit-scrollbar-thumb {
    background: #3f3f46;
    border-radius: 4px;
}

body.theme-ruff ::-webkit-scrollbar-thumb:hover {
    background: #4ade80;
}

/* Theme preview for settings page */
.theme-preview-ruff .theme-preview-header {
    background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
    border-bottom: 2px solid #4ade80;
}

.theme-preview-ruff .theme-preview-sidebar {
    background: rgba(255, 255, 255, 0.05);
}

.theme-preview-ruff .theme-preview-content {
    background: linear-gradient(135deg, #0f0f0f, #1a1a1a);
}

/* ============================================
   CLOSET STUDIOS THEME
   Brand theme with indigo/violet gradients
   ============================================ */
body.theme-closet {
    --closet-primary: #6366f1;
    --closet-secondary: #8b5cf6;
    --closet-accent: #06b6d4;
    --closet-dark: #0f172a;
    --closet-darker: #020617;
    --closet-card: #1e293b;
    --closet-text: #f1f5f9;
    --closet-text-muted: #94a3b8;
    --closet-border: rgba(148, 163, 184, 0.1);

    /* Override semantic variables */
    --ocean-deep: var(--closet-primary);
    --ocean-medium: var(--closet-secondary);
    --ocean-light: #a5b4fc;
    --text: var(--closet-text);
    --text-muted: var(--closet-text-muted);
    --text-light: #64748b;
    --bg: linear-gradient(135deg, #020617 0%, #0f172a 50%, #1e293b 100%);
    --bg-solid: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.8);
    --glass-border: rgba(148, 163, 184, 0.15);
    --border: rgba(148, 163, 184, 0.1);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --primary: var(--closet-primary);
    --primary-hover: #4f46e5;
}

body.theme-closet .navbar {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

body.theme-closet .nav-brand a {
    background: linear-gradient(135deg, var(--closet-primary), var(--closet-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body.theme-closet .nav-links {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98) 0%, rgba(2, 6, 23, 0.98) 100%);
}

body.theme-closet .nav-link {
    color: var(--closet-text);
}

body.theme-closet .nav-link:hover {
    color: var(--closet-primary);
    background: rgba(99, 102, 241, 0.1);
}
body.theme-closet .nav-group-toggle {
    color: var(--closet-text);
}
body.theme-closet .nav-group-toggle:hover {
    color: var(--closet-primary);
    background: rgba(99, 102, 241, 0.1);
}
body.theme-closet .nav-group-items {
    background: rgba(0, 0, 0, 0.2);
}
body.theme-closet .nav-group.open .nav-group-toggle {
    color: var(--closet-primary);
    background: rgba(99, 102, 241, 0.05);
}

body.theme-closet .card,
body.theme-closet .mail-sidebar,
body.theme-closet .message-list,
body.theme-closet .compose-card,
body.theme-closet .settings-card {
    background: var(--closet-card);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(148, 163, 184, 0.1);
}

body.theme-closet .card:hover {
    box-shadow: 0 15px 40px rgba(99, 102, 241, 0.2);
}

body.theme-closet .card-header {
    border-bottom-color: rgba(148, 163, 184, 0.1);
}

body.theme-closet .btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    font-weight: 600;
    border: none;
}

body.theme-closet .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}

body.theme-closet .btn-secondary {
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: var(--closet-text);
}

body.theme-closet .btn-secondary:hover {
    background: rgba(148, 163, 184, 0.2);
    border-color: var(--closet-primary);
}

body.theme-closet .btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

/* Forms */
body.theme-closet .form-group input,
body.theme-closet .form-group select,
body.theme-closet .form-group textarea,
body.theme-closet .form-control {
    background: var(--closet-card);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: var(--closet-text);
}

body.theme-closet .form-group input::placeholder,
body.theme-closet .form-group textarea::placeholder,
body.theme-closet .form-control::placeholder {
    color: var(--closet-text-muted);
}

body.theme-closet .form-group input:focus,
body.theme-closet .form-group select:focus,
body.theme-closet .form-group textarea:focus,
body.theme-closet .form-control:focus {
    border-color: var(--closet-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    outline: none;
}

/* Tables */
body.theme-closet .admin-table,
body.theme-closet .data-table {
    background: transparent;
}

body.theme-closet .admin-table th,
body.theme-closet .data-table th {
    background: rgba(99, 102, 241, 0.1);
    color: var(--closet-primary);
    border-bottom: 1px solid rgba(99, 102, 241, 0.3);
}

body.theme-closet .admin-table td,
body.theme-closet .data-table td {
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

body.theme-closet .admin-table tbody tr:hover,
body.theme-closet .data-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.08);
}

/* Badges */
body.theme-closet .badge-ok,
body.theme-closet .status-active {
    background: rgba(6, 182, 212, 0.2);
    color: #06b6d4;
}

body.theme-closet .badge-admin {
    background: rgba(139, 92, 246, 0.2);
    color: #8b5cf6;
}

body.theme-closet .badge-error,
body.theme-closet .status-error {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* Stat cards */
body.theme-closet .stat-card {
    background: var(--closet-card);
    border: 1px solid rgba(148, 163, 184, 0.1);
    position: relative;
    overflow: hidden;
}

body.theme-closet .stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #06b6d4);
}

body.theme-closet .stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(99, 102, 241, 0.2);
}

/* Contact cards */
body.theme-closet .contact-card {
    background: var(--closet-card);
    border: 1px solid rgba(148, 163, 184, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

body.theme-closet .contact-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(99, 102, 241, 0.2);
}

body.theme-closet .contact-avatar {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

body.theme-closet .contact-name {
    color: var(--closet-text);
}

body.theme-closet .contact-group {
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

/* Mail sidebar */
body.theme-closet .folder-link {
    color: var(--closet-text);
}

body.theme-closet .folder-link:hover,
body.theme-closet .folder-link.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--closet-primary);
}

/* Message list */
body.theme-closet .message-row {
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

body.theme-closet .message-row:hover {
    background: rgba(99, 102, 241, 0.08);
}

body.theme-closet .message-row.unread {
    background: rgba(99, 102, 241, 0.05);
    border-left: 3px solid var(--closet-primary);
}

/* Task cards */
body.theme-closet .task-card {
    background: var(--closet-card);
    border: 1px solid rgba(148, 163, 184, 0.1);
}

body.theme-closet .task-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.15);
}

body.theme-closet .task-priority-urgent {
    border-left-color: #ef4444;
}

body.theme-closet .task-priority-high {
    border-left-color: #f97316;
}

body.theme-closet .task-priority-medium {
    border-left-color: #6366f1;
}

body.theme-closet .task-priority-low {
    border-left-color: #06b6d4;
}

/* Alerts */
body.theme-closet .alert {
    background: var(--closet-card);
    border: 1px solid rgba(148, 163, 184, 0.1);
}

body.theme-closet .alert-success {
    background: rgba(6, 182, 212, 0.15);
    border-color: rgba(6, 182, 212, 0.3);
    color: #06b6d4;
}

body.theme-closet .alert-info {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    color: #6366f1;
}

body.theme-closet .alert-warning {
    background: rgba(251, 191, 36, 0.15);
    border-color: rgba(251, 191, 36, 0.3);
    color: #fbbf24;
}

body.theme-closet .alert-error,
body.theme-closet .alert-danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

/* Page header */
body.theme-closet .page-header h1 {
    background: linear-gradient(135deg, var(--closet-primary), var(--closet-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Empty state */
body.theme-closet .empty-state {
    color: var(--closet-text-muted);
}

body.theme-closet .empty-icon {
    opacity: 0.6;
}

/* Links */
body.theme-closet a {
    color: var(--closet-primary);
}

body.theme-closet a:hover {
    color: var(--closet-secondary);
}

/* Scrollbar */
body.theme-closet ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

body.theme-closet ::-webkit-scrollbar-track {
    background: #0f172a;
}

body.theme-closet ::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}

body.theme-closet ::-webkit-scrollbar-thumb:hover {
    background: #6366f1;
}

/* Special gradient text for headings */
body.theme-closet h1,
body.theme-closet h2 {
    color: var(--closet-text);
}

body.theme-closet .section-title {
    background: linear-gradient(135deg, var(--closet-primary), var(--closet-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Theme preview for settings page */
.theme-preview-closet .theme-preview-header {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    border-bottom: 2px solid #6366f1;
}

.theme-preview-closet .theme-preview-sidebar {
    background: #1e293b;
}

.theme-preview-closet .theme-preview-content {
    background: linear-gradient(135deg, #020617, #0f172a);
}

/* ============================================
   CONTACTS PAGE
   ============================================ */
.contacts-container {
    max-width: 1200px;
}

.contacts-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-options {
    display: flex;
    gap: 12px;
    align-items: center;
}

.filter-select {
    padding: 8px 14px;
    font-size: 13px;
    border: 1px solid rgba(0, 107, 150, 0.2);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
    cursor: pointer;
}

.contacts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.contact-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
}

.contact-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.contact-card.favorite {
    border-left: 3px solid var(--gold-accent);
}

.contact-card.shared {
    background: rgba(0, 180, 216, 0.05);
}

.contact-card.shared .contact-avatar {
    background: linear-gradient(135deg, #00b4d8, #0096c7);
}

.shared-badge {
    font-size: 12px;
}

.contact-owner {
    display: block;
    font-size: 11px;
    color: var(--text-light);
    font-style: italic;
    margin-top: 4px;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.contact-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ocean-medium), var(--ocean-deep));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    flex-shrink: 0;
}

.contact-info {
    flex: 1;
    min-width: 0;
}

.contact-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--ocean-deep);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.favorite-star {
    font-size: 12px;
}

.contact-email {
    font-size: 14px;
    color: var(--text);
    margin-bottom: 8px;
    word-break: break-all;
}

.contact-company,
.contact-phone {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.contact-group {
    display: inline-block;
    margin-top: 8px;
    padding: 3px 10px;
    font-size: 11px;
    background: rgba(0, 107, 150, 0.1);
    color: var(--ocean-medium);
    border-radius: 12px;
    font-weight: 500;
}

.contact-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.contact-actions .btn {
    padding: 6px 10px;
    font-size: 12px;
}

/* Contact Form */
.contact-form-card {
    max-width: 700px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 107, 150, 0.1);
}

/* Dark theme contacts */
body.theme-dark .contact-card {
    background: rgba(26, 26, 46, 0.95);
    border-color: rgba(127, 219, 255, 0.15);
}

body.theme-dark .contact-avatar {
    background: linear-gradient(135deg, var(--ocean-medium), #16213e);
}

body.theme-dark .filter-select {
    background: rgba(22, 33, 62, 0.9);
    border-color: rgba(127, 219, 255, 0.2);
    color: var(--text);
}

@media (max-width: 768px) {
    .contacts-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-options {
        flex-wrap: wrap;
    }

    .contacts-grid {
        grid-template-columns: 1fr;
    }

    .contact-card {
        flex-wrap: wrap;
    }

    .contact-actions {
        flex-direction: row;
        width: 100%;
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid rgba(0, 107, 150, 0.1);
    }
}

/* ============================================
   COMPOSE MODAL
   ============================================ */
.compose-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 30, 60, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.compose-modal.open {
    display: flex;
}

.compose-modal-content {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 78, 124, 0.3);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.compose-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid rgba(0, 107, 150, 0.1);
    background: rgba(0, 107, 150, 0.05);
}

.compose-modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--ocean-deep);
}

.modal-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.modal-close-btn:hover {
    background: rgba(0, 107, 150, 0.1);
    color: var(--ocean-deep);
}

.compose-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.compose-modal-body .compose-row {
    padding: 10px 20px;
}

.modal-editor-container {
    margin: 0 20px 16px;
    border: 1px solid rgba(0, 107, 150, 0.15);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.modal-editor-container .editor-toolbar {
    border-radius: 0;
    box-shadow: none;
    border: none;
    border-bottom: 1px solid rgba(0, 107, 150, 0.1);
}

.modal-editor-container .compose-editor {
    min-height: 200px;
    max-height: 300px;
    overflow-y: auto;
    padding: 16px;
    background: #fff;
}

.compose-attachments-row {
    padding: 12px 20px;
    border-top: 1px solid rgba(0, 107, 150, 0.1);
    background: rgba(0, 107, 150, 0.02);
}

.compose-modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid rgba(0, 107, 150, 0.1);
    background: rgba(0, 107, 150, 0.03);
}

/* ============================================
   CONTACT AUTOCOMPLETE
   ============================================ */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid rgba(0, 107, 150, 0.2);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0, 78, 124, 0.15);
    max-height: 280px;
    overflow-y: auto;
    z-index: 3000;
    margin-top: 4px;
}

.autocomplete-dropdown.show {
    display: block;
}

.autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.1s ease;
    border-bottom: 1px solid rgba(0, 107, 150, 0.05);
}

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

.autocomplete-item:hover,
.autocomplete-item.active {
    background: rgba(0, 180, 216, 0.08);
}

.contact-result {
    display: flex;
    align-items: center;
    gap: 12px;
}

.contact-result-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ocean-medium), var(--ocean-deep));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.contact-result-info {
    min-width: 0;
    flex: 1;
}

.contact-result-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--ocean-deep);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-result-email {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-result-company {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 2px;
}

/* Dark theme modal styles */
body.theme-dark .compose-modal {
    background: rgba(0, 0, 0, 0.7);
}

body.theme-dark .compose-modal-content {
    background: rgba(26, 26, 46, 0.98);
    border-color: rgba(127, 219, 255, 0.2);
}

body.theme-dark .compose-modal-header {
    background: rgba(127, 219, 255, 0.05);
    border-color: rgba(127, 219, 255, 0.1);
}

body.theme-dark .modal-editor-container {
    border-color: rgba(127, 219, 255, 0.15);
}

body.theme-dark .modal-editor-container .compose-editor {
    background: #16213e;
}

body.theme-dark .autocomplete-dropdown {
    background: #1a1a2e;
    border-color: rgba(127, 219, 255, 0.2);
}

body.theme-dark .autocomplete-item:hover,
body.theme-dark .autocomplete-item.active {
    background: rgba(127, 219, 255, 0.1);
}

body.theme-dark .contact-result-avatar {
    background: linear-gradient(135deg, var(--ocean-medium), #16213e);
}

/* Responsive modal */
@media (max-width: 768px) {
    .compose-modal {
        padding: 10px;
    }

    .compose-modal-content {
        max-height: 95vh;
    }

    .compose-modal-body .compose-row {
        flex-wrap: wrap;
        padding: 12px 16px;
    }

    .compose-modal-body .compose-label {
        width: 100%;
        margin-bottom: 6px;
    }

    .compose-modal-body .compose-actions {
        width: 100%;
        margin-top: 8px;
    }

    .modal-editor-container {
        margin: 0 16px 16px;
    }

    .modal-editor-container .compose-editor {
        min-height: 150px;
    }

    .compose-modal-footer {
        flex-wrap: wrap;
    }
}

/* ============================================
   TASKS MODULE
   ============================================ */

/* Tasks Layout */
.tasks-container {
    max-width: 1400px;
}

.tasks-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 24px;
    min-height: calc(100vh - 200px);
}

/* Tasks Sidebar */
.tasks-sidebar {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius);
    padding: 16px;
    height: fit-content;
    position: sticky;
    top: 80px;
}

.sidebar-section {
    margin-bottom: 20px;
}

.sidebar-section h3 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin: 0 0 12px;
    padding: 0 8px;
}

.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    transition: all 0.2s ease;
}

.sidebar-nav li a:hover {
    background: var(--glass-hover);
    text-decoration: none;
}

.sidebar-nav li a.active {
    background: linear-gradient(135deg, var(--ocean-medium), var(--ocean-deep));
    color: #fff;
}

.sidebar-nav li a .badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(0, 78, 124, 0.15);
    color: var(--ocean-deep);
}

.sidebar-nav li a.active .badge {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.badge-danger {
    background: var(--danger) !important;
    color: #fff !important;
}

.overdue-link {
    color: var(--danger) !important;
}

/* Tasks Main Content */
.tasks-main {
    min-width: 0;
}

.tasks-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* Tasks List */
.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.task-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
}

.task-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.task-card.priority-urgent {
    border-left-color: var(--danger);
}

.task-card.priority-high {
    border-left-color: var(--gold-accent);
}

.task-card.priority-medium {
    border-left-color: var(--aqua-cyan);
}

.task-card.priority-low {
    border-left-color: var(--text-light);
}

.task-card.status-completed {
    opacity: 0.7;
}

/* Task Checkbox */
.task-checkbox {
    flex-shrink: 0;
}

.task-complete-btn {
    width: 24px;
    height: 24px;
    border: 2px solid var(--text-light);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.task-complete-btn:hover {
    border-color: var(--success);
    background: rgba(0, 184, 148, 0.1);
}

.task-complete-btn.completed {
    background: var(--success);
    border-color: var(--success);
}

.task-complete-btn .check-icon {
    font-size: 14px;
    color: #fff;
    font-weight: bold;
}

.task-complete-btn .check-icon.empty {
    display: none;
}

.task-complete-btn:hover .check-icon.empty {
    display: block;
    color: var(--success);
}

/* Task Content */
.task-content {
    flex: 1;
    min-width: 0;
}

.task-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--ocean-deep);
    margin-bottom: 4px;
}

.task-title.completed {
    text-decoration: line-through;
    color: var(--text-muted);
}

.task-description {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
    line-height: 1.4;
}

.task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: var(--text-light);
}

.task-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.task-due.overdue {
    color: var(--danger);
    font-weight: 600;
}

.task-section {
    background: rgba(0, 107, 150, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

.task-from-email {
    background: rgba(0, 180, 216, 0.15);
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--aqua-teal);
}

/* Task Priority Badge */
.task-priority-badge {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.task-priority-badge.priority-urgent {
    background: rgba(214, 48, 49, 0.15);
    color: var(--danger);
}

.task-priority-badge.priority-high {
    background: rgba(255, 215, 0, 0.2);
    color: #b8860b;
}

.task-priority-badge.priority-medium {
    background: rgba(0, 180, 216, 0.15);
    color: var(--aqua-teal);
}

.task-priority-badge.priority-low {
    background: rgba(74, 144, 164, 0.15);
    color: var(--text-light);
}

/* Task Detail Page */
.task-detail-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 24px;
}

.task-detail-card {
    padding: 28px;
}

.task-detail-header {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.task-status-badge {
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
    text-transform: capitalize;
}

.task-status-badge.status-pending {
    background: rgba(255, 215, 0, 0.2);
    color: #b8860b;
}

.task-status-badge.status-in_progress {
    background: rgba(0, 180, 216, 0.15);
    color: var(--aqua-teal);
}

.task-status-badge.status-completed {
    background: rgba(0, 184, 148, 0.15);
    color: var(--success);
}

.task-status-badge.status-cancelled {
    background: rgba(108, 117, 125, 0.15);
    color: #6c757d;
}

.task-detail-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--ocean-deep);
    margin: 0 0 20px;
    line-height: 1.3;
}

.task-detail-title.completed {
    text-decoration: line-through;
    color: var(--text-muted);
}

.task-detail-description {
    margin-bottom: 24px;
}

.task-detail-description h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.task-detail-description p {
    margin: 0;
    white-space: pre-wrap;
    line-height: 1.6;
}

.task-detail-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    padding: 20px;
    background: rgba(0, 78, 124, 0.03);
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meta-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.meta-value {
    font-size: 14px;
    color: var(--text);
}

.meta-item.overdue .meta-value {
    color: var(--danger);
}

.overdue-badge {
    display: inline-block;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
}

/* Source Email Card */
.task-source-email {
    margin-bottom: 24px;
}

.task-source-email h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.source-email-card {
    padding: 16px;
    background: rgba(0, 180, 216, 0.05);
    border: 1px solid rgba(0, 180, 216, 0.15);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.source-email-card:hover {
    background: rgba(0, 180, 216, 0.1);
}

.source-email-subject {
    font-weight: 600;
    color: var(--ocean-deep);
    margin-bottom: 4px;
}

.source-email-from {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.source-email-snippet {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.4;
}

/* Task Actions */
.task-actions {
    display: flex;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* Subtasks Card */
.subtasks-card {
    padding: 20px;
}

.subtasks-card h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--ocean-deep);
    margin: 0 0 16px;
}

.subtasks-list {
    margin-bottom: 16px;
}

.subtask-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

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

.subtask-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    flex: 1;
}

.subtask-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--success);
}

.subtask-text {
    font-size: 14px;
    color: var(--text);
}

.subtask-text.completed {
    text-decoration: line-through;
    color: var(--text-muted);
}

.subtask-delete {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.subtask-item:hover .subtask-delete {
    opacity: 1;
}

.subtask-delete:hover {
    color: var(--danger);
}

.no-subtasks {
    color: var(--text-light);
    font-size: 13px;
    text-align: center;
    padding: 20px;
}

.add-subtask-form {
    display: flex;
    gap: 8px;
}

.add-subtask-form input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.add-subtask-form input:focus {
    outline: none;
    border-color: var(--aqua-cyan);
}

/* Task Attachments */
.attachments-card {
    margin-top: 16px;
}

.attachments-card h3 {
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: 600;
}

.attachments-list {
    margin-bottom: 16px;
}

.attachments-card .attachment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(0, 107, 150, 0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.attachments-card .attachment-item:last-child {
    margin-bottom: 0;
}

.attachments-card .attachment-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.attachments-card .attachment-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.attachments-card .attachment-name {
    font-weight: 500;
    color: var(--ocean-deep);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachments-card .attachment-name:hover {
    color: var(--aqua-cyan);
    text-decoration: underline;
}

.attachments-card .attachment-size {
    color: var(--text-light);
    font-size: 12px;
    flex-shrink: 0;
}

.attachments-card .attachment-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 16px;
}

.attachments-card .attachment-remove {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    opacity: 0.5;
    transition: opacity 0.2s, color 0.2s;
}

.attachments-card .attachment-item:hover .attachment-remove {
    opacity: 1;
}

.attachments-card .attachment-remove:hover {
    color: var(--danger);
}

.no-attachments {
    color: var(--text-light);
    font-size: 13px;
    text-align: center;
    padding: 20px;
}

.add-attachment-form {
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.add-attachment-form h4 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 10px;
    color: var(--text-light);
}

.attachment-form-row {
    display: flex;
    gap: 8px;
}

.attachment-form-row select {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: var(--card-bg);
}

.attachment-form-row select:focus {
    outline: none;
    border-color: var(--aqua-cyan);
}

.attachment-hint {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-light);
}

.attachment-hint a {
    color: var(--aqua-cyan);
    text-decoration: none;
}

.attachment-hint a:hover {
    text-decoration: underline;
}

/* Task Form */
.task-form-card {
    max-width: 700px;
}

/* Responsive Tasks */
@media (max-width: 992px) {
    .tasks-layout {
        grid-template-columns: 1fr;
    }

    .tasks-sidebar {
        position: static;
    }

    .task-detail-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .task-card {
        flex-wrap: wrap;
    }

    .task-priority-badge {
        order: -1;
        margin-bottom: 8px;
    }

    .task-detail-meta {
        grid-template-columns: 1fr;
    }
}

/* Dark Theme - Tasks */
body.theme-dark .tasks-sidebar {
    background: rgba(26, 26, 46, 0.95);
    border-color: rgba(127, 219, 255, 0.15);
}

body.theme-dark .task-card {
    background: rgba(26, 26, 46, 0.95);
    border-color: rgba(127, 219, 255, 0.15);
}

body.theme-dark .task-title {
    color: #fff;
}

body.theme-dark .task-detail-title {
    color: #fff;
}

body.theme-dark .subtasks-card {
    background: rgba(26, 26, 46, 0.95);
    border-color: rgba(127, 219, 255, 0.15);
}

body.theme-dark .subtask-text {
    color: rgba(255, 255, 255, 0.9);
}

body.theme-dark .attachments-card {
    background: rgba(26, 26, 46, 0.95);
    border-color: rgba(127, 219, 255, 0.15);
}

body.theme-dark .attachments-card .attachment-item {
    background: rgba(0, 107, 150, 0.1);
    border-color: rgba(127, 219, 255, 0.15);
}

body.theme-dark .attachments-card .attachment-name {
    color: #fff;
}

body.theme-dark .attachment-form-row select {
    background: rgba(26, 26, 46, 0.95);
    color: #fff;
    border-color: rgba(127, 219, 255, 0.15);
}

body.theme-dark .source-email-card {
    background: rgba(0, 180, 216, 0.1);
    border-color: rgba(0, 180, 216, 0.2);
}

body.theme-dark .source-email-subject {
    color: #fff;
}

/* ============================================
   TASK SHARING STYLES
   ============================================ */

.sharing-card {
    margin-top: 20px;
}

.sharing-card h3 {
    margin-bottom: 16px;
    color: var(--text);
    font-size: 16px;
    font-weight: 600;
}

.shares-list {
    margin-bottom: 20px;
}

.share-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: rgba(0, 107, 150, 0.04);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.share-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.share-icon {
    font-size: 16px;
}

.share-name {
    font-weight: 500;
    color: var(--text);
}

.share-permission {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.05);
}

.share-permission.permission-view {
    background: rgba(149, 165, 166, 0.2);
    color: #7f8c8d;
}

.share-permission.permission-add_subtasks {
    background: rgba(46, 204, 113, 0.15);
    color: #27ae60;
}

.share-permission.permission-edit {
    background: rgba(52, 152, 219, 0.15);
    color: #2980b9;
}

.share-remove {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.share-remove:hover {
    background: rgba(214, 48, 49, 0.1);
    color: #d63031;
}

.no-shares {
    color: var(--text-light);
    font-style: italic;
    text-align: center;
    padding: 16px;
}

.add-share-form {
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.add-share-form h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
}

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

.share-form-row select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    font-size: 13px;
    color: var(--text);
    min-width: 120px;
}

.share-form-row select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Dark theme sharing styles */
body.theme-dark .share-item {
    background: rgba(255, 255, 255, 0.05);
}

body.theme-dark .share-name {
    color: #fff;
}

body.theme-dark .share-form-row select {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

body.theme-dark .add-share-form {
    border-color: rgba(255, 255, 255, 0.1);
}

/* ============================================
   CALENDAR STYLES
   ============================================ */

.calendar-container {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.calendar-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    padding: 16px 20px;
    background: var(--glass-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.view-selector {
    display: flex;
    gap: 4px;
    background: rgba(0, 107, 150, 0.08);
    padding: 4px;
    border-radius: var(--radius-sm);
}

.view-btn {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.view-btn:hover {
    color: var(--primary);
    background: rgba(0, 107, 150, 0.1);
    text-decoration: none;
}

.view-btn.active {
    color: #fff;
    background: linear-gradient(135deg, var(--ocean-medium) 0%, var(--aqua-teal) 100%);
    box-shadow: 0 2px 8px rgba(0, 107, 150, 0.3);
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-date {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    min-width: 200px;
    text-align: center;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: #fff;
}

/* Day View */
.day-view {
    background: var(--glass-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.day-header {
    padding: 24px;
    background: linear-gradient(135deg, var(--ocean-medium) 0%, var(--aqua-teal) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 16px;
}

.day-header.is-today {
    background: linear-gradient(135deg, var(--gold-accent) 0%, var(--gold-hover) 100%);
    color: var(--dark-navy);
}

.day-number {
    font-size: 48px;
    font-weight: 700;
    line-height: 1;
}

.day-name {
    font-size: 20px;
    font-weight: 500;
    opacity: 0.9;
}

.day-tasks {
    padding: 24px;
    min-height: 400px;
}

.day-tasks .tasks-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.day-tasks .task-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background: rgba(0, 107, 150, 0.04);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary);
    transition: all 0.2s ease;
}

.day-tasks .task-item:hover {
    background: rgba(0, 107, 150, 0.08);
    text-decoration: none;
    transform: translateX(4px);
}

.day-tasks .task-item.priority-urgent {
    border-left-color: #d63031;
}

.day-tasks .task-item.priority-high {
    border-left-color: var(--gold-accent);
}

.day-tasks .task-item.priority-medium {
    border-left-color: var(--aqua-cyan);
}

.day-tasks .task-item.priority-low {
    border-left-color: #6c757d;
}

.task-time {
    min-width: 80px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

.task-content {
    flex: 1;
}

.task-title {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.task-desc {
    font-size: 13px;
    color: var(--text-muted);
}

.task-priority {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 4px;
}

.task-priority.priority-urgent {
    background: rgba(214, 48, 49, 0.1);
    color: #d63031;
}

.task-priority.priority-high {
    background: rgba(255, 215, 0, 0.2);
    color: #b8860b;
}

.task-priority.priority-medium {
    background: rgba(0, 180, 216, 0.1);
    color: var(--aqua-teal);
}

.task-priority.priority-low {
    background: rgba(108, 117, 125, 0.1);
    color: #6c757d;
}

.empty-day {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-day .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Week View */
.week-view {
    background: var(--glass-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.week-day {
    border-right: 1px solid var(--border);
    min-height: 400px;
}

.week-day:last-child {
    border-right: none;
}

.week-day-header {
    padding: 12px;
    background: rgba(0, 107, 150, 0.06);
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.week-day.is-today .week-day-header {
    background: linear-gradient(135deg, var(--gold-accent) 0%, var(--gold-hover) 100%);
}

.week-day.is-today .week-day-header .day-name,
.week-day.is-today .week-day-header .day-number {
    color: var(--dark-navy);
}

.week-day-header .day-name {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    display: block;
}

.week-day-header .day-number {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.week-day-tasks {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.week-task {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 8px;
    background: rgba(0, 107, 150, 0.04);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text);
    transition: all 0.2s ease;
}

.week-task:hover {
    background: rgba(0, 107, 150, 0.1);
    text-decoration: none;
}

.task-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    margin-top: 4px;
    flex-shrink: 0;
}

.task-dot.priority-urgent { background: #d63031; }
.task-dot.priority-high { background: var(--gold-accent); }
.task-dot.priority-medium { background: var(--aqua-cyan); }
.task-dot.priority-low { background: #6c757d; }

/* Recurring task indicator */
.recurring-icon {
    color: #3498db;
    font-size: 0.9em;
    font-weight: bold;
}

.cell-task.recurring .recurring-icon,
.week-task.recurring .recurring-icon {
    font-size: 0.85em;
    margin-right: 2px;
}

.task-item.recurring {
    border-left: 3px solid #3498db;
}

.week-task .task-text {
    flex: 1;
    line-height: 1.3;
}

.week-task .task-time {
    font-size: 10px;
    color: var(--text-light);
    white-space: nowrap;
}

.no-tasks-hint {
    font-size: 11px;
    color: var(--text-light);
    text-align: center;
    padding: 20px 8px;
    opacity: 0.6;
}

/* Month View */
.month-view {
    background: var(--glass-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.month-grid {
    display: flex;
    flex-direction: column;
}

.month-header-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: linear-gradient(135deg, var(--ocean-medium) 0%, var(--aqua-teal) 100%);
}

.month-day-header {
    padding: 12px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #fff;
}

.month-day-header.weekend {
    background: rgba(0, 0, 0, 0.1);
}

.month-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid var(--border);
}

.month-week:last-child {
    border-bottom: none;
}

.month-cell {
    min-height: 120px;
    padding: 8px;
    border-right: 1px solid var(--border);
    background: #fff;
    transition: background 0.2s ease;
}

.month-cell:last-child {
    border-right: none;
}

.month-cell:hover {
    background: rgba(0, 180, 216, 0.03);
}

.month-cell.empty {
    background: rgba(0, 0, 0, 0.02);
}

.month-cell.is-today {
    background: rgba(255, 215, 0, 0.1);
}

.month-cell.is-today .cell-day-number {
    background: var(--gold-accent);
    color: var(--dark-navy);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cell-header {
    margin-bottom: 6px;
}

.cell-day-number {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.cell-day-number:hover {
    color: var(--primary);
    text-decoration: none;
}

.cell-tasks {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cell-task {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px;
    font-size: 11px;
    color: var(--text);
    background: rgba(0, 107, 150, 0.06);
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cell-task:hover {
    background: rgba(0, 107, 150, 0.12);
    text-decoration: none;
}

.cell-task.priority-urgent { background: rgba(214, 48, 49, 0.1); }
.cell-task.priority-high { background: rgba(255, 215, 0, 0.15); }
.cell-task.priority-medium { background: rgba(0, 180, 216, 0.1); }

.cell-task .task-dot {
    width: 6px;
    height: 6px;
    margin-top: 0;
}

.cell-more {
    font-size: 10px;
    color: var(--primary);
    padding: 2px 6px;
    font-weight: 500;
}

.cell-more:hover {
    text-decoration: underline;
}

/* Multi-Month View (3-month, 6-month) */
.multi-month-view {
    display: grid;
    gap: 20px;
}

.multi-month-view.months-3 {
    grid-template-columns: repeat(3, 1fr);
}

.multi-month-view.months-6 {
    grid-template-columns: repeat(3, 1fr);
}

/* Year View */
.year-view {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

/* Mini Month (for multi-month and year views) */
.mini-month {
    background: var(--glass-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.mini-month-header {
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--ocean-medium) 0%, var(--aqua-teal) 100%);
    text-align: center;
}

.mini-month-header a {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
}

.mini-month-header a:hover {
    text-decoration: none;
    opacity: 0.9;
}

.mini-month-grid {
    padding: 12px;
}

.mini-header-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    margin-bottom: 8px;
}

.mini-header-row span {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.mini-header-row .weekend {
    color: var(--text-light);
}

.mini-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
}

.mini-day {
    position: relative;
    padding: 6px 4px;
    font-size: 12px;
    color: var(--text);
    border-radius: 4px;
}

.mini-day:hover {
    background: rgba(0, 107, 150, 0.1);
    text-decoration: none;
}

.mini-day.empty {
    visibility: hidden;
}

.mini-day.is-today {
    background: var(--gold-accent);
    color: var(--dark-navy);
    font-weight: 700;
}

.mini-day.has-tasks {
    font-weight: 600;
    color: var(--primary);
}

.task-indicator {
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--primary);
    border-radius: 50%;
}

.mini-day.is-today .task-indicator {
    background: var(--dark-navy);
}

/* Responsive Calendar */
@media (max-width: 1200px) {
    .year-view {
        grid-template-columns: repeat(3, 1fr);
    }

    .multi-month-view.months-6 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .year-view {
        grid-template-columns: repeat(2, 1fr);
    }

    .multi-month-view.months-3 {
        grid-template-columns: 1fr;
    }

    .multi-month-view.months-6 {
        grid-template-columns: 1fr;
    }

    .week-grid {
        display: flex;
        flex-direction: column;
    }

    .week-day {
        border-right: none;
        border-bottom: 1px solid var(--border);
        min-height: auto;
    }

    .week-day-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 16px;
    }

    .view-selector {
        flex-wrap: wrap;
    }
}

@media (max-width: 600px) {
    .calendar-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .view-selector {
        justify-content: center;
    }

    .calendar-nav {
        justify-content: center;
    }

    .nav-date {
        min-width: auto;
    }

    .year-view {
        grid-template-columns: 1fr;
    }

    .month-cell {
        min-height: 80px;
        padding: 4px;
    }

    .cell-task {
        font-size: 10px;
        padding: 2px 4px;
    }
}

/* Dark theme for calendar */
body.theme-dark .calendar-toolbar {
    background: rgba(30, 30, 30, 0.9);
}

body.theme-dark .view-selector {
    background: rgba(255, 255, 255, 0.05);
}

body.theme-dark .view-btn {
    color: rgba(255, 255, 255, 0.7);
}

body.theme-dark .view-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

body.theme-dark .nav-date {
    color: #fff;
}

body.theme-dark .day-view,
body.theme-dark .week-view,
body.theme-dark .month-view,
body.theme-dark .mini-month {
    background: rgba(30, 30, 30, 0.9);
}

body.theme-dark .month-cell {
    background: rgba(40, 40, 40, 0.9);
}

body.theme-dark .month-cell.empty {
    background: rgba(20, 20, 20, 0.5);
}

body.theme-dark .month-cell.is-today {
    background: rgba(255, 215, 0, 0.15);
}

body.theme-dark .cell-day-number,
body.theme-dark .mini-day,
body.theme-dark .week-day-header .day-number,
body.theme-dark .task-title {
    color: #fff;
}

body.theme-dark .cell-task,
body.theme-dark .week-task {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
}

body.theme-dark .week-day-header {
    background: rgba(255, 255, 255, 0.05);
}

body.theme-dark .week-day {
    border-color: rgba(255, 255, 255, 0.1);
}

body.theme-dark .month-week,
body.theme-dark .month-cell {
    border-color: rgba(255, 255, 255, 0.1);
}

body.theme-dark .day-tasks .task-item {
    background: rgba(255, 255, 255, 0.05);
}

body.theme-dark .day-tasks .task-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ============================================
   FILE MANAGER STYLES
   ============================================ */

.files-container {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.files-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    padding: 16px 24px;
    background: var(--glass-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--glass-border);
}

.files-nav-tabs {
    display: flex;
    gap: 12px;
}

.nav-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ocean-deep);
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 107, 150, 0.08);
}

.nav-tab:hover {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--aqua-cyan);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 107, 150, 0.15);
}

.nav-tab.active {
    color: #fff;
    background: linear-gradient(135deg, var(--ocean-medium) 0%, var(--aqua-teal) 100%);
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(0, 180, 216, 0.3);
}

.files-search .search-input {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    width: 250px;
}

.storage-info {
    font-size: 13px;
    color: var(--text-muted);
}

.files-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 16px;
    padding: 10px 16px;
    background: rgba(0, 107, 150, 0.04);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.files-breadcrumb a {
    color: var(--text-muted);
}

.files-breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb-sep {
    color: var(--text-light);
    margin: 0 4px;
}

/* Files Grid */
.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.file-card {
    position: relative;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 24px 16px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.file-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 107, 150, 0.15);
    border-color: var(--aqua-cyan);
}

.file-card.folder-card {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 200, 50, 0.08) 100%);
    border: 1px solid rgba(255, 200, 50, 0.25);
}

.file-card.folder-card:hover {
    border-color: rgba(255, 200, 50, 0.4);
}

.file-icon {
    font-size: 52px;
    margin-bottom: 14px;
    line-height: 1;
}

.folder-icon {
    color: var(--gold-accent);
    text-shadow: 0 2px 8px rgba(255, 200, 50, 0.3);
}

.file-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 4px;
}

.file-meta {
    font-size: 11px;
    color: var(--text-light);
    font-weight: 500;
}

.public-badge {
    display: inline-block;
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.2) 0%, rgba(39, 174, 96, 0.1) 100%);
    color: #27ae60;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 6px;
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.file-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.file-card:hover .file-actions {
    opacity: 1;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--glass-border);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.action-btn:hover {
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
    border-color: var(--aqua-cyan);
}

.action-btn.danger:hover {
    background: rgba(214, 48, 49, 0.1);
    border-color: var(--danger);
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Drag and Drop */
.files-container {
    position: relative;
}

.files-container.drag-over {
    background: rgba(0, 180, 216, 0.05);
    outline: 2px dashed var(--aqua-cyan);
    outline-offset: -4px;
}

/* Drop zone overlay */
.drop-zone-overlay {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 180, 216, 0.1);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 100;
    pointer-events: none;
}

.drop-zone-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 60px 80px;
    background: var(--glass-bg);
    border: 3px dashed var(--aqua-cyan);
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0, 180, 216, 0.2);
}

.drop-zone-content .drop-icon {
    font-size: 64px;
}

.drop-zone-content span {
    font-size: 18px;
    font-weight: 600;
    color: var(--ocean-deep);
}

/* Folder drag over state */
.folder-card.folder-drag-over {
    transform: scale(1.05);
    border-color: var(--aqua-cyan) !important;
    background: linear-gradient(135deg, rgba(0, 180, 216, 0.2) 0%, rgba(127, 219, 255, 0.1) 100%) !important;
    box-shadow: 0 8px 30px rgba(0, 180, 216, 0.3);
}

.folder-card.folder-drag-over .folder-icon {
    transform: scale(1.1);
    transition: transform 0.2s ease;
}

/* File Detail Page */
.file-detail-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 24px;
}

.file-preview-card {
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-preview {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview img {
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.video-preview video {
    max-width: 100%;
    max-height: 500px;
    border-radius: var(--radius-sm);
}

.audio-preview {
    flex-direction: column;
    gap: 20px;
}

.audio-preview .audio-icon {
    font-size: 80px;
    opacity: 0.5;
}

.audio-preview audio {
    width: 100%;
    max-width: 400px;
}

.pdf-preview iframe {
    width: 100%;
    height: 500px;
    border: none;
    border-radius: var(--radius-sm);
}

.generic-preview {
    flex-direction: column;
    gap: 16px;
    color: var(--text-muted);
}

.preview-icon {
    font-size: 80px;
    opacity: 0.5;
}

.file-info-card {
    height: fit-content;
    border: 1px solid var(--glass-border);
}

.file-detail-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--ocean-deep);
    margin-bottom: 20px;
    word-break: break-word;
    line-height: 1.3;
}

.file-detail-meta {
    margin-bottom: 24px;
}

.file-detail-meta .meta-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--glass-border);
    font-size: 13px;
}

.file-detail-meta .meta-item:last-child {
    border-bottom: none;
}

.file-detail-meta .meta-label {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.file-detail-meta .meta-value {
    color: var(--text);
    font-weight: 500;
}

.file-detail-meta .meta-value a {
    color: var(--aqua-cyan);
    text-decoration: none;
}

.file-detail-meta .meta-value a:hover {
    text-decoration: underline;
}

.file-description {
    margin-bottom: 20px;
}

.file-description h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.file-description p {
    font-size: 13px;
    color: var(--text-muted);
    white-space: pre-wrap;
}

.file-public-link {
    margin-bottom: 24px;
    padding: 20px;
    background: rgba(0, 107, 150, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
}

.file-public-link h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--ocean-deep);
}

.public-link-active {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.public-link-active input {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
}

.public-link-active .btn {
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.public-link-active .btn-secondary {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--glass-border);
    color: var(--ocean-deep);
}

.public-link-active .btn-secondary:hover {
    background: #fff;
    border-color: var(--aqua-cyan);
    transform: translateY(-1px);
}

.public-link-active .btn-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border: none;
    color: #fff;
}

.public-link-active .btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.public-link-disabled {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.file-actions-section {
    padding-top: 20px;
    margin-top: 20px;
    border-top: 1px solid var(--glass-border);
}

.file-actions-section .btn-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border: none;
    color: #fff;
    padding: 12px 24px;
    font-weight: 600;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.file-actions-section .btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.3);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--glass-bg);
    padding: 24px;
    border-radius: var(--radius);
    min-width: 300px;
    max-width: 90%;
    box-shadow: var(--shadow-lg);
}

.modal-content h3 {
    margin-bottom: 16px;
    font-size: 18px;
}

.modal-content input,
.modal-content select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Responsive */
@media (max-width: 900px) {
    .file-detail-layout {
        grid-template-columns: 1fr;
    }

    .files-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .files-nav-tabs {
        justify-content: center;
    }

    .files-search .search-input {
        width: 100%;
    }

    .storage-info {
        text-align: center;
    }
}

@media (max-width: 600px) {
    .files-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .file-card {
        padding: 16px 12px;
    }

    .file-icon {
        font-size: 36px;
    }
}

/* Dark theme file styles */
body.theme-dark .files-toolbar {
    background: rgba(26, 26, 46, 0.95);
    border-color: rgba(127, 219, 255, 0.15);
}

body.theme-dark .nav-tab {
    background: rgba(40, 40, 60, 0.8);
    color: rgba(255, 255, 255, 0.8);
    border-color: rgba(127, 219, 255, 0.2);
}

body.theme-dark .nav-tab:hover {
    background: rgba(50, 50, 70, 0.9);
    color: var(--aqua-cyan);
    border-color: var(--aqua-cyan);
}

body.theme-dark .nav-tab.active {
    background: linear-gradient(135deg, var(--ocean-medium) 0%, var(--aqua-teal) 100%);
    color: #fff;
    border-color: transparent;
}

body.theme-dark .file-card {
    background: rgba(26, 26, 46, 0.95);
    border-color: rgba(127, 219, 255, 0.15);
}

body.theme-dark .file-card:hover {
    border-color: var(--aqua-cyan);
}

body.theme-dark .file-card.folder-card {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 165, 0, 0.1) 100%);
    border-color: rgba(255, 200, 50, 0.2);
}

body.theme-dark .file-name {
    color: #fff;
}

body.theme-dark .files-breadcrumb {
    background: rgba(255, 255, 255, 0.05);
}

body.theme-dark .files-search .search-input {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

body.theme-dark .action-btn {
    background: rgba(40, 40, 60, 0.9);
    color: #fff;
    border-color: rgba(127, 219, 255, 0.2);
}

body.theme-dark .drop-zone-overlay {
    background: rgba(0, 180, 216, 0.15);
}

body.theme-dark .drop-zone-content {
    background: rgba(26, 26, 46, 0.98);
    border-color: var(--aqua-cyan);
}

body.theme-dark .drop-zone-content span {
    color: #fff;
}

body.theme-dark .action-btn:hover {
    background: rgba(50, 50, 70, 0.95);
    border-color: var(--aqua-cyan);
}

body.theme-dark .file-preview-card,
body.theme-dark .file-info-card {
    background: rgba(30, 30, 30, 0.9);
}

body.theme-dark .file-detail-name {
    color: #fff;
}

body.theme-dark .file-detail-meta .meta-value {
    color: #fff;
}

body.theme-dark .file-public-link {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(127, 219, 255, 0.15);
}

body.theme-dark .file-public-link h3 {
    color: #fff;
}

body.theme-dark .public-link-active input {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

body.theme-dark .public-link-active .btn-secondary {
    background: rgba(40, 40, 60, 0.9);
    color: #fff;
    border-color: rgba(127, 219, 255, 0.2);
}

body.theme-dark .public-link-active .btn-secondary:hover {
    background: rgba(50, 50, 70, 0.95);
    border-color: var(--aqua-cyan);
}

body.theme-dark .file-info-card {
    border-color: rgba(127, 219, 255, 0.15);
}

body.theme-dark .modal-content {
    background: rgba(30, 30, 30, 0.95);
}

body.theme-dark .modal-content input,
body.theme-dark .modal-content select {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* ============================================
   PROJECT LIST IMPROVEMENTS
   ============================================ */

/* Year Section Headers - Enhanced */
.project-year-section {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow);
}

.project-year-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    margin: -20px -20px 16px -20px;
    background: linear-gradient(135deg, var(--ocean-medium) 0%, var(--ocean-deep) 100%);
    border-radius: var(--radius) var(--radius) 0 0;
    cursor: pointer;
    user-select: none;
    transition: opacity 0.2s;
}

.project-year-header:hover {
    opacity: 0.95;
}

.project-year-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
}

.project-year-header .year-count {
    font-weight: 400;
    font-size: 14px;
    opacity: 0.85;
}

.project-year-toggle {
    font-size: 14px;
    color: #fff;
    transition: transform 0.2s;
}

.project-year-toggle.collapsed {
    transform: rotate(-90deg);
}

/* Project Table - Enhanced */
.project-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.project-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.project-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ocean-deep);
    background: rgba(0, 107, 150, 0.08);
    border-bottom: 2px solid rgba(0, 107, 150, 0.15);
}

.project-table th:first-child {
    border-radius: var(--radius-sm) 0 0 0;
}

.project-table th:last-child {
    border-radius: 0 var(--radius-sm) 0 0;
}

.project-table td {
    padding: 16px;
    font-size: 14px;
    color: var(--ocean-deep);
    border-bottom: 1px solid rgba(0, 107, 150, 0.08);
    vertical-align: middle;
}

.project-table tbody tr {
    transition: all 0.15s ease;
    cursor: pointer;
}

.project-table tbody tr:hover {
    background: rgba(127, 219, 255, 0.12);
}

.project-table tbody tr:last-child td {
    border-bottom: none;
}

/* Job Number Column */
.project-job-number {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    font-weight: 600;
    color: var(--ocean-medium);
    white-space: nowrap;
}

/* Project Name Column */
.project-name-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.project-name {
    font-weight: 600;
    color: var(--ocean-deep);
    font-size: 14px;
}

.project-description {
    font-size: 12px;
    color: var(--text-muted);
    opacity: 0.8;
    max-width: 400px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Status Badges - Improved Contrast */
.project-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
    border: 1.5px solid;
}

.project-status-badge.status-active {
    background: rgba(0, 184, 148, 0.2);
    color: #008b6e;
    border-color: rgba(0, 184, 148, 0.4);
}

.project-status-badge.status-on_hold {
    background: rgba(240, 147, 43, 0.2);
    color: #c77000;
    border-color: rgba(240, 147, 43, 0.4);
}

.project-status-badge.status-completed {
    background: rgba(108, 117, 125, 0.2);
    color: #545b62;
    border-color: rgba(108, 117, 125, 0.4);
}

.project-status-badge.status-cancelled {
    background: rgba(214, 48, 49, 0.2);
    color: #a71d2a;
    border-color: rgba(214, 48, 49, 0.4);
}

/* Budget/Money Columns */
.project-budget {
    font-family: 'Consolas', 'Monaco', monospace;
    font-weight: 600;
    text-align: right;
    color: var(--ocean-deep);
}

.project-spent {
    font-family: 'Consolas', 'Monaco', monospace;
    font-weight: 600;
    text-align: right;
    color: #c44536;
}

.project-spent.zero {
    color: var(--text-muted);
    opacity: 0.5;
}

/* Project Actions */
.project-actions {
    text-align: center;
}

.project-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 107, 150, 0.1);
    color: var(--ocean-medium);
    font-size: 14px;
    transition: all 0.2s;
    text-decoration: none;
}

.project-view-btn:hover {
    background: var(--ocean-medium);
    color: #fff;
    transform: scale(1.1);
}

/* Status Tabs - Enhanced */
.project-status-tabs {
    display: flex;
    gap: 4px;
    background: rgba(0, 107, 150, 0.05);
    padding: 6px;
    border-radius: var(--radius-sm);
    flex-wrap: wrap;
}

.project-tab {
    padding: 10px 18px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--ocean-deep);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.project-tab:hover {
    background: rgba(0, 107, 150, 0.1);
}

.project-tab.active {
    background: linear-gradient(135deg, var(--ocean-medium) 0%, var(--ocean-deep) 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 107, 150, 0.3);
}

.project-tab .tab-count {
    background: rgba(255, 255, 255, 0.25);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    min-width: 28px;
    text-align: center;
}

.project-tab.active .tab-count {
    background: rgba(255, 255, 255, 0.3);
}

/* Project Files Section */
.project-files-section {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.project-files-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: rgba(0, 107, 150, 0.05);
    border-bottom: 1px solid rgba(0, 107, 150, 0.1);
}

.project-files-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--ocean-deep);
}

.project-files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    padding: 20px;
}

.project-file-card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 107, 150, 0.1);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.project-file-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 107, 150, 0.15);
    border-color: var(--ocean-medium);
}

.project-file-icon {
    font-size: 36px;
    margin-bottom: 10px;
}

.project-file-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--ocean-deep);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-file-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Project Folder Link */
.project-folder-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: rgba(0, 107, 150, 0.03);
    border-top: 1px solid rgba(0, 107, 150, 0.08);
}

.project-folder-link .folder-icon {
    font-size: 20px;
}

.project-folder-link .folder-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.project-folder-link .folder-path {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    color: var(--ocean-medium);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-folder-link .folder-path:hover {
    color: var(--ocean-deep);
    text-decoration: underline;
}

/* Drop Zone for Project Files */
.project-drop-zone {
    position: relative;
    min-height: 150px;
}

.project-drop-zone-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 180, 216, 0.1);
    border: 3px dashed var(--aqua-cyan);
    border-radius: var(--radius-sm);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.project-drop-zone-overlay.visible {
    display: flex;
}

.project-drop-zone-content {
    text-align: center;
    color: var(--ocean-medium);
}

.project-drop-zone-content .drop-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.project-drop-zone-content span {
    font-size: 16px;
    font-weight: 500;
}

/* Empty State for Project Files */
.project-files-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.project-files-empty .empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.project-files-empty p {
    margin: 0;
    font-size: 14px;
}

/* Dark theme overrides for projects */
body.theme-dark .project-year-section {
    background: rgba(30, 30, 50, 0.8);
    border-color: rgba(127, 219, 255, 0.15);
}

body.theme-dark .project-table th {
    background: rgba(127, 219, 255, 0.08);
    color: #fff;
}

body.theme-dark .project-table td {
    color: rgba(255, 255, 255, 0.9);
    border-bottom-color: rgba(127, 219, 255, 0.1);
}

body.theme-dark .project-table tbody tr:hover {
    background: rgba(127, 219, 255, 0.1);
}

body.theme-dark .project-job-number {
    color: var(--aqua-cyan);
}

body.theme-dark .project-name {
    color: #fff;
}

body.theme-dark .project-status-badge.status-active {
    background: rgba(0, 184, 148, 0.25);
    color: #00d9a5;
    border-color: rgba(0, 184, 148, 0.5);
}

body.theme-dark .project-status-badge.status-on_hold {
    background: rgba(240, 147, 43, 0.25);
    color: #ffb347;
    border-color: rgba(240, 147, 43, 0.5);
}

body.theme-dark .project-status-badge.status-completed {
    background: rgba(108, 117, 125, 0.25);
    color: #a0a0a0;
    border-color: rgba(108, 117, 125, 0.5);
}

body.theme-dark .project-status-badge.status-cancelled {
    background: rgba(214, 48, 49, 0.25);
    color: #ff6b6b;
    border-color: rgba(214, 48, 49, 0.5);
}

body.theme-dark .project-files-section {
    background: rgba(30, 30, 50, 0.8);
    border-color: rgba(127, 219, 255, 0.15);
}

body.theme-dark .project-files-header {
    background: rgba(127, 219, 255, 0.05);
    border-bottom-color: rgba(127, 219, 255, 0.1);
}

body.theme-dark .project-files-header h2 {
    color: #fff;
}

body.theme-dark .project-file-card {
    background: rgba(40, 40, 60, 0.8);
    border-color: rgba(127, 219, 255, 0.15);
}

body.theme-dark .project-file-card:hover {
    border-color: var(--aqua-cyan);
}

body.theme-dark .project-file-name {
    color: #fff;
}

body.theme-dark .project-folder-link {
    background: rgba(127, 219, 255, 0.03);
    border-top-color: rgba(127, 219, 255, 0.1);
}

body.theme-dark .project-folder-link .folder-path {
    color: var(--aqua-cyan);
}

body.theme-dark .project-status-tabs {
    background: rgba(127, 219, 255, 0.05);
}

body.theme-dark .project-tab {
    color: rgba(255, 255, 255, 0.85);
}

body.theme-dark .project-tab:hover {
    background: rgba(127, 219, 255, 0.1);
}

/* ============================================
   EMAIL THREAD MODAL
   ============================================ */

/* Thread Modal Overlay */
.thread-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 30, 50, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.thread-modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* Thread Modal Container */
.thread-modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 70%;
    max-width: 900px;
    min-width: 500px;
    background: var(--glass-bg);
    box-shadow: -10px 0 40px rgba(0, 50, 80, 0.2);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.thread-modal-overlay.visible .thread-modal {
    transform: translateX(0);
}

/* Thread Modal Header */
.thread-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--ocean-medium) 0%, var(--ocean-deep) 100%);
    color: #fff;
    flex-shrink: 0;
}

.thread-modal-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 16px;
}

.thread-modal-controls {
    display: flex;
    gap: 8px;
}

.thread-modal-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}

.thread-modal-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Thread Modal Body */
.thread-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Thread Message Cards */
.thread-message-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 107, 150, 0.1);
    border-radius: var(--radius);
    margin-bottom: 16px;
    overflow: hidden;
    transition: all 0.2s;
}

.thread-message-card:last-child {
    margin-bottom: 0;
}

.thread-message-card.collapsed {
    cursor: pointer;
}

.thread-message-card.collapsed:hover {
    border-color: var(--ocean-medium);
}

.thread-message-card.collapsed .thread-message-body {
    display: none;
}

.thread-message-card.collapsed .thread-message-header {
    border-bottom: none;
}

/* Thread Message Header */
.thread-message-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: rgba(0, 107, 150, 0.03);
    border-bottom: 1px solid rgba(0, 107, 150, 0.08);
    cursor: pointer;
}

.thread-message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ocean-medium) 0%, var(--aqua-teal) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
}

.thread-message-meta {
    flex: 1;
    min-width: 0;
}

.thread-message-from {
    font-weight: 600;
    color: var(--ocean-deep);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thread-message-to {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thread-message-date {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.thread-message-snippet {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 4px;
    display: none;
}

.thread-message-card.collapsed .thread-message-snippet {
    display: block;
}

/* Thread Message Body */
.thread-message-body {
    padding: 20px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
}

.thread-message-body img {
    max-width: 100%;
    height: auto;
}

/* Email content styling */
.thread-message-body blockquote {
    margin: 16px 0;
    padding: 12px 16px;
    border-left: 3px solid var(--ocean-medium);
    background: rgba(0, 107, 150, 0.05);
    color: var(--text-muted);
}

.thread-message-body a {
    color: var(--ocean-medium);
}

.thread-message-body pre {
    background: rgba(0, 0, 0, 0.04);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 13px;
}

/* Thread Attachments */
.thread-attachments {
    padding: 12px 18px;
    background: rgba(0, 107, 150, 0.02);
    border-top: 1px solid rgba(0, 107, 150, 0.08);
}

.thread-attachments-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.thread-attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.thread-attachment-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 107, 150, 0.15);
    border-radius: 6px;
    font-size: 13px;
    color: var(--ocean-deep);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.thread-attachment-item:hover {
    background: #fff;
    border-color: var(--ocean-medium);
    transform: translateY(-1px);
    text-decoration: none;
}

.thread-attachment-icon {
    font-size: 16px;
}

.thread-attachment-name {
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thread-attachment-size {
    color: var(--text-muted);
    font-size: 11px;
}

/* Thread Reply Section - Compact with resize */
.thread-reply-section {
    flex-shrink: 0;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid rgba(0, 107, 150, 0.1);
    position: relative;
}

/* Resize Handle */
.thread-reply-resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    cursor: ns-resize;
    background: transparent;
    transition: background 0.2s;
}

.thread-reply-resize-handle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: rgba(0, 107, 150, 0.15);
    border-radius: 2px;
}

.thread-reply-resize-handle:hover {
    background: rgba(0, 107, 150, 0.05);
}

.thread-reply-resize-handle:hover::after {
    background: rgba(0, 107, 150, 0.3);
}

.thread-reply-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.thread-reply-header label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ocean-deep);
}

.thread-reply-from {
    display: flex;
    align-items: center;
    gap: 6px;
}

.thread-reply-from label {
    font-size: 11px;
    color: var(--text-muted);
}

.thread-reply-from select {
    padding: 4px 10px;
    border: 1px solid rgba(0, 107, 150, 0.2);
    border-radius: 4px;
    font-size: 12px;
    background: #fff;
    color: var(--text);
}

/* Editor Container - Resizable */
.thread-reply-editor-container {
    border: 1px solid rgba(0, 107, 150, 0.2);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    background: #fff;
    overflow: hidden;
    height: 80px; /* Default small height */
}

.thread-reply-editor-container .editor-toolbar {
    padding: 4px 8px;
    border-bottom: 1px solid rgba(0, 107, 150, 0.1);
    background: rgba(0, 107, 150, 0.02);
    display: flex;
    gap: 2px;
}

.thread-reply-editor-container .toolbar-btn {
    padding: 4px 8px;
    font-size: 12px;
}

.thread-reply-editor-container .toolbar-divider {
    width: 1px;
    background: rgba(0, 107, 150, 0.15);
    margin: 0 4px;
}

/* Small editor style */
.thread-reply-editor-small {
    min-height: 40px;
    height: calc(100% - 32px);
    padding: 8px 10px;
    font-size: 13px;
    overflow-y: auto;
}

.thread-reply-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.thread-reply-actions .btn {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
}

.thread-reply-actions .btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

/* Minimized Thread Bars Container */
.minimized-bars-container {
    position: fixed;
    bottom: 0;
    right: 0;
    z-index: 999;
    display: flex;
    flex-direction: row-reverse;
    gap: 8px;
    padding-right: 20px;
}

/* Minimized Thread Bar */
.minimized-thread-bar {
    position: relative;
    bottom: 0;
    width: 320px;
    background: linear-gradient(135deg, var(--ocean-medium) 0%, var(--ocean-deep) 100%);
    border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: 0 -4px 20px rgba(0, 50, 80, 0.2);
    cursor: pointer;
    transition: all 0.2s;
    display: none;
}

.minimized-thread-bar:hover {
    transform: translateY(-2px);
}

.minimized-thread-bar.visible {
    display: block;
}

.minimized-thread-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    color: #fff;
}

.minimized-thread-subject {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 12px;
}

.minimized-thread-controls {
    display: flex;
    gap: 6px;
}

.minimized-thread-controls button {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
}

.minimized-thread-controls button:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Loading state */
.thread-modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.thread-modal-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 107, 150, 0.1);
    border-top-color: var(--ocean-medium);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

/* Error state */
.thread-modal-error {
    padding: 40px 20px;
    text-align: center;
    color: var(--danger);
}

.thread-modal-error .error-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* Responsive */
@media (max-width: 900px) {
    .thread-modal {
        width: 100%;
        min-width: unset;
    }
}

@media (max-width: 600px) {
    .thread-modal-header h2 {
        font-size: 14px;
    }

    .thread-message-header {
        flex-wrap: wrap;
    }

    .thread-message-date {
        width: 100%;
        margin-top: 8px;
        padding-left: 52px;
    }

    .minimized-bars-container {
        flex-direction: column;
        padding-right: 10px;
        gap: 4px;
    }

    .minimized-thread-bar {
        width: calc(100vw - 20px);
    }
}

/* Dark theme for thread modal */
body.theme-dark .thread-modal-overlay {
    background: rgba(0, 10, 20, 0.7);
}

body.theme-dark .thread-modal {
    background: rgba(26, 26, 46, 0.98);
}

body.theme-dark .thread-message-card {
    background: rgba(40, 40, 60, 0.9);
    border-color: rgba(127, 219, 255, 0.15);
}

body.theme-dark .thread-message-card.collapsed:hover {
    border-color: var(--aqua-cyan);
}

body.theme-dark .thread-message-header {
    background: rgba(127, 219, 255, 0.03);
    border-bottom-color: rgba(127, 219, 255, 0.1);
}

body.theme-dark .thread-message-from {
    color: #fff;
}

body.theme-dark .thread-message-body {
    color: rgba(255, 255, 255, 0.9);
}

body.theme-dark .thread-message-body blockquote {
    background: rgba(127, 219, 255, 0.05);
    border-left-color: var(--aqua-cyan);
}

body.theme-dark .thread-message-body a {
    color: var(--aqua-cyan);
}

body.theme-dark .thread-message-body pre {
    background: rgba(0, 0, 0, 0.3);
}

body.theme-dark .thread-attachments {
    background: rgba(127, 219, 255, 0.02);
    border-top-color: rgba(127, 219, 255, 0.1);
}

body.theme-dark .thread-attachment-item {
    background: rgba(40, 40, 60, 0.8);
    border-color: rgba(127, 219, 255, 0.2);
    color: #fff;
}

body.theme-dark .thread-attachment-item:hover {
    background: rgba(50, 50, 70, 0.9);
    border-color: var(--aqua-cyan);
}

body.theme-dark .thread-reply-section {
    background: rgba(30, 30, 50, 0.95);
    border-top-color: rgba(127, 219, 255, 0.1);
}

body.theme-dark .thread-reply-resize-handle::after {
    background: rgba(127, 219, 255, 0.2);
}

body.theme-dark .thread-reply-resize-handle:hover {
    background: rgba(127, 219, 255, 0.05);
}

body.theme-dark .thread-reply-resize-handle:hover::after {
    background: rgba(127, 219, 255, 0.4);
}

body.theme-dark .thread-reply-header label {
    color: #fff;
}

body.theme-dark .thread-reply-from select {
    background: rgba(40, 40, 60, 0.9);
    border-color: rgba(127, 219, 255, 0.2);
    color: #fff;
}

body.theme-dark .thread-reply-editor-container {
    border-color: rgba(127, 219, 255, 0.2);
    background: rgba(40, 40, 60, 0.9);
}

body.theme-dark .thread-reply-editor-container .editor-toolbar {
    background: rgba(127, 219, 255, 0.02);
    border-bottom-color: rgba(127, 219, 255, 0.1);
}

body.theme-dark .thread-reply-editor-small {
    color: #fff;
}

body.theme-dark .minimized-thread-bar {
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
}
