/* @feature WORKSPACE */
/*
 * RepoMine Global Styles
 * Modern GitHub-inspired design with glassmorphism
 * Color Palette: Deep blue-black (#020617), Amber accent (#f59e0b)
 * Theme: dark (default) / light — toggled via <html data-theme="light">
 */

:root {
    /* Accent — same in both themes */
    --accent-amber: #f59e0b;
    --accent-amber-light: #fbbf24;

    /* Status — same in both themes */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;

    /* Dark theme (default) */
    --bg-deep: #020617;
    --bg-secondary: #0f172a;
    --panel-bg: rgba(15, 23, 42, 0.7);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --text-muted: #64748b;
    --border-light: rgba(255, 255, 255, 0.08);
    --border-medium: rgba(255, 255, 255, 0.1);
    --overlay: rgba(0, 0, 0, 0.5);
    --input-bg: rgba(15, 23, 42, 0.8);
    --code-bg: rgba(0, 0, 0, 0.3);
    --scrollbar-thumb: rgba(255, 255, 255, 0.15);
    --scrollbar-track: transparent;
}

/* Light theme overrides */
[data-theme="light"] {
    --bg-deep: #f1f5f9;
    --bg-secondary: #ffffff;
    --panel-bg: rgba(255, 255, 255, 0.85);
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-tertiary: #64748b;
    --text-muted: #94a3b8;
    --border-light: rgba(0, 0, 0, 0.07);
    --border-medium: rgba(0, 0, 0, 0.10);
    --overlay: rgba(0, 0, 0, 0.35);
    --input-bg: rgba(255, 255, 255, 0.9);
    --code-bg: rgba(0, 0, 0, 0.05);
    --scrollbar-thumb: rgba(0, 0, 0, 0.18);
    --scrollbar-track: transparent;
}

/* Reset & Base Styles */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

body {
    font-family: 'Plus Jakarta Sans', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* Glass Morphism Effect */
.glass {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-light);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Container */
.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation Bar */

/* Navigation Bar */
.navbar {
        width: 100%;
        background: rgba(15, 23, 42, 0.8);
        backdrop-filter: blur(12px);
        padding: 16px 0;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
        position: sticky;
        top: 0;
        z-index: 1000;
        border-bottom: 1px solid var(--border-light);
}

.navbar .container {
        display: flex;
        justify-content: space-between;
        align-items: center;
}

/* Fallback for navbars without an inner container (Tailwind layouts) */
.navbar {
        display: flex;
        align-items: center;
        gap: 16px;
        padding-left: 16px;
        padding-right: 16px;
}

.navbar > .global-search-bar {
    flex: 1 1 420px;
    max-width: 520px;
}

.navbar .logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.logo {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--accent-amber-light), var(--accent-amber));
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #0f172a;
    font-weight: 800;
    font-size: 1.4rem;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

.brand-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.brand-name .highlight {
    color: var(--accent-amber);
}

.nav-links {
    display: flex;
    gap: 24px;
    align-items: center;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    padding: 8px 12px;
    border-radius: 8px;
}

