:root {
    --primary: #667eea;
    --primary-dark: #5568d3;
    --secondary: #764ba2;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --glass: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.2);

    /* Semantic tokens - light */
    --surface: #ffffff;
    --surface-hover: #f9fafb;
    --surface-alt: #f3f4f6;
    --border: #e5e7eb;
    --border-hover: #d1d5db;
    --text-primary: #111827;
    --text-secondary: #374151;
    --text-muted: #6b7280;
    --input-bg: #ffffff;
    --input-border: #e5e7eb;
}

/* ============================================
   DARK MODE
   ============================================ */

[data-theme="dark"] {
    --bg-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --glass: rgba(0, 0, 0, 0.3);
    --glass-border: rgba(255, 255, 255, 0.08);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.6);

    --surface: #1e1e2e;
    --surface-hover: #252538;
    --surface-alt: #2a2a3d;
    --border: #3a3a52;
    --border-hover: #4a4a65;
    --text-primary: #e2e2f0;
    --text-secondary: #a0a0b8;
    --text-muted: #6b6b85;
    --input-bg: #252538;
    --input-border: #3a3a52;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.screen {
    min-height: 100vh;
}

/* ============================================
   AUTH SCREEN - GLASSMORPHISM DESIGN
   ============================================ */

.auth-container {
    max-width: 440px;
    margin: 0 auto;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
    position: relative;
}

.auth-container h1 {
    font-size: 56px;
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff 0%, rgba(255, 255, 255, 0.8) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.subtitle {
    color: rgba(255, 255, 255, 0.95);
    text-align: center;
    margin-bottom: 48px;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

#auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: rgba(255, 255, 255, 0.15);
    padding: 6px;
    border-radius: 12px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.01em;
}

.tab-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.auth-form {
    background: var(--surface);
    backdrop-filter: blur(20px);
    padding: 36px;
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border);
}

.auth-form input {
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 16px;
    border: 2px solid var(--input-border);
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--input-bg);
    color: var(--text-primary);
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.auth-form input::placeholder {
    color: var(--text-muted);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--bg-gradient);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    letter-spacing: 0.01em;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    padding: 10px 20px;
    background: var(--surface);
    color: var(--text-secondary);
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.01em;
}

