/* ===========================================================
   SEO/GEO Audit — Design System
   =========================================================== */

:root {
    /* Brand */
    --brand-primary: #5b8def;
    --brand-secondary: #9b6dff;
    --brand-gradient: linear-gradient(135deg, #5b8def 0%, #9b6dff 100%);

    /* Light theme palette (default) */
    --bg-app: #f7f8fc;
    --bg-surface: #ffffff;
    --bg-surface-2: #f0f2f7;
    --bg-elevated: #ffffff;
    --bg-overlay: rgba(15, 23, 42, 0.5);

    --border: #e4e7ee;
    --border-strong: #cbd1dd;
    --border-focus: #5b8def;

    --text: #0f172a;
    --text-muted: #5b6478;
    --text-subtle: #8a93a6;
    --text-inverse: #ffffff;

    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;
    --accent-pink: #ec4899;
    --accent-cyan: #06b6d4;

    /* Score colors */
    --score-excellent: #10b981;
    --score-good: #3b82f6;
    --score-improve: #f59e0b;
    --score-critical: #ef4444;
    --score-na: #94a3b8;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
    --shadow-md: 0 2px 4px -1px rgba(15, 23, 42, 0.06), 0 4px 6px -1px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -2px rgba(15, 23, 42, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.10), 0 10px 10px -5px rgba(15, 23, 42, 0.04);

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-pill: 999px;

    /* Spacing */
    --gap-1: 4px;
    --gap-2: 8px;
    --gap-3: 12px;
    --gap-4: 16px;
    --gap-5: 24px;
    --gap-6: 32px;
    --gap-7: 48px;

    /* Layout */
    --sidebar-width: 250px;
    --topbar-height: 64px;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', SFMono-Regular, Menlo, monospace;
}

/* Dark theme */
:root[data-theme="dark"],
:root[data-theme="auto"] {
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root[data-theme="auto"] {
        --bg-app: #0a0d18;
        --bg-surface: #11151f;
        --bg-surface-2: #181d2a;
        --bg-elevated: #1c2231;
        --bg-overlay: rgba(0, 0, 0, 0.7);

        --border: #232a3b;
        --border-strong: #313a51;
        --border-focus: #5b8def;

        --text: #e6e9f0;
        --text-muted: #98a3b8;
        --text-subtle: #6b7589;
        --text-inverse: #0f172a;

        --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
        --shadow-md: 0 2px 4px -1px rgba(0, 0, 0, 0.4), 0 4px 6px -1px rgba(0, 0, 0, 0.3);
        --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
        --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
    }
}

:root[data-theme="dark"] {
    --bg-app: #0a0d18;
    --bg-surface: #11151f;
    --bg-surface-2: #181d2a;
    --bg-elevated: #1c2231;
    --bg-overlay: rgba(0, 0, 0, 0.7);

    --border: #232a3b;
    --border-strong: #313a51;
    --border-focus: #5b8def;

    --text: #e6e9f0;
    --text-muted: #98a3b8;
    --text-subtle: #6b7589;
    --text-inverse: #0f172a;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 2px 4px -1px rgba(0, 0, 0, 0.4), 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
}

/* ===========================================================
   Reset & Base
   =========================================================== */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg-app);
    min-height: 100vh;
}

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

img, svg { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
code, pre { font-family: var(--font-mono); }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--gap-5) 0; }

h1, h2, h3, h4, h5 { margin: 0 0 var(--gap-3); font-weight: 700; line-height: 1.25; color: var(--text); }
h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
p { margin: 0 0 var(--gap-3); }
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.no-margin { margin: 0; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: var(--gap-1); } .mt-2 { margin-top: var(--gap-2); }
.mt-3 { margin-top: var(--gap-3); } .mt-4 { margin-top: var(--gap-4); } .mt-5 { margin-top: var(--gap-5); }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: var(--gap-1); } .mb-2 { margin-bottom: var(--gap-2); }
.mb-3 { margin-bottom: var(--gap-3); } .mb-4 { margin-bottom: var(--gap-4); } .mb-5 { margin-bottom: var(--gap-5); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--gap-1); } .gap-2 { gap: var(--gap-2); } .gap-3 { gap: var(--gap-3); }
.gap-4 { gap: var(--gap-4); } .gap-5 { gap: var(--gap-5); }
.w-full { width: 100%; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

::selection { background: rgba(91, 141, 239, 0.25); color: var(--text); }

/* ===========================================================
   App Shell
   =========================================================== */

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}

