@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
/* ========================================
   Backlink Checker v2 - Styles
   Sober colors: navy, white, gray
   ======================================== */

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #1e3a5f;
    --primary-light: #2d5a8e;
    --primary-dark: #152a45;
    --accent: #3b82f6;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --muted: #9ca3af;
    --muted-light: #f3f4f6;
    --text: #1f2937;
    --text-light: #6b7280;
    --bg: #f8fafc;
    --white: #ffffff;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.06);
    --radius: 8px;
    /* Dark mode extra tokens */
    --hover-row: #f0f4ff;
    --hover-row-error: #fff5f5;
    --hover-sortable: #e2e8f0;
    --hover-accent: #eef2ff;
    --code-bg: #1e293b;
    --code-text: #e2e8f0;
    --hero-gradient: linear-gradient(135deg, #eef2ff, #e0e7ff);
    --login-gradient: linear-gradient(135deg, #0f1f33 0%, #1e3a5f 50%, #2d5a8e 100%);
    --pipeline-track: #f1f5f9;
    --distrib-track: #e5e7eb;
    --distrib-chip-bg: #f3f4f6;
    --badge-purple-bg: #f3e8ff;
    --badge-purple-text: #7c3aed;
    --badge-primary-bg: #dbeafe;
    --badge-info-bg: #e0f2fe;
    --badge-info-text: #0284c7;
    --alert-info-bg: #dbeafe;
    --alert-info-border: #93c5fd;
    --alert-error-border: #fca5a5;
    --alert-success-border: #86efac;
    --alert-warning-border: #fcd34d;
    --step-complete-bg: #f0fdf4;
    --step-progress-bg: #eff6ff;
    --monitor-interval-bg: #eff6ff;
    --monitor-interval-text: #2563eb;
    --step-rapport-bg: #f0f5ff;
    --tooltip-hover-bg: #e2e8f0;
    --df-preset-hover: #f1f5f9;
    --btn-accent-hover: #2563eb;
    --btn-success-hover: #15803d;
    --btn-warning-hover: #b45309;
    --btn-danger-hover: #b91c1c;
}

[data-theme="dark"] {
    --primary: #60a5fa;
    --primary-light: #93c5fd;
    --primary-dark: #3b82f6;
    --accent: #60a5fa;
    --success: #4ade80;
    --success-light: #14532d;
    --warning: #fbbf24;
    --warning-light: #422006;
    --danger: #f87171;
    --danger-light: #450a0a;
    --muted: #6b7280;
    --muted-light: #1e293b;
    --text: #e2e8f0;
    --text-light: #94a3b8;
    --bg: #0f172a;
    --white: #1e293b;
    --border: #334155;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --hover-row: #1e293b;
    --hover-row-error: #2d1b1b;
    --hover-sortable: #334155;
    --hover-accent: #1e293b;
    --code-bg: #0f172a;
    --code-text: #e2e8f0;
    --hero-gradient: linear-gradient(135deg, #1e293b, #1e3a5f);
    --login-gradient: linear-gradient(135deg, #020617 0%, #0f172a 50%, #1e293b 100%);
    --pipeline-track: #334155;
    --distrib-track: #334155;
    --distrib-chip-bg: #1e293b;
    --badge-purple-bg: #2e1065;
    --badge-purple-text: #c4b5fd;
    --badge-primary-bg: #1e3a5f;
    --badge-info-bg: #0c4a6e;
    --badge-info-text: #7dd3fc;
    --alert-info-bg: #1e3a5f;
    --alert-info-border: #3b82f6;
    --alert-error-border: #dc2626;
    --alert-success-border: #16a34a;
    --alert-warning-border: #d97706;
    --step-complete-bg: #14532d;
    --step-progress-bg: #1e3a5f;
    --monitor-interval-bg: #1e3a5f;
    --monitor-interval-text: #93c5fd;
    --step-rapport-bg: #1e3a5f;
    --tooltip-hover-bg: #334155;
    --df-preset-hover: #1e293b;
    --btn-accent-hover: #3b82f6;
    --btn-success-hover: #22c55e;
    --btn-warning-hover: #f59e0b;
    --btn-danger-hover: #ef4444;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    font-size: 14px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Login / Auth pages ─── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--login-gradient);
}

.login-container {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}

.login-header {
    background: var(--primary);
    color: var(--white);
    padding: 40px 32px 32px;
    text-align: center;
}
.login-header h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 4px; }
.login-header p { opacity: 0.8; font-size: 0.9rem; }

.login-form { padding: 32px; }
.login-links { text-align: center; margin-top: 16px; font-size: 0.8125rem; }
.login-links a { margin: 0 8px; }

/* ─── Form elements ─── */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.8125rem;
    margin-bottom: 4px;
    color: var(--text);
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="number"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 0.8125rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--white);
    color: var(--text);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

textarea {
    resize: vertical;
    min-height: 80px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.75rem;
    line-height: 1.5;
}

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 16px;
    border: 1.5px solid transparent;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }

.btn-accent { background: var(--accent); color: var(--white); }
.btn-accent:hover:not(:disabled) { background: var(--btn-accent-hover); }

.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover:not(:disabled) { background: var(--btn-success-hover); }

.btn-warning { background: var(--warning); color: var(--white); }
.btn-warning:hover:not(:disabled) { background: var(--btn-warning-hover); }

.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover:not(:disabled) { background: var(--btn-danger-hover); }

.btn-outline { background: var(--white); color: var(--text); border-color: var(--border); }
.btn-outline:hover:not(:disabled) { background: var(--muted-light); border-color: var(--muted); }

.btn-block { width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 0.75rem; border-radius: 5px; }
.btn-xs { padding: 2px 7px; font-size: 0.65rem; border-radius: 4px; line-height: 1.2; min-width: 24px; }

