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

:root {
    --bg:        #ffffff;
    --bg2:       #f7f8fb;
    --bg3:       #eef1f6;
    --border:    #e4e7ec;
    --border2:   #d1d5db;
    --text:      #343F5A;
    --text2:     #667085;
    --text3:     #98a2b3;
    --blue:      #3D73FF;
    --radius:    8px;
    --radius-lg: 12px;
    --modal-bg:  #ffffff;
    --shadow:    0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.05);
}

html[data-theme="dark"] {
    --bg:        #0d0d0d;
    --bg2:       #141414;
    --bg3:       #1a1a1a;
    --border:    #242424;
    --border2:   #2e2e2e;
    --text:      #e2e2e2;
    --text2:     #888;
    --text3:     #555;
    --blue:      #60a5fa;
    --modal-bg:  #181818;
    --shadow:    none;
}

body {
    font-family: 'Red Hat Display', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    padding: 2rem 2rem 5rem;
    min-height: 100vh;
    transition: background .2s, color .2s;
}

.header { margin-bottom: 0.75rem; }
.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    margin-bottom: 0;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.header h1 { font-size: 18px; font-weight: 600; font-family: 'Poppins', sans-serif; color: #4F80FF; }
html[data-theme="dark"] .header h1 { color: var(--text); }
.header .sub { font-size: 13px; color: var(--text2); margin-top: 3px; }

.btn-back,
.btn-theme {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text2);
    text-decoration: none;
    background: var(--bg3);
    border: 0.5px solid var(--border2);
    border-radius: var(--radius);
    padding: 6px 12px;
    white-space: nowrap;
    cursor: pointer;
    font-family: inherit;
    transition: color .15s, border-color .15s, background .15s;
}
.btn-back:hover,
.btn-theme:hover { color: var(--text); border-color: var(--text3); }

.btn-theme { padding: 6px 10px; }

.theme-icon-sun  { display: none !important; }
.theme-icon-moon { display: inline-block !important; }
html[data-theme="dark"] .theme-icon-sun  { display: inline-block !important; }
html[data-theme="dark"] .theme-icon-moon { display: none !important; }

.controls-sticky {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg);
    padding: 10px 2rem;
    margin: 0 -2rem 1rem;
    border-bottom: 0.5px solid var(--border);
    transition: background .2s;
}
.controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: var(--bg);
    border-top: 0.5px solid var(--border);
    padding: 10px 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    transition: background .2s;
}
.footer-left {
    font-size: 12px;
    color: var(--text3);
}
.footer-right {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text3);
}
.footer-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #4ade80;
    animation: pulse 2s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .3; }
}
.footer-left a,
.footer-right a {
    color: var(--blue);
    text-decoration: none;
}
.footer-left a:hover,
.footer-right a:hover { text-decoration: underline; }

.controls input,
.controls select {
    background: var(--bg3);
    border: 0.5px solid var(--border2);
    border-radius: var(--radius);
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text);
    font-family: inherit;
    outline: none;
    transition: border-color .15s;
}
.controls input { flex: 1; min-width: 180px; }
.controls input::placeholder { color: var(--text3); }
.controls input:focus,
.controls select:focus { border-color: var(--text3); }
.controls select { cursor: pointer; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }

thead th {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text3);
    padding: 8px 12px;
    text-align: left;
    border-bottom: 0.5px solid var(--border);
}
thead th.sortable {
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
}
thead th.sortable:hover { color: var(--text2); }
thead th .sort-icon {
    display: inline-block;
    margin-left: 4px;
    opacity: .3;
    font-style: normal;
    font-size: 10px;
    transition: opacity .1s;
}
thead th.sort-asc  .sort-icon,
thead th.sort-desc .sort-icon { opacity: 1; color: var(--text); }

tbody tr {
    border-bottom: 0.5px solid var(--border);
    cursor: pointer;
    transition: background .1s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg2); }

tbody td {
    padding: 12px;
    font-size: 13px;
    vertical-align: middle;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 20px;
    white-space: nowrap;
}
.badge::before {
    content: '';
    width: 5px; height: 5px;
    border-radius: 50%;
    background: currentColor;
    opacity: .7;
    flex-shrink: 0;
}

.badge-confirmee  { background: #dcfce7; color: #15803d; }
.badge-credible   { background: #ffedd5; color: #c2410c; }
.badge-peu_fiable { background: #fee2e2; color: #b91c1c; }

html[data-theme="dark"] .badge-confirmee  { background: #16a34a22; color: #4ade80; }
html[data-theme="dark"] .badge-credible   { background: #d9770633; color: #fb923c; }
html[data-theme="dark"] .badge-peu_fiable { background: #dc262633; color: #f87171; }

.type-pill {
    font-size: 11px;
    color: var(--text2);
    background: var(--bg3);
    border: 0.5px solid var(--border);
    border-radius: 4px;
    padding: 2px 6px;
}

.muted { color: var(--text3); font-size: 12px; }

.empty {
    text-align: center;
    padding: 2.5rem;
    color: var(--text3);
    font-size: 13px;
}

.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
html[data-theme="dark"] .overlay { background: rgba(0, 0, 0, .65); }
.overlay.open { display: flex; }

.modal {
    background: var(--modal-bg);
    border: 0.5px solid var(--border2);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    width: 500px;
    max-width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.25rem 1.25rem 0;
    gap: 12px;
}
.modal-title {
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
}
.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text3);
    font-size: 18px;
    line-height: 1;
    padding: 2px;
    flex-shrink: 0;
    transition: color .1s;
}
.modal-close:hover { color: var(--text); }

.modal-body { padding: 1rem 1.25rem 1.25rem; }

.modal-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 0.5px solid var(--border);
}
.modal-row:last-child { border-bottom: none; }

.modal-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text3);
    min-width: 68px;
    flex-shrink: 0;
}
.modal-value { font-size: 13px; }

.modal-img-wrap {
    margin-top: 10px;
    cursor: zoom-in;
    border-radius: var(--radius);
    overflow: hidden;
    border: 0.5px solid var(--border);
    display: inline-block;
}
.modal-img-wrap img {
    display: block;
    max-width: 100%;
    max-height: 220px;
    object-fit: contain;
    background: var(--bg3);
}
.modal-hint {
    margin-top: 5px;
    font-size: 11px;
    color: var(--text3);
}

.modal-contenu {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}
.modal-contenu .modal-label { margin-bottom: 2px; }
.modal-contenu-text {
    font-size: 13px;
    line-height: 1.65;
    color: var(--text);
    background: var(--bg3);
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    width: 100%;
    white-space: pre-wrap;
    word-break: break-word;
}
.modal-contenu-text ul {
    padding-left: 18px;
    margin: 0;
}
.modal-contenu-text li {
    padding: 3px 0;
    color: var(--text);
}

.src-link {
    font-size: 13px;
    color: var(--blue);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.src-link:hover { text-decoration: underline; }

.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .9);
    z-index: 200;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img {
    max-width: 92vw;
    max-height: 92vh;
    object-fit: contain;
    border-radius: var(--radius);
}
.lb-close {
    position: fixed;
    top: 16px; right: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 26px;
    cursor: pointer;
    opacity: .6;
    transition: opacity .1s;
}
.lb-close:hover { opacity: 1; }