.app-sidebar {
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--gap-3);
    padding: 20px 18px;
    border-bottom: 1px solid var(--border);
}
.sidebar-logo { display: flex; }
.sidebar-brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.sidebar-brand-text strong { font-size: 1rem; color: var(--text); }
.sidebar-brand-text span { font-size: 0.7rem; color: var(--text-subtle); text-transform: uppercase; letter-spacing: 0.06em; }

.sidebar-nav { padding: 16px 12px; flex: 1; display: flex; flex-direction: column; gap: 2px; }

.sidebar-section {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-subtle);
    padding: 14px 10px 6px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}
.sidebar-link:hover { background: var(--bg-surface-2); color: var(--text); text-decoration: none; }
.sidebar-link.is-active { background: linear-gradient(135deg, rgba(91,141,239,0.12), rgba(155,109,255,0.12)); color: var(--brand-primary); font-weight: 600; }
.sidebar-link.is-active svg { color: var(--brand-primary); }
.sidebar-link svg { flex-shrink: 0; }

.sidebar-footer {
    padding: 14px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--gap-2);
}
.theme-toggle, .logout-form button {
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: var(--radius-md);
    padding: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.theme-toggle:hover, .logout-form button:hover { background: var(--bg-surface); color: var(--text); border-color: var(--border-strong); }
.logout-form { margin: 0; }

.icon-sun, .icon-moon { display: none; }
:root[data-theme="light"] .icon-moon { display: block; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="auto"] .icon-sun { display: block; }
@media (prefers-color-scheme: light) { :root[data-theme="auto"] .icon-sun { display: none; } :root[data-theme="auto"] .icon-moon { display: block; } }

/* Main */
.app-main { min-width: 0; display: flex; flex-direction: column; }

.app-topbar {
    height: var(--topbar-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--gap-5);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(8px);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: var(--gap-3); }

.sidebar-mobile-toggle {
    display: none;
    background: transparent;
    border: 0;
    padding: 8px;
    color: var(--text);
    border-radius: var(--radius-md);
}

.topbar-search {
    position: relative;
    display: flex;
    align-items: center;
}
.topbar-search svg {
    position: absolute;
    left: 12px;
    color: var(--text-subtle);
}
.topbar-search input {
    background: var(--bg-surface-2);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    padding: 9px 14px 9px 40px;
    width: 320px;
    color: var(--text);
    font-size: 0.875rem;
    outline: none;
    transition: border 0.15s;
}
.topbar-search input:focus { border-color: var(--border-focus); background: var(--bg-surface); }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px 4px 4px;
    border-radius: var(--radius-md);
    background: var(--bg-surface-2);
}
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--brand-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
}
.user-info { display: flex; flex-direction: column; line-height: 1.15; }
.user-info strong { font-size: 0.85rem; }
.user-info span { font-size: 0.7rem; color: var(--text-muted); }

.app-content { padding: var(--gap-5) var(--gap-5) var(--gap-7); flex: 1; }

/* ===========================================================
   Buttons
   =========================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    background: transparent;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.btn-primary { background: var(--brand-gradient); color: white; box-shadow: var(--shadow-md); }
.btn-primary:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }

.btn-secondary { background: var(--bg-surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg-surface); border-color: var(--border-strong); }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-surface-2); color: var(--text); }

.btn-danger { background: var(--accent-red); color: white; }
.btn-danger:hover { background: #dc2626; }

.btn-success { background: var(--accent-green); color: white; }

.btn-sm { padding: 7px 12px; font-size: 0.8rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { padding: 9px; }

.icon-btn {
    background: transparent;
    border: 0;
    padding: 8px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.icon-btn:hover { background: var(--bg-surface-2); color: var(--text); }

.link-btn { background: transparent; border: 0; color: var(--brand-primary); cursor: pointer; padding: 0; font-size: 0.875rem; text-decoration: underline; }

/* ===========================================================
   Forms
   =========================================================== */

.form { display: flex; flex-direction: column; gap: var(--gap-4); }

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

label, .field-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.field-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
input[type="search"],
input[type="date"],
input[type="datetime-local"],
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    line-height: 1.4;
    transition: border 0.15s, box-shadow 0.15s;
}
textarea { min-height: 88px; resize: vertical; }
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(91, 141, 239, 0.18);
}

input::placeholder, textarea::placeholder { color: var(--text-subtle); }

