/* ACDRL 80 — Espace régulateurs */
:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f3f8;
  --border: #e2e6ee;
  --text: #1c2430;
  --text-2: #4d5866;
  --muted: #7a8494;
  --brand: #3d4854;          /* ardoise du logo */
  --accent: #3a74a8;         /* bleu dent du logo */
  --accent-soft: #e6effa;
  --accent-ink: #ffffff;
  --ok: #1e7650; --ok-soft: #e0f3e9;
  --warn: #8f5c08; --warn-soft: #fcf1d8;
  --bad: #b13838; --bad-soft: #fce7e7;
  --garde: #3a74a8; --garde-soft: #e6effa;
  --indispo: #7f8896; --indispo-soft: #eef0f4;
  --open: #b13838; --open-soft: #fdeded;
  /* Pastels (fond / encre) */
  --p1: #e3edf9; --p1-ink: #2c5e8e;   /* bleu */
  --p2: #ddf2e8; --p2-ink: #1d6a4a;   /* menthe */
  --p3: #fde8da; --p3-ink: #974719;   /* pêche */
  --p4: #ebe7fa; --p4-ink: #57449c;   /* lavande */
  --p5: #fbe4ec; --p5-ink: #98345c;   /* rose */
  --p6: #faf1d3; --p6-ink: #7a5f0e;   /* citron */
  --side: #eef2f9;
  --series-2b: #e0b04a; --series-1: #5b95cf; --series-2: #e98a5f; --series-3: #4fb28a; --series-4: #8e7ddb; --series-5: #de7aa2;
  --grid: #eceff4;
  --radius: 4px;
  --radius-sm: 3px;
  --shadow: none;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #14181d; --surface: #1b2027; --surface-2: #232a33; --border: #313a45;
    --text: #eef1f4; --text-2: #b8c1cb; --muted: #8a94a0;
    --brand: #c9d2dc; --accent: #7fb0e0; --accent-soft: #1f3247; --accent-ink: #0c1824;
    --ok: #6cc99a; --ok-soft: #173327; --warn: #e5b758; --warn-soft: #362c15; --bad: #ef8583; --bad-soft: #3b2020;
    --garde: #7fb0e0; --garde-soft: #1f3247; --indispo: #8a94a0; --indispo-soft: #272e36; --open: #ef8583; --open-soft: #362222;
    --p1: #1d3044; --p1-ink: #a9cdef; --p2: #173529; --p2-ink: #9fdcc0; --p3: #3a2618; --p3-ink: #f4bd98;
    --p4: #2a2542; --p4-ink: #c4b8f2; --p5: #3a2230; --p5-ink: #f1a9c5; --p6: #352e16; --p6-ink: #ead58f;
    --side: #171c22;
    --series-2b: #e3bd62; --series-1: #6ea6dc; --series-2: #e8966f; --series-3: #5cc198; --series-4: #9d8ee6; --series-5: #e38bb0;
    --grid: #29313a;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14181d; --surface: #1b2027; --surface-2: #232a33; --border: #313a45;
  --text: #eef1f4; --text-2: #b8c1cb; --muted: #8a94a0;
  --brand: #c9d2dc; --accent: #7fb0e0; --accent-soft: #1f3247; --accent-ink: #0c1824;
  --ok: #6cc99a; --ok-soft: #173327; --warn: #e5b758; --warn-soft: #362c15; --bad: #ef8583; --bad-soft: #3b2020;
  --garde: #7fb0e0; --garde-soft: #1f3247; --indispo: #8a94a0; --indispo-soft: #272e36; --open: #ef8583; --open-soft: #362222;
  --p1: #1d3044; --p1-ink: #a9cdef; --p2: #173529; --p2-ink: #9fdcc0; --p3: #3a2618; --p3-ink: #f4bd98;
  --p4: #2a2542; --p4-ink: #c4b8f2; --p5: #3a2230; --p5-ink: #f1a9c5; --p6: #352e16; --p6-ink: #ead58f;
  --side: #171c22;
  --series-2b: #e3bd62; --series-1: #6ea6dc; --series-2: #e8966f; --series-3: #5cc198; --series-4: #9d8ee6; --series-5: #e38bb0;
  --grid: #29313a;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6rem; color: var(--text); }