.btn-credit { display: block; font-size: 0.6875rem; opacity: 0.7; font-weight: 400; margin-top: 1px; }
.btn-action-group { display: inline-flex; align-items: center; gap: 6px; }
.btn-cost { font-weight: 400; opacity: 0.85; }
.btn-remaining { font-size: 0.6875rem; color: var(--text-light); white-space: nowrap; }

/* ─── Alerts ─── */
.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; font-size: 0.8125rem; font-weight: 500; }
.alert-error { background: var(--danger-light); color: var(--danger); border: 1px solid var(--alert-error-border); }
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid var(--alert-success-border); }
.alert-warning { background: var(--warning-light); color: var(--warning); border: 1px solid var(--alert-warning-border); }
.alert-info { background: var(--alert-info-bg); color: var(--primary); border: 1px solid var(--alert-info-border); }

/* ─── Topbar ─── */
.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 0 max(20px, calc(50% - 830px));
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: 52px;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-left h1 { font-size: 1rem; font-weight: 700; color: var(--primary); white-space: nowrap; }

/* Toggle BLC ↔ NLC : segmented control 2 pilules en haut-gauche */
.module-toggle {
    display: inline-flex;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px;
    gap: 2px;
    white-space: nowrap;
}
.module-pill {
    padding: 5px 14px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    border-radius: 999px;
    text-decoration: none;
    line-height: 1.2;
    transition: background 0.15s ease, color 0.15s ease;
}
.module-pill:hover { color: var(--text); background: rgba(0,0,0,0.04); }
.module-pill.active,
.module-pill.active:hover {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.topbar-nav { display: flex; align-items: center; gap: 2px; }
.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 14px 12px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-light);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}
.nav-link:hover { color: var(--primary); text-decoration: none; background: var(--muted-light); }
.nav-link.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.topbar-domain {
    background: var(--primary);
    color: var(--white);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.6875rem;
    font-weight: 600;
}

.topbar-right { display: flex; align-items: center; gap: 8px; }
.user-email { font-size: 0.75rem; color: var(--text-light); }

/* ─── Container ─── */
.container { max-width: 1700px; margin: 0 auto; padding: 20px; }

/* ─── Stats grid ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    text-align: center;
    border-left: 3px solid var(--primary);
}
.stat-card.stat-success { border-left-color: var(--success); }
.stat-card.stat-danger { border-left-color: var(--danger); }
.stat-card.stat-warning { border-left-color: var(--warning); }
.stat-card.stat-muted { border-left-color: var(--muted); }
.stat-card.stat-accent { border-left-color: var(--accent); }

.stat-number { font-size: 1.75rem; font-weight: 800; color: var(--text); line-height: 1; margin-bottom: 2px; }
.stat-label { font-size: 0.6875rem; color: var(--text-light); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

/* ─── Cards ─── */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    overflow: clip;
}
.card-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-header h2 { font-size: 0.875rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 16px; }
.card-footer { padding: 12px 16px; border-top: 1px solid var(--border); background: var(--bg); }

.card-header-toggle { cursor: pointer; user-select: none; }
.card-header-toggle:hover { background: var(--muted-light); }
.toggle-icon { font-size: 1.125rem; font-weight: 700; color: var(--text-light); width: 24px; text-align: center; }

.count-badge {
    background: var(--muted-light);
    color: var(--text-light);
    padding: 1px 8px;
    border-radius: 20px;
    font-size: 0.6875rem;
    font-weight: 700;
}

/* ─── Actions bar ─── */
.actions-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 8px; }
.actions-left, .actions-right { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ─── Progress ─── */
.progress-container {
    background: var(--white);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    border: 2px solid var(--accent);
    display: none;
}
.progress-container.active { display: block; }
.progress-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 0.8125rem; font-weight: 500; }
.progress-bar { background: var(--muted-light); border-radius: 100px; height: 6px; overflow: hidden; }
.progress-fill { background: linear-gradient(90deg, var(--primary), var(--accent)); height: 100%; border-radius: 100px; transition: width 0.3s ease; }

/* ─── Table ─── */
.table-filters {
    display: flex;
    gap: 8px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    align-items: center;
    flex-wrap: wrap;
}
.table-filters .filter-search { flex: 1; min-width: 160px; padding: 5px 10px; font-size: 0.75rem; }
.table-filters .filter-select { width: auto; min-width: 140px; padding: 5px 10px; font-size: 0.75rem; }

.table-responsive { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: 0.75rem; }
.table thead th {
    background: var(--muted-light);
    padding: 8px 10px;
    text-align: left;
    font-weight: 700;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    white-space: nowrap;
    border-bottom: 2px solid var(--border);
}
.table tbody td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr:hover { background: var(--hover-row); }
.table tbody tr.row-error { background: var(--hover-row-error); }
.table tbody tr.row-checking { opacity: 0.5; }

.sortable { cursor: pointer; user-select: none; position: relative; padding-right: 18px !important; }
.sortable:hover { background: var(--hover-sortable) !important; }
.sortable::after { content: '⇅'; position: absolute; right: 3px; top: 50%; transform: translateY(-50%); opacity: 0.25; font-size: 0.5625rem; }
.sortable.sort-asc::after { content: '▲'; opacity: 0.7; }
.sortable.sort-desc::after { content: '▼'; opacity: 0.7; }

.cell-url { max-width: 320px; word-break: break-all; }
.cell-url a { font-weight: 500; font-size: 0.75rem; }
.cell-actions { white-space: nowrap; display: flex; gap: 4px; align-items: center; }

/* ─── Badges ─── */
.badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 20px;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    vertical-align: middle;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-muted { background: var(--muted-light); color: var(--muted); }
.badge-purple { background: var(--badge-purple-bg); color: var(--badge-purple-text); }
.badge-primary { background: var(--badge-primary-bg); color: var(--accent); }
.badge-info { background: var(--badge-info-bg); color: var(--badge-info-text); }

/* ─── Accordion backlink rows ─── */
.bl-summary { cursor: pointer; transition: background 0.15s; }
.bl-summary:hover { background: var(--hover-accent) !important; }
.bl-summary.expanded { background: var(--hover-accent); border-bottom: none !important; }
.bl-summary.expanded td { border-bottom-color: transparent; }