.nav-links a:hover {
    color: var(--accent-amber);
    background: rgba(245, 158, 11, 0.1);
}

    /* Global Search Bar */
    .global-search-bar {
        flex: 1 1 420px;
        max-width: 520px;
        min-width: 220px;
        margin: 0 20px;
    }

    .search-input-wrapper {
        position: relative;
        display: flex;
        align-items: center;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--border-light);
        border-radius: 12px;
        padding: 0 12px;
        transition: all 0.3s ease;
    }

    .search-input-wrapper:focus-within {
        border-color: var(--accent-amber);
        background: rgba(255, 255, 255, 0.08);
        box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
    }

    .search-icon {
        color: var(--text-tertiary);
        margin-right: 8px;
        flex-shrink: 0;
    }

    #global-search-input {
        flex: 1;
        background: transparent;
        border: none;
        outline: none;
        color: var(--text-primary);
        font-size: 0.95rem;
        padding: 12px 8px;
        font-family: inherit;
    }

    #global-search-input::placeholder {
        color: var(--text-tertiary);
    }

    .search-filter-btn {
        background: transparent;
        border: none;
        color: var(--text-tertiary);
        cursor: pointer;
        padding: 6px;
        display: flex;
        align-items: center;
        border-radius: 6px;
        transition: all 0.2s ease;
        margin-left: 4px;
    }

    .search-filter-btn:hover {
        background: rgba(245, 158, 11, 0.1);
        color: var(--accent-amber);
    }

    /* Search Results Modal */
    .search-modal {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 2000;
        display: flex;
        align-items: flex-start;
        justify-content: center;
        padding-top: 80px;
    }

    .search-modal.hidden {
        display: none;
    }

    .search-modal-overlay {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.7);
        backdrop-filter: blur(4px);
    }

    .search-modal-content {
        position: relative;
        width: 90%;
        max-width: 900px;
        max-height: 80vh;
        background: var(--bg-secondary);
        border: 1px solid var(--border-medium);
        border-radius: 16px;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .search-modal-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 20px 24px;
        border-bottom: 1px solid var(--border-light);
    }

    .search-modal-header h2 {
        font-size: 1.5rem;
        margin: 0;
    }

    .close-modal-btn {
        background: transparent;
        border: none;
        color: var(--text-secondary);
        font-size: 2rem;
        cursor: pointer;
        padding: 0;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 6px;
        transition: all 0.2s ease;
    }

    .close-modal-btn:hover {
        background: rgba(239, 68, 68, 0.1);
        color: var(--error);
    }

    .search-filters {
        display: flex;
        gap: 16px;
        align-items: center;
        padding: 16px 24px;
        background: rgba(255, 255, 255, 0.02);
        border-bottom: 1px solid var(--border-light);
    }

    .search-filters select {
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--border-light);
        border-radius: 8px;
        padding: 8px 12px;
        color: var(--text-primary);
        font-size: 0.9rem;
        cursor: pointer;
        outline: none;
        font-family: inherit;
    }

    .search-filters select:focus {
        border-color: var(--accent-amber);
    }

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

    .similarity-slider label {
        font-size: 0.9rem;
        color: var(--text-secondary);
        white-space: nowrap;
    }

    .similarity-slider input[type="range"] {
        flex: 1;
        max-width: 200px;
    }

    .search-results-container {
        flex: 1;
        overflow-y: auto;
        padding: 20px 24px;
    }

    #search-results-list {
        display: grid;
        gap: 12px;
    }

    .result-card {
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid var(--border-light);
        border-radius: 12px;
        padding: 16px;
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .result-card:hover {
        background: rgba(255, 255, 255, 0.06);
        border-color: var(--accent-amber);
        transform: translateX(4px);
    }

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

    .entity-badge {
        padding: 4px 10px;
        border-radius: 999px;
        font-size: 0.8rem;
        font-weight: 600;
        border: 1px solid;
    }

    .badge-DEV {
        background: rgba(34, 197, 94, 0.1);
        color: #22c55e;
        border-color: #22c55e;
    }

    .badge-TEST {
        background: rgba(59, 130, 246, 0.1);
        color: #3b82f6;
        border-color: #3b82f6;
    }

    .badge-REQ {
        background: rgba(245, 158, 11, 0.1);
        color: var(--accent-amber);
        border-color: var(--accent-amber);
    }

    .badge-UI {
        background: rgba(168, 85, 247, 0.1);
        color: #a855f7;
        border-color: #a855f7;
    }

    .badge-CONFIG {
        background: rgba(156, 163, 175, 0.1);
        color: #9ca3af;
        border-color: #9ca3af;
    }

    .similarity-score {
        font-weight: 700;
        color: var(--accent-amber);
        font-size: 0.95rem;
    }

    .result-body {
        margin-bottom: 10px;
    }

    .result-file-path {
        font-size: 0.9rem;
        color: var(--text-secondary);
        margin-bottom: 4px;
        font-family: 'Monaco', 'Menlo', monospace;
    }

    .result-project {
        font-size: 0.85rem;
        color: var(--text-tertiary);
        margin-bottom: 8px;
    }

    .result-content {
        font-size: 0.9rem;
        color: var(--text-primary);
        line-height: 1.5;
    }

    .result-content mark {
        background: rgba(245, 158, 11, 0.2);
        color: var(--accent-amber-light);
        padding: 2px 4px;
        border-radius: 3px;
    }

    .similarity-bar {
        height: 6px;
        background: rgba(255, 255, 255, 0.06);
        border-radius: 10px;
        overflow: hidden;
    }

    .similarity-fill {
        height: 100%;
        background: linear-gradient(90deg, var(--accent-amber), var(--accent-amber-light));
        border-radius: 10px;
        transition: width 0.3s ease;
    }

    .search-modal-footer {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 16px 24px;
        border-top: 1px solid var(--border-light);
        background: rgba(255, 255, 255, 0.02);
    }

    #results-count {
        font-size: 0.9rem;
        color: var(--text-secondary);
        font-weight: 600;
    }

    .search-tips {
        font-size: 0.85rem;
        color: var(--text-tertiary);
    }

    .loading-state,
    .empty-state,
    .error-state {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 60px 20px;
        text-align: center;
        color: var(--text-secondary);
    }

    .loading-state.hidden,
    .empty-state.hidden {
        display: none;
    }

    .spinner {
        width: 40px;
        height: 40px;
        border: 3px solid rgba(245, 158, 11, 0.1);
        border-top-color: var(--accent-amber);
        border-radius: 50%;
        animation: spin 0.8s linear infinite;
        margin-bottom: 16px;
    }

    @keyframes spin {
        to { transform: rotate(360deg); }
    }

    .empty-state svg,
    .error-state svg {
        margin-bottom: 16px;
        color: var(--text-tertiary);
    }

    .empty-state p,
    .error-state p {
        font-size: 1.1rem;
        margin-bottom: 8px;
    }

    .empty-state small,
    .error-state small {
        color: var(--text-tertiary);
    }

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