.input-with-icon { position: relative; }
.input-with-icon input { padding-right: 42px; }
.input-with-icon .icon-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }

.totp-input { letter-spacing: 0.6em; font-size: 1.4rem; text-align: center; font-family: var(--font-mono); }

.checkbox, .radio {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.checkbox input, .radio input { width: 16px; height: 16px; accent-color: var(--brand-primary); }

.toggle-switch {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    gap: 8px;
}
.toggle-switch input { display: none; }
.toggle-switch .switch-thumb {
    width: 36px;
    height: 20px;
    background: var(--border-strong);
    border-radius: 12px;
    position: relative;
    transition: background 0.2s;
}
.toggle-switch .switch-thumb::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}
.toggle-switch input:checked + .switch-thumb { background: var(--brand-primary); }
.toggle-switch input:checked + .switch-thumb::after { transform: translateX(16px); }

/* ===========================================================
   Cards
   =========================================================== */

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--gap-5);
}
.card-sm { padding: var(--gap-4); }
.card-lg { padding: var(--gap-6); }
.card-elevated { box-shadow: var(--shadow-md); }
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: var(--gap-4);
    margin-bottom: var(--gap-4);
    border-bottom: 1px solid var(--border);
}
.card-header h2, .card-header h3 { margin: 0; }
.card-actions { display: flex; align-items: center; gap: var(--gap-2); }

.grid { display: grid; gap: var(--gap-5); }
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1100px) { .grid-cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 800px) {
    .grid-cols-2, .grid-cols-3 { grid-template-columns: 1fr; }
    .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 500px) {
    .grid-cols-4 { grid-template-columns: 1fr; }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--gap-5);
    flex-wrap: wrap;
    gap: var(--gap-3);
}
.section-header h1 { margin: 0; }
.section-header .breadcrumb { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 4px; }
.section-header .breadcrumb a { color: var(--text-muted); }

/* ===========================================================
   Tables
   =========================================================== */

.table-wrapper { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--border); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
table.data-table th, table.data-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
table.data-table thead th {
    background: var(--bg-surface-2);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    position: sticky;
    top: 0;
}
table.data-table tbody tr:hover { background: var(--bg-surface-2); }
table.data-table tbody tr:last-child td { border-bottom: 0; }

/* ===========================================================
   Badges & Tags
   =========================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.4;
}
.badge-blue   { background: rgba(59,130,246,0.15);  color: var(--accent-blue); }
.badge-purple { background: rgba(139,92,246,0.15);  color: var(--accent-purple); }
.badge-green  { background: rgba(16,185,129,0.15);  color: var(--accent-green); }
.badge-orange { background: rgba(245,158,11,0.15);  color: var(--accent-orange); }
.badge-red    { background: rgba(239,68,68,0.15);   color: var(--accent-red); }
.badge-gray   { background: rgba(148,163,184,0.18); color: var(--text-muted); }
.badge-cyan   { background: rgba(6,182,212,0.15);   color: var(--accent-cyan); }
.badge-pink   { background: rgba(236,72,153,0.15);  color: var(--accent-pink); }

.priority-critical  { background: rgba(239,68,68,0.15);   color: var(--accent-red); }
.priority-important { background: rgba(245,158,11,0.15);  color: var(--accent-orange); }
.priority-medium    { background: rgba(59,130,246,0.15);  color: var(--accent-blue); }
.priority-optional  { background: rgba(148,163,184,0.18); color: var(--text-muted); }

.status-pass  { background: rgba(16,185,129,0.15);  color: var(--accent-green); }
.status-warn  { background: rgba(245,158,11,0.15);  color: var(--accent-orange); }
.status-fail  { background: rgba(239,68,68,0.15);   color: var(--accent-red); }
.status-na    { background: rgba(148,163,184,0.18); color: var(--text-muted); }
.status-error { background: rgba(236,72,153,0.15); color: var(--accent-pink); }

/* ===========================================================
   Score & Stats
   =========================================================== */

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--gap-5);
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--brand-gradient);
}
.stat-card .stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.stat-card .stat-value { font-size: 2rem; font-weight: 800; color: var(--text); line-height: 1; }
.stat-card .stat-trend { font-size: 0.75rem; color: var(--text-muted); }
.stat-trend.up { color: var(--accent-green); }
.stat-trend.down { color: var(--accent-red); }

