/* ============================================================================
   Qontinuity Entrepot - Design System
   Inspired by ernest template - Clean, modern, accessible
   ============================================================================ */

/* --- CSS Variables --- */
:root {
    /* Qontinuity Gold */
    --primary: #B8941F;
    --primary-dark: #9A7A1A;
    --primary-light: #FDF6E3;

    /* Semantic colors */
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --info: #0891b2;
    --info-light: #cffafe;

    /* Neutrals - WCAG AA compliant */
    --black: #18181B;
    --gray-800: #3F3F46;
    --gray-600: #52525B;
    --gray-400: #A1A1AA;
    --gray-200: #E4E4E7;
    --gray-100: #F4F4F5;
    --white: #FFFFFF;

    /* Aliases */
    --text: var(--black);
    --text-muted: var(--gray-600);
    --border: var(--gray-200);
    --bg: var(--gray-100);
    --bg-card: var(--white);

    /* Layout */
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.2s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}
a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Focus visible for accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* --- Header / Navbar --- */
.navbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--primary);
    color: var(--white);
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 700;
}

.nav-title {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--black);
}

.nav-subtitle {
    display: none; /* Hidden in new design */
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-600);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius);
    transition: var(--transition);
}

.nav-link:hover {
    background: var(--gray-100);
    color: var(--black);
    text-decoration: none;
}

.nav-link.active {
    background: var(--primary);
    color: var(--white);
}

.nav-link svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 1.75;
    fill: none;
    flex-shrink: 0;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem 0.25rem 0.25rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--white);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--black);
}

.user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--white);
}

.logout-link {
    font-size: 0.8125rem;
    color: var(--gray-600) !important;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius);
}
.logout-link:hover {
    background: var(--danger-light);
    color: var(--danger) !important;
    text-decoration: none;
}

/* Mobile menu */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
}

.mobile-menu {
    display: none;
    flex-direction: column;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
}
.mobile-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius);
    color: var(--text);
}
.mobile-menu a:hover {
    background: var(--bg);
    text-decoration: none;
}
.mobile-menu hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0.5rem 0;
}
.mobile-user {
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

@media (max-width: 900px) {
    .navbar {
        padding: 0 1rem;
    }
    .nav-links, .nav-user {
        display: none;
    }
    .mobile-menu-btn {
        display: block;
    }
    .mobile-menu.show {
        display: flex;
    }
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
}

@media (max-width: 640px) {
    .main-content {
        padding: 1.5rem 1rem;
    }
}

/* --- Page Header --- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--black);
}

.page-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.page-subtitle {
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-size: 1rem;
}

.breadcrumb {
    font-size: 0.875rem;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}
.breadcrumb:hover {
    color: var(--primary);
}

/* --- Cards --- */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    margin-bottom: 1rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.card-body {
    padding: 1.25rem;
}

.card-body.no-padding {
    padding: 0;
}

.collapsible {
    cursor: pointer;
    transition: var(--transition);
}
.collapsible:hover {
    background: var(--gray-100);
}
.collapse-icon {
    color: var(--gray-400);
    font-size: 0.875rem;
}
.collapsed {
    display: none;
}

/* --- Stats Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stats-grid.stats-small {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1024px) {
    .stats-grid, .stats-grid.stats-small {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--black);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-600);
    margin-top: 0.25rem;
}

.stat-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Colored stat cards - subtle left border accent */
.stat-card.stat-warning {
    border-left: 3px solid var(--warning);
}
.stat-card.stat-success {
    border-left: 3px solid var(--success);
}
.stat-card.stat-info {
    border-left: 3px solid var(--info);
}
.stat-card.stat-error {
    border-left: 3px solid var(--danger);
}

/* Progress Bar */
.progress-bar-container,
.theme-progress,
.stat-progress {
    background: var(--gray-100);
    border-radius: 3px;
    overflow: hidden;
    height: 6px;
}

.progress-bar {
    height: 6px;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* --- Dashboard Grid --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 1rem;
}

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

.dashboard-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* --- Tables --- */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.875rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9375rem;
}