.btn-primary {
    background: var(--accent-amber);
    color: #0f172a;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-amber-light);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(245, 158, 11, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-medium);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-amber);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, var(--accent-amber-light), var(--accent-amber));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Cards */
.card {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border-color: var(--accent-amber);
}

/* Headers */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: 3rem; margin-bottom: 1rem; }
h2 { font-size: 2.25rem; margin-bottom: 0.875rem; }
h3 { font-size: 1.75rem; margin-bottom: 0.75rem; }
h4 { font-size: 1.5rem; margin-bottom: 0.625rem; }

/* Links */
a {
    color: var(--accent-amber);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--accent-amber-light);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.badge-error {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: var(--info);
}

/* Auth Status Badge - Phase 1 Task 1.5 */
.auth-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(12px);
    border: 1px solid transparent;
    text-decoration: none;
}

.auth-status-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.auth-status-badge .icon {
    font-size: 1rem;
}

.auth-status-badge .status-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.auth-status-badge .status-label {
    font-size: 0.7rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-status-badge .status-value {
    font-size: 0.875rem;
    font-weight: 700;
}

/* Auth badge variants */
.auth-status-badge.auth-silent {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.auth-status-badge.auth-silent:hover {
    background: rgba(16, 185, 129, 0.25);
}

.auth-status-badge.auth-oauth {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    color: var(--info);
}

.auth-status-badge.auth-oauth:hover {
    background: rgba(59, 130, 246, 0.25);
}

.auth-status-badge.auth-none {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--error);
}

.auth-status-badge.auth-none:hover {
    background: rgba(239, 68, 68, 0.25);
}

.auth-status-badge.auth-loading {
    background: rgba(156, 163, 175, 0.15);
    border-color: rgba(156, 163, 175, 0.3);
    color: var(--text-secondary);
    cursor: default;
}

/* Auth controls */
.auth-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.auth-btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    background: none;
    color: var(--text-secondary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.auth-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.auth-btn.btn-primary {
    background: linear-gradient(135deg, var(--accent-amber-light), var(--accent-amber));
    color: #0f172a;
}

.auth-btn.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* Footer */
footer {
    width: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    padding: 24px 0;
    text-align: center;
    color: var(--text-tertiary);
    border-top: 1px solid var(--border-light);
    margin-top: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-links {
        gap: 12px;
    }
    
    .nav-links a {
        font-size: 0.85rem;
        padding: 6px 8px;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    
    .container {
        padding: 0 16px;
    }
}
/* Workspace Switcher Styles */
.workspace-switcher-wrapper {
    position: relative;
}

.workspace-switcher-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.workspace-switcher-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-medium);
    transform: translateY(-2px);
}

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

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

.dropdown-arrow {
    transition: transform 0.2s ease;
    font-size: 12px;
}

.workspace-switcher-btn[aria-expanded="true"] .dropdown-arrow {
    transform: rotate(180deg);
}

.workspace-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: #0f172a;
    border: 1px solid var(--border-medium);
    border-radius: 12px;
    min-width: 280px;
    max-width: 320px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.7);
}

.workspace-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.workspace-list {
    max-height: 320px;
    overflow-y: auto;
    padding: 8px 0;
}

.workspace-list::-webkit-scrollbar {
    width: 6px;
}

.workspace-list::-webkit-scrollbar-track {
    background: transparent;
}

.workspace-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.workspace-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.workspace-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    margin: 0 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.workspace-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.workspace-item.active {
    background: rgba(245, 158, 11, 0.1);
    border-left-color: var(--accent-amber);
}

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

