/* ============================================================
   LegalGuard Pro — Styles principaux
   Mobile-first, responsive, mode sombre, WCAG 2.1 AA
   ============================================================ */

/* --- Variables CSS --- */
:root {
    --color-primary: #1a365d;
    --color-primary-light: #2b6cb0;
    --color-primary-dark: #0f2440;
    --color-secondary: #e53e3e;
    --color-success: #38a169;
    --color-warning: #d69e2e;
    --color-danger: #e53e3e;
    --color-info: #3182ce;

    --bg-body: #f7fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #1a202c;
    --bg-input: #ffffff;

    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #a0aec0;
    --text-inverse: #ffffff;

    --border-color: #e2e8f0;
    --border-radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-lg: 0 4px 14px rgba(0,0,0,0.1);

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --sidebar-width: 260px;
    --header-height: 64px;
    --transition: 0.2s ease;
}

/* Mode sombre */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-body: #0f1117;
        --bg-card: #1a1d27;
        --bg-sidebar: #0d0f14;
        --bg-input: #252830;
        --text-primary: #e2e8f0;
        --text-secondary: #a0aec0;
        --text-muted: #718096;
        --border-color: #2d3748;
        --shadow: 0 1px 3px rgba(0,0,0,0.4);
        --shadow-lg: 0 4px 14px rgba(0,0,0,0.3);
    }
}

[data-theme="dark"] {
    --bg-body: #0f1117;
    --bg-card: #1a1d27;
    --bg-sidebar: #0d0f14;
    --bg-input: #252830;
    --text-primary: #e2e8f0;
    --text-secondary: #a0aec0;
    --text-muted: #718096;
    --border-color: #2d3748;
    --shadow: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-lg: 0 4px 14px rgba(0,0,0,0.3);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    color: var(--text-primary);
    background: var(--bg-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary-light); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-primary); }
a:focus-visible { outline: 2px solid var(--color-primary-light); outline-offset: 2px; border-radius: 2px; }

img { max-width: 100%; height: auto; }

/* --- Typographie --- */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
    margin-bottom: 0.5em;
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

/* --- Layout Admin --- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-inverse);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    background: var(--color-primary-light);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}

.sidebar-brand { font-size: 1.1rem; font-weight: 600; }

.sidebar-nav { padding: 1rem 0; }

.nav-section {
    padding: 0.5rem 1.25rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.4);
    margin-top: 0.75rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
    transition: all var(--transition);
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.nav-link.active {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-left-color: var(--color-primary-light);
}

.nav-link .nav-icon { width: 20px; text-align: center; opacity: 0.8; }
.nav-link .badge {
    margin-left: auto;
    background: var(--color-danger);
    color: #fff;
    font-size: 0.7rem;
    padding: 0.1rem 0.45rem;
    border-radius: 10px;
    font-weight: 600;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

/* Header */
.top-header {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left { display: flex; align-items: center; gap: 1rem; }
.header-right { display: flex; align-items: center; gap: 1rem; }

.search-box {
    position: relative;
    width: 300px;
}

.search-box input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.25rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.search-box::before {
    content: "\1F50D";
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
}

.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--text-primary);
}

/* Content */
.page-content { padding: 1.5rem; flex: 1; }

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

.page-header h1 { margin-bottom: 0; }
.breadcrumb { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1rem; }
.breadcrumb a { color: var(--text-secondary); }

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

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

.card-body { padding: 1.25rem; }
.card-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-body);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* --- Tables --- */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