.cell-toggle { width: 30px; text-align: center; padding: 8px 4px !important; vertical-align: middle; }
.chevron { display: inline-block; font-size: 0.625rem; color: var(--text-light); transition: transform 0.2s; line-height: 1; }
.bl-summary.expanded .chevron { transform: rotate(90deg); color: var(--primary); }
.bl-summary .sub-info { font-size: 0.6875rem; color: var(--text-light); margin-top: 2px; }

.bl-detail-row td { padding: 0 !important; border-top: none !important; }
.bl-detail-row:hover { background: transparent !important; }
.bl-detail {
    background: var(--white);
    border-left: 3px solid var(--primary);
    margin: 0 8px 6px;
    border-radius: 0 0 6px 6px;
    padding: 10px 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.bl-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }
.bl-detail-section { background: var(--bg); border-radius: 6px; padding: 8px 10px; }
.bl-detail-section h4 {
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1.5px solid var(--badge-primary-bg);
}

.bl-detail-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    font-size: 0.6875rem;
    border-radius: 4px;
    margin-bottom: 2px;
    transition: background 0.15s;
}
.bl-detail-link:hover { background: var(--hover-accent); }
.bl-detail-link .link-url { flex: 1; word-break: break-all; color: var(--accent); font-weight: 500; }
.bl-detail-link .link-anchor {
    color: var(--text);
    font-weight: 600;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: var(--white);
    padding: 1px 7px;
    border-radius: 4px;
    border: 1px solid var(--border);
    font-size: 0.625rem;
}
.bl-detail-link .link-type { flex-shrink: 0; }

.bl-detail-meta { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 0.6875rem; }
.bl-detail-meta dt { font-weight: 600; color: var(--text-light); white-space: nowrap; }
.bl-detail-meta dd { word-break: break-all; color: var(--text); line-height: 1.4; }

.bl-detail-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    align-items: center;
}
.bl-detail-actions::before {
    content: 'Analyser :';
    font-size: 0.625rem;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-right: 2px;
}

/* ─── SEObserver ─── */
.seobserver-link { display: inline-flex; align-items: center; vertical-align: middle; margin-left: 4px; opacity: 0.5; transition: opacity 0.15s; }
.seobserver-link:hover { opacity: 1; }
.seobserver-icon { width: 14px; height: 14px; vertical-align: middle; }

/* ─── Project cards (dashboard) ─── */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; margin-top: 16px; }
.project-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
    border-top: 3px solid var(--primary);
}
.project-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.project-card-body { padding: 16px; }
.project-card-body h3 { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.project-card-domain { font-size: 0.8125rem; color: var(--accent); font-weight: 500; margin-bottom: 12px; }
.project-card-stats { display: flex; gap: 16px; font-size: 0.75rem; color: var(--text-light); margin-bottom: 12px; }
.project-card-stats strong { color: var(--text); }
.project-card-footer {
    padding: 10px 16px;
    background: var(--bg);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.project-card-owner { font-size: 0.6875rem; color: var(--text-light); }
.project-card-actions { display: flex; gap: 6px; }

.project-archived { opacity: 0.6; border-top-color: var(--muted); }

/* ─── Modal ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.modal-overlay.active { display: flex; }

.modal-content {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1rem; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-light); padding: 0 4px; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border); text-align: right; }

/* ─── Quota bars ─── */
.quota-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.quota-label { width: 80px; font-size: 0.75rem; font-weight: 600; color: var(--text-light); }
.quota-track { flex: 1; background: var(--muted-light); border-radius: 100px; height: 8px; overflow: hidden; }
.quota-fill { height: 100%; border-radius: 100px; transition: width 0.3s ease; }
.quota-fill.green { background: var(--success); }
.quota-fill.orange { background: var(--warning); }
.quota-fill.red { background: var(--danger); }
.quota-value { font-size: 0.6875rem; color: var(--text-light); width: 100px; text-align: right; white-space: nowrap; }

/* ─── Score badges ─── */
.score-badge {
    display: inline-block;
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--white);
    background: var(--muted);
}
.score-badge.score-high { background: var(--success); }
.score-badge.score-mid { background: var(--warning); }
.score-badge.score-low { background: var(--danger); }
.score-badge.score-na { background: var(--border); color: var(--text-light); }

/* ─── Report page ─── */
.report-header {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
    margin-bottom: 24px;
    text-align: center;
    border-top: 4px solid var(--primary);
}
.report-header h1 { font-size: 1.5rem; font-weight: 800; color: var(--text); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.report-header h2 { font-size: 1.1rem; font-weight: 600; color: var(--primary); margin-bottom: 16px; }
.report-meta { text-align: left; font-size: 0.8125rem; color: var(--text-light); line-height: 1.8; max-width: 800px; margin: 0 auto; }
.report-meta strong { color: var(--text); }

.analysis-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.analysis-item { background: var(--bg); border-radius: var(--radius); padding: 12px; font-size: 0.8125rem; }
.analysis-item strong { display: block; margin-bottom: 4px; }
.analysis-item p { color: var(--text-light); font-size: 0.8125rem; line-height: 1.5; margin-top: 6px; }

.report-conclusions { font-size: 0.875rem; line-height: 1.8; }
.report-conclusions p { margin-bottom: 12px; }
.report-conclusions h3 { font-size: 0.9375rem; margin: 16px 0 8px; }
.report-conclusions ul { list-style: disc; padding-left: 24px; margin-bottom: 12px; }
.report-conclusions li { margin-bottom: 4px; }

/* ─── Log detail rows ─── */
.log-detail-row td { padding: 0 !important; border-top: none !important; }
.log-detail { background: var(--bg); border-top: 1px dashed var(--border); padding: 12px 16px; }
.log-detail-section { margin-bottom: 8px; }
.log-detail-section:last-child { margin-bottom: 0; }
.log-detail-section code { background: var(--hover-sortable); padding: 2px 6px; border-radius: 3px; font-size: 0.8rem; word-break: break-all; }
.log-detail-pre {
    background: var(--code-bg);
    color: var(--code-text);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.75rem;
    line-height: 1.5;
    overflow-x: auto;
    max-height: 300px;
    white-space: pre-wrap;
    word-break: break-all;
    margin-top: 4px;
}
.btn-toggle-detail { width: 28px; height: 28px; padding: 0; font-size: 1rem; font-weight: bold; line-height: 28px; }

/* ─── Spinner ─── */
.spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--muted-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Copy textarea ─── */
.copy-textarea {
    width: 100%;
    font-family: var(--font);
    font-size: 0.8125rem;
    line-height: 1.5;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    resize: vertical;
}

/* ─── Text utilities ─── */
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-right { text-align: right; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }

/* ─── Empty state ─── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-light);
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.5; }
.empty-state h3 { font-size: 1.1rem; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 0.875rem; margin-bottom: 16px; }

/* ─── Footer ─── */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-light);
    font-size: 0.75rem;
    border-top: 1px solid var(--border);
    margin-top: 32px;
}