h1 { font-size: 1.45rem; font-weight: 650; }
h2 { font-size: 1.1rem; font-weight: 650; }
h3 { font-size: .95rem; font-weight: 650; color: var(--text-2); }
p { margin: 0 0 .8rem; }
.boot { padding: 2rem; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- Mise en page ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--border); padding: 1rem .75rem; display: flex; flex-direction: column; gap: .25rem; position: sticky; top: 0; height: 100vh; }
.side .brand { display: flex; align-items: center; gap: .6rem; padding: .25rem .5rem 1rem; }
.side .brand img { width: 38px; height: 38px; }
.side .brand b { display: block; font-size: 1rem; color: var(--brand); letter-spacing: .02em; }
.side .brand span { font-size: .75rem; color: var(--muted); }
.nav a { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border-radius: var(--radius); color: var(--text-2); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav .sep { margin: .8rem .7rem .3rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.nav .badge { margin-left: auto; }
.side .who { margin-top: auto; padding: .7rem; border-top: 1px solid var(--border); font-size: .85rem; }
.side .who b { display: block; }
.main { padding: 1.5rem 2rem 3rem; max-width: 1280px; width: 100%; min-width: 0; }
.topbar { display: none; }
.pagehead { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; }
.pagehead h1 { margin: 0; }
.pagehead .sub { color: var(--muted); font-size: .9rem; margin-top: .2rem; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 30; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 30px rgba(0,0,0,.2); }
  .shell.menu-open .side { transform: none; }
  .topbar { display: flex; align-items: center; gap: .7rem; padding: .6rem 16px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
  .topbar img { width: 28px; height: 28px; }
  .topbar b { color: var(--brand); }
  .main { padding: 1rem 16px 3rem; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 25; }
}

/* ---------- Composants ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); min-width: 0; }
.card + .card, .grid + .card, .card + .grid, .tiles + .card, .tiles + .grid { margin-top: 1rem; }
.card > h2:first-child { margin-bottom: .8rem; }
.grid > .card, .grid > section, .grid > form { margin-top: 0 !important; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.tiles { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 1rem; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); }
.tile .label { font-size: .8rem; color: var(--text-2); }
.tile .value { font-size: 1.7rem; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: .15rem; }
.tile .hint { font-size: .78rem; color: var(--muted); margin-top: .1rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 550; font-size: .9rem; padding: .5rem .9rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; white-space: nowrap; min-height: 36px; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: .3rem .6rem; font-size: .82rem; min-height: 30px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .cell:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btns { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg button { font: inherit; font-size: .85rem; padding: .4rem .8rem; border: 0; background: none; color: var(--text-2); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

label.field { display: block; margin-bottom: .8rem; }
label.field > span { display: block; font-size: .83rem; font-weight: 550; color: var(--text-2); margin-bottom: .25rem; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem .65rem; width: 100%; min-height: 38px; }
textarea { min-height: 80px; resize: vertical; }
input[type="checkbox"] { width: auto; min-height: 0; }
.form-grid { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.inline { display: flex; gap: .5rem; align-items: end; flex-wrap: wrap; }
.inline label.field { margin-bottom: 0; }
select.compact, input.compact { width: auto; min-height: 34px; padding: .35rem .55rem; }

.badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; font-weight: 600; padding: .12rem .5rem; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge.garde { background: var(--garde-soft); color: var(--garde); }
.badge.indispo { background: var(--indispo-soft); color: var(--indispo); }
.badge.open { background: var(--open-soft); color: var(--open); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

.alert { border-radius: var(--radius); padding: .7rem .9rem; margin-bottom: 1rem; font-size: .9rem; border: 1px solid transparent; }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.info { background: var(--accent-soft); color: var(--accent); }
.alert.bad { background: var(--bad-soft); color: var(--bad); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }

.table-wrap { overflow-x: auto; margin: 0 -1.2rem; padding: 0 1.2rem; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { padding: .5rem .6rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { font-size: .78rem; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .03em; background: var(--surface); }
tbody tr:hover { background: var(--surface-2); }
tfoot td { font-weight: 650; border-top: 2px solid var(--border); border-bottom: 0; }
td.actions { text-align: right; white-space: nowrap; }

/* ---------- Planning : liste ---------- */
.month { margin-bottom: 1.2rem; }
.month h3 { text-transform: capitalize; margin: 0 0 .5rem; }
.slot { display: grid; grid-template-columns: 92px 1fr auto; gap: .8rem; align-items: center; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: .4rem; }
.slot.mine { border-color: var(--garde); background: var(--garde-soft); }
.slot.past { opacity: .6; }
.slot .d { font-weight: 650; font-variant-numeric: tabular-nums; }
.slot .d small { display: block; font-weight: 400; color: var(--muted); font-size: .78rem; }
.slot .who { font-size: .88rem; color: var(--text-2); display: flex; flex-wrap: wrap; gap: .3rem .5rem; align-items: center; }
@media (max-width: 600px) {
  .slot { grid-template-columns: 70px 1fr; }
  .slot .btns { grid-column: 1 / -1; }
}

/* ---------- Planning : grille ---------- */
.pgrid-wrap { overflow: auto; max-height: 72vh; border: 1px solid var(--border); border-radius: var(--radius); }
.pgrid { border-collapse: separate; border-spacing: 0; font-size: .8rem; }
.pgrid th, .pgrid td { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); padding: 0; text-align: center; }
.pgrid thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); text-transform: none; letter-spacing: 0; font-weight: 600; padding: .35rem .25rem; min-width: 46px; }
.pgrid thead tr:first-child th { top: 0; }
.pgrid thead tr:nth-child(2) th { top: 30px; }
.pgrid thead th.mon { text-transform: capitalize; color: var(--text); border-bottom: 2px solid var(--border); height: 30px; }
.pgrid thead th .dd { display: block; font-size: .9rem; color: var(--text); }
.pgrid thead th .ll { display: block; font-weight: 400; color: var(--muted); font-size: .68rem; max-width: 60px; margin: 0 auto; line-height: 1.1; }
.pgrid thead th.hol .ll { color: var(--accent); font-weight: 600; }
.pgrid th.name { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; padding: .35rem .6rem; white-space: nowrap; font-size: .82rem; text-transform: none; letter-spacing: 0; color: var(--text); min-width: 150px; }
.pgrid thead th.name { z-index: 3; }
.pgrid tr.me th.name { color: var(--accent); }
.pgrid tfoot th, .pgrid tfoot td { background: var(--surface-2); font-weight: 600; }
.cell { width: 100%; height: 34px; border: 0; background: none; font: inherit; cursor: default; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.cell.editable { cursor: pointer; }
.cell.editable:hover { box-shadow: inset 0 0 0 2px var(--accent); }
.cell.garde { background: var(--garde); color: var(--accent-ink); font-weight: 700; }
.cell.indispo { background: var(--indispo-soft); color: var(--indispo); }
.cell.past { opacity: .75; }
td.open-col { background: var(--open-soft); }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .82rem; color: var(--text-2); align-items: center; }
.legend i { width: 14px; height: 14px; border-radius: 3px; display: inline-block; vertical-align: -2px; margin-right: .35rem; }
.legend i.g { background: var(--garde); } .legend i.n { background: var(--indispo-soft); border: 1px solid var(--border); } .legend i.o { background: var(--open-soft); border: 1px solid var(--open); }