.workspace-item-name {
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workspace-item-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.workspace-actions-inline {
    display: flex;
    gap: 4px;
    margin-left: 8px;
}

.workspace-delete-btn {
    padding: 4px 6px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s ease;
    opacity: 0;
}

.workspace-item:hover .workspace-delete-btn {
    opacity: 1;
    color: var(--error);
}

.workspace-delete-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

.workspace-actions {
    border-top: 1px solid var(--border-light);
    padding: 8px 4px;
}

.workspace-action-btn {
    width: 100%;
    padding: 10px 12px;
    margin: 0;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    color: var(--accent-amber);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.workspace-action-btn:hover {
    background: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.5);
    transform: translateY(-2px);
}

.empty-state,
.error-state,
.loading-state {
    padding: 16px 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.error-state {
    color: var(--error);
}

/* ====== MOBILE RESPONSIVE BREAKPOINTS ====== */

/* Tablet Breakpoint (768px) */
@media (max-width: 768px) {
    /* Navbar: keep single row — hamburger handles the links */
    .navbar .container {
        flex-direction: row;
        gap: 0;
    }

    .nav-links {
        gap: 8px;
        flex-wrap: wrap;
    }

    /* Workspace switcher */
    .workspace-switcher-btn {
        padding: 6px 10px;
        font-size: 12px;
        min-width: auto;
    }

    .workspace-dropdown {
        min-width: 240px;
        max-width: 90vw;
    }

    /* Grid layouts */
    .metrics-section #metricsGrid,
    #semanticMetricsGrid,
    #riskSummaryGrid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 15px;
    }

    /* Semantic cards */
    .metric-card,
    .semantic-card,
    .risk-card {
        padding: 12px;
    }

    /* Graphs */
    #graph-container,
    .graph-container {
        height: 350px;
    }

    .graph-controls {
        flex-wrap: wrap;
        gap: 8px;
    }

    .control-group {
        flex: 1 1 auto;
        min-width: 150px;
    }

    /* Search results */
    .search-result-item {
        flex-direction: column;
        gap: 8px;
    }

    .result-meta {
        flex-wrap: wrap;
        gap: 6px;
    }

    /* Tables */
    .table-wrapper {
        overflow-x: auto;
    }

    table {
        font-size: 13px;
    }

    table th, table td {
        padding: 8px 6px;
    }

    /* Modals and overlays */
    .modal, .modal-content {
        width: 90vw;
        max-height: 80vh;
    }

    .entity-detail-card {
        max-width: 100%;
    }

    /* Risk modal */
    .risk-details-modal {
        width: 95vw;
        max-height: 85vh;
    }

    .entity-list-item {
        flex-direction: column;
        gap: 8px;
    }

    /* Traceability links */
    .link-item {
        flex-direction: column;
        gap: 6px;
    }

    /* Typography */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
}

/* Mobile Breakpoint (480px) */
@media (max-width: 480px) {
    /* Core typography */
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.1rem; }

    body {
        font-size: 14px;
    }

    /* Padding/spacing */
    .container {
        padding: 0 12px;
    }

    .page {
        padding: 16px 12px 32px !important;
    }

    /* Navbar */
    .navbar .container {
        gap: 8px;
    }

    .logo-section {
        min-width: fit-content;
    }

    /* Workspace switcher - mobile optimized */
    .workspace-switcher-btn {
        padding: 5px 8px;
        font-size: 11px;
        gap: 4px;
    }

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

    .dropdown-arrow {
        font-size: 10px;
    }

    .workspace-dropdown {
        position: fixed;
        bottom: 16px;
        right: 16px;
        left: 16px;
        top: auto;
        margin-top: 0;
        width: auto;
        max-width: none;
        max-height: 50vh;
        border-radius: 16px;
    }

    .workspace-dropdown.open {
        z-index: 10001;
    }

    .workspace-item-name {
        font-size: 13px;
    }

    .workspace-item-meta {
        font-size: 11px;
    }

    /* Grid layouts - single column on mobile */
    .metrics-section #metricsGrid,
    #semanticMetricsGrid,
    #riskSummaryGrid {
        grid-template-columns: 1fr;
    }

    .dashboard-container {
        gap: 12px;
    }

    /* Cards */
    .metric-card,
    .semantic-card,
    .risk-card,
    .entity-card {
        padding: 10px;
        border-radius: 8px;
    }

    /* Buttons */
    .btn, button {
        padding: 8px 12px;
        font-size: 12px;
        border-radius: 6px;
    }

    .btn-primary {
        min-height: 36px;
    }

    /* Graphs and charts */
    #graph-container,
    .graph-container,
    .traceability-graph {
        height: 250px;
        min-height: 250px;
    }

    .graph-controls {
        flex-direction: column;
        gap: 8px;
    }

    .control-group {
        width: 100%;
    }

    .control-group label {
        font-size: 12px;
    }

    .control-group input,
    .control-group select,
    .control-group button {
        width: 100%;
        font-size: 12px;
    }

    /* Search results */
    .search-result-item {
        padding: 10px;
        gap: 8px;
    }

    .result-title {
        font-size: 14px;
    }

    .result-content {
        font-size: 12px;
    }

    .result-meta {
        font-size: 11px;
    }

    /* Tables - stacked layout on mobile */
    .table-wrapper {
        overflow-x: auto;
    }

    table {
        font-size: 12px;
    }

    table th {
        padding: 8px 4px;
        font-size: 11px;
    }

    table td {
        padding: 6px 4px;
        font-size: 12px;
    }

    /* Hide less important columns on mobile */
    table th:nth-child(4),
    table td:nth-child(4) {
        display: none;
    }

    /* Modals */
    .modal,
    .modal-content {
        position: fixed;
        width: calc(100vw - 24px);
        max-height: 85vh;
        top: 50%;
        left: 12px;
        right: 12px;
        border-radius: 16px;
        transform: translateY(-50%);
        overflow-y: auto;
    }

    .modal-header {
        padding: 12px;
    }

    .modal-body {
        padding: 12px;
    }

    .modal-footer {
        padding: 12px;
    }

    /* Risk modal optimized for mobile */
    .risk-details-modal {
        width: calc(100vw - 24px);
        max-height: 85vh;
        padding: 12px;
    }

    .entity-list-item {
        padding: 10px;
        gap: 6px;
        flex-direction: column;
    }

    .entity-complexity {
        font-size: 12px;
    }

    .entity-file-path {
        font-size: 11px;
        word-break: break-word;
    }

    /* Entity detail view */
    .entity-detail {
        padding: 12px;
    }

    .entity-detail-section {
        padding: 12px;
        margin-bottom: 10px;
    }

    .entity-section-title {
        font-size: 13px;
        padding: 8px 0 6px 0;
    }

    /* Traceability links */
    .link-item {
        padding: 8px;
        gap: 6px;
    }

    .link-entity-type {
        padding: 2px 6px;
        font-size: 10px;
    }

    /* Glassmorphic elements */
    .glass,
    .modal,
    .card {
        backdrop-filter: blur(8px);
    }

    /* Input fields */
    input,
    textarea,
    select {
        padding: 8px 10px;
        font-size: 14px;
        border-radius: 6px;
    }

    input[type="range"] {
        width: 100%;
        height: 20px;
    }

    /* Badges and pills */
    .badge,
    .pill {
        padding: 4px 8px;
        font-size: 11px;
        border-radius: 4px;
    }

    /* Remove hover effects on touch devices - use @media (hover: none) if needed */
    @media (hover: none) {
        .workspace-switcher-btn:hover {
            background: rgba(255, 255, 255, 0.05);
            transform: none;
        }

        .workspace-item:hover {
            background: rgba(255, 255, 255, 0.03);
        }

        .metric-card:hover,
        .semantic-card:hover,
        .risk-card:hover {
            transform: none;
        }
    }

    /* Touch-friendly interactions */
    button, .btn, input, textarea, select {
        min-height: 44px; /* iOS recommended minimum touch target */
        min-width: 44px;
    }

    .workspace-switcher-btn {
        min-height: 40px;
    }

    .btn-small {
        min-height: 36px;
    }

    /* Landscape orientation optimizations */
    @media (max-height: 500px) {
        .modal,
        .modal-content,
        .risk-details-modal {
            max-height: 90vh;
        }

        .dashboard-container {
            gap: 8px;
        }

        .metrics-section,
        .risk-section,
        .semantic-section {
            margin-bottom: 12px;
        }

        h3 {
            margin-bottom: 8px;
        }
    }
}