/* ─── Inline edit ─── */
.inline-edit { display: flex; gap: 4px; align-items: center; }
.inline-edit input { width: 80px; padding: 3px 6px; font-size: 0.75rem; }

/* ─── Status dots ─── */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.status-dot.green { background: var(--success); }
.status-dot.orange { background: var(--warning); }
.status-dot.red { background: var(--danger); }
.status-dot.gray { background: var(--muted); }

/* ─── Copy section ─── */
.copy-section { margin: 0; }
.copy-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.copy-header small { font-weight: 600; color: var(--text-light); }

/* ─── Responsive ─── */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
    .analysis-grid { grid-template-columns: 1fr; }
    .project-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .topbar { flex-direction: column; gap: 6px; padding: 8px 12px; min-height: auto; }
    .topbar-left { flex-wrap: wrap; gap: 8px; }
    .topbar-right { width: 100%; justify-content: flex-end; }
    .topbar-icon-links { gap: 4px; justify-content: flex-end; }
    .topbar-icon-link { padding: 4px 8px; font-size: 0.6875rem; }
    .topbar-separator { display: none; }
    .topbar-nav { flex-wrap: wrap; }
    .topbar-breadcrumb { font-size: 0.75rem; }
    .container { padding: 12px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat-card { padding: 12px; }
    .stat-number { font-size: 1.5rem; }
    .actions-bar { flex-direction: column; align-items: stretch; }
    .actions-left, .actions-right { justify-content: stretch; }
    .actions-left .btn, .actions-right .btn { flex: 1; }
    .user-email { display: none; }
    .bl-detail-grid { grid-template-columns: 1fr; }
    .table-filters { flex-direction: column; }
    .modal-content { max-height: 90vh; width: 95vw; }
    .report-subnav { top: 0; }
    .report-subnav a { padding: 8px 10px; font-size: 0.6875rem; }
    .card-header { flex-wrap: wrap; gap: 6px; }
}

@media (max-width: 480px) {
    .login-container { margin: 16px; }
    .topbar-left h1 { font-size: 0.875rem; }
    .topbar-icon-links { flex-wrap: wrap; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
    .stat-card { padding: 8px; }
    .stat-number { font-size: 1.25rem; }
    .stat-label { font-size: 0.625rem; }
    .report-subnav a { padding: 6px 8px; font-size: 0.625rem; }
}

/* ─── Pipeline chart (stacked horizontal bars) ─── */
.pipeline-chart {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 16px 0;
    padding: 16px 20px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.pipeline-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 32px;
}
.pipeline-label {
    width: 120px;
    min-width: 120px;
    text-align: right;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text);
}
.pipeline-bars {
    flex: 1;
    display: flex;
    height: 26px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--pipeline-track);
}
.pipeline-seg {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
    padding: 0 4px;
    transition: width 0.5s ease;
}
.pipeline-seg:first-child { border-radius: 4px 0 0 4px; }
.pipeline-seg:last-child  { border-radius: 0 4px 4px 0; }
.pipeline-seg:only-child  { border-radius: 4px; }
.pipeline-legend {
    font-size: 0.6875rem;
    color: var(--text-light);
    white-space: nowrap;
}
@media (max-width: 768px) {
    .pipeline-label { width: 90px; min-width: 90px; font-size: 0.6875rem; }
    .pipeline-legend { font-size: 0.625rem; }
}
@media (max-width: 480px) {
    .pipeline-chart { padding: 10px 8px; gap: 4px; }
    .pipeline-label { width: 70px; min-width: 70px; font-size: 0.625rem; }
    .pipeline-bars { height: 22px; }
    .pipeline-seg { font-size: 0.5625rem; }
    .pipeline-legend { display: none; }
}

/* ─── Pipeline v2 (vertical cards layout) ─── */
.pipeline-v2 {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.pipeline-v2-row {
    padding: 14px 20px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
}
.pipeline-v2-row:last-child { border-bottom: none; }
.pipeline-v2-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.pipeline-v2-title {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text);
}
.pipeline-v2-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    background: var(--muted-light);
    padding: 2px 8px;
    border-radius: 10px;
}
.pipeline-v2 .pipeline-bars {
    height: 28px;
    margin-bottom: 8px;
}
.pipeline-v2-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
}
.pipeline-v2-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.6875rem;
    color: var(--text-light);
}
.pipeline-v2-chip b { color: var(--text); font-weight: 700; }
.pipeline-v2-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
@media (max-width: 768px) {
    .pipeline-v2-row { padding: 10px 14px; }
    .pipeline-v2-title { font-size: 0.75rem; }
    .pipeline-v2 .pipeline-bars { height: 24px; }
    .pipeline-v2-chip { font-size: 0.625rem; }
}
@media (max-width: 480px) {
    .pipeline-v2-row { padding: 8px 10px; }
    .pipeline-v2 .pipeline-bars { height: 20px; }
    .pipeline-v2-legend { gap: 4px 8px; }
}