/* ---------- Graphiques ---------- */
.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .baseline { stroke: var(--border); stroke-width: 1; }
.chart .s1 { fill: var(--series-1); } .chart .s2 { fill: var(--series-2); } .chart .s3 { fill: var(--series-3); } .chart .s4 { fill: var(--series-4); } .chart .s5 { fill: var(--series-5); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + g rect, .chart g.col:hover rect.bar { opacity: .85; }
.chart .vlabel { fill: var(--text-2); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .82rem; color: var(--text-2); margin-bottom: .5rem; }
.chart-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-right: .35rem; }
.chart-legend i.s1 { background: var(--series-1); } .chart-legend i.s2 { background: var(--series-2); } .chart-legend i.s3 { background: var(--series-3); } .chart-legend i.s4 { background: var(--series-4); } .chart-legend i.s5 { background: var(--series-5); }
details.tableview { margin-top: .6rem; font-size: .85rem; }
details.tableview summary { cursor: pointer; color: var(--text-2); }
#tooltip { position: fixed; z-index: 100; pointer-events: none; background: var(--text); color: var(--bg); padding: .45rem .6rem; border-radius: var(--radius); font-size: .8rem; line-height: 1.35; max-width: 260px; box-shadow: 0 4px 16px rgba(0,0,0,.18); }
#tooltip b { display: block; margin-bottom: .1rem; }

/* ---------- Connexion ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 400px; padding: 1.5rem; }
.login .plate { background: #fbfafa; border-radius: var(--radius); padding: .5rem; margin: -0.3rem -0.3rem 1.2rem; text-align: center; }
.login .plate img { width: 100%; max-width: 300px; height: auto; }
.login h1 { font-size: 1.15rem; text-align: center; }

/* ---------- Toast ---------- */
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: .4rem; align-items: center; }
#toast .t { background: var(--text); color: var(--bg); padding: .6rem 1rem; border-radius: var(--radius); font-size: .9rem; box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: min(560px, 92vw); }
#toast .t.bad { background: var(--bad); color: #fff; }

