@font-face { font-family: "Lato"; src: url("/lato-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Lato"; src: url("/lato-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Lato"; src: url("/lato-900.woff2") format("woff2"); font-weight: 900; font-style: normal; font-display: swap; }
:root {
  --jaune: #F2C200; --jaune-fonce: #D9AD00;
  --encre: #1A1033; --violet: #5400C2; --violet-fonce: #3B0A8F; --marine: #26327F; --ciel: #8CCBFF;
  --brume: #F4F1FA; --gris: #5B5670; --ligne: #DDD6EC; --blanc: #FFFFFF; --danger: #B42318;
  --sans: "Lato", "Helvetica Neue", "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--blanc); color: var(--encre); font-family: var(--sans); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; }
h1, h2, h3 { margin: 0; font-weight: 900; letter-spacing: -0.02em; }

.btn { border: 2px solid transparent; border-radius: 4px; padding: .65rem 1.15rem; font-weight: 700; }
.btn.ink { background: var(--encre); color: var(--blanc); }
.btn.violet { background: var(--violet); color: var(--blanc); }
.btn.violet:hover { background: var(--violet-fonce); }
.btn.outline { background: transparent; border-color: var(--encre); }
.btn:disabled { opacity: .5; cursor: default; }
.mini { background: var(--encre); color: var(--blanc); border: 0; border-radius: 4px; padding: .3rem .7rem; font-size: .85rem; font-weight: 700; }
.link { background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; font-size: .875rem; text-align: left; }
.icon { background: none; border: 0; font-size: 1.2rem; padding: .35rem .55rem; border-radius: 4px; }
.error { color: var(--danger); margin: 0; font-size: .9rem; font-weight: 700; }
.hl { box-shadow: inset 0 -0.32em 0 var(--ciel); }

/* Connexion */
.login { min-height: 100%; display: grid; place-items: center; padding: 1.5rem; background: var(--jaune); }
.login-box { width: min(24rem, 100%); display: grid; gap: .7rem; background: var(--blanc); padding: 2.2rem; border-radius: 4px; }
.login-box h1 { font-size: 2.6rem; letter-spacing: -0.03em; line-height: 1; }
.login-sub { margin: 0 0 .8rem; font-weight: 700; }
.login-box label { font-size: .875rem; color: var(--gris); font-weight: 700; }
.login-box input { background: var(--brume); border: 2px solid transparent; border-radius: 4px; padding: .7rem .8rem; }
.login-box input:focus { border-color: var(--encre); outline: none; }

/* Structure : panneau jaune, discussion, barre vocale sur toute la largeur */
.app { height: 100%; display: grid; grid-template-columns: 24rem minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
.panel { position: relative; overflow: hidden; background: var(--jaune); min-height: 0; }
.crane { position: absolute; left: 0; top: 0; width: 100%; height: auto; pointer-events: none; }
.panel-in { position: relative; height: 100%; overflow-y: auto; padding: 1.8rem 1.6rem 1.2rem; display: flex; flex-direction: column; gap: 1.1rem; }
.word { font-size: 2.2rem; font-weight: 900; letter-spacing: -0.03em; line-height: 1; }
.tabs { display: flex; gap: .5rem; }
.tabs { flex-wrap: wrap; }
.tab { background: transparent; border: 2px solid var(--encre); border-radius: 4px; padding: .5rem .8rem; font-weight: 700; }
.tab.active { background: var(--encre); color: var(--blanc); }
.block { display: flex; flex-direction: column; gap: .5rem; }
.block h2 { font-size: .8rem; letter-spacing: .05em; text-transform: uppercase; font-weight: 900; }
.block-head { display: flex; align-items: center; justify-content: space-between; }
.conv-list { display: flex; flex-direction: column; gap: 4px; max-height: 11.5rem; overflow-y: auto; }
.conv { display: flex; align-items: center; background: rgba(255, 255, 255, .55); border-radius: 4px; }
.conv.active { background: var(--blanc); box-shadow: inset 0 0 0 2px var(--encre); }
.conv-open { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: .55rem .7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; font-size: .95rem; }
.conv-del { font-size: .85rem; visibility: hidden; }
.conv:hover .conv-del, .conv:focus-within .conv-del { visibility: visible; }
.conv-none { margin: 0; font-size: .9rem; }
.corpus { display: flex; flex-direction: column; gap: 2px; font-size: .92rem; }
.corpus .big { font-size: 1.6rem; font-weight: 900; letter-spacing: -0.02em; line-height: 1.15; }
.corpus .row { display: flex; justify-content: space-between; gap: .75rem; }
.corpus .row span:last-child { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.corpus .muted { font-size: .82rem; margin-top: 2px; }
.grow { flex: 1; min-height: .5rem; }
.slogan { margin: 0; font-size: 1.9rem; font-weight: 900; letter-spacing: -0.03em; line-height: 1.05; }
.panel-foot { display: grid; gap: .35rem; border-top: 2px solid var(--encre); padding-top: .8rem; }
.greeting { font-weight: 900; }
.usage { font-size: .82rem; }
.usage-bar { height: 5px; background: rgba(26, 16, 51, .18); margin-top: .3rem; }
.usage-bar i { display: block; height: 100%; background: var(--encre); }
.usage-bar.high i { background: var(--danger); }

.chat { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--blanc); }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: .75rem; padding: 1.3rem 2.4rem .4rem; }
.topbar h2 { flex: 1; min-width: 0; font-size: .8rem; letter-spacing: .05em; text-transform: uppercase; color: var(--violet); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#toggle-rail { display: none; }
.scroll { flex: 1; overflow-y: auto; padding: 1rem 2.4rem 1.4rem; }
.messages, .empty { max-width: 48rem; }
.msg { margin: 0 0 1.2rem; overflow-wrap: anywhere; }
.msg.user { width: fit-content; max-width: min(34rem, 88%); margin-left: auto; background: var(--violet); color: var(--blanc); font-weight: 700; padding: .7rem 1rem; border-radius: 4px; white-space: pre-wrap; }
.msg.assistant { font-size: 1.12rem; line-height: 1.6; }
.msg.assistant > :first-child { margin-top: 0; }
.msg.assistant > :last-child { margin-bottom: 0; }
.msg.assistant p { margin: 0 0 .85em; }
.msg.assistant ul, .msg.assistant ol { margin: 0 0 .85em; padding-left: 1.4em; }
.msg.assistant li { margin-bottom: .3em; }
.msg.assistant h3, .msg.assistant h4, .msg.assistant h5, .msg.assistant h6 { font-size: 1.15rem; margin: 1.2em 0 .4em; }
.msg.assistant a { color: var(--violet); text-underline-offset: 3px; }
.msg.assistant code { font-family: var(--mono); font-size: .86em; background: var(--brume); padding: .08em .35em; border-radius: 3px; }
.msg.assistant pre { background: var(--brume); border-radius: 4px; padding: .85rem 1rem; overflow-x: auto; margin: 0 0 .85em; }
.msg.assistant pre code { background: none; padding: 0; }
.msg.assistant.pending::after { content: "▍"; color: var(--violet); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.msg.failed { font-size: .98rem; font-weight: 700; color: var(--danger); background: none; padding: 0; }
.steps { display: flex; flex-direction: column; gap: 2px; margin: 0 0 .7rem; font-size: .85rem; color: var(--gris); }
.steps div::before { content: "→ "; }
.cite { font: inherit; font-size: .76em; font-weight: 700; background: var(--brume); color: var(--encre); border: 0; border-radius: 4px; padding: .15em .5em; margin: 0 .1em; white-space: nowrap; }
.cite:hover { background: var(--violet); color: var(--blanc); }
.cite:disabled { color: var(--danger); cursor: default; }

.empty { padding-top: 9vh; }
.empty-lead { font-size: 2.4rem; font-weight: 900; letter-spacing: -0.03em; line-height: 1.12; margin: 0 0 .9rem; max-width: 36rem; }
.empty-sub { color: var(--gris); margin: 0 0 1.4rem; max-width: 34rem; font-size: 1.05rem; }
.starters { display: flex; flex-wrap: wrap; gap: .5rem; }
.starters button { background: var(--blanc); border: 2px solid var(--encre); border-radius: 4px; padding: .55rem .95rem; font-weight: 700; }
.starters button:hover { background: var(--encre); color: var(--blanc); }

/* Recherche */
.search-form { display: flex; flex-wrap: wrap; gap: .5rem; padding: .6rem 2.4rem .8rem; }
.search-form input, .search-form select { background: var(--brume); border: 2px solid transparent; border-radius: 4px; padding: .65rem .85rem; min-width: 0; }
.search-form input { flex: 1 1 16rem; }
.search-form input:focus, .search-form select:focus { border-color: var(--encre); outline: none; }
.search-count { margin: 0 0 .8rem; color: var(--gris); font-size: .92rem; }
.results { display: flex; flex-direction: column; gap: 8px; margin-bottom: 1rem; max-width: 52rem; }
.result { text-align: left; background: var(--blanc); border: 2px solid var(--ligne); border-radius: 4px; padding: .8rem 1rem; display: flex; flex-direction: column; gap: .25rem; }
.result:hover { border-color: var(--encre); }
.result-meta { font-size: .8rem; color: var(--gris); font-weight: 700; }
.result-title { font-weight: 900; line-height: 1.3; }
.result-snippet { font-size: .9rem; color: var(--gris); overflow-wrap: anywhere; }
.result-snippet mark { background: none; color: var(--violet); font-weight: 700; }

/* Cartes électorales */
.map-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .7rem; padding: .5rem 2.4rem .3rem; }
.map-controls label { display: block; font-size: .8rem; font-weight: 700; color: var(--gris); }
.map-controls select { background: var(--brume); border: 2px solid transparent; border-radius: 4px; padding: .55rem .7rem; max-width: 19rem; }
.map-controls select:focus { border-color: var(--encre); outline: none; }
.map-controls select:disabled { opacity: .5; }
.map-controls .btn { padding: .5rem .9rem; }
.map-note { margin: 0; padding: .2rem 2.4rem; font-size: .88rem; color: var(--gris); min-height: 1.4rem; }
.map-body { flex: 1; min-height: 0; display: flex; gap: 1.2rem; padding: .4rem 2.4rem 1.2rem; }
.map-stage { position: relative; flex: 1; min-width: 0; min-height: 0; background: #fcfcfb; border: 2px solid var(--ligne); border-radius: 4px; overflow: hidden; }
.map-svg { width: 100%; height: 100%; display: block; }
.map-svg.off { display: none; }
.bv { stroke: #fcfcfb; stroke-width: 1.2; vector-effect: non-scaling-stroke; cursor: pointer; outline: none; }
.bv:hover, .bv:focus-visible { stroke: var(--encre); stroke-width: 2.5; }
.bv.sel { stroke: var(--encre); stroke-width: 4; }
.bv.out { stroke: #f4f3ef; }
.bv.out:hover { fill: #d6d3cb; stroke: var(--encre); stroke-width: 1.5; }
.zone-ring { pointer-events: none; fill: #000; }
.zone-label { pointer-events: none; font-family: var(--sans); font-weight: 900; fill: var(--gris); text-anchor: middle; dominant-baseline: middle; paint-order: stroke; stroke: #fff; stroke-linejoin: round; }
.zone-tabs { display: flex; flex-wrap: wrap; gap: .5rem; padding: .5rem 2.4rem 0; }
.zone-tab { display: flex; flex-direction: column; align-items: flex-start; background: var(--blanc); border: 2px solid var(--encre); border-radius: 4px; padding: .45rem .9rem; line-height: 1.25; }
.zone-tab span { font-size: .78rem; color: var(--gris); }
.zone-tab.active { background: var(--encre); color: var(--blanc); }
.zone-tab.active span { color: #D9D2EE; }
.bar-sub { font-size: .78rem; color: var(--gris); margin-top: 2px; }
.map-table .num { text-align: right; white-space: nowrap; }
.map-table td.lead { font-weight: 900; background: var(--brume); }
.map-tip { position: absolute; z-index: 2; width: 220px; pointer-events: none; background: var(--encre); color: var(--blanc); border-radius: 4px; padding: .45rem .6rem; font-size: .85rem; display: flex; flex-direction: column; }
.map-table { position: absolute; inset: 0; overflow: auto; background: var(--blanc); padding: .6rem; }
.map-table table { border-collapse: collapse; width: 100%; font-size: .88rem; }
.map-table th { text-align: left; position: sticky; top: -.6rem; background: var(--blanc); padding: .4rem .5rem; border-bottom: 2px solid var(--encre); }
.map-table td { padding: .3rem .5rem; border-bottom: 1px solid var(--ligne); font-variant-numeric: tabular-nums; }
.map-side { width: 20rem; flex: none; overflow-y: auto; display: flex; flex-direction: column; gap: 1.2rem; }
.map-side h3 { font-size: .95rem; margin-bottom: .4rem; }
.lg-row { display: flex; align-items: center; gap: .5rem; font-size: .88rem; padding: .1rem 0; }
.lg-sw { flex: none; width: 16px; height: 16px; border-radius: 3px; display: block; }
.md-meta { margin: 0 0 .6rem; font-size: .85rem; color: var(--gris); }
.bar-row { margin-bottom: .6rem; }
.bar-head { display: flex; justify-content: space-between; gap: .6rem; font-size: .88rem; }
.bar-head strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-track { height: 8px; background: var(--brume); border-radius: 0 4px 4px 0; }
.bar-track i { display: block; height: 100%; border-radius: 0 4px 4px 0; min-width: 2px; }
.fam-list { display: flex; flex-direction: column; gap: 4px; margin-top: .4rem; }
.fam-row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.fam-row span { flex: 1; min-width: 0; font-size: .92rem; }
.fam-row select { width: 12rem; flex: none; padding: .4rem .6rem; }
@media (max-width: 860px) { .zone-tabs { padding: .5rem 1rem 0; } .map-controls, .map-note { padding-left: 1rem; padding-right: 1rem; } .map-body { flex-direction: column; padding: .4rem 1rem 1rem; overflow-y: auto; } .map-stage { min-height: 62vh; flex: none; } .map-side { width: auto; overflow: visible; } }

/* Réglages */
.admin { display: flex; flex-direction: column; gap: 1.2rem; }
.card { max-width: 46rem; border: 2px solid var(--ligne); border-radius: 4px; padding: 1.2rem 1.4rem 1.4rem; display: flex; flex-direction: column; gap: .45rem; }
.card h3 { font-size: 1.25rem; margin: .5rem 0 .2rem; }
.card h3:first-child { margin-top: 0; }
.card h4 { margin: 0 0 .2rem; font-size: 1rem; font-weight: 900; }
.card label { font-size: .85rem; font-weight: 700; color: var(--gris); margin-top: .35rem; display: block; }
.card input, .card select { width: 100%; background: var(--brume); border: 2px solid transparent; border-radius: 4px; padding: .6rem .75rem; }
.card input:focus, .card select:focus { border-color: var(--encre); outline: none; }
.state { font-weight: 400; }
.hint { margin: 0; font-size: .85rem; color: var(--gris); }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; align-items: end; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: .8rem; }
.status { font-size: .9rem; font-weight: 700; color: var(--violet); }
.team { display: flex; flex-direction: column; gap: 6px; }
.member { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; background: var(--brume); border-radius: 4px; padding: .6rem .75rem; }
.member .who { flex: 1 1 12rem; min-width: 0; display: flex; flex-direction: column; }
.member .who span { font-size: .82rem; color: var(--gris); overflow-wrap: anywhere; }
.member input { width: 12rem; flex: 0 1 12rem; background: var(--blanc); padding: .4rem .6rem; }
.mini.ghost { background: transparent; color: var(--encre); box-shadow: inset 0 0 0 2px var(--encre); }
.mini.danger { background: var(--danger); }
.newuser { border-top: 2px solid var(--ligne); margin-top: 1rem; padding-top: 1rem; }
@media (max-width: 860px) { .pair { grid-template-columns: minmax(0, 1fr); } }

/* Barre vocale */
.voicebar { grid-column: 1 / -1; background: var(--encre); color: var(--blanc); display: flex; align-items: center; gap: 1.2rem; padding: .9rem 1.6rem; padding-bottom: calc(.9rem + env(safe-area-inset-bottom, 0px)); }
.mic { flex: none; width: 72px; height: 72px; border: 0; border-radius: 50%; background: var(--jaune); color: var(--encre); display: grid; place-items: center; }
.mic:hover { background: #FFD633; }
.mic.live { background: var(--blanc); color: var(--violet); box-shadow: 0 0 0 6px rgba(140, 203, 255, .55); }
.voice-text { flex: none; max-width: 22rem; }
.voice-title { font-size: 1.3rem; font-weight: 900; letter-spacing: -0.01em; line-height: 1.2; }
.voice-sub { font-size: .88rem; color: #D9D2EE; line-height: 1.35; }
.wave { flex: none; display: flex; align-items: center; gap: 5px; height: 56px; padding: 0 16px; border-radius: 4px; background: var(--jaune); }
.wave i { display: block; width: 6px; height: 14px; border-radius: 3px; background: var(--encre); }
.wave i:nth-child(3n+1) { height: 22px; } .wave i:nth-child(3n+2) { height: 36px; } .wave i:nth-child(4n) { height: 28px; }
.wave.on i { animation: wave 0.9s ease-in-out infinite alternate; }
.wave.on i:nth-child(2n) { animation-delay: .15s; } .wave.on i:nth-child(3n) { animation-delay: .3s; } .wave.on i:nth-child(5n) { animation-delay: .45s; }
@keyframes wave { from { transform: scaleY(.35); } to { transform: scaleY(1.15); } }
.composer { flex: 1; min-width: 12rem; display: flex; gap: .5rem; align-items: flex-end; margin-left: auto; max-width: 40rem; }
.composer textarea { flex: 1; resize: none; max-height: 30vh; background: var(--blanc); color: var(--encre); border: 0; border-radius: 4px; padding: .8rem .95rem; line-height: 1.4; }
.send { flex: none; width: 52px; height: 52px; border: 0; border-radius: 4px; background: var(--violet); color: var(--blanc); display: grid; place-items: center; }
.send:hover { background: #6A1BE0; }
.send:disabled { opacity: .5; cursor: default; }

/* Lecteur de délibération */
.doc { position: fixed; inset: 0 0 0 auto; width: min(42rem, 100%); z-index: 20; background: var(--blanc); border-left: 3px solid var(--encre); box-shadow: -20px 0 60px rgba(26, 16, 51, .25); display: flex; flex-direction: column; gap: .8rem; padding: 1.4rem 1.6rem; overflow-y: auto; }
.doc-head { display: flex; justify-content: space-between; align-items: center; }
.doc-head h2 { font-size: .8rem; letter-spacing: .05em; text-transform: uppercase; color: var(--violet); }
.doc-body { display: flex; flex-direction: column; gap: .8rem; }
.doc-meta { font-size: .88rem; color: var(--gris); font-weight: 700; }
.doc-title { font-size: 1.3rem; font-weight: 900; letter-spacing: -0.01em; line-height: 1.25; margin: 0; }
.doc-facts { display: grid; grid-template-columns: auto 1fr; gap: .25rem .9rem; font-size: .92rem; margin: 0; }
.doc-facts dt { color: var(--gris); font-weight: 700; }
.doc-facts dd { margin: 0; overflow-wrap: anywhere; }
.doc-link { align-self: flex-start; display: inline-block; background: var(--marine); color: var(--blanc); text-decoration: none; padding: .65rem 1.1rem; border-radius: 4px; font-weight: 700; }
.doc-warn { font-size: .85rem; color: var(--gris); margin: 0; }
.doc-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .92rem; line-height: 1.6; background: var(--brume); border-radius: 4px; padding: 1rem; margin: 0; font-family: var(--sans); }

@media (max-width: 1180px) { .app { grid-template-columns: 20rem minmax(0, 1fr); } .slogan { font-size: 1.6rem; } .voice-sub { display: none; } }
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .panel { position: fixed; inset: 0 auto 0 0; width: min(21rem, 88%); z-index: 30; transform: translateX(-100%); transition: transform .18s ease; }
  .panel.open { transform: none; box-shadow: 14px 0 40px rgba(26, 16, 51, .3); }
  #toggle-rail { display: inline-block; }
  .conv-del { visibility: visible; }
  .topbar { padding: .8rem 1rem .3rem; }
  .scroll { padding: .8rem 1rem 1rem; }
  .search-form { padding: .5rem 1rem .8rem; }
  .empty { padding-top: 5vh; } .empty-lead { font-size: 1.7rem; }
  .voicebar { gap: .6rem; padding: .7rem .8rem; padding-bottom: calc(.7rem + env(safe-area-inset-bottom, 0px)); }
  .mic { width: 56px; height: 56px; }
  .voice-text, .wave { display: none; }
  .mic.live + .voice-text { display: block; }
  .mic.live ~ .composer { display: none; }
  .composer { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) { .wave.on i, .msg.assistant.pending::after { animation: none; } .panel { transition: none; } }