/* Extra small devices (320px and below) */
@media (max-width: 360px) {
    h1 { font-size: 1.35rem; }
    h2 { font-size: 1.15rem; }
    h3 { font-size: 1rem; }

    body {
        font-size: 13px;
    }

    .container {
        padding: 0 10px;
    }

    .workspace-switcher-btn {
        padding: 4px 6px;
        font-size: 10px;
    }

    .btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    table {
        font-size: 11px;
    }

    table th, table td {
        padding: 4px 3px;
    }
}

/* Touch device specific (iPad, etc.) */
@media (min-width: 769px) and (max-width: 1024px) {
    .metrics-section #metricsGrid,
    #semanticMetricsGrid,
    #riskSummaryGrid {
        grid-template-columns: repeat(2, 1fr);
    }

    .graph-container {
        height: 400px;
    }

    .workspace-dropdown {
        min-width: 260px;
    }
}

/* Large screens optimization */
@media (min-width: 1201px) {
    .metrics-section #metricsGrid,
    #semanticMetricsGrid,
    #riskSummaryGrid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }

    .graph-container {
        height: 500px;
    }
}

/* Print styles */
@media print {
    .navbar,
    .header,
    .graph-controls,
    .action-buttons,
    .workspace-switcher {
        display: none;
    }

    .page {
        padding: 0;
    }

    .metric-card,
    .semantic-card,
    .entity-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    body {
        background: white;
        color: black;
    }
}

/* Auth Modal Component - Phase 1 Task 1.6 */
.auth-modal-container {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    animation: fadeIn 0.3s ease-out;
}

.auth-modal-container.visible {
    display: flex;
}

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

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

.auth-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    cursor: pointer;
}

.auth-modal-content {
    position: relative;
    margin: auto;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

.auth-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.auth-modal-header {
    padding: 32px 32px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
}

.auth-modal-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.auth-modal-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 0;
}

.auth-modal-body {
    padding: 24px 32px;
    overflow-y: auto;
    flex: 1;
}

.auth-modal-footer {
    padding: 16px 32px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.2);
    text-align: center;
}

.footer-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

.footer-text a {
    color: var(--accent-amber);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-text a:hover {
    color: var(--accent-amber-light);
}

/* Auth Methods Section */
.auth-methods-section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 16px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-methods-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.auth-method-card {
    padding: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
}

.auth-method-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.method-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.auth-method-card h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 6px 0;
}

.auth-method-card p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0 0 10px 0;
    line-height: 1.4;
}