/* ---------- Modale ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(10, 15, 20, .45); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; padding: 1.3rem; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.modal h2 { margin-bottom: 1rem; }
.modal .foot { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
.pw-box { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.2rem; background: var(--surface-2); padding: .7rem 1rem; border-radius: var(--radius); text-align: center; letter-spacing: .05em; user-select: all; }

/* ---------- Attestation (annexe 2) ---------- */
.attest { background: #fff; color: #111; padding: 28px 32px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 12px; max-width: 1100px; }
.attest h2 { color: #111; text-align: center; font-size: 15px; margin: 0 0 4px; }
.attest .c { text-align: center; margin: 0 0 3px; }
.attest .box { border: 1px solid #333; padding: 8px 10px; margin: 12px 0; }
.attest .box p { margin: 2px 0; }
.attest table { font-size: 11px; table-layout: fixed; }
.attest th, .attest td { border: 1px solid #333; padding: 3px 2px; text-align: center; color: #111; background: #fff; text-transform: none; letter-spacing: 0; font-size: 10.5px; }
.attest th.tot, .attest td.tot { width: 44px; }
.attest table { margin-bottom: 10px; }
.attest th.lab, .attest td.lab { width: 120px; text-align: left; padding-left: 5px; font-weight: 600; }
.attest td.tot { font-weight: 700; }
.attest .sign { display: flex; justify-content: space-between; margin-top: 18px; gap: 20px; }
.attest .sign .zone { border: 1px dashed #999; width: 300px; height: 120px; padding: 6px; color: #666; position: relative; }
.attest .sign .zone .zlabel { font-size: 10px; }
.attest .sign .zone img { position: absolute; }
.attest .sign .zone img.cachet { right: 8px; top: 14px; max-height: 100px; max-width: 48%; }
.attest .sign .zone img.sig { left: 10px; bottom: 6px; max-height: 78px; max-width: 62%; }
@media print { .attest .sign .zone { border-color: transparent; } .attest .sign .zone .zlabel { color: #444; } }
.attest .note { font-size: 10px; color: #444; margin-top: 12px; }
.attest-wrap { overflow-x: auto; }

@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body { background: #fff; }
  .side, .topbar, .noprint, #toast { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; max-width: none; }
  .attest { border: 0; padding: 0; max-width: none; }
  .attest-wrap { overflow: visible; }
}

/* ---------- Signature & cachet ---------- */
.stamp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: .8rem; }
.stamp-slot { display: flex; flex-direction: column; gap: .5rem; }
.stamp-slot h3 { margin: 0; }
.stamp-prev { height: 120px; border: 1px dashed var(--border); border-radius: var(--radius); background: #fff; display: grid; place-items: center; padding: 8px; }
.stamp-prev img { max-height: 104px; max-width: 100%; object-fit: contain; }
.stamp-prev .muted { color: #7b858e; }
label.check { display: flex; gap: .5rem; align-items: center; font-size: .88rem; color: var(--text-2); margin-bottom: .6rem; }
.sigpad { width: 100%; aspect-ratio: 1200 / 440; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); touch-action: none; cursor: crosshair; display: block; }

/* ---------- Avatars ---------- */
.av { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; flex: none; object-fit: cover; font-weight: 650; letter-spacing: .02em; color: #fff; background: var(--muted); user-select: none; }
.av-xs { width: 22px; height: 22px; font-size: .6rem; }
.av-sm { width: 30px; height: 30px; font-size: .72rem; }
.av-md { width: 38px; height: 38px; font-size: .85rem; }
.av-xl { width: 96px; height: 96px; font-size: 1.9rem; }
.av-c0 { background: #3f7cac; } .av-c1 { background: #b0563a; } .av-c2 { background: #2e8a67; }
.av-c3 { background: #7a5aa6; } .av-c4 { background: #9a7414; } .av-c5 { background: #5b6b78; }
img.av { background: var(--surface-2); }
.person { display: inline-flex; align-items: center; gap: .45rem; }
.pgrid th.name .person { gap: .5rem; }
.side .who .who-id { display: flex; align-items: center; gap: .6rem; color: inherit; text-decoration: none; margin-bottom: .5rem; }
.side .who .who-id span { display: flex; flex-direction: column; }
.topbar .top-av { margin-left: auto; display: flex; }
.photo-row { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.crop-wrap { display: grid; place-items: center; margin-bottom: .8rem; }
.crop-wrap canvas { width: min(300px, 100%); aspect-ratio: 1; border-radius: 50%; cursor: grab; touch-action: none; box-shadow: 0 0 0 1px var(--border); }

/* ---------- Ma garde ---------- */
.garde-cta { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1rem 1.2rem; margin-bottom: 1rem; border-radius: var(--radius); background: var(--garde-soft); border: 1px solid var(--garde); color: var(--text); text-decoration: none; }
.garde-cta > span:first-child { display: flex; flex-direction: column; }
.garde-cta > span:first-child span { color: var(--text-2); font-size: .9rem; }
.badge.live { position: relative; padding-left: 1.2rem; }
.badge.live::before { content: ''; position: absolute; left: .45rem; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: currentColor; animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .25; } }
.garde-head { display: grid; grid-template-columns: 1fr auto auto; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.garde-head h1 { margin: 0; }
.garde-head .sub { color: var(--muted); font-size: .9rem; }
.garde-clock { display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; }
.garde-clock #gClock { font-size: 1.9rem; font-weight: 650; letter-spacing: .02em; }
.garde-kpis { display: grid; gap: 1rem; grid-template-columns: repeat(4, 1fr); margin-bottom: 1rem; }
.gtile-other { background: var(--surface-2); }
.gtile-other:active { background: var(--accent-soft); }
.garde-tiles { display: grid; gap: 1rem; grid-template-columns: repeat(3, 1fr); margin-bottom: .8rem; }
.gtile { font: inherit; text-align: left; cursor: pointer; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem 1.1rem; min-height: 170px; display: flex; flex-direction: column; justify-content: space-between; box-shadow: var(--shadow); transition: transform .08s, border-color .15s, background .15s; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.gtile:hover { border-color: var(--accent); }
.gtile:active { transform: scale(.98); background: var(--accent-soft); }
.gtile:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.gtile.pulse { animation: pulse .35s ease-out; }
@keyframes pulse { 0% { background: var(--accent-soft); } 100% { background: var(--surface); } }
.gt-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.gt-name { font-weight: 650; font-size: 1.05rem; display: inline-flex; align-items: center; gap: .5rem; }
.gt-count { font-size: 3.4rem; font-weight: 700; line-height: 1; }
.gt-hint { font-size: .8rem; color: var(--muted); }
kbd { font: 600 .75rem ui-monospace, SFMono-Regular, Menlo, monospace; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: var(--radius); padding: .05rem .4rem; color: var(--text-2); background: var(--surface-2); }
.gdot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.gdot.s1 { background: var(--series-1); } .gdot.s2 { background: var(--series-2); } .gdot.s3 { background: var(--series-3); } .gdot.s4 { background: var(--series-4); } .gdot.s5 { background: var(--series-5); }
.garde-last { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; min-height: 44px; padding: .5rem .8rem; border: 1px dashed var(--border); border-radius: var(--radius); margin-bottom: 1rem; }
.btn.chip { border-radius: var(--radius-sm); }
.btn.chip.on { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.gj td { padding: .4rem .5rem; }
.gnote-form { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .5rem; }
.gnote { display: grid; grid-template-columns: auto 1fr auto; gap: .6rem; align-items: start; padding: .5rem 0; border-top: 1px solid var(--border); font-size: .9rem; }
.garde-off { max-width: 680px; }
/* mode plein écran : menu masqué, contenu élargi */
.shell.focus { grid-template-columns: 1fr; }
.shell.focus .side, .shell.focus .topbar, .shell.focus .demo-banner { display: none; }
.shell.focus .main { max-width: none; padding: 1.2rem 1.5rem; }
@media (max-width: 1180px) { .garde-tiles { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1000px) { .garde-tiles { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) {
  .garde-head { grid-template-columns: 1fr; }
  .garde-clock { align-items: flex-start; }
  .garde-kpis { grid-template-columns: repeat(2, 1fr); gap: .5rem; }
  .garde-kpis .tile { padding: .6rem; } .garde-kpis .value { font-size: 1.3rem; }
  .gtile { min-height: 130px; } .gt-count { font-size: 2.6rem; } kbd { display: none; }
}

.gtile:disabled { cursor: not-allowed; opacity: .6; }
.garde.readonly .gtile:hover { border-color: var(--border); }

/* ---------- Envoi CPAM ---------- */
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.checks li { display: flex; gap: .6rem; align-items: flex-start; font-size: .9rem; padding: .45rem .6rem; border-radius: var(--radius); background: var(--surface-2); }
.checks li .badge { flex: none; margin-top: .1rem; }
.steps { margin: 1rem 0 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: .9rem; }
.steps li > .btns, .steps li > a { margin-top: .4rem; }
.mail { margin-top: .5rem; border: 1px solid var(--border); border-radius: var(--radius); padding: .7rem .9rem; background: var(--surface-2); }
.mail pre { white-space: pre-wrap; font: inherit; font-size: .88rem; margin: .5rem 0; max-height: 320px; overflow: auto; }
.transmit { margin-bottom: 1rem; }
.dossier { display: flex; flex-direction: column; gap: 1.2rem; }
.recap-page table.recap { font-size: 12px; margin: 12px 0; table-layout: auto; }
.recap-page table.recap th, .recap-page table.recap td { padding: 4px 8px; text-align: left; }
.recap-page tfoot td { font-weight: 700; }
@media print {
  .dossier { display: block; }
  .page-break { break-after: page; page-break-after: always; height: 0; }
  .dossier .attest { border: 0; }
}

.send-box { margin: 1rem 0; display: flex; flex-direction: column; gap: .5rem; }
details.manual { margin-top: .5rem; border-top: 1px solid var(--border); padding-top: .8rem; }
details.manual summary { cursor: pointer; font-weight: 600; color: var(--text-2); }
code { font: .85em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: .05rem .3rem; border-radius: 4px; }

.draft-note { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; }

.export-card { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.export-card h2 { margin-bottom: .3rem; }
.export-card p { margin: 0; max-width: 60ch; }

/* ---------- Secrétariat SAS (lecture seule) ---------- */
.lec-hero { margin-bottom: 1rem; }
.lec-who { display: flex; align-items: center; gap: .7rem; margin-top: .5rem; font-size: 1.15rem; flex-wrap: wrap; }
table.lec { table-layout: fixed; }
table.lec col.c-date { width: 45%; }
table.lec tr.m th { text-transform: capitalize; font-size: .95rem; letter-spacing: 0; color: var(--text); padding: 1rem .6rem .4rem; background: none; }
table.lec td { padding: .45rem .6rem; }
@media (max-width: 600px) { table.lec col.c-date { width: 50%; } }
table.lec tr.today td { background: var(--garde-soft); }
table.lec tr.past td { color: var(--muted); }

.lec-hero + .export-card { margin-bottom: 1rem; }

table.act td.remarques { white-space: pre-line; min-width: 220px; max-width: 420px; }

/* ---------- RGPD ---------- */
.policy { max-width: 75ch; }
.policy h2 { font-size: 1rem; margin: 1.2rem 0 .4rem; }
.policy ul { margin: 0 0 .8rem; padding-left: 1.2rem; display: flex; flex-direction: column; gap: .3rem; }
.policy p, .policy li { font-size: .92rem; }
.policy-scroll { max-height: 55vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); padding: 0 1rem; }
.modal:has(.policy-scroll) { max-width: 720px; }
.policy-card { max-width: 780px !important; }
.side .who .privacy-link { display: block; margin-top: .6rem; color: var(--muted); }
/* Échanges de gardes */
.badge.cede { background: var(--warn-soft, #fdf1dc); color: var(--warn, #8a5a00); }
.cell.garde.cede { box-shadow: inset 0 0 0 2px var(--warn, #c98a00); background-image: repeating-linear-gradient(135deg, transparent 0 4px, rgba(255,255,255,.35) 4px 7px); }
.legend i.c { background: var(--garde); box-shadow: inset 0 0 0 2px var(--warn, #c98a00); }
.cession-card { border-left: 4px solid var(--warn, #c98a00); }
.cession-card table td { vertical-align: middle; }
/* Répartition des gardes */
.eq-table td, .eq-table th { vertical-align: middle; }
.eq-table tr.me td { background: var(--accent-soft, rgba(60,120,170,.08)); }
.eq-bar svg { display: block; }
.eq-bg { fill: var(--indispo-soft, #eef1f4); }
.eq-done { fill: var(--garde); }
.eq-todo { fill: var(--garde); opacity: .45; }
.eq-moy { stroke: var(--text, #222); stroke-width: 1.5; stroke-dasharray: 2 2; }
.legend i.eq-l-done { background: var(--garde); } .legend i.eq-l-todo { background: var(--garde); opacity: .45; }
.legend i.eq-l-moy { background: none; border-left: 2px dashed var(--text, #222); width: 0; border-radius: 0; }
.eq-plus { color: var(--warn); font-weight: 600; } .eq-moins { color: var(--accent, #2f6f9f); font-weight: 600; }
.eq-table th .legend { font-weight: 400; font-size: .8em; }
.eq-table th .legend { text-transform: none; letter-spacing: 0; }
@media (max-width: 640px) { .eq-table .eq-bar, .eq-table th:nth-child(2) { display: none; } }
@media (max-width: 640px) {
  .cession-card table, .cession-card tbody { display: block; }
  .cession-card tr { display: flex; flex-wrap: wrap; gap: .3rem .6rem; align-items: center; padding: .5rem 0; border-bottom: 1px solid var(--border); }
  .cession-card td { display: block; border: 0; padding: 0; }
  .cession-card td.actions { width: 100%; }
}
/* Application installable */
.pwa-head { display: flex; gap: .9rem; align-items: flex-start; }
.pwa-head img { width: 48px; height: 48px; border-radius: var(--radius); border: 1px solid var(--border); background: #fff; flex: none; }
.pwa-head h2 { margin-top: 0; }
.pwa-steps { margin: .4rem 0 0; padding-left: 1.2rem; line-height: 1.7; }
.pwa-share { display: inline-block; border: 1px solid var(--border); border-radius: 4px; padding: 0 .3rem; }
.pwa-hint { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; }
.pwa-hint img { width: 36px; height: 36px; border-radius: var(--radius); background: #fff; flex: none; }
.pwa-hint > span:not(.btns) { flex: 1 1 12rem; }
@media (display-mode: standalone) {
  .topbar { padding-top: calc(.6rem + env(safe-area-inset-top)); }
  .main { padding-bottom: calc(3rem + env(safe-area-inset-bottom)); }
  .side { padding-top: env(safe-area-inset-top); }
}
/* Sécurité du mot de passe */
.pw-meter { margin: -.3rem 0 .9rem; font-size: .85rem; }
.pw-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: .3rem; }
.pw-bar i { height: 6px; border-radius: 3px; background: var(--border); }
.pw-bar.s1 i:nth-child(-n+1) { background: var(--bad); }
.pw-bar.s2 i:nth-child(-n+2) { background: var(--warn); }
.pw-bar.s3 i:nth-child(-n+3) { background: var(--ok); }
.pw-bar.s4 i { background: var(--ok); }
.pw-level { color: var(--text-2); margin-bottom: .2rem; }
.pw-rules { list-style: none; margin: 0; padding: 0; color: var(--muted); }
.pw-rules li { padding-left: 1.3rem; position: relative; line-height: 1.5; }
.pw-rules li::before { content: '✕'; position: absolute; left: .1rem; color: var(--bad); font-size: .8em; }
.pw-rules li.ok { color: var(--text-2); }
.pw-rules li.ok::before { content: '✓'; color: var(--ok); }
/* Versements CPAM */
.tiles-sm { margin: .4rem 0 1rem; }
.tiles-sm .tile { padding: .7rem .9rem; }
.tiles-sm .value { font-size: 1.35rem; }
.vers-table td { vertical-align: middle; }

/* =====================================================================
   Esthétique : angles nets, pastels, style épuré
   ===================================================================== */
body { letter-spacing: -.003em; }
h1 { font-weight: 700; letter-spacing: -.015em; }
h2 { font-weight: 650; letter-spacing: -.01em; }

/* Menu latéral pastel */
.side { background: var(--side); border-right: 0; }
.nav a { border-radius: 0; border-left: 3px solid transparent; padding-left: .8rem; }
.nav a:hover { background: color-mix(in srgb, var(--surface) 60%, transparent); }
.nav a.active { background: var(--surface); color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.side .who { border-top-color: rgba(0,0,0,.06); }
@media (max-width: 860px) { .topbar { background: var(--side); border-bottom: 0; } }

/* Cartes : à plat, filet fin */
.card { border-color: var(--border); box-shadow: none; }
.card > h2:first-child, .card-head h2 { display: flex; align-items: center; gap: .55rem; }
.card > h2:first-child::before, .card-head h2::before { content: ''; width: 4px; height: 1em; background: var(--accent); flex: none; }

/* Tuiles de chiffres clés en pastel, une teinte par tuile */
.tile { border: 0; box-shadow: none; background: var(--p1); }
.tile .label { color: var(--p1-ink); font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; }
.tile .hint { color: var(--text-2); opacity: .8; }
.tiles > .tile:nth-child(6n+2) { background: var(--p2); } .tiles > .tile:nth-child(6n+2) .label { color: var(--p2-ink); }
.tiles > .tile:nth-child(6n+3) { background: var(--p3); } .tiles > .tile:nth-child(6n+3) .label { color: var(--p3-ink); }
.tiles > .tile:nth-child(6n+4) { background: var(--p4); } .tiles > .tile:nth-child(6n+4) .label { color: var(--p4-ink); }
.tiles > .tile:nth-child(6n+5) { background: var(--p5); } .tiles > .tile:nth-child(6n+5) .label { color: var(--p5-ink); }
.tiles > .tile:nth-child(6n+6) { background: var(--p6); } .tiles > .tile:nth-child(6n+6) .label { color: var(--p6-ink); }
.garde-kpis .tile:nth-child(2) { background: var(--p2); } .garde-kpis .tile:nth-child(2) .label { color: var(--p2-ink); }
.garde-kpis .tile:nth-child(3) { background: var(--p3); } .garde-kpis .tile:nth-child(3) .label { color: var(--p3-ink); }
.garde-kpis .tile:nth-child(4) { background: var(--p4); } .garde-kpis .tile:nth-child(4) .label { color: var(--p4-ink); }

/* Boutons, champs, onglets */
.btn { font-weight: 600; }
.btn.primary:hover { filter: brightness(.9); }
input, select, textarea { background: var(--surface); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.seg { background: var(--surface-2); border-color: var(--surface-2); padding: 2px; gap: 2px; }
.seg button + button { border-left: 0; }
.seg button { border-radius: var(--radius-sm); }
.seg button.on { background: var(--surface); color: var(--accent); box-shadow: 0 0 0 1px var(--border); }

/* Badges et alertes */
.badge { font-weight: 600; letter-spacing: .01em; }
.badge.garde { background: var(--p1); color: var(--p1-ink); }
.badge.ok { background: var(--p2); color: var(--p2-ink); }
.badge.cede { background: var(--p3); color: var(--p3-ink); }
.alert { border: 0; border-left: 3px solid currentColor; }
.alert.info { background: var(--p1); color: var(--p1-ink); }
.alert.ok { background: var(--p2); color: var(--p2-ink); }

/* Tableaux */
th { background: var(--surface-2); color: var(--text-2); font-size: .72rem; letter-spacing: .05em; border-bottom: 0; }
thead th:first-child { box-shadow: inset 3px 0 0 var(--surface-2); }
tbody tr:hover { background: var(--p1); }
tfoot td { border-top: 1px solid var(--text-2); }

/* Planning */
.slot { border-left: 3px solid var(--border); }
.slot.mine { border-color: var(--p1); border-left-color: var(--accent); background: var(--p1); }
.cell.garde { background: #b9d4ef; color: #1d4a74; }
.legend i.g, .legend i.c { background: #b9d4ef; }
td.open-col { background: var(--p5); }
.cession-card { border-left: 3px solid var(--p3-ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cell.garde, :root:not([data-theme="light"]) .legend i.g { background: #2d4d6d; color: #d5e7f8; } }

/* Ma garde : une teinte pastel par issue */
.gtile { border: 0; box-shadow: none; background: var(--p1); }
.garde-tiles .gtile:nth-child(2) { background: var(--p3); }
.garde-tiles .gtile:nth-child(3) { background: var(--p6); }
.garde-tiles .gtile:nth-child(4) { background: var(--p2); }
.garde-tiles .gtile:nth-child(5) { background: var(--p4); }
.garde-tiles .gtile:nth-child(6) { background: var(--p5); }
.gdot.s2b { background: var(--series-2b); }
.gt-prat { display: block; font-size: .85rem; font-weight: 600; color: var(--text-2); margin-top: .25rem; line-height: 1.25; overflow-wrap: anywhere; }
.gt-prat.vide { font-weight: 400; font-style: italic; color: var(--muted); }
.gtile { gap: .2rem; }
.gtile:hover { border-color: transparent; box-shadow: inset 0 0 0 2px var(--accent); }
.gtile:active { background: var(--accent-soft); }
@keyframes pulse { 0% { filter: brightness(.9); } 100% { filter: none; } }
.garde-cta { background: var(--p1); border: 0; border-left: 4px solid var(--accent); }

/* Avatars pastel */
.av { font-weight: 700; }
.av-c0 { background: var(--p1); color: var(--p1-ink); } .av-c1 { background: var(--p3); color: var(--p3-ink); } .av-c2 { background: var(--p2); color: var(--p2-ink); }
.av-c3 { background: var(--p4); color: var(--p4-ink); } .av-c4 { background: var(--p6); color: var(--p6-ink); } .av-c5 { background: var(--p5); color: var(--p5-ink); }

/* Connexion : bandes pastel obliques */
.login { background: linear-gradient(115deg, var(--p1) 0 34%, var(--bg) 34% 66%, var(--p2) 66% 100%); }
.login .card { border: 0; box-shadow: 0 24px 60px -30px rgba(30, 50, 80, .35); }
.login .plate { background: transparent; }

/* Modales, toasts */
.modal { box-shadow: 0 30px 80px -20px rgba(10, 20, 40, .45); border-top: 4px solid var(--accent); }
.modal-bg { background: rgba(20, 30, 45, .35); backdrop-filter: blur(2px); }
.export-card h2 { display: flex; align-items: center; gap: .55rem; }
.export-card h2::before { content: ''; width: 4px; height: 1em; background: var(--accent); flex: none; }
.demo-accounts .btn { white-space: normal; text-align: left; gap: .8rem; }
.demo-accounts .btn .muted { text-align: right; font-weight: 500; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .login .plate { background: #f3f5f8; } }
:root[data-theme="dark"] .login .plate { background: #f3f5f8; }
.topbar .top-av, .who-id { text-decoration: none; }
.prat-table td { vertical-align: top; }
.prat-table tr.today td { background: var(--p1); }
.prat-table tr.past td { opacity: .6; }
@media (min-width: 1500px) { .garde-tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); } .gt-name { font-size: .95rem; } }
.shell.focus .garde-tiles { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.gt-name { white-space: normal; }
.garde-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 1500px) { .garde-tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 1000px) { .garde-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.gt-prat { font-weight: 500; }
.gtile { min-height: 150px; }
.bad-txt { color: var(--bad); } .alert ul { margin: .3rem 0 .4rem; padding-left: 1.2rem; }
/* Aide contextuelle */
.aide { background: var(--p6); color: var(--text); border-left: 3px solid var(--p6-ink); padding: .75rem 1rem .8rem; margin: -.4rem 0 1.1rem; font-size: .9rem; border-radius: var(--radius); }
.aide-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .35rem; }
.aide-head b { display: inline-flex; align-items: center; gap: .5rem; color: var(--p6-ink); }
.aide-ico { display: inline-grid; place-items: center; width: 1.25rem; height: 1.25rem; background: var(--p6-ink); color: var(--p6); font-size: .8rem; font-weight: 800; border-radius: var(--radius-sm); }
.aide ul { margin: 0; padding-left: 1.2rem; line-height: 1.5; color: var(--text-2); }
.aide li + li { margin-top: .15rem; }
.aide kbd { font-size: .72rem; }
.aide .btn.sm { min-height: 26px; padding: .2rem .55rem; background: transparent; border-color: color-mix(in srgb, var(--p6-ink) 35%, transparent); color: var(--p6-ink); }
.aide .btn.sm:hover { background: color-mix(in srgb, var(--surface) 55%, transparent); }
.btn.aide-open { color: var(--p6-ink); border-color: color-mix(in srgb, var(--p6-ink) 35%, transparent); background: var(--p6); }
.shell.focus .aide, .shell.focus .aide-open { display: none; }
.garde-head + .aide { margin-top: 0; }
.gt-prat[hidden] { display: none; }