.table th {
    font-weight: 600;
    color: var(--gray-600);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--gray-100);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: var(--gray-100);
}

.clickable-row {
    cursor: pointer;
}

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

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.5;
}

.badge-lg {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

/* Type badges */
.badge-type {
    background: var(--gray-100);
    color: var(--gray-800);
}

.badge-theme {
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* Status badges */
.badge-pending {
    background: var(--gray-100);
    color: var(--gray-600);
}

.badge-processing,
.badge-running {
    background: var(--primary-light);
    color: var(--primary-dark);
    animation: pulse 2s infinite;
}

.badge-processed,
.badge-done,
.badge-completed,
.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-validated {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid var(--success);
}

.badge-error,
.badge-failed {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

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

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--text);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    font-family: inherit;
}

.btn:hover {
    background: var(--gray-100);
    text-decoration: none;
}

.btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: var(--white);
}

.btn-success {
    background: var(--success);
    color: var(--white);
    border-color: var(--success);
}
.btn-success:hover {
    background: #15803d;
    border-color: #15803d;
    color: var(--white);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: var(--danger);
}
.btn-danger:hover {
    background: var(--danger);
    color: var(--white);
}

.btn-ghost {
    border: none;
    background: transparent;
}
.btn-ghost:hover {
    background: var(--gray-100);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-full {
    width: 100%;
    margin-bottom: 0.5rem;
}

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

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
    color: var(--text);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
select,
textarea {
    width: 100%;
    padding: 0.625rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-family: inherit;
    background: var(--white);
    color: var(--text);
    transition: var(--transition);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(184, 148, 31, 0.15);
}

input::placeholder,
textarea::placeholder {
    color: var(--gray-400);
}

/* --- Filters Bar --- */
.filters-bar {
    margin-bottom: 1rem;
}

.filters-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.filters-form select,
.search-input {
    width: auto;
    min-width: 150px;
}

/* --- Flash Messages --- */
.flash-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0.75rem 2rem 0;
}

.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flash-success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid #bbf7d0;
}

.flash-error {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #fecaca;
}

.flash-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    color: inherit;
    opacity: 0.7;
}
.flash-close:hover {
    opacity: 1;
}

/* --- Login --- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--black) 0%, var(--gray-800) 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--primary);
    color: var(--white);
    border-radius: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.9375rem;
}

.login-footer {
    text-align: center;
    margin-top: 2rem;
}

.login-footer p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* --- Upload --- */
.upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

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

.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--white);
}

.dropzone:hover,
.dropzone-active {
    border-color: var(--primary);
    background: var(--primary-light);
}

.dropzone-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    stroke: var(--gray-400);
    stroke-width: 1.5;
    fill: none;
}

.dropzone:hover .dropzone-icon,
.dropzone-active .dropzone-icon {
    stroke: var(--primary);
}

.dropzone-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.dropzone-subtext {
    color: var(--text-muted);
    font-size: 0.9375rem;
}

.upload-help {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 1rem;
}

.url-help {
    margin-top: 1.5rem;
}

.url-help h3 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.url-help ul {
    padding-left: 1.25rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.upload-progress {
    margin-top: 1rem;
}

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

.upload-filename {
    font-size: 0.9375rem;
    font-weight: 500;
}

.upload-status {
    font-size: 0.8125rem;
    font-weight: 500;
}
.upload-status.uploading {
    color: var(--primary);
}
.upload-status.success {
    color: var(--success);
}
.upload-status.error {
    color: var(--danger);
}

.recent-upload-item a {
    display: block;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

/* --- Document Detail --- */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1.5rem;
}

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

.detail-main {
    min-width: 0;
}

.detail-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.meta-item {}

.meta-full {
    grid-column: 1 / -1;
}

.meta-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.url-link {
    word-break: break-all;
    font-size: 0.875rem;
}

.confidence-value {
    font-weight: 700;
    color: var(--primary);
}

.ai-summary,
.ai-keyinfo,
.ai-suggestion {
    margin-bottom: 1.5rem;
}

.ai-summary h3,
.ai-keyinfo h3,
.ai-suggestion h3 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.ai-keyinfo ul {
    list-style: none;
    padding: 0;
}

.ai-keyinfo li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.9375rem;
}