.status-indicator {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-indicator.pending {
    background: rgba(156, 163, 175, 0.2);
    color: var(--text-secondary);
}

.status-indicator.success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.status-indicator.error {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

/* Modal Divider */
.modal-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 24px 0;
}

/* OAuth Login Section */
.auth-login-section {
    margin-bottom: 24px;
}

.auth-login-btn {
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: white;
    background: linear-gradient(135deg, var(--accent-amber-light), var(--accent-amber));
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
    margin-bottom: 12px;
}

.auth-login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

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

.auth-login-btn svg {
    width: 20px;
    height: 20px;
}

.oauth-help {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    text-align: center;
    line-height: 1.5;
}

/* PAT Section */
.pat-section {
    margin-top: 16px;
}

.pat-section[open] .expand-icon {
    transform: rotate(180deg);
}

.summary-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    font-weight: 600;
}

.summary-trigger:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.expand-icon {
    transition: transform 0.3s ease;
}

.pat-content {
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: none;
    border-radius: 0 0 10px 10px;
}

.pat-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.pat-input {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    resize: vertical;
    transition: all 0.2s ease;
    margin-bottom: 10px;
    box-sizing: border-box;
}

.pat-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-amber);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.pat-help {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0 0 12px 0;
    line-height: 1.5;
}

.pat-help a {
    color: var(--accent-amber);
    text-decoration: none;
    transition: color 0.2s ease;
}

.pat-help a:hover {
    color: var(--accent-amber-light);
}

.pat-submit-btn {
    width: 100%;
    padding: 10px 16px;
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-radius: 8px;
    color: var(--info);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.pat-submit-btn:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.6);
}

/* Responsive Design */
@media (max-width: 640px) {
    .auth-modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .auth-modal-header {
        padding: 24px 20px 16px;
    }

    .auth-modal-title {
        font-size: 1.5rem;
    }

    .auth-modal-body {
        padding: 16px 20px;
    }

    .auth-modal-footer {
        padding: 12px 20px;
    }

    .auth-methods-grid {
        grid-template-columns: 1fr;
    }

    .auth-login-btn {
        padding: 12px 16px;
        font-size: 0.95rem;
    }
}

/* ====== SHARED COMPONENTS - Phase 6 UI Batch 5 ====== */

/* --- Mermaid Renderer Component --- */
.mermaid-renderer {
    position: relative;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    overflow: hidden;
}

.mermaid-controls {
    display: flex;
    gap: 6px;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
}

.mermaid-btn {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: auto;
    min-width: auto;
}

.mermaid-btn:hover {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-amber);
    border-color: rgba(245, 158, 11, 0.3);
}

.mermaid-diagram {
    padding: 20px;
    overflow: auto;
    min-height: 200px;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mermaid-diagram:active {
    cursor: grabbing;
}

.mermaid-diagram svg {
    transition: transform 0.1s ease;
}

.mermaid-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(2, 6, 23, 0.7);
    z-index: 10;
}

.mermaid-loading.hidden {
    display: none;
}

.mermaid-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-medium);
    border-top-color: var(--accent-amber);
    border-radius: 50%;
    animation: mermaid-spin 0.8s linear infinite;
}

@keyframes mermaid-spin {
    to { transform: rotate(360deg); }
}

.mermaid-empty,
.mermaid-error {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.mermaid-error {
    color: var(--error);
}

.mermaid-flash {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 20px;
    background: rgba(16, 185, 129, 0.9);
    color: #fff;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 20;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.mermaid-flash.hidden {
    opacity: 0;
}

/* --- D3 Force Graph Component --- */
.d3-force-graph {
    position: relative;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    overflow: hidden;
}

.d3-graph-controls {
    display: flex;
    gap: 6px;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
    align-items: center;
}

.d3-graph-btn {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: auto;
    min-width: auto;
}

.d3-graph-btn:hover {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-amber);
    border-color: rgba(245, 158, 11, 0.3);
}

.d3-graph-canvas {
    width: 100%;
    height: 600px;
    cursor: grab;
}

.d3-graph-canvas:active {
    cursor: grabbing;
}

.d3-graph-canvas svg {
    width: 100%;
    height: 100%;
}

.d3-graph-legend {
    position: absolute;
    top: 60px;
    left: 14px;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(10px);
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    pointer-events: none;
    z-index: 5;
}

.d3-legend-title {
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.d3-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.d3-legend-circle {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.d3-graph-tooltip {
    position: absolute;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 10px 14px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 10;
    max-width: 280px;
}

.d3-graph-tooltip.visible {
    opacity: 1;
}

.d3-tooltip-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.d3-tooltip-content {
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.5;
}

.d3-graph-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(2, 6, 23, 0.7);
    z-index: 10;
}

.d3-graph-loading.hidden {
    display: none;
}

.d3-graph-stats {
    display: flex;
    gap: 20px;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--border-light);
    font-size: 0.8rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.d3-stat-item {
    display: flex;
    gap: 6px;
    align-items: center;
}

.d3-stat-value {
    font-weight: 700;
    color: var(--accent-amber);
}

/* --- Product Suite Navigation Sidebar --- */
.product-nav {
    position: fixed;
    left: 0;
    top: 56px;
    bottom: 0;
    width: 220px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border-right: 1px solid var(--border-light);
    z-index: 900;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.product-nav.open {
    transform: translateX(0);
}

.product-nav-header {
    padding: 16px 14px 12px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.product-nav-theme-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-tertiary);
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.product-nav-theme-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}
[data-theme="light"] .product-nav-theme-btn {
    background: rgba(0, 0, 0, 0.05);
    border-color: var(--border-medium);
}
[data-theme="light"] .product-nav-theme-btn:hover {
    background: rgba(0, 0, 0, 0.10);
}

.product-nav-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.product-nav-section {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}

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

.product-nav-label {
    padding: 6px 14px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    cursor: pointer;
}

.product-nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.product-nav-item.active {
    background: rgba(245, 158, 11, 0.08);
    color: var(--accent-amber);
    border-left-color: var(--accent-amber);
}

.product-nav-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.product-nav-badge {
    margin-left: auto;
    padding: 1px 7px;
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent-amber);
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
}