/* ─── Dashboard comparison table ─── */
.dash-compare-table th { font-size: 0.6875rem; padding: 8px 6px; white-space: nowrap; }
.dash-compare-table td { padding: 8px 6px; vertical-align: middle; }
.dash-bar {
    display: flex;
    height: 18px;
    border-radius: 3px;
    overflow: hidden;
    background: var(--muted-light);
    margin-bottom: 3px;
}
.dash-seg {
    height: 100%;
    min-width: 2px;
    transition: width 0.3s ease;
}
.dash-legend {
    display: flex;
    gap: 6px;
    font-size: 0.6rem;
    font-weight: 600;
    line-height: 1;
}
.dash-pct {
    display: inline-block;
    font-size: 0.875rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
}
.dash-pct-ok { color: var(--success); background: rgba(22,163,74,0.1); }
.dash-pct-warn { color: var(--warning); background: rgba(234,179,8,0.1); }
.dash-pct-bad { color: var(--danger); background: rgba(220,38,38,0.1); }

@media (max-width: 1024px) {
    .dash-compare-table { font-size: 0.75rem; }
    .dash-bar { height: 14px; }
    .dash-legend { font-size: 0.55rem; }
}
@media (max-width: 768px) {
    .dash-compare-table th, .dash-compare-table td { padding: 6px 4px; }
    .dash-pct { font-size: 0.75rem; }
}

/* ─── Score badge variants (report) ─── */
.score-badge.score-ok { background: var(--success); }
.score-badge.score-ko { background: var(--danger); }

/* ─── Risk bars (report distributions) ─── */
.risk-bars { display: flex; flex-direction: column; gap: 8px; }
.risk-bar-row { display: flex; align-items: center; gap: 12px; }
.risk-label { width: 80px; font-size: 0.8125rem; font-weight: 600; text-align: right; }
.risk-bar-track { flex: 1; background: var(--muted-light); border-radius: 100px; height: 20px; overflow: hidden; }
.risk-bar-fill { height: 100%; border-radius: 100px; transition: width 0.5s ease; min-width: 2px; }
.risk-count { width: 80px; font-size: 0.8125rem; font-weight: 600; color: var(--text-light); }

/* ─── Report table (compact) ─── */
.report-table thead th { font-size: 0.6875rem; padding: 8px 6px; }
.report-table tbody td { padding: 8px 6px; font-size: 0.75rem; }

/* ─── Global hero (report overview) ─── */
.global-hero {
    text-align: center;
    padding: 20px 16px;
    margin-bottom: 20px;
    background: var(--hero-gradient);
    border-radius: var(--radius);
}
.global-hero-number { font-size: 2.5rem; font-weight: 800; color: var(--primary); line-height: 1; }
.global-hero-label { font-size: 0.875rem; color: var(--text-light); font-weight: 600; margin-top: 4px; }

/* ─── Distribution bars (report overview) ─── */
.distrib-grid { display: flex; flex-direction: column; gap: 16px; }
.distrib-item { padding: 0; }
.distrib-title { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text); margin-bottom: 6px; }
.distrib-bar { display: flex; height: 22px; border-radius: 6px; overflow: hidden; background: var(--distrib-track); gap: 1px; }
.distrib-segment { transition: width 0.3s; min-width: 2px; cursor: default; }
.distrib-segment:first-child { border-radius: 6px 0 0 6px; }
.distrib-segment:last-child { border-radius: 0 6px 6px 0; }
.distrib-segment:only-child { border-radius: 6px; }
.distrib-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.distrib-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px 4px 8px; background: var(--distrib-chip-bg); border-radius: 20px; font-size: 0.6875rem; font-weight: 600; color: var(--text-light); white-space: nowrap; }
.distrib-chip b { color: var(--text); font-weight: 700; }
.distrib-dot { display: block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ─── Analysis progress bar (report sections) ─── */
.analysis-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--muted-light);
    border-radius: var(--radius);
    margin-bottom: 16px;
}
.analysis-progress-label { font-size: 0.8125rem; font-weight: 600; color: var(--text); white-space: nowrap; }
.analysis-progress-track { flex: 1; background: var(--distrib-track); border-radius: 100px; height: 8px; overflow: hidden; }
.analysis-progress-fill { height: 100%; border-radius: 100px; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width 0.5s ease; }
.analysis-progress-count { font-size: 0.75rem; font-weight: 600; color: var(--text-light); white-space: nowrap; }

/* ─── Report sub-navigation (sticky tabs) ─── */
.report-subnav {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    position: sticky;
    top: 52px;
    z-index: 50;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    border: 1px solid var(--border);
}
.report-subnav a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}
.report-subnav a:hover { color: var(--primary); background: var(--muted-light); text-decoration: none; }
.report-subnav a.active { color: var(--primary); border-bottom-color: var(--primary); }
.report-subnav .subnav-spacer { flex: 1; }
.report-subnav .subnav-actions { display: flex; align-items: center; gap: 4px; padding: 6px 10px; }

/* ─── Topbar breadcrumb ─── */
.topbar-breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 0.8125rem; }
.topbar-breadcrumb a { color: var(--text-light); font-weight: 500; text-decoration: none; }
.topbar-breadcrumb a:hover { color: var(--primary); text-decoration: none; }
.breadcrumb-sep { color: var(--muted); font-size: 0.75rem; }
.breadcrumb-current { font-weight: 700; color: var(--text); }

/* ─── Topbar icon links (right side utilities) ─── */
.topbar-icon-links { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.topbar-icon-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-light);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.15s;
}
.topbar-icon-link:hover { color: var(--primary); background: var(--muted-light); text-decoration: none; }
.topbar-icon-link.active { color: var(--primary); font-weight: 600; }
.topbar-separator { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }

/* ─── Topbar Dropdowns ─── */
.topbar-dropdown { position: relative; }
.topbar-dropdown-trigger { cursor: pointer; white-space: nowrap; }
.topbar-dropdown-menu {
    display: none; position: absolute; top: calc(100% + 4px); left: 0;
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15); min-width: 160px; z-index: 1000;
    padding: 4px 0;
}
[data-theme="dark"] .topbar-dropdown-menu { background: #1e293b; }
.topbar-dropdown-menu.open { display: block; }
.topbar-dropdown-menu.topbar-dropdown-right { left: auto; right: 0; }
.topbar-dropdown-menu a,
.topbar-dropdown-menu button {
    display: block; padding: 6px 14px; font-size: 0.75rem; color: var(--text);
    text-decoration: none; white-space: nowrap; transition: background 0.1s;
}
.topbar-dropdown-menu a:hover,
.topbar-dropdown-menu button:hover { background: var(--muted-light); color: var(--primary); }

/* ─── Tooltips (CSS-only) ─── */
[data-tooltip] { position: relative; cursor: help; }
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-dark);
    color: var(--white);
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.6875rem;
    font-weight: 500;
    white-space: nowrap;
    max-width: 280px;
    white-space: normal;
    text-align: center;
    line-height: 1.4;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 200;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
[data-tooltip]::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--primary-dark);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 200;
}
[data-tooltip]:hover::after,
[data-tooltip]:hover::before { opacity: 1; }

/* ─── Report section (card-based sections) ─── */
.report-section { scroll-margin-top: 120px; }
.analysis-detail[id^="detail-bl-"] { scroll-margin-top: 120px; }

/* ─── Health score (consultation section) ─── */
.health-score {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--muted-light);
    border-radius: var(--radius);
    margin-bottom: 16px;
}
.health-score-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--white);
    flex-shrink: 0;
}
.health-score-detail { flex: 1; }
.health-score-detail h3 { font-size: 1rem; font-weight: 700; margin-bottom: 2px; }
.health-score-detail p { font-size: 0.8125rem; color: var(--text-light); }

/* ─── Prompt section ─── */
.prompt-box {
    background: var(--code-bg);
    color: var(--code-text);
    padding: 16px;
    border-radius: var(--radius);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.75rem;
    line-height: 1.6;
    max-height: 500px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ─── Monitoring ─── */
.monitor-chart-card {
    padding: 20px;
}
.monitor-chart-card canvas {
    max-height: 260px;
}
.monitor-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.875rem;
    line-height: 1;
    transition: background 0.15s;
    opacity: 0.7;
}
.monitor-toggle:hover { background: var(--muted-light); opacity: 1; }
.monitor-toggle.is-disabled { opacity: 0.3; }
.monitor-interval-badge {
    display: inline-block;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--monitor-interval-bg);
    color: var(--monitor-interval-text);
    white-space: nowrap;
}
.monitor-next-date {
    font-size: 0.6875rem;
    color: var(--text-light);
    white-space: nowrap;
}
.badge-cloaking {
    background: var(--badge-purple-bg);
    color: var(--badge-purple-text);
    font-weight: 700;
}
.cloaking-signals {
    font-size: 0.75rem;
    color: var(--badge-purple-text);
    margin-top: 4px;
}
.cloaking-signals li {
    margin-bottom: 2px;
}

/* ─── Step cards (pipeline actions) ─── */
.step-cards {
    display: flex;
    align-items: flex-start;
    gap: 0;
    margin-bottom: 16px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 12px 16px;
    border: 1px solid var(--border);
}

.step-card {
    flex: 1;
    min-width: 110px;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    position: relative;
    transition: opacity 0.2s;
}

.step-card-dot {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-bottom: 10px;
}

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--white);
    color: var(--step-color, var(--text-light));
    font-size: 0.8125rem;
    font-weight: 800;
    border: 3px solid var(--border);
    position: relative;
    z-index: 2;
    transition: all 0.3s;
    flex-shrink: 0;
}

.step-complete .step-num {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.step-connector {
    position: absolute;
    top: 50%;
    left: calc(50% + 16px);
    right: calc(-50% + 16px);
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    z-index: 1;
    transform: translateY(-50%);
}
.step-connector-done { background: var(--success); }

.step-card-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 0 4px;
}

.step-card-title {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

.step-card-sub {
    font-size: 0.5625rem;
    color: var(--text-light);
    line-height: 1.3;
    margin-bottom: 4px;
}

.step-card-count {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}

.step-card-progress {
    width: 80%;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    margin: 4px 0 2px;
    overflow: hidden;
}
.step-card-progress-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s ease;
}

.step-card-status {
    font-size: 0.625rem;
    color: var(--text-light);
    font-weight: 600;
    min-height: 14px;
}
.step-complete .step-card-status { color: var(--success); }

.step-card-btn {
    margin-top: 4px;
    background: var(--btn-color, var(--primary));
    color: #fff;
    border-color: var(--btn-color, var(--primary));
    font-size: 0.625rem;
    padding: 3px 10px;
    border-radius: 4px;
}
.step-card-btn:hover {
    opacity: 0.85;
}
.step-card-btn:disabled {
    background: var(--muted-light);
    border-color: var(--border);
    color: var(--text-light);
    opacity: 0.6;
}

.step-card.step-in-progress .step-num {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    animation: step-dot-pulse 1.5s ease-in-out infinite;
}
@keyframes step-dot-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(37, 99, 235, 0); }
}

/* Rapport card */
.step-card-rapport {
    flex: 0 0 120px;
    min-width: 120px;
    border-left: 2px solid var(--border);
    margin-left: 8px;
    padding-left: 12px;
}
.step-card-rapport .step-card-dot { margin-bottom: 6px; }
.step-num-rapport {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-size: 1rem;
}
.step-rapport-btn {
    padding: 8px 20px;
    font-size: 0.8125rem;
    font-weight: 700;
    margin-top: 6px;
}
.step-rapport-links {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}
.step-rapport-links .btn {
    font-size: 0.5625rem;
    padding: 2px 8px;
}
.force-refresh-label {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    font-size: 0.5625rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}
.force-refresh-label input[type="checkbox"] {
    width: 12px;
    height: 12px;
    accent-color: var(--danger);
    cursor: pointer;
}