.ai-keyinfo li:last-child {
    border-bottom: none;
}

.markdown-content {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text);
}

.processing-indicator {
    text-align: center;
    padding: 2rem;
}

.error-box {
    background: var(--danger-light);
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 1.5rem;
}

.error-box h3 {
    color: var(--danger);
    margin-bottom: 0.5rem;
}

.raw-text {
    background: var(--gray-100);
    padding: 1rem;
    border-radius: var(--radius);
    font-size: 0.8125rem;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    white-space: pre-wrap;
    max-height: 400px;
    overflow-y: auto;
    color: var(--gray-800);
}

.current-theme {
    font-size: 0.9375rem;
    margin: 0.5rem 0;
}

/* --- Themes --- */
.themes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.theme-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: var(--transition);
    color: var(--text);
    display: block;
}

.theme-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(184, 148, 31, 0.12);
    text-decoration: none;
}

.theme-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.theme-card-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.theme-description {
    font-size: 0.9375rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.theme-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.theme-progress {
    margin-bottom: 0.75rem;
}

.theme-audit {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Theme mini (sidebar) */
.theme-mini {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.theme-mini:last-child {
    border-bottom: none;
}

.theme-mini a {
    font-size: 0.9375rem;
    font-weight: 500;
}

.theme-mini-stats {
    display: flex;
    gap: 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.confidence-mini {
    font-weight: 600;
    color: var(--primary);
}

/* --- KB Entries --- */
.kb-entries {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.kb-entry {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    background: var(--white);
}

.kb-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.kb-entry-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.kb-entry-content {
    font-size: 0.9375rem;
    color: var(--text);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.kb-entry-footer {
    display: flex;
    gap: 1rem;
    font-size: 0.8125rem;
    flex-wrap: wrap;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-100);
}

/* --- Activity Feed --- */
.activity-feed {
    display: flex;
    flex-direction: column;
}

.activity-item {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    transition: var(--transition);
}

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

.activity-item:hover {
    background: var(--gray-100);
    margin: 0 -1.25rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon svg {
    width: 18px;
    height: 18px;
    stroke: var(--gray-600);
    stroke-width: 1.75;
    fill: none;
}

.activity-user {
    font-weight: 600;
    min-width: 60px;
}

.activity-action {
    color: var(--text-muted);
    flex: 1;
}

.activity-time {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

/* --- Modals --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    width: 100%;
    max-width: 480px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.25rem;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text);
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* --- Spinner --- */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state p {
    margin-bottom: 0.75rem;
    font-size: 0.9375rem;
}

.empty-state .btn {
    margin-top: 0.5rem;
}

/* --- Toast --- */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--black);
    color: var(--white);
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 500;
    z-index: 2000;
    animation: slideUp 0.3s ease-out;
}

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

/* --- Pagination --- */
.pagination {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    margin-top: 1.5rem;
}

.pagination-info {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.8125rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border);
}

/* --- Utilities --- */
.text-muted {
    color: var(--text-muted);
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1rem 0;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- Modal --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 480px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.modal-close:hover {
    color: var(--text-secondary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Affichage du mot de passe temporaire */
.temp-password-display {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-light);
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-top: 0.75rem;
}

.temp-password-display code {
    font-size: 1.25rem;
    font-weight: 600;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, monospace;
    color: var(--primary);
    flex: 1;
    letter-spacing: 0.05em;
}

/* Form hint */
.form-hint {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.375rem;
}