.score-ring {
    --score: 0;
    --color: var(--score-na);
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: conic-gradient(var(--color) calc(var(--score) * 1%), var(--bg-surface-2) 0);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}
.score-ring::before {
    content: '';
    position: absolute;
    inset: 8px;
    background: var(--bg-surface);
    border-radius: 50%;
}
.score-ring .score-text {
    position: relative;
    z-index: 1;
    text-align: center;
}
.score-ring .score-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}
.score-ring .score-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }

.score-ring.size-sm { width: 72px; height: 72px; }
.score-ring.size-sm::before { inset: 5px; }
.score-ring.size-sm .score-value { font-size: 1.05rem; }
.score-ring.size-sm .score-label { display: none; }

.level-excellent { --color: var(--score-excellent); color: var(--score-excellent); }
.level-good      { --color: var(--score-good);      color: var(--score-good); }
.level-improve   { --color: var(--score-improve);   color: var(--score-improve); }
.level-critical  { --color: var(--score-critical);  color: var(--score-critical); }
.level-na        { --color: var(--score-na);        color: var(--score-na); }

.module-bar {
    height: 8px;
    background: var(--bg-surface-2);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}
.module-bar > span {
    display: block;
    height: 100%;
    background: var(--brand-gradient);
    border-radius: 4px;
    transition: width 0.4s;
}

/* ===========================================================
   Flash messages
   =========================================================== */

.flash-stack { display: flex; flex-direction: column; gap: var(--gap-2); margin-bottom: var(--gap-4); }
.flash {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid;
    font-size: 0.875rem;
}
.flash-message { flex: 1; }
.flash-close { background: transparent; border: 0; color: inherit; opacity: 0.6; padding: 0 4px; font-size: 1.4rem; line-height: 1; }
.flash-close:hover { opacity: 1; }

.flash-success { background: rgba(16,185,129,0.1);  border-color: rgba(16,185,129,0.3);  color: var(--accent-green); }
.flash-error   { background: rgba(239,68,68,0.1);   border-color: rgba(239,68,68,0.3);   color: var(--accent-red); }
.flash-warning { background: rgba(245,158,11,0.1);  border-color: rgba(245,158,11,0.3);  color: var(--accent-orange); }
.flash-info    { background: rgba(59,130,246,0.1);  border-color: rgba(59,130,246,0.3);  color: var(--accent-blue); }

/* ===========================================================
   Auth
   =========================================================== */

.auth-body {
    background: var(--bg-app);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--gap-5);
}

.auth-container {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    width: 100%;
    max-width: 1080px;
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border);
}

.auth-brand {
    padding: 56px 48px;
    background: linear-gradient(160deg, #5b8def 0%, #9b6dff 100%);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--gap-4);
    position: relative;
    overflow: hidden;
}
.auth-brand::before {
    content: '';
    position: absolute;
    top: -100px;
    right: -100px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 60%);
    border-radius: 50%;
}
.auth-brand::after {
    content: '';
    position: absolute;
    bottom: -150px;
    left: -100px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    border-radius: 50%;
}
.brand-logo { background: rgba(255,255,255,0.2); padding: 14px; border-radius: var(--radius-lg); display: inline-flex; align-self: flex-start; backdrop-filter: blur(8px); }
.auth-brand h1 { color: white; font-size: 2.25rem; margin: 0; letter-spacing: -0.02em; }
.auth-brand p { color: rgba(255,255,255,0.9); font-size: 1rem; margin: 0; max-width: 380px; }
.auth-features { list-style: none; padding: 0; margin: var(--gap-5) 0 0; display: flex; flex-direction: column; gap: 12px; position: relative; z-index: 1; }
.auth-features li { display: flex; align-items: center; gap: 10px; color: rgba(255,255,255,0.95); font-size: 0.9rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-blue { background: #93c5fd; }
.dot-purple { background: #c4b5fd; }
.dot-green { background: #6ee7b7; }
.dot-orange { background: #fcd34d; }

.auth-card-wrapper { padding: 56px 48px; display: flex; flex-direction: column; justify-content: center; }
.auth-card h2 { margin: 0 0 8px; font-size: 1.75rem; }
.auth-subtitle { color: var(--text-muted); margin-bottom: var(--gap-5); font-size: 0.95rem; }
.auth-help { margin-top: var(--gap-5); padding-top: var(--gap-4); border-top: 1px solid var(--border); font-size: 0.85rem; color: var(--text-muted); }
.auth-help code { background: var(--bg-surface-2); padding: 2px 6px; border-radius: 4px; font-size: 0.85em; }

@media (max-width: 760px) {
    .auth-container { grid-template-columns: 1fr; max-width: 480px; }
    .auth-brand { padding: 36px 32px; }
    .auth-card-wrapper { padding: 36px 32px; }
}

/* ===========================================================
   Tabs
   =========================================================== */

.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--gap-5);
    overflow-x: auto;
}
.tab {
    padding: 10px 14px;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    text-decoration: none;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.is-active { color: var(--brand-primary); border-bottom-color: var(--brand-primary); font-weight: 600; }

/* ===========================================================
   Progress
   =========================================================== */

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-surface-2);
    border-radius: 4px;
    overflow: hidden;
}
.progress-bar > span {
    display: block;
    height: 100%;
    background: var(--brand-gradient);
    transition: width 0.4s;
    border-radius: 4px;
}

.progress-large {
    height: 16px;
    border-radius: 8px;
}
.progress-large > span { border-radius: 8px; position: relative; }
.progress-large > span::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: progress-shine 1.6s linear infinite;
}
@keyframes progress-shine { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(91,141,239,0.2);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===========================================================
   Empty states
   =========================================================== */

.empty-state {
    text-align: center;
    padding: var(--gap-7) var(--gap-5);
    color: var(--text-muted);
}
.empty-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--gap-4);
    background: var(--bg-surface-2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-subtle);
}
.empty-state h3 { margin-bottom: 8px; color: var(--text); }
.empty-state p { color: var(--text-muted); max-width: 400px; margin: 0 auto var(--gap-4); }

