/* Registre de gestion : en-tête collant + onglets, colonne de 1080px, tableaux repliés en fiches sur téléphone. */

:root {
  --bg: #F5F3EF; --surface: #FFFFFF; --sunk: #EDEAE4; --line: #DDD8CF; --field: #8F887D; --fg: #1C1D1F; --muted: #5F5A52;
  --accent: #1F3B50; --accent-ink: #FFFFFF; --accent-soft: #E4EAEF;
  --ok: #25683F; --ok-soft: #E0EEE3; --warn: #8A5308; --warn-soft: #F6EBD7; --bad: #A3301F; --bad-soft: #F7E1DC;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --display: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --r: 8px; color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root {
  --bg: #121314; --surface: #1A1C1E; --sunk: #232629; --line: #34383C; --field: #6B7178; --fg: #ECEAE6; --muted: #A5A097;
  --accent: #A3C0D6; --accent-ink: #0E1A23; --accent-soft: #1E2D39;
  --ok: #6FC994; --ok-soft: #173224; --warn: #E2A750; --warn-soft: #382B13; --bad: #EE8A7D; --bad-soft: #3B1C18; color-scheme: dark } }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 15px; line-height: 1.5; }
[hidden] { display: none !important; }
.wrap { max-width: 1080px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
header.top { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); }
.top .wrap { padding-block: 14px 0; display: grid; gap: 10px; }
.eyebrow { font-family: var(--body); font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.brand { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand h1 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: -.01em; text-wrap: balance; }
.who { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
nav.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin-bottom: -1px; }
nav.tabs::-webkit-scrollbar { display: none; }
.tab { appearance: none; border: 0; background: none; color: var(--muted); font: 500 14px var(--body); padding: 10px 12px 11px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tab:hover { color: var(--fg); }
.tab[aria-current="page"] { color: var(--fg); border-bottom-color: var(--accent); }
.count { font-family: var(--body); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 11px; background: var(--warn-soft); color: var(--warn); border-radius: 99px; padding: 1px 7px; }
main .wrap { padding-block: 22px 80px; display: grid; gap: 28px; }
section { display: grid; gap: 12px; min-width: 0; }
h2 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 17px; }
.sec-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-family: inherit; font-variant-numeric: tabular-nums; }
p { margin: 0; max-width: 65ch; }

button, .btn { appearance: none; font: 500 13.5px var(--body); border-radius: 6px; padding: 7px 12px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; text-decoration: none; }
button:hover, .btn:hover { border-color: var(--muted); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover { filter: brightness(1.08); }
button.ghost { border-color: transparent; background: transparent; color: var(--accent); padding-inline: 6px; }
button.danger { color: var(--bad); }
button.danger.solid { background: var(--bad); color: var(--surface); border-color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 2px 9px; border-radius: 99px; background: var(--sunk); color: var(--muted); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.acc { background: var(--accent-soft); color: var(--accent); }
.tag { font-family: var(--body); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.monthbar { display: flex; align-items: center; gap: 8px; }
.monthbar .lbl { font-family: var(--display); font-weight: 600; font-size: 15px; min-width: 9.5em; text-align: center; text-transform: capitalize; }
.summary { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.summary > div { background: var(--surface); padding: 18px 20px; display: grid; gap: 6px; align-content: start; min-width: 0; }
.big { font-family: var(--display); font-weight: 700; font-size: 34px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.meter { height: 8px; background: var(--sunk); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.meter span { display: block; height: 100%; width: var(--w, 0%); background: var(--ok); border-radius: 99px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { display: grid; gap: 2px; }
.stat b { font-family: var(--display); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12.5px; color: var(--muted); }

.ledger { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.lrow { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) 7em 7.5em 7.5em minmax(0, 2fr); gap: 12px; align-items: center; padding: 11px 16px; border-top: 1px solid var(--line); }
.lrow:first-child { border-top: 0; }
.lrow.head { background: var(--sunk); color: var(--muted); padding-block: 8px; }
.lrow.head > * { font-size: 12px; }
.lrow .r { text-align: right; }
.lrow .name { font-weight: 600; }
.lrow .sub { font-size: 12.5px; color: var(--muted); }
.lrow.p { grid-template-columns: 6.5em minmax(0, 1.4fr) minmax(0, 1.1fr) minmax(0, 1.1fr) 7.5em 7em; cursor: pointer; }
.lrow.p:hover { background: var(--sunk); }
.lrow.p.open { background: var(--accent-soft); }
.lrow.t { grid-template-columns: minmax(0, 1.2fr) 8em 8em 8em minmax(0, 1.6fr); }
.lrow.j { grid-template-columns: 9em minmax(0, 1.4fr) minmax(0, 1.6fr) 8em; }
.inline-form { padding: 14px 16px 16px; border-top: 1px dashed var(--line); background: var(--sunk); }
.cell-label { display: none; }
@media (max-width: 760px) {
  .summary { grid-template-columns: 1fr; }
  .lrow, .lrow.p, .lrow.t, .lrow.j { grid-template-columns: 1fr 1fr; gap: 6px 12px; }
  .lrow.head { display: none; }
  .lrow .r { text-align: left; }
  .cell-label { display: block; font-size: 11.5px; color: var(--muted); }
  .lrow .wide { grid-column: 1 / -1; }
}

.alerts { display: grid; gap: 6px; }
.alert { display: flex; align-items: center; gap: 12px; justify-content: space-between; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: 6px; padding: 9px 12px; }
.alert.bad { border-left-color: var(--bad); }
.alert.warn { border-left-color: var(--warn); }
.alert.info { border-left-color: var(--accent); }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); padding: 22px; color: var(--muted); display: grid; gap: 10px; justify-items: start; }

.bars { display: grid; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.bar { display: grid; grid-template-columns: minmax(0, 11em) 1fr 7.5em; gap: 12px; align-items: center; font-size: 13.5px; }
.bar .track { height: 10px; background: var(--sunk); border-radius: 3px; overflow: hidden; }
.bar .fill { height: 100%; width: var(--w, 0%); background: var(--accent); border-radius: 3px; }
.bar .v { text-align: right; }
.bar.total { border-top: 1px solid var(--line); padding-top: 8px; font-weight: 600; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: grid; gap: 10px; text-align: left; cursor: pointer; font: inherit; color: inherit; }
button.card { white-space: normal; }
.card:hover { border-color: var(--accent); }
.card .t { display: flex; justify-content: space-between; gap: 8px; align-items: start; }
.card h3 { margin: 0; font-family: var(--display); font-size: 16.5px; font-weight: 600; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: grid; gap: 10px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; }
.months span { height: 22px; border-radius: 3px; background: var(--sunk); font-family: var(--body); font-size: 10.5px; font-weight: 500; display: grid; place-items: center; color: var(--muted); }
.months .ok { background: var(--ok-soft); color: var(--ok); }
.months .warn { background: var(--warn-soft); color: var(--warn); }
.months .bad { background: var(--bad-soft); color: var(--bad); }

form { display: grid; gap: 16px; }
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px 16px; margin: 0; background: var(--surface); display: grid; gap: 12px; min-width: 0; }
legend { font-family: var(--display); font-weight: 600; font-size: 14.5px; padding: 0 6px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); gap: 12px; }
label.f { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); min-width: 0; }
label.chk { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; color: var(--fg); }
label.chk input { width: auto; margin-top: 3px; }
input, select, textarea { font: 14px var(--body); color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: space-between; }
.form-actions > div { display: flex; gap: 8px; flex-wrap: wrap; }
.confirm { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--bad-soft); color: var(--bad); border-radius: 6px; padding: 10px 12px; font-size: 13.5px; }

.drop { background: var(--surface); border: 1.5px dashed var(--line); border-radius: var(--r); padding: 18px 20px; display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop h3 { margin: 0 0 2px; font-family: var(--display); font-size: 16px; font-weight: 600; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; border-radius: 0; border-left: 1px solid var(--line); padding: 6px 11px; }
.seg button:first-child { border-left: 0; }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.sec-head select { width: auto; }
.filters select { width: auto; padding: 6px 8px; font-size: 13.5px; }
.pv { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; min-height: 120px; display: grid; place-items: center; overflow: hidden; color: var(--muted); font-size: 13px; }
.pv img { display: block; max-height: 520px; width: auto; max-width: 100%; }
.pv iframe { width: 100%; height: 520px; border: 0; background: #fff; }
.piece-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px; align-items: start; }
@media (max-width: 760px) { .piece-edit { grid-template-columns: 1fr; } }

.dgroup { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.dgroup h3 { margin: 0; padding: 10px 16px; background: var(--sunk); font-family: var(--display); font-size: 14px; font-weight: 600; }
.ditem { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.ditem:first-of-type { border-top: 0; }

.notice { font-size: 13px; color: var(--muted); background: var(--sunk); border-radius: 6px; padding: 10px 12px; max-width: none; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.toasts { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; justify-items: center; gap: 8px; padding: 0 max(16px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); pointer-events: none; }
.toast { pointer-events: auto; background: var(--fg); color: var(--bg); border-radius: 8px; padding: 10px 14px; font-size: 13.5px; max-width: 560px; box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.toast.bad { background: var(--bad); color: var(--surface); }
.back { justify-self: start; }

/* Connexion */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 32px max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px)); }
.gate-card { width: min(100%, 420px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px 26px; display: grid; gap: 16px; }
.gate-card h1 { margin: 0; font-family: var(--display); font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.gate-card .demo { border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 8px; }
.demo-band { background: var(--warn-soft); color: var(--warn); font-size: 12.5px; text-align: center; padding: 6px 16px; }

/* === Proposition revue design === */
.mark { font-family: var(--serif); font-size: 13px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--fg); }
.eyebrow .mark { font-size: 12px; padding-right: .7em; margin-right: .7em; border-right: 1px solid var(--line); }
.gate-card > .mark { font-size: 15px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.gate-card button.ghost, .back { justify-self: start; padding-inline: 0; }
.btn.doc { border-color: transparent; background: transparent; color: var(--accent); padding-inline: 8px; }
.btn.doc:hover { background: var(--accent-soft); border-color: transparent; }
input, select, textarea { border-color: var(--field); }
label.chk input { width: 18px; height: 18px; flex: none; margin-top: 2px; accent-color: var(--accent); }
input[type="file"] { padding: 6px; }
input[type="file"]::file-selector-button { font: 500 13.5px var(--body); color: var(--fg); background: var(--sunk); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; margin-right: 10px; cursor: pointer; }
@media (max-width: 760px) {
  header.top { position: static; }
  .top .wrap { padding-top: 12px; gap: 6px; }
  .brand h1 { font-size: 19px; }
  .who .who-mail { display: none; }
  nav.tabs { flex-wrap: wrap; overflow: visible; gap: 0 2px; }
  .tab { padding: 9px 10px; }
  button, .btn { min-height: 44px; padding-inline: 14px; }
  .seg button { min-height: 40px; padding-inline: 10px; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea { font-size: 16px; min-height: 44px; }
  .stats { grid-template-columns: 1fr; gap: 8px; }
  .stat { grid-template-columns: 1fr auto; align-items: baseline; gap: 12px; }
  .stat b { font-size: 17px; }
  .bar { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
  .bar .track { grid-column: 1 / -1; grid-row: 2; }
  .bar .v { grid-column: 2; grid-row: 1; }
  .bar.total > span:nth-child(2) { display: none; }
}