.btn-secondary:hover {
    background: var(--surface-hover);
    border-color: var(--border-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.message {
    margin-top: 20px;
    padding: 14px;
    border-radius: 10px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.message.error {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fca5a5;
}

[data-theme="dark"] .message.error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

.message.success {
    background: #d1fae5;
    color: #059669;
    border: 1px solid #6ee7b7;
}

[data-theme="dark"] .message.success {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.3);
}

/* ============================================
   MAIN SCREEN - MODERN INTERFACE
   ============================================ */

header {
    background: var(--surface);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-sm);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

.header-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 24px;
    font-weight: 700;
    background: var(--bg-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.01em;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

#user-email {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    background: var(--surface-alt);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 48px 32px;
}

.section {
    background: var(--surface);
    padding: 32px;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    margin-bottom: 32px;
    border: 1px solid var(--border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.section h2 {
    color: var(--text-primary);
    margin-bottom: 24px;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section h2::before {
    content: '';
    width: 4px;
    height: 24px;
    background: var(--bg-gradient);
    border-radius: 4px;
}

.section h3 {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* ============================================
   VAULT CONTROLS
   ============================================ */

.vault-controls {
    display: flex;
    gap: 16px;
}

#vault-select {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--input-border);
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    background: var(--input-bg);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#vault-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#create-vault-form input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 16px;
    border: 2px solid var(--input-border);
    border-radius: 12px;
    font-size: 15px;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#create-vault-form input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#create-vault-form label {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 12px;
    background: var(--surface-hover);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

#create-vault-form label:hover {
    background: var(--surface-alt);
}

#create-vault-form input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.form-buttons {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.form-buttons button {
    flex: 1;
}

/* ============================================
   NOTE FORM
   ============================================ */

#note-form textarea {
    width: 100%;
    padding: 16px;
    margin-bottom: 16px;
    border: 2px solid var(--input-border);
    border-radius: 12px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    min-height: 300px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--surface-hover);
    color: var(--text-primary);
}

#note-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: var(--input-bg);
}

#note-form input {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 16px;
    border: 2px solid var(--input-border);
    border-radius: 12px;
    font-size: 15px;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#note-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ============================================
   TASK PROGRESS
   ============================================ */

.task-card {
    background: var(--surface-hover);
    padding: 28px;
    border-radius: 16px;
    border: 2px solid var(--border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.task-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.task-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

#task-type {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.status-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: var(--shadow-sm);
}

.status-badge.queued {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
}

.status-badge.processing {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: .7;
    }
}

.status-badge.completed {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
}

.status-badge.failed {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 16px;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: var(--bg-gradient);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.task-details {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
}

.task-result {
    margin-top: 20px;
    padding: 16px;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid #6ee7b7;
    display: none;
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.task-error {
    margin-top: 20px;
    padding: 16px;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid #fca5a5;
    display: none;
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   SEARCH & NOTES
   ============================================ */

.search-controls {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

#search-query {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--input-border);
    border-radius: 12px;
    font-size: 15px;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#search-query:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#notes-list, #search-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.note-item {
    padding: 20px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.note-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--bg-gradient);
    opacity: 0;
    transition: opacity 0.3s;
}

.note-item:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.note-item:hover::before {
    opacity: 1;
}

.note-item h4 {
    color: var(--text-primary);
    margin-bottom: 12px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-item .note-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 12px;
}

.note-item .note-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.tag {
    padding: 4px 12px;
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    color: #3730a3;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: all 0.3s;
}

.tag:hover {
    background: linear-gradient(135deg, #c7d2fe 0%, #a5b4fc 100%);
    transform: translateY(-1px);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .container {
        padding: 24px 16px;
    }

    .section {
        padding: 20px;
        border-radius: 16px;
    }

    header h1 {
        font-size: 20px;
    }

    .auth-container h1 {
        font-size: 42px;
    }

    #notes-list, #search-results {
        grid-template-columns: 1fr;
    }

    .header-content {
        padding: 0 16px;
    }

    #user-email {
        display: none;
    }

    .vault-controls {
        flex-direction: column;
    }

    .search-controls {
        flex-direction: column;
    }
}

/* ============================================
   ADMIN PANEL
   ============================================ */

.admin-section {
    margin-bottom: 32px;
    padding-bottom: 32px;
    border-bottom: 2px solid var(--border);
}

.admin-section:last-child {
    border-bottom: none;
}

.admin-form {
    display: grid;
    gap: 16px;
    max-width: 600px;
}

.admin-form input,
.admin-form select {
    padding: 12px 16px;
    border: 2px solid var(--input-border);
    border-radius: 12px;
    font-size: 15px;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.admin-form input:focus,
.admin-form select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.users-grid {
    display: grid;
    gap: 16px;
    margin-top: 20px;
}

.user-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.user-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.user-info {
    flex: 1;
}

.user-name {
    font-size: 17px;
    margin-bottom: 8px;
}

.user-name strong {
    color: var(--text-primary);
}

.user-display {
    color: var(--text-muted);
    font-weight: 500;
    margin-left: 8px;
}

.user-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 13px;
}

.user-role {
    padding: 4px 12px;
    border-radius: 8px;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    font-size: 11px;
}

.user-role.role-admin {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
}

.user-role.role-user {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
}

.user-status {
    padding: 4px 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 12px;
}

.user-status.active {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
}

.user-status.inactive {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
}

.user-date {
    color: var(--text-muted);
    font-weight: 500;
}

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

.btn-warning {
    padding: 8px 16px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    border: 2px solid #fde68a;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-warning:hover {
    background: linear-gradient(135deg, #fde68a 0%, #fcd34d 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-success {
    padding: 8px 16px;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border: 2px solid #a7f3d0;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-success:hover {
    background: linear-gradient(135deg, #a7f3d0 0%, #6ee7b7 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-danger {
    padding: 8px 16px;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border: 2px solid #fecaca;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* CouchDB Credentials Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--surface);
    border: 3px solid var(--border);
    border-radius: 24px;
    padding: 32px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

.modal-content h2 {
    margin: 0 0 16px 0;
    color: var(--text-primary);
    font-size: 24px;
}

.modal-content h3 {
    margin: 24px 0 12px 0;
    color: var(--text-secondary);
    font-size: 18px;
}

.credentials-box {
    background: var(--surface-alt);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    margin: 20px 0;
}

.credentials-box label {
    display: block;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.credentials-box textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-hover);
    border-radius: 12px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    resize: vertical;
    background: var(--input-bg);
    color: var(--text-primary);
    margin-bottom: 12px;
}

.credentials-details {
    margin: 24px 0;
}

.credential-item {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.credential-item label {
    min-width: 100px;
    font-weight: 600;
    color: var(--text-secondary);
}

.credential-item input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid var(--input-border);
    border-radius: 10px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.modal-footer {
    margin-top: 24px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.warning-text {
    margin-top: 20px;
    padding: 12px;
    background: #fef3c7;
    border: 2px solid #fde68a;
    border-radius: 12px;
    color: #92400e;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

.info-box {
    margin: 20px 0;
    padding: 16px;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border: 2px solid #93c5fd;
    border-radius: 12px;
    color: #1e40af;
    font-size: 14px;
    line-height: 1.6;
}

.info-box strong {
    display: block;
    margin-bottom: 8px;
    font-size: 15px;
}

.passphrase-item {
    border-top: 2px solid #e5e7eb;
    padding-top: 16px;
    margin-top: 16px;
}

.passphrase-item label {
    color: #7c3aed;
    font-weight: 700;
}

.passphrase-highlight {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 3px solid #f59e0b;
    border-radius: 16px;
    padding: 24px;
    margin: 24px 0;
}

.passphrase-highlight h3 {
    margin: 0 0 16px 0;
    color: #92400e;
    font-size: 20px;
}

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

.passphrase-display input {
    flex: 1;
    padding: 14px;
    border: 2px solid #f59e0b;
    border-radius: 12px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    font-weight: 600;
    background: white;
    color: #92400e;
}

.passphrase-note {
    margin: 0;
    color: #92400e;
    font-size: 14px;
    font-weight: 600;
}

.setup-uri-section {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border: 3px solid #10b981;
    border-radius: 16px;
    padding: 24px;
    margin: 24px 0;
}

.setup-uri-section h3 {
    margin: 0 0 12px 0;
    color: #065f46;
    font-size: 20px;
}

.setup-uri-section p {
    margin: 0 0 16px 0;
    color: #065f46;
}

.uri-display {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.uri-note {
    margin: 12px 0 0 0 !important;
    color: #047857;
    font-size: 13px;
    font-style: italic;
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(16, 185, 129, 0.3);
}

.setup-instructions {
    margin: 24px 0;
    padding: 20px;
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    border: 2px solid #818cf8;
    border-radius: 16px;
}

.setup-instructions h3 {
    margin: 0 0 16px 0;
    color: #3730a3;
    font-size: 18px;
}

.setup-instructions ol {
    margin: 0;
    padding-left: 24px;
    color: #3730a3;
}

.setup-instructions li {
    margin: 8px 0;
    line-height: 1.6;
}

.setup-instructions strong {
    color: #1e1b4b;
}

/* ============================================
   DARK MODE - COLORED ELEMENT OVERRIDES
   ============================================ */

[data-theme="dark"] .tag {
    background: rgba(102, 126, 234, 0.2);
    color: #a5b4fc;
}

[data-theme="dark"] .tag:hover {
    background: rgba(102, 126, 234, 0.3);
}

[data-theme="dark"] .status-badge.queued {
    background: rgba(245, 158, 11, 0.2);
    color: #fde68a;
}

[data-theme="dark"] .status-badge.processing {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

[data-theme="dark"] .status-badge.completed {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

[data-theme="dark"] .status-badge.failed {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

[data-theme="dark"] .task-result {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.3);
}

[data-theme="dark"] .task-error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] .user-role.role-admin {
    background: rgba(245, 158, 11, 0.2);
    color: #fde68a;
}

[data-theme="dark"] .user-role.role-user {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

[data-theme="dark"] .user-status.active {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

[data-theme="dark"] .user-status.inactive {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

[data-theme="dark"] .btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] .btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

[data-theme="dark"] .btn-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fde68a;
    border-color: rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .btn-warning:hover {
    background: rgba(245, 158, 11, 0.25);
}

[data-theme="dark"] .warning-text {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
    color: #fde68a;
}

[data-theme="dark"] .info-box {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

[data-theme="dark"] .passphrase-highlight {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .passphrase-highlight h3 {
    color: #fde68a;
}

[data-theme="dark"] .passphrase-display input {
    background: var(--input-bg);
    color: #fde68a;
    border-color: rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .passphrase-note {
    color: #fcd34d;
}

[data-theme="dark"] .setup-uri-section {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
}

[data-theme="dark"] .setup-uri-section h3 {
    color: #6ee7b7;
}

[data-theme="dark"] .setup-uri-section p {
    color: #a7f3d0;
}

[data-theme="dark"] .setup-instructions {
    background: rgba(102, 126, 234, 0.1);
    border-color: rgba(102, 126, 234, 0.3);
}

[data-theme="dark"] .setup-instructions h3 {
    color: #a5b4fc;
}

[data-theme="dark"] .setup-instructions ol {
    color: #c7d2fe;
}

[data-theme="dark"] .setup-instructions strong {
    color: #e0e7ff;
}

[data-theme="dark"] .passphrase-item label {
    color: #c4b5fd;
}

/* Theme toggle buttons */
#theme-toggle {
    min-width: 42px;
    text-align: center;
    font-size: 16px;
    padding: 8px 12px;
}

.auth-theme-btn {
    position: absolute;
    top: 24px;
    right: 24px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 16px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s;
}

.auth-theme-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

/* ============================================
   DARK MODE LOGO FIX
   ============================================ */

[data-theme="dark"] header h1 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   GENERIC APP MODAL (replaces alert/confirm/prompt)
   ============================================ */

.modal-sm {
    max-width: 440px;
}

.modal-sm h2 {
    font-size: 20px;
    margin-bottom: 12px;
}

.modal-sm p {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 16px;
}

.modal-success h2 { color: var(--success); }
.modal-error h2 { color: var(--error); }
.modal-warning h2 { color: var(--warning); }
.modal-info h2 { color: var(--primary); }

#app-modal-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--input-border);
    border-radius: 12px;
    font-size: 15px;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 8px;
}

#app-modal-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ============================================
   CUSTOM VAULT DROPDOWN
   ============================================ */

.custom-select {
    position: relative;
    flex: 1;
}

.custom-select-trigger {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--input-border);
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    background: var(--input-bg);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
}

.custom-select-trigger:hover {
    border-color: var(--border-hover);
}

.custom-select-trigger:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.custom-select.open .custom-select-trigger {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.select-arrow {
    font-size: 12px;
    color: var(--text-muted);
    transition: transform 0.3s;
}

.custom-select.open .select-arrow {
    transform: rotate(180deg);
}

.custom-select-options {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 2px solid var(--primary);
    border-top: none;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    max-height: 280px;
    overflow-y: auto;
    z-index: 200;
    box-shadow: var(--shadow-md);
}

.custom-select.open .custom-select-options {
    display: block;
}

.select-option {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    transition: background 0.15s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.select-option:hover {
    background: var(--surface-hover);
}

.select-option.selected {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary);
    font-weight: 600;
}

.select-option .vault-gear {
    opacity: 0;
    cursor: pointer;
    font-size: 16px;
    padding: 2px 6px;
    border-radius: 6px;
    transition: all 0.2s;
}

.select-option:hover .vault-gear {
    opacity: 0.7;
}

.select-option .vault-gear:hover {
    opacity: 1;
    background: var(--surface-alt);
}

.select-option-placeholder {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 15px;
    color: var(--text-muted);
    transition: background 0.15s;
}

.select-option-placeholder:hover {
    background: var(--surface-hover);
}

/* ============================================
   VAULT SETTINGS MODAL
   ============================================ */

#vault-settings-modal .modal-content {
    max-width: 600px;
}

.vault-settings-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--border);
}

.vault-settings-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.vault-settings-section h3 {
    margin: 0 0 16px 0;
}

.settings-form-group {
    margin-bottom: 16px;
}

.settings-form-group label {
    display: block;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-size: 14px;
}

.settings-form-group input[type="text"],
.settings-form-group input[type="number"] {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--input-border);
    border-radius: 10px;
    font-size: 14px;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.settings-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--surface-hover);
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.3s;
}

.settings-toggle:hover {
    background: var(--surface-alt);
}

.settings-toggle input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.similarity-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.similarity-control input[type="range"] {
    flex: 1;
    cursor: pointer;
}

.similarity-control .similarity-value {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}