/* ─── Tooltip help (?) icon ─── */
.tooltip-help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--muted-light);
    color: var(--text-light);
    font-size: 0.5625rem;
    font-weight: 700;
    cursor: help;
    flex-shrink: 0;
    position: relative;
    border: 1px solid var(--border);
    line-height: 1;
    transition: background 0.15s;
}

.tooltip-help:hover { background: var(--tooltip-hover-bg); }

.tooltip-help[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    bottom: auto;
    background: var(--primary-dark);
    color: var(--white);
    padding: 6px 10px;
    border-radius: 5px;
    font-size: 0.6875rem;
    font-weight: 500;
    white-space: normal;
    width: max-content;
    max-width: 220px;
    text-align: left;
    line-height: 1.4;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 200;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.tooltip-help[data-tooltip]::before {
    content: '';
    position: absolute;
    left: calc(100% + 4px);
    top: 50%;
    transform: translateY(-50%);
    bottom: auto;
    border: 4px solid transparent;
    border-right-color: var(--primary-dark);
    border-top-color: transparent;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 200;
}

.tooltip-help[data-tooltip]:hover::after,
.tooltip-help[data-tooltip]:hover::before { opacity: 1; }

/* ─── Topbar credits ─── */
.topbar-credits {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-credit {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: var(--muted-light);
    border-radius: 20px;
    font-size: 0.625rem;
    white-space: nowrap;
}

.topbar-credit-label {
    color: var(--text-light);
    font-weight: 600;
}

.topbar-credit-value {
    color: var(--text);
    font-weight: 700;
}

/* ─── Report section warning banner ─── */
.report-section-warning {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--warning-light);
    border: 1px solid var(--alert-warning-border);
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--warning);
}

.report-section-warning .btn { flex-shrink: 0; }

.report-batch-progress {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 12px;
}

.report-batch-progress.active { display: flex; }

.report-batch-progress .progress-bar {
    flex: 1;
    height: 6px;
}

.report-batch-progress .progress-text {
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    color: var(--text);
}

@media (max-width: 768px) {
    .step-cards { flex-wrap: wrap; gap: 8px; padding: 12px 8px; }
    .step-card { min-width: calc(33% - 8px); flex: 1 1 calc(33% - 8px); }
    .step-connector { display: none; }
    .step-card-rapport { border-left: none; border-top: 2px solid var(--border); margin-left: 0; padding-left: 0; padding-top: 8px; flex: 1 1 100%; }
    .topbar-credits { display: none; }
    .progress-container { padding: 10px 16px; }
}

@media (max-width: 480px) {
    .step-cards { flex-wrap: wrap; gap: 6px; padding: 10px 6px; }
    .step-card { min-width: calc(50% - 6px); flex: 1 1 calc(50% - 6px); }
    .step-num { width: 26px; height: 26px; font-size: 0.6875rem; }
    .step-card-count { font-size: 1rem; }
    .step-card-rapport { flex: 1 1 100%; }
}

/* ─── Print ─── */
@media print {
    .no-print, .topbar, .footer, .actions-bar, .table-filters, .cell-actions,
    .modal-overlay, .progress-container, .btn-bulk-ignore, .report-subnav { display: none !important; }
    body { background: white; color: black; font-size: 10pt; }
    .container { max-width: 100%; padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; page-break-inside: avoid; }
    .report-header { box-shadow: none; border: 2px solid var(--primary); }
    .stat-card { box-shadow: none; border: 1px solid #ddd; }
    .bl-detail-row { display: table-row !important; }
    .cell-toggle, .bl-detail-actions { display: none !important; }
    .risk-bar-fill, .score-badge, .distrib-segment, .distrib-dot, .health-score-circle,
    .analysis-progress-fill { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .global-hero { background: #eef2ff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .prompt-box { display: none !important; }
    a { color: black; text-decoration: underline; }
}

/* ─── DataForSEO preset bar ─── */
.df-preset-bar {
    display: flex;
    gap: 0;
    margin-bottom: 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    font-size: 0.75rem;
}
.df-preset-label {
    flex: 1;
    text-align: center;
    padding: 7px 4px;
    cursor: pointer;
    border-right: 1px solid var(--border);
    background: var(--white);
    transition: background 0.15s, color 0.15s;
    user-select: none;
}
.df-preset-label:last-child {
    border-right: none;
}
.df-preset-label:hover:not(.active) {
    background: var(--df-preset-hover);
}
.df-preset-label.active {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}
.df-preset-label input[type="radio"] {
    display: none;
}

/* ─── Live preview loading pulse ─── */
.df-preview-loading {
    animation: df-pulse 1.5s ease-in-out infinite;
}
@keyframes df-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ─── Advanced filter details styling ─── */
#df-advanced-details summary {
    list-style: none;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    padding: 6px 0;
    user-select: none;
}
#df-advanced-details summary::-webkit-details-marker {
    display: none;
}
#df-advanced-details summary::before {
    content: '\25B6';
    display: inline-block;
    margin-right: 6px;
    font-size: 0.625rem;
    transition: transform 0.2s;
}
#df-advanced-details[open] summary::before {
    transform: rotate(90deg);
}

/* ─── Dark mode overrides for inline styles ─── */
[data-theme="dark"] #ai-summary-result {
    background: var(--white) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}