thead th {
    background: var(--bg-body);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

tbody tr:hover { background: rgba(0,0,0,0.02); }
[data-theme="dark"] tbody tr:hover { background: rgba(255,255,255,0.02); }

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

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

.form-control {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: var(--font-sans);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 3px rgba(43,108,176,0.15);
}

.form-control.is-invalid { border-color: var(--color-danger); }
.form-text { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }
.form-error { font-size: 0.8rem; color: var(--color-danger); margin-top: 0.25rem; }

select.form-control { appearance: none; padding-right: 2rem; }
textarea.form-control { resize: vertical; min-height: 100px; }

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

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.15rem;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: var(--font-sans);
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn:focus-visible { outline: 2px solid var(--color-primary-light); outline-offset: 2px; }

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

.btn-success { background: var(--color-success); color: #fff; }
.btn-success:hover { background: #2f855a; color: #fff; }

.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #c53030; color: #fff; }

.btn-warning { background: var(--color-warning); color: #fff; }

.btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
}
.btn-outline:hover { background: var(--bg-body); color: var(--text-primary); }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }

.btn-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* --- Badges & Status --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-ouvert, .badge-nouveau { background: #ebf8ff; color: #2b6cb0; }
.badge-en_cours, .badge-envoye { background: #fefcbf; color: #975a16; }
.badge-en_attente, .badge-brouillon { background: #feebc8; color: #c05621; }
.badge-resolu, .badge-signe, .badge-cloture { background: #c6f6d5; color: #276749; }
.badge-archive, .badge-expire { background: #e2e8f0; color: #4a5568; }
.badge-urgente { background: #fed7d7; color: #c53030; }
.badge-haute { background: #fefcbf; color: #975a16; }

[data-theme="dark"] .badge-ouvert, [data-theme="dark"] .badge-nouveau { background: #1a365d; color: #90cdf4; }
[data-theme="dark"] .badge-en_cours, [data-theme="dark"] .badge-envoye { background: #5a4a1a; color: #fefcbf; }
[data-theme="dark"] .badge-resolu, [data-theme="dark"] .badge-signe { background: #1a4731; color: #9ae6b4; }

/* --- Score jauge --- */
.strength-meter {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.strength-meter-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.strength-low { background: var(--color-danger); }
.strength-medium { background: var(--color-warning); }
.strength-high { background: var(--color-success); }

/* --- Timeline --- */
.timeline { position: relative; padding-left: 2rem; }
.timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.65rem;
    top: 0.35rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-primary-light);
    border: 2px solid var(--bg-card);
}

.timeline-date { font-size: 0.8rem; color: var(--text-muted); }
.timeline-content { font-size: 0.9rem; margin-top: 0.15rem; }

/* --- Messages / Chat --- */
.chat-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 500px;
    overflow-y: auto;
    padding: 1rem;
}

.chat-message {
    max-width: 75%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.chat-message.sent {
    align-self: flex-end;
    background: var(--color-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-message.received {
    align-self: flex-start;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

.chat-meta { font-size: 0.75rem; opacity: 0.7; margin-top: 0.25rem; }

.chat-form {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.chat-form textarea {
    flex: 1;
    resize: none;
    min-height: 44px;
    max-height: 120px;
}

/* --- Alerts --- */
.alert {
    padding: 0.85rem 1.15rem;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    border-left: 4px solid;
}

.alert-success { background: #c6f6d5; color: #276749; border-color: #38a169; }
.alert-danger { background: #fed7d7; color: #9b2c2c; border-color: #e53e3e; }
.alert-warning { background: #fefcbf; color: #975a16; border-color: #d69e2e; }
.alert-info { background: #bee3f8; color: #2a4365; border-color: #3182ce; }

[data-theme="dark"] .alert-success { background: #1a4731; color: #9ae6b4; }
[data-theme="dark"] .alert-danger { background: #4a1a1a; color: #feb2b2; }

/* --- Pagination --- */
.pagination {
    display: flex;
    gap: 0.25rem;
    list-style: none;
    margin-top: 1.5rem;
    justify-content: center;
}

.pagination a, .pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.pagination a:hover { background: var(--bg-body); color: var(--text-primary); }
.pagination .active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

/* --- Modal / Overlay --- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

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

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

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

/* --- Tabs --- */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    gap: 0;
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

.tab {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: var(--font-sans);
}

.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* --- Filters --- */
.filters {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    align-items: end;
}

.filters .form-group { margin-bottom: 0; }
.filters .form-control { min-width: 150px; }

/* --- File Upload --- */
.file-upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--bg-body);
}

.file-upload-zone:hover, .file-upload-zone.dragover {
    border-color: var(--color-primary-light);
    background: rgba(43,108,176,0.05);
}

.file-upload-zone input[type="file"] { display: none; }

/* --- Signature Canvas --- */
.signature-pad {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: crosshair;
    touch-action: none;
    background: #fff;
}

/* --- Public site --- */
.public-layout { min-height: 100vh; display: flex; flex-direction: column; }

.public-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 50;
}

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

.public-nav { display: flex; gap: 1.5rem; align-items: center; }
.public-nav a {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color var(--transition);
}
.public-nav a:hover { color: var(--color-primary); }

.public-footer {
    background: var(--color-primary-dark);
    color: rgba(255,255,255,0.8);
    padding: 3rem 0 1.5rem;
    margin-top: auto;
}

.public-footer a { color: rgba(255,255,255,0.7); }
.public-footer a:hover { color: #fff; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

/* Hero */
.hero {
    background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary-light));
    color: #fff;
    padding: 4rem 0;
    text-align: center;
}

.hero h1 { font-size: 2.5rem; margin-bottom: 1rem; color: #fff; }
.hero p { font-size: 1.15rem; opacity: 0.9; max-width: 600px; margin: 0 auto 2rem; }

/* Features */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 3rem 0;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.75rem;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
}

.feature-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.feature-icon { font-size: 2.5rem; margin-bottom: 1rem; }

/* Steps */
.steps {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    margin: 3rem 0;
}

.step {
    flex: 1;
    min-width: 180px;
    max-width: 220px;
    text-align: center;
    position: relative;
}

.step-number {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    margin: 0 auto 0.75rem;
}

/* FAQ Accordion */
.faq-item { border-bottom: 1px solid var(--border-color); }

.faq-question {
    padding: 1rem 0;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    font-size: 1rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
}

.faq-question::after { content: '+'; font-size: 1.25rem; transition: transform var(--transition); }
.faq-question.open::after { transform: rotate(45deg); }

.faq-answer {
    padding: 0 0 1rem;
    color: var(--text-secondary);
    display: none;
    line-height: 1.7;
}

.faq-answer.open { display: block; }

/* Auth layout */
.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary));
    padding: 1.5rem;
}

.auth-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 0.25rem;
    font-size: 1.5rem;
}

.auth-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

/* --- Utility --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.font-mono { font-family: var(--font-mono); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.gap-1 { gap: 0.5rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
.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; }
.d-none-mobile { display: inline; }

/* --- Notifications dropdown --- */
.notif-wrapper #notifToggle { position: relative; }
.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--color-danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid var(--bg-card);
}

.notif-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    max-width: 90vw;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    overflow: hidden;
}

.notif-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-body);
}

.notif-list {
    max-height: 400px;
    overflow-y: auto;
}

.notif-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
    cursor: pointer;
    transition: background var(--transition);
}

.notif-item:hover { background: var(--bg-body); }
.notif-item.unread { background: rgba(43,108,176,0.05); border-left: 3px solid var(--color-primary-light); }

.notif-item-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.15rem;
    color: var(--text-primary);
}

.notif-item-msg { font-size: 0.8rem; color: var(--text-secondary); }
.notif-item-date { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.15rem; }

.notif-footer {
    padding: 0.5rem 1rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    background: var(--bg-body);
}

.notif-footer a { font-size: 0.85rem; color: var(--color-primary-light); }

/* --- Toast notifications --- */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 360px;
}

.toast {
    background: var(--bg-card);
    border-left: 4px solid var(--color-info);
    border-radius: 6px;
    padding: 0.85rem 1.15rem;
    box-shadow: var(--shadow-lg);
    font-size: 0.9rem;
    animation: toast-in 0.25s ease-out;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toast-success { border-left-color: var(--color-success); }
.toast-error { border-left-color: var(--color-danger); }
.toast-warning { border-left-color: var(--color-warning); }

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0;
    margin-left: auto;
}

@keyframes toast-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.removing {
    animation: toast-out 0.25s ease-in forwards;
}

@keyframes toast-out {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* --- Loading spinner --- */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-primary .spinner { border-color: rgba(255,255,255,0.3); border-top-color: #fff; }
.btn-outline .spinner { border-color: rgba(0,0,0,0.1); border-top-color: var(--text-primary); }

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

.btn:disabled, .btn.loading {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

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

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .hamburger { display: block; }
    .search-box { width: 100%; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
    .filters { flex-direction: column; }
    .hero h1 { font-size: 1.75rem; }
    .hero { padding: 2.5rem 0; }
    .steps { flex-direction: column; align-items: center; }
    .chat-message { max-width: 90%; }
    .public-nav { display: none; }
    .public-nav.open { display: flex; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0; background: var(--bg-card); padding: 1rem; border-bottom: 1px solid var(--border-color); }
    .tabs { gap: 0; }
    .tab { padding: 0.5rem 0.75rem; font-size: 0.8rem; }
    .table-responsive { font-size: 0.8rem; }
    .d-none-mobile { display: none; }
    .notif-dropdown { width: calc(100vw - 40px); right: -100px; }
}

@media (max-width: 360px) {
    .stats-grid { grid-template-columns: 1fr; }
    .auth-card { padding: 1.5rem; }
}

@media (min-width: 1440px) {
    .container { max-width: 1320px; }
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

.sidebar-overlay.active { display: block; }

/* Print */
@media print {
    .sidebar, .top-header, .hamburger, .btn, .filters, .pagination { display: none !important; }
    .main-content { margin-left: 0; }
    .card { box-shadow: none; border: 1px solid #ccc; }
}