.product-nav-toggle {
    display: none;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    min-height: auto;
    min-width: auto;
}

.product-nav-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Show toggle button in navbar on pages with sidebar */
.has-product-nav .product-nav-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Shift main content when sidebar is open */
.has-product-nav .page-content {
    transition: margin-left 0.3s ease;
}

.has-product-nav .page-content.sidebar-open {
    margin-left: 220px;
}

@media (max-width: 768px) {
    .product-nav {
        width: 260px;
        top: 0;
        z-index: 1100;
    }

    .has-product-nav .page-content.sidebar-open {
        margin-left: 0;
    }

    .product-nav-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1099;
        display: none;
    }

    .product-nav-overlay.visible {
        display: block;
    }
}

/* --- Notification Preferences --- */
.notification-prefs {
    max-width: 800px;
    margin: 0 auto;
}

.notification-channel-card {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    transition: all 0.2s ease;
}

.notification-channel-card:hover {
    border-color: var(--border-medium);
}

.notification-channel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.notification-channel-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notification-channel-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.notification-channel-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.notification-channel-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    transition: 0.3s;
}

.toggle-slider:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent-amber);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
    background: var(--bg-deep);
}

.notification-channel-config {
    padding-top: 14px;
    border-top: 1px solid var(--border-light);
}

.notification-field {
    margin-bottom: 12px;
}

.notification-field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.notification-field input[type="text"],
.notification-field input[type="email"],
.notification-field input[type="url"],
.notification-field input[type="number"],
.notification-field select {
    width: 100%;
    padding: 9px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s ease;
    min-height: auto;
}

.notification-field input:focus,
.notification-field select:focus {
    outline: none;
    border-color: var(--accent-amber);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.notification-priority-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.priority-option {
    padding: 8px;
    text-align: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.priority-option:hover {
    background: rgba(255, 255, 255, 0.08);
}

.priority-option.selected {
    background: rgba(245, 158, 11, 0.15);
    border-color: var(--accent-amber);
    color: var(--accent-amber);
    font-weight: 600;
}

.notification-test-btn {
    padding: 8px 16px;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 6px;
    color: var(--info);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: auto;
    min-width: auto;
}

.notification-test-btn:hover {
    background: rgba(59, 130, 246, 0.25);
}

.notification-save-bar {
    position: sticky;
    bottom: 0;
    padding: 16px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Navbar inline theme toggle button */
.navbar-theme-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    line-height: 1;
}
.navbar-theme-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    color: var(--accent-amber);
}
[data-theme="light"] .navbar-theme-btn {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
    color: var(--text-secondary);
}
[data-theme="light"] .navbar-theme-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* ============================================================
 * Light-mode overrides for components with fixed dark backgrounds
 * ============================================================ */

/* --- Navbar: use light background in light mode --- */
[data-theme="light"] .navbar {
    background: rgba(248, 250, 252, 0.97);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* --- Product nav sidebar: always dark panel, keep text readable --- */
[data-theme="light"] .product-nav {
    background: rgba(15, 23, 42, 0.98);
}
[data-theme="light"] .product-nav-title {
    color: #475569;
}
[data-theme="light"] .product-nav-label {
    color: #64748b;
}
[data-theme="light"] .product-nav-item {
    color: #cbd5e1;
}
[data-theme="light"] .product-nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #f8fafc;
}

/* --- Auth modal: always dark panel, keep text readable --- */
[data-theme="light"] .auth-modal-content {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.98));
}
[data-theme="light"] .auth-modal-title {
    color: #f8fafc;
}
[data-theme="light"] .auth-modal-subtitle,
[data-theme="light"] .auth-modal-close,
[data-theme="light"] .oauth-help,
[data-theme="light"] .footer-text,
[data-theme="light"] .summary-trigger {
    color: #cbd5e1;
}
[data-theme="light"] .auth-modal-content .section-title,
[data-theme="light"] .auth-method-card h4 {
    color: #f8fafc;
}
[data-theme="light"] .auth-method-card p {
    color: #94a3b8;
}
[data-theme="light"] .pat-label {
    color: #f8fafc;
}
[data-theme="light"] .pat-input {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
}

