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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1a1a2e;
    background: #f5f5f7;
    line-height: 1.6;
}

a { color: #0a3d91; text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ── Header & Nav ── */
.site-header {
    background: #0a3d91;
    color: #fff;
    padding: 12px 0;
    margin-bottom: 30px;
}
.site-header h1 { font-size: 1.3rem; font-weight: 600; }
.site-header a { color: #fff; }
.site-nav {
    display: flex;
    align-items: center;
    gap: 32px;
}
.nav-brand {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff !important;
    white-space: nowrap;
}
.nav-brand:hover { text-decoration: none; opacity: 0.9; }
.nav-links {
    display: flex;
    gap: 4px;
}
.nav-links a {
    color: rgba(255,255,255,0.8);
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}
.nav-links a:hover { background: rgba(255,255,255,0.15); color: #fff; text-decoration: none; }
.nav-links a.active { background: rgba(255,255,255,0.2); color: #fff; }

/* ── List page ── */
.page-title { font-size: 1.5rem; margin-bottom: 4px; }
.page-subtitle { color: #666; margin-bottom: 20px; font-size: 0.9rem; }

.debat-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.debat-table th {
    background: #0a3d91;
    color: #fff;
    text-align: left;
    padding: 12px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.debat-table td {
    padding: 10px 16px;
    border-bottom: 1px solid #eee;
    font-size: 0.92rem;
}
.debat-table tbody tr:hover { background: #f0f4ff; }
.debat-table tbody tr { cursor: pointer; }
.debat-table td.date-col { white-space: nowrap; width: 120px; }
.debat-table td.leg-col { width: 50px; text-align: center; }

/* ── Pagination ── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 30px 0;
    flex-wrap: wrap;
}
.pagination a, .pagination span {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
}
.pagination a {
    background: #fff;
    border: 1px solid #ddd;
}
.pagination a:hover {
    background: #0a3d91;
    color: #fff;
    text-decoration: none;
    border-color: #0a3d91;
}
.pagination .current {
    background: #0a3d91;
    color: #fff;
    font-weight: 700;
    border: 1px solid #0a3d91;
}
.pagination .ellipsis { border: none; color: #999; }

/* ── Show page ── */
.debat-header {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 24px;
}
.debat-header h1 { font-size: 1.4rem; margin-bottom: 6px; }
.debat-meta { color: #555; font-size: 0.88rem; display: flex; gap: 16px; flex-wrap: wrap; }
.debat-meta span { background: #eef2ff; padding: 2px 10px; border-radius: 4px; }

/* ── Sommaire ── */
.sommaire {
    background: #fff;
    padding: 20px 24px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 24px;
}
.sommaire h2 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #0a3d91;
}
.sommaire ul { list-style: none; }
.sommaire li { padding: 4px 0; font-size: 0.9rem; }
.sommaire li.niveau-0 { font-weight: 700; margin-top: 8px; }
.sommaire li.niveau-1 { padding-left: 20px; }
.sommaire li small { color: #666; }

/* ── Sections (accordion) ── */
.debat-corps {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    overflow: hidden;
}

.section {
    border-bottom: 1px solid #eee;
}
.section:last-child { border-bottom: none; }

.section > summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    background: #fafbff;
    list-style: none;
    user-select: none;
    transition: background 0.15s;
}
.section > summary::-webkit-details-marker { display: none; }
.section > summary::before {
    content: "\25B6";
    font-size: 0.7rem;
    color: #0a3d91;
    transition: transform 0.2s;
    flex-shrink: 0;
}
.section[open] > summary::before { transform: rotate(90deg); }
.section > summary:hover { background: #eef2ff; }

.section-content { padding: 0 20px 16px 36px; }

/* Nested sections */
.section .section {
    margin-top: 8px;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
}
.section .section > summary {
    padding: 10px 16px;
    font-size: 0.9rem;
    background: #f7f8fc;
}

/* Section type labels */
.section-type {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: 700;
    flex-shrink: 0;
}
.type-ouvertureSeance { background: #d4edda; color: #155724; }
.type-point { background: #cce5ff; color: #004085; }
.type-inter { background: #fff3cd; color: #856404; }
.type-cloture { background: #f8d7da; color: #721c24; }
.type-suspensionSeance { background: #e2e3e5; color: #383d41; }
.type-repriseSeance { background: #d1ecf1; color: #0c5460; }

.section-title-text { flex: 1; }
.orateur-section { color: #0a3d91; font-weight: 500; }

/* ── Paroles ── */
.parole {
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}
.parole:last-child { border-bottom: none; }

.parole-header {
    margin-bottom: 4px;
}
.orateur-nom {
    font-weight: 700;
    color: #0a3d91;
}
.orateur-qualite {
    color: #666;
    font-size: 0.85rem;
    font-style: italic;
    margin-left: 4px;
}

.parole-texte {
    font-size: 0.92rem;
    line-height: 1.7;
}
.parole-texte p { margin-bottom: 6px; }

/* Visual differentiation by role */
.parole-president {
    border-left: 3px solid #0a3d91;
    padding-left: 12px;
}
.parole-president .orateur-nom { color: #0a3d91; }

.parole-orateur {
    border-left: 3px solid #28a745;
    padding-left: 12px;
}
.parole-orateur .orateur-nom { color: #1a6b2a; }

.parole-gouvernement {
    border-left: 3px solid #dc3545;
    padding-left: 12px;
}
.parole-gouvernement .orateur-nom { color: #a71d2a; }

/* ── Back link ── */
.back-link {
    display: inline-block;
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: #0a3d91;
}
.back-link::before { content: "\2190 "; }

/* ── Homepage ── */
.hero {
    text-align: center;
    padding: 40px 20px 32px;
}
.hero h1 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: #0a3d91;
}
.hero p {
    color: #555;
    font-size: 1rem;
    max-width: 600px;
    margin: 0 auto;
}

.home-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}
.home-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 24px;
    color: #1a1a2e;
    transition: box-shadow 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
}
.home-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    transform: translateY(-2px);
    text-decoration: none;
}
.home-card h2 {
    font-size: 1.15rem;
    margin-bottom: 8px;
    color: #0a3d91;
}
.home-card p {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.5;
    flex: 1;
}
.home-card-link {
    display: inline-block;
    margin-top: 14px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #0a3d91;
}
.home-card-link::after { content: " \2192"; }

/* ── Stats row ── */
.stats-row {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    flex: 1;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    text-align: center;
}
.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #0a3d91;
}
.stat-label {
    font-size: 0.85rem;
    color: #666;
    margin-top: 4px;
}

/* ── Cards ── */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 24px;
    overflow: hidden;
}
.card h2 {
    font-size: 1.1rem;
    padding: 16px 20px;
    border-bottom: 2px solid #0a3d91;
    margin: 0;
}
.card p { padding: 12px 20px; }
.card .debat-table { box-shadow: none; border-radius: 0; }

/* ── Filter bar ── */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    align-items: center;
}
.filter-bar input[type="text"],
.filter-bar select {
    padding: 8px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    background: #fff;
    color: #1a1a2e;
}
.filter-bar input[type="text"] { flex: 1; min-width: 200px; }
.filter-bar select { min-width: 160px; }
.filter-bar input:focus,
.filter-bar select:focus { outline: none; border-color: #0a3d91; box-shadow: 0 0 0 2px rgba(10,61,145,0.15); }

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    background: #e2e3e5;
    color: #383d41;
}
.badge-GP { background: #cce5ff; color: #004085; }
.badge-COMPER { background: #d4edda; color: #155724; }
.badge-COMSENAT { background: #d4edda; color: #155724; }
.badge-CMP { background: #fff3cd; color: #856404; }
.badge-ORGEXTPAam { background: #d1ecf1; color: #0c5460; }
.badge-ASSEMBLEE { background: #0a3d91; color: #fff; }
.badge-SENAT { background: #721c24; color: #fff; }
.badge-GOUVERNEMENT { background: #dc3545; color: #fff; }
.badge-DELEG { background: #e8daef; color: #6c3483; }
.badge-DELEGBUREAU { background: #e8daef; color: #6c3483; }
.badge-GROUPEABSPARLAM { background: #fce4ec; color: #880e4f; }
.badge-GE { background: #fff3cd; color: #856404; }
.badge-GA { background: #fff3cd; color: #856404; }
.badge-MISINFO { background: #f8d7da; color: #721c24; }
.badge-MISENQ { background: #f8d7da; color: #721c24; }
.badge-OFFICEPAAM { background: #d1ecf1; color: #0c5460; }
.badge-CNPE { background: #d1ecf1; color: #0c5460; }
.badge-API { background: #e2e3e5; color: #383d41; }
.badge-PARPOL { background: #ffecd2; color: #8a5600; }

/* ── Scrutin badges ── */
.badge-adopte { background: #d4edda; color: #155724; }
.badge-rejete { background: #f8d7da; color: #721c24; }

/* ── Vote colors ── */
.stat-pour { color: #28a745 !important; }
.stat-contre { color: #dc3545 !important; }
.stat-abstention { color: #fd7e14 !important; }

.vote-cell { text-align: center; font-weight: 600; }
.vote-cell.pour { color: #28a745; }
.vote-cell.contre { color: #dc3545; }
.vote-cell.abstention { color: #fd7e14; }
.vote-cell.nonvotant { color: #999; }

/* ── Decryptage ── */
.decryptage-card .decryptage-content { padding: 16px 20px; }
.decryptage-meta { background: #f7f8fc; padding: 12px 16px; border-radius: 6px; margin: 12px 0; font-size: 0.92rem; }
.decryptage-context { margin-top: 10px; font-size: 0.92rem; color: #555; line-height: 1.6; }
.decryptage-context p { margin-bottom: 6px; }
.dossier-etapes { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dossier-etapes strong { margin-right: 4px; }
.etape-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 0.82rem; font-weight: 500; }
.etape-adopte { background: #e6f4ea; color: #1a7431; }
.etape-rejete { background: #fde8e8; color: #b91c1c; }
.expose-text { font-size: 0.92rem; line-height: 1.7; }
.expose-text p { margin-bottom: 8px; }
.parole-didascalie { font-style: italic; color: #888; padding: 4px 0; font-size: 0.88rem; }
.groupe-votes-summary p { margin: 6px 0; font-size: 0.92rem; }
.btn-decryptage {
    display: inline-block;
    padding: 10px 20px;
    background: #0a3d91;
    color: #fff;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.15s;
}
.btn-decryptage:hover { background: #082f6e; text-decoration: none; color: #fff; }
.btn-decryptage-ai { background: #7c3aed; }
.btn-decryptage-ai:hover { background: #6d28d9; }
.badge-ia { background: #ede9fe; color: #7c3aed; }
.decryptage-nav-links { display: flex; gap: 16px; margin-bottom: 8px; }
.decryptage-ai-content { padding: 20px; font-size: 0.95rem; line-height: 1.8; }
.decryptage-ai-content h2, .decryptage-ai-content strong { color: #0a3d91; }
.decryptage-ai-content p { margin-bottom: 14px; }
.decryptage-ai-content blockquote { border-left: 3px solid #cbd5e1; padding-left: 12px; color: #555; margin: 8px 0; font-style: italic; }
.decryptage-disclaimer { margin-top: 16px; padding: 12px 16px; background: #fef3c7; border-radius: 6px; font-size: 0.85rem; color: #92400e; }

/* ── Citation validation ── */
.citation-alert {
    padding: 14px 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 16px;
    line-height: 1.6;
}
.citation-alert-ok {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.citation-alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}
.citation-details { margin-top: 10px; }
.citation-details summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
}
.citation-list {
    list-style: none;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.citation-list li {
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.citation-ok { background: rgba(40,167,69,0.08); }
.citation-ko { background: rgba(220,53,69,0.08); }
.citation-status {
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}
.citation-ok .citation-status { background: #28a745; }
.citation-ko .citation-status { background: #dc3545; }
.citation-source {
    margin-left: auto;
    font-size: 0.8rem;
    font-style: italic;
    color: #555;
    flex-shrink: 0;
}
.citation-source-missing { color: #dc3545; font-weight: 600; }

/* ── Vote bar (scrutin show) ── */
.vote-bar-container { margin-bottom: 24px; }
.vote-bar {
    display: flex;
    height: 24px;
    border-radius: 12px;
    overflow: hidden;
    background: #eee;
}
.vote-bar-segment { transition: width 0.3s; }
.vote-pour { background: #28a745; }
.vote-contre { background: #dc3545; }
.vote-abstention { background: #fd7e14; }
.vote-bar-legend {
    display: flex;
    gap: 20px;
    margin-top: 8px;
    font-size: 0.85rem;
    color: #555;
}
.legend-pour::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: #28a745; margin-right: 4px; }
.legend-contre::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: #dc3545; margin-right: 4px; }
.legend-abstention::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: #fd7e14; margin-right: 4px; }

/* ── Search form ── */
.search-form {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
}
.search-form input {
    flex: 1;
    padding: 12px 18px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    color: #1a1a2e;
    background: #fff;
}
.search-form input:focus { outline: none; border-color: #0a3d91; box-shadow: 0 0 0 3px rgba(10,61,145,0.12); }
.search-form button {
    padding: 12px 24px;
    background: #0a3d91;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.search-form button:hover { background: #082f6e; }

/* ── Nav search link ── */
.nav-search { margin-left: auto; }

/* ── Bar chart (stats) ── */
.chart-container { padding: 20px; overflow-x: auto; }
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    min-height: 200px;
    padding-top: 20px;
}
.bar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 30px;
}
.bar-value { font-size: 0.7rem; color: #666; margin-bottom: 4px; }
.bar {
    width: 100%;
    max-width: 40px;
    background: #0a3d91;
    border-radius: 3px 3px 0 0;
    min-height: 2px;
}
.bar-label { font-size: 0.65rem; color: #999; margin-top: 4px; white-space: nowrap; }

/* ── Inline bar (stats table) ── */
.inline-bar {
    width: 100%;
    height: 8px;
    background: #eee;
    border-radius: 4px;
    overflow: hidden;
}
.inline-bar-fill {
    height: 100%;
    background: #0a3d91;
    border-radius: 4px;
}

/* ── XML tags from imported data ── */
texte { display: inline; }
italique { font-style: italic; }
exposant { vertical-align: super; font-size: 0.8em; }
gras { font-weight: bold; }
souligne { text-decoration: underline; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .site-nav { flex-direction: column; gap: 8px; }
    .nav-links { gap: 2px; }
    .debat-table th:nth-child(3),
    .debat-table td:nth-child(3) { display: none; }
    .section > summary { padding: 10px 14px; font-size: 0.88rem; }
    .section-content { padding-left: 20px; }
    .debat-header h1 { font-size: 1.2rem; }
    .stats-row { flex-direction: column; }
    .filter-bar { flex-direction: column; }
    .filter-bar input[type="text"] { min-width: 0; width: 100%; }
    .home-grid { grid-template-columns: 1fr; }
    .hero h1 { font-size: 1.4rem; }
    .nav-links { flex-wrap: wrap; }
    .search-form { flex-direction: column; }
    .vote-bar-legend { flex-wrap: wrap; gap: 10px; }
}