[data-theme="dark"] .pipeline-seg {
    color: #fff !important;
}
[data-theme="dark"] input:disabled,
[data-theme="dark"] select:disabled,
[data-theme="dark"] textarea:disabled {
    background: var(--muted-light) !important;
    color: var(--text-light) !important;
}
[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

/* ── Project Monitoring ── */
.monitor-date-overdue { color: var(--danger); font-weight: 600; }
.alert-filter { transition: background 0.15s, color 0.15s; }
.alert-filter.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ========================================
   Charte Uplix (2026-09-19) : police Poppins, bleu #0169E6, filets #E4E4EE, logo.
   Surcharge en fin de fichier, active sauf <html data-skin="classic"> (Paramètres > Thème).
   Les règles d'origine restent intactes : le thème classique est l'ancien rendu.
   ======================================== */
html:not([data-skin="classic"]):not([data-theme="dark"]) {
    --primary: #0169E6;
    --primary-light: #3D8BF0;
    --primary-dark: #113D8A;
    --accent: #0169E6;
    --success: #00BB52;
    --border: #E4E4EE;
    --bg: #F7F8FB;
    --text: #1A1D29;
    --text-light: #595959;
    --hover-row: #F0F6FF;
    --hover-accent: #EAF2FE;
    --badge-primary-bg: #E1EDFD;
    --alert-info-bg: #EAF2FE;
    --btn-accent-hover: #0154B8;
}
html:not([data-skin="classic"]) body, html:not([data-skin="classic"]) button, html:not([data-skin="classic"]) input, html:not([data-skin="classic"]) select, html:not([data-skin="classic"]) textarea {
    font-family: 'Poppins', -apple-system, 'Segoe UI', Roboto, sans-serif;
}
html:not([data-skin="classic"]) body { font-size: 13.5px; }
html:not([data-skin="classic"]) h1, html:not([data-skin="classic"]) h2, html:not([data-skin="classic"]) h3 { letter-spacing: -0.01em; }

/* Barre du haut : logo + onglets en pastille (comme le hub Uplix) */
html:not([data-skin="classic"]) .topbar-brand {
    display: inline-flex;
    align-items: center;
    padding-right: 14px;
    border-right: 1px solid var(--border);
    text-decoration: none;
}
html:not([data-skin="classic"]) .topbar-brand:hover { text-decoration: none; opacity: .85; }
html:not([data-skin="classic"]) .topbar-brand svg { height: 24px; width: auto; display: block; }
html:not([data-skin="classic"]) .nav-link { border-bottom: 0; border-radius: 8px; margin: 6px 0; padding: 8px 12px; }
html:not([data-skin="classic"]) .nav-link.active { background: #EAF2FE; color: var(--primary); border-bottom: 0; }
html:not([data-skin="classic"])[data-theme="dark"] .nav-link.active { background: rgba(96, 165, 250, .15); }

/* Pages d'authentification : composition « couverture » de la charte
   (carte givrée, pastille logo à cheval sur le bord haut, masses de couleur floutées) */
html:not([data-skin="classic"]) .login-page { position: relative; overflow: hidden; background: #EDEDF2; padding: 56px 16px; }
html:not([data-skin="classic"]) .login-bg i { position: absolute; display: block; border-radius: 50%; filter: blur(56px); opacity: .55; pointer-events: none; }
html:not([data-skin="classic"]) .login-bg i:nth-child(1) { width: 420px; height: 420px; background: #FF5D45; top: -90px; left: -120px; }
html:not([data-skin="classic"]) .login-bg i:nth-child(2) { width: 380px; height: 380px; background: #00BB52; top: 110px; right: 16%; }
html:not([data-skin="classic"]) .login-bg i:nth-child(3) { width: 460px; height: 460px; background: #0169E6; bottom: -150px; right: -110px; }
html:not([data-skin="classic"]) .login-container {
    position: relative;
    overflow: visible;
    max-width: 440px;
    background: rgba(255, 255, 255, .88);
    border-radius: 28px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}
html:not([data-skin="classic"]) .login-header { position: relative; background: transparent; color: #111; padding: 56px 36px 6px; }
html:not([data-skin="classic"]) .login-brand {
    position: absolute; top: 0; left: 50%; transform: translate(-50%, -50%);
    display: inline-flex; background: #fff; border: 1px solid var(--border);
    border-radius: 99px; padding: 12px 26px; box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}
html:not([data-skin="classic"]) .login-brand svg { height: 24px; width: auto; display: block; }
html:not([data-skin="classic"]) .login-header h1 { font-size: 1.6rem; font-weight: 500; line-height: 1.25; color: #111; margin-bottom: 0; }
html:not([data-skin="classic"]) .login-header h1 b { font-weight: 700; }
html:not([data-skin="classic"]) .login-header h1 .lt { font-weight: 300; }
html:not([data-skin="classic"]) .login-header p { opacity: 1; color: #595959; font-size: .88rem; margin-top: 8px; }
html:not([data-skin="classic"]) .login-form { padding: 20px 36px 36px; }
html:not([data-skin="classic"]) .login-baseline {
    position: absolute; left: 0; right: 0; bottom: 16px; margin: 0;
    text-align: center; font-size: .75rem; font-style: italic; color: #9E9E9E;
}
html:not([data-skin="classic"])[data-theme="dark"] .login-page { background: #0b1220; }
html:not([data-skin="classic"])[data-theme="dark"] .login-container { background: rgba(15, 23, 42, .92); }
html:not([data-skin="classic"])[data-theme="dark"] .login-header h1 { color: #f1f5f9; }
html:not([data-skin="classic"])[data-theme="dark"] .login-header p { color: #94a3b8; }

html:not([data-skin="classic"]) .login-header h1 b { display: block; }
html:not([data-skin="classic"]) button.topbar-icon-link { background: var(--white); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
html:not([data-skin="classic"]) button.topbar-icon-link:hover { background: #EAF2FE; border-color: #CADCFC; }

/* Thème classique : masque les éléments ajoutés pour la charte */
html[data-skin="classic"] .topbar-brand,
html[data-skin="classic"] .login-brand,
html[data-skin="classic"] .login-bg,
html[data-skin="classic"] .login-baseline { display: none; }