/* ============================================================
 * Light-mode overrides — remaining hardcoded dark surfaces
 * ============================================================ */

/* --- Footer --- */
[data-theme="light"] footer {
    background: rgba(241, 245, 249, 0.97);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

/* --- Glass card shadow --- */
[data-theme="light"] .glass {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.10);
}

/* --- Workspace switcher button --- */
[data-theme="light"] .workspace-switcher-btn {
    background: rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .workspace-switcher-btn:hover {
    background: rgba(0, 0, 0, 0.08);
}

/* --- Workspace dropdown panel --- */
[data-theme="light"] .workspace-dropdown {
    background: #ffffff;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .workspace-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}
[data-theme="light"] .workspace-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}
[data-theme="light"] .workspace-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

/* --- Mermaid renderer --- */
[data-theme="light"] .mermaid-renderer {
    background: rgba(241, 245, 249, 0.85);
}
[data-theme="light"] .mermaid-controls {
    background: rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .mermaid-btn {
    background: rgba(0, 0, 0, 0.05);
}
[data-theme="light"] .mermaid-btn:hover {
    background: rgba(245, 158, 11, 0.12);
}
[data-theme="light"] .mermaid-loading {
    background: rgba(241, 245, 249, 0.85);
}

/* --- D3 force graph --- */
[data-theme="light"] .d3-force-graph {
    background: rgba(0, 0, 0, 0.02);
}
[data-theme="light"] .d3-graph-controls {
    background: rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .d3-graph-btn {
    background: rgba(0, 0, 0, 0.05);
}
[data-theme="light"] .d3-graph-btn:hover {
    background: rgba(245, 158, 11, 0.12);
}
[data-theme="light"] .d3-graph-legend {
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
}
[data-theme="light"] .d3-graph-tooltip {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .d3-graph-loading {
    background: rgba(241, 245, 249, 0.85);
}
[data-theme="light"] .d3-graph-stats {
    background: rgba(0, 0, 0, 0.03);
}

/* --- Product nav toggle (in navbar) --- */
[data-theme="light"] .product-nav-toggle {
    background: rgba(0, 0, 0, 0.05);
}
[data-theme="light"] .product-nav-toggle:hover {
    background: rgba(0, 0, 0, 0.10);
    color: var(--text-primary);
}

/* --- Notification preferences --- */
[data-theme="light"] .notification-save-bar {
    background: rgba(241, 245, 249, 0.97);
}
[data-theme="light"] .notification-channel-icon {
    background: rgba(0, 0, 0, 0.05);
}
[data-theme="light"] .toggle-slider {
    background: rgba(0, 0, 0, 0.15);
}

/* --- Auth modal borders & footer (dark panel, fix subtle chrome) --- */
[data-theme="light"] .auth-modal-header {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}
[data-theme="light"] .auth-modal-footer {
    border-top-color: rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.25);
}
[data-theme="light"] .auth-modal-close:hover {
    background: rgba(255, 255, 255, 0.12);
}

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

/* ============================================================
 * Hamburger / Mobile nav
 * ============================================================ */

/* Mobile controls row (theme btn + hamburger) — hidden on desktop */
.navbar-mobile-controls {
    display: none;
    align-items: center;
    gap: 8px;
}

/* Hamburger button */
.hamburger-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
}
.hamburger-btn span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--accent-amber);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease;
    transform-origin: center;
}
/* Animate to × when open */
.hamburger-btn.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.is-open span:nth-child(2) { opacity: 0; }
.hamburger-btn.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

[data-theme="light"] .hamburger-btn {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    /* Show hamburger row, hide desktop theme btn inside nav-links */
    .navbar-mobile-controls {
        display: flex;
    }
    .nav-links .navbar-theme-btn {
        display: none;
    }

    /* Desktop nav links: hide by default on mobile */
    .nav-links {
        display: none;
        position: fixed;
        top: 65px;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 12px 16px 16px;
        background: rgba(10, 15, 30, 0.98);
        backdrop-filter: blur(16px);
        border-bottom: 1px solid var(--border-light);
        z-index: 1001;
    }

    /* Open state */
    .nav-links.mobile-open {
        display: flex;
    }

    .nav-links a {
        padding: 12px 16px;
        font-size: 1rem;
        border-radius: 8px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }
    .nav-links a:last-of-type {
        border-bottom: none;
    }

    /* Auth controls + workspace switcher stretch full width */
    .nav-links .auth-controls,
    .nav-links #workspace-switcher {
        width: 100%;
    }

    /* Navbar container: keep logo + controls on one line */
    .navbar .container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    /* Keep navbar sticky on mobile — dropdown uses position:fixed so no relative parent needed */
    .navbar {
        position: sticky;
        top: 0;
    }
}

@media (max-width: 768px) {
    [data-theme="light"] .nav-links {
        background: rgba(248, 250, 252, 0.97);
    }
    [data-theme="light"] .nav-links a {
        border-bottom-color: rgba(0, 0, 0, 0.06);
    }
}