/* ===========================================================
   Modal
   =========================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--gap-4);
    backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }
.modal {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}
.modal-header {
    padding: var(--gap-4) var(--gap-5);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}
.modal-body { padding: var(--gap-5); }
.modal-footer { padding: var(--gap-4) var(--gap-5); display: flex; gap: var(--gap-2); justify-content: flex-end; border-top: 1px solid var(--border); }

/* ===========================================================
   Code blocks
   =========================================================== */

pre.code {
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    overflow-x: auto;
    line-height: 1.5;
}
code.inline {
    background: var(--bg-surface-2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
    color: var(--brand-primary);
}

/* ===========================================================
   Recommendations / Audit results
   =========================================================== */

.reco-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--gap-4);
    background: var(--bg-surface);
    margin-bottom: var(--gap-3);
}
.reco-card.priority-border-critical  { border-left: 4px solid var(--accent-red); }
.reco-card.priority-border-important { border-left: 4px solid var(--accent-orange); }
.reco-card.priority-border-medium    { border-left: 4px solid var(--accent-blue); }
.reco-card.priority-border-optional  { border-left: 4px solid var(--text-muted); }

.reco-card .reco-header {
    display: flex;
    justify-content: space-between;
    gap: var(--gap-3);
    margin-bottom: var(--gap-2);
    flex-wrap: wrap;
}
.reco-card .reco-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.reco-card .reco-title { font-weight: 600; color: var(--text); margin: 0; }
.reco-card .reco-body p { margin: 0 0 8px; font-size: 0.875rem; color: var(--text-muted); }
.reco-card .reco-body strong { color: var(--text); }

.module-summary {
    display: flex;
    align-items: center;
    gap: var(--gap-4);
    padding: var(--gap-4);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}
.module-summary .module-info { flex: 1; }
.module-summary .module-info h4 { margin-bottom: 4px; }
.module-summary .module-info .module-meta { display: flex; gap: var(--gap-3); font-size: 0.75rem; color: var(--text-muted); }

/* ===========================================================
   Scrollbar
   =========================================================== */

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-subtle); }

/* ===========================================================
   Responsive
   =========================================================== */

@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }
    .app-sidebar {
        position: fixed;
        top: 0;
        left: -260px;
        width: 240px;
        z-index: 100;
        transition: left 0.25s;
    }
    .app-sidebar.is-open { left: 0; }
    .sidebar-mobile-toggle { display: inline-flex; }
    .topbar-search input { width: 180px; }
}

@media (max-width: 640px) {
    .app-content { padding: var(--gap-4); }
    .topbar-search { display: none; }
    .user-info { display: none; }
    .topbar-user { background: transparent; padding: 0; }
    .section-header { flex-direction: column; align-items: flex-start; }
}

/* ===========================================================
   Print (rapports)
   =========================================================== */

@media print {
    body { background: white; color: black; }
    .app-sidebar, .app-topbar, .topbar-right { display: none; }
    .app-content { padding: 0; }
}
