/* Giant Plannings — feuille de style (thèmes clair / sombre, responsive) */
:root {
  --blue: #0B4EA2;
  --blue-2: #1565C0;
  --blue-soft: #E6EEF9;
  --navy: #0A1F44;
  --bg: #F3F6FA;
  --surface: #FFFFFF;
  --surface-2: #F7F9FC;
  --text: #16202E;
  --muted: #5F6B7A;
  --line: #DDE3EB;
  --ok: #1E8E3E;
  --warn: #C77700;
  --red: #D93025;
  --red-soft: #FDECEA;
  --warn-soft: #FFF4E0;
  --ok-soft: #E6F4EA;
  --info-soft: #E8F0FE;
  --open-band: rgba(11, 78, 162, .07);
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] { --bg:#0D1420; --surface:#151F30; --surface-2:#1B2739; --text:#E7ECF3; --muted:#9AA7B8; --line:#2A3850; --blue-soft:#18315A; --red-soft:#3B1C1C; --warn-soft:#3A2D12; --ok-soft:#163323; --info-soft:#17284A; --open-band: rgba(90,150,255,.10); --blue:#4C8DF0; --blue-2:#6AA2F5; color-scheme: dark; }
}
html[data-theme="dark"] { --bg:#0D1420; --surface:#151F30; --surface-2:#1B2739; --text:#E7ECF3; --muted:#9AA7B8; --line:#2A3850; --blue-soft:#18315A; --red-soft:#3B1C1C; --warn-soft:#3A2D12; --ok-soft:#163323; --info-soft:#17284A; --open-band: rgba(90,150,255,.10); --blue:#4C8DF0; --blue-2:#6AA2F5; color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--blue); }
h1 { font-size: 1.35rem; margin: 0 0 .8rem; }
h2 { font-size: 1.12rem; margin: 0 0 .7rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; font-size: .9em; }

/* ---------- barre du haut */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem; padding: .55rem 1rem; background: var(--navy); color: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.brand { display: flex; align-items: center; gap: .55rem; color: #fff; text-decoration: none; font-size: 1.1rem; letter-spacing: .2px; }
.brand b { color: #7FB2FF; }
.topbar nav { display: flex; align-items: center; gap: .25rem; margin-left: auto; flex-wrap: wrap; }
.topbar nav a { color: #DCE6F5; text-decoration: none; padding: .4rem .7rem; border-radius: 8px; }
.topbar nav a:hover, .topbar nav a.on { background: rgba(255,255,255,.12); color: #fff; }
.topbar nav .ghost { color: #DCE6F5; border-color: rgba(255,255,255,.25); }
.nav-toggle { display: none; margin-left: auto; background: transparent; color: #fff; border: 0; font-size: 1.4rem; }
.badge { display: inline-block; min-width: 1.3em; padding: 0 .35em; border-radius: 99px; background: var(--red); color: #fff; font-size: .78rem; text-align: center; }
.banner { padding: .5rem 1rem; font-size: .9rem; }
.banner.info { background: var(--info-soft); border-bottom: 1px solid var(--line); }
form.inline { display: inline; margin: 0; }

.main { max-width: 1500px; margin: 0 auto; padding: 1rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; }
.grid2 > .card { margin-bottom: 0; }
.grid2 + .card, .grid2 + .grid2 { margin-top: 1rem; }
.grid-side { display: grid; grid-template-columns: minmax(240px, 320px) 1fr; gap: 1rem; align-items: start; }

/* ---------- formulaires */
label { display: flex; flex-direction: column; gap: .25rem; font-size: .88rem; color: var(--muted); margin-bottom: .6rem; }
label.check { flex-direction: row; align-items: center; gap: .45rem; color: var(--text); }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .45rem .6rem; min-height: 38px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
input[type="checkbox"] { min-height: auto; width: 18px; height: 18px; accent-color: var(--blue); }
input[type="color"] { padding: 2px; width: 60px; }
textarea { width: 100%; }
input.narrow { width: 80px; }
button, .button { font: inherit; display: inline-flex; align-items: center; justify-content: center; gap: .35rem; cursor: pointer; padding: .45rem .85rem; min-height: 38px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; }
button:hover, .button:hover { border-color: var(--blue); }
button.primary, .button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
button.primary:hover { background: var(--blue-2); }
button.danger { background: var(--red); border-color: var(--red); color: #fff; }
button.ghost { background: transparent; }
button.small, .button.small { padding: .2rem .55rem; min-height: 30px; font-size: .85rem; }
button.wide { width: 100%; }
button:disabled { opacity: .5; cursor: not-allowed; }
.row-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem; }
.row-form label { margin-bottom: 0; }
.row-form .grow { flex: 1 1 220px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 1rem; }
.form-grid .full { grid-column: 1 / -1; }
.sep { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }

.flash { padding: .6rem .8rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid transparent; }
.flash.ok { background: var(--ok-soft); border-color: #B7DFC3; }
.flash.error { background: var(--red-soft); border-color: #F3B8B2; }
.flash.warn { background: var(--warn-soft); border-color: #F2D39B; }
.flash.info { background: var(--info-soft); border-color: #BBD0F5; }

.tabs { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: 1rem; }
.tabs a { padding: .45rem .8rem; border-radius: 8px; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--line); display: inline-flex; align-items: center; gap: .4rem; }
.tabs a.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: var(--muted); flex: none; }
.chip { display: inline-flex; align-items: center; gap: .25rem; padding: .08rem .5rem; border-radius: 99px; font-size: .78rem; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); }
.chip.warn { background: var(--warn-soft); }
.chip.red { background: var(--red-soft); color: var(--red); border-color: #F3B8B2; }
.chip.blue { background: var(--blue-soft); }

table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { font-size: .82rem; color: var(--muted); font-weight: 600; }
table.list.compact td, table.list.compact th { padding: .3rem .45rem; font-size: .88rem; }
.table-wrap { overflow-x: auto; }
td.plus { color: var(--red); }
td.minus { color: #3D6FD8; }
.audit .details { font-family: ui-monospace, monospace; font-size: .78rem; word-break: break-all; }
.seasons input { width: 150px; }
.seasons input.narrow { width: 70px; }
.plist { list-style: none; padding: 0; margin: 0 0 1rem; }
.plist li { padding: .45rem .3rem; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
.plist li a { display: flex; gap: .45rem; align-items: center; text-decoration: none; color: var(--text); font-weight: 600; }
.plist li.on { background: var(--blue-soft); border-radius: 6px; }
.plist li.off { opacity: .55; }
.scenario { border: 1px solid var(--line); border-radius: 8px; padding: .7rem; margin: .8rem 0 .3rem; background: var(--surface-2); }
.scenario.new { border-style: dashed; }
.school { border-top: 1px solid var(--line); padding-top: .6rem; margin-top: .6rem; }
.weeks-preview { display: flex; flex-wrap: wrap; gap: .3rem; margin: .4rem 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .6rem; margin-bottom: .6rem; }
.kpi { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: .55rem .7rem; display: flex; flex-direction: column; }
.kpi span { font-size: .78rem; color: var(--muted); }
.kpi b { font-size: 1.15rem; }
.kpi.big b { font-size: 1.6rem; color: var(--blue); }
.kpi.hot { border-color: var(--warn); background: var(--warn-soft); }
.codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .4rem; margin-top: .5rem; }
.steps li { margin-bottom: .8rem; }
.qr { background: #fff; display: inline-block; padding: 10px; border-radius: 8px; margin: .5rem 0; }
.qr img, .qr canvas { display: block; width: 200px; height: 200px; image-rendering: pixelated; }

/* ---------- connexion */
body.bare { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, var(--navy) 0%, #0B4EA2 60%, #1B76D1 100%); }
.bare-main { width: 100%; padding: 1rem; }
.login-card { max-width: 380px; margin: 0 auto; background: var(--surface); border-radius: 14px; padding: 1.6rem; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.login-card input { width: 100%; }
.login-head { text-align: center; margin-bottom: 1rem; }
.login-head h1 { margin: .4rem 0 0; font-size: 1.5rem; }
.login-head h1 b { color: var(--blue); }
.login-card form { margin-bottom: .6rem; }

/* ---------- planning */
.planning .loading { padding: 2rem; text-align: center; color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .8rem; }
.toolbar .week-label { font-weight: 700; font-size: 1.05rem; margin: 0 .3rem; }
.toolbar .spacer { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; min-height: 34px; }
.seg button.on { background: var(--blue); color: #fff; }
.state-draft { background: var(--warn-soft); }
.state-published { background: var(--info-soft); }
.state-validated { background: var(--ok-soft); }
.legend { display: flex; flex-wrap: wrap; gap: .5rem; margin: .2rem 0 .8rem; font-size: .8rem; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 3px; }
.hidden-week { text-align: center; padding: 3rem 1rem; }

/* vue jauge (inspirée du planning Decathlon) */
.day-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .9rem; box-shadow: var(--shadow); overflow: hidden; }
.day-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .5rem .8rem; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.day-head h3 { margin: 0; font-size: 1rem; }
.day-head.today { box-shadow: inset 4px 0 0 var(--blue); }
.day-head.closed h3 { color: var(--muted); }
.notice { margin: .4rem .8rem; padding: .45rem .7rem; border-radius: 8px; font-size: .88rem; background: var(--warn-soft); border: 1px solid #F2D39B; }
.notice.red { background: var(--red-soft); border-color: #F3B8B2; }
.grid-rows { display: grid; grid-template-columns: 150px 1fr 64px 64px 72px; }
.grid-rows > div { border-bottom: 1px solid var(--line); min-height: 40px; display: flex; align-items: center; }
.grid-rows .hdr { min-height: 26px; font-size: .74rem; color: var(--muted); background: var(--surface); }
.grid-rows .num { justify-content: flex-end; padding: 0 .55rem; font-variant-numeric: tabular-nums; font-size: .88rem; }
.grid-rows .num.hdr { justify-content: flex-end; }
.grid-rows .who { padding: 0 .6rem; gap: .45rem; font-weight: 600; font-size: .9rem; cursor: default; }
.grid-rows .who .flag { margin-left: auto; }
.grid-rows .row-click { cursor: pointer; }
.grid-rows .row-click:hover { background: var(--blue-soft); }
.track { position: relative; height: 100%; min-height: 40px; }
.track .open { position: absolute; top: 0; bottom: 0; background: var(--open-band); }
.track .tick { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--line); }
.track .tlabel { position: absolute; top: 5px; transform: translateX(-50%); font-size: .72rem; color: var(--muted); }
.bar { position: absolute; top: 7px; bottom: 7px; border-radius: 6px; color: #fff; font-size: .74rem; display: flex; align-items: center; justify-content: center; overflow: hidden; white-space: nowrap; padding: 0 4px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.bar.full { left: 4px !important; right: 4px; width: auto !important; color: #1C2430; font-weight: 600; letter-spacing: .3px; }
.bar.adj-plus { background: repeating-linear-gradient(45deg, var(--red), var(--red) 4px, #F07167 4px, #F07167 8px) !important; }
.bar.pending { opacity: .55; }
.flag { font-size: .8rem; }
.flag.red { color: var(--red); }
.flag.warn { color: var(--warn); }
.cov-row .cov { display: flex; flex: 1; height: 22px; align-items: stretch; }
.cov span { flex: 1; border-right: 1px solid var(--surface); font-size: .62rem; color: #fff; display: flex; align-items: center; justify-content: center; }
.cov .c-closed { background: transparent; }
.cov .c-ok { background: #43A047; }
.cov .c-low { background: var(--red); }
.cov .c-out { background: #9AA5B1; opacity: .45; }
.cov-label { font-size: .78rem !important; color: var(--muted); font-weight: 500 !important; }
.gap-pos { color: var(--red); }
.gap-neg { color: #3D6FD8; }

/* vue grille */
table.week { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.week th, table.week td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: .45rem .5rem; vertical-align: top; font-size: .86rem; }
table.week th { background: var(--surface-2); font-size: .8rem; text-align: left; }
table.week th.closed { color: var(--muted); }
table.week td.cell { cursor: pointer; min-width: 110px; }
table.week td.cell:hover { background: var(--blue-soft); }
table.week td.tot { white-space: nowrap; font-variant-numeric: tabular-nums; }
.cell .st { display: inline-block; padding: 0 .4rem; border-radius: 5px; color: #1C2430; font-size: .78rem; font-weight: 600; }
.cell .hrs { display: block; }
.cell .day-total { color: var(--muted); font-size: .78rem; }

/* vue « mon planning » */
.my-day { display: flex; gap: .8rem; padding: .7rem .8rem; border-bottom: 1px solid var(--line); background: var(--surface); }
.my-day:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.my-day .date { width: 72px; flex: none; text-align: center; }
.my-day .date b { display: block; font-size: 1.4rem; line-height: 1.1; }
.my-day .date span { font-size: .78rem; color: var(--muted); text-transform: uppercase; }
.my-day .body { flex: 1; min-width: 0; }
.my-day .actions { display: flex; flex-direction: column; gap: .3rem; }
.my-day.today { box-shadow: inset 4px 0 0 var(--blue); }
.my-list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 1rem; }
.my-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .6rem; margin-bottom: .8rem; }
.adj { font-size: .84rem; margin-top: .25rem; }
.adj.pending { color: var(--warn); }
.adj.rejected { color: var(--muted); text-decoration: line-through; }
.adj.approved.plus { color: var(--red); }
.adj.approved.minus { color: #3D6FD8; }
.comment { font-size: .84rem; margin-top: .25rem; padding: .25rem .5rem; background: var(--surface-2); border-radius: 6px; border: 1px solid var(--line); }

/* modale */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(8, 15, 30, .55); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 1rem; overflow-y: auto; }
.modal[hidden] { display: none; }
.modal-box { position: relative; width: 100%; max-width: 620px; background: var(--surface); border-radius: 14px; padding: 1.2rem 1.3rem; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.modal-close { position: absolute; top: .5rem; right: .5rem; border: 0; font-size: 1.5rem; background: transparent; min-height: 0; padding: .2rem .6rem; }
.shift-row { display: flex; gap: .4rem; align-items: center; margin-bottom: .4rem; }
.shift-row input { width: 120px; }
.alert-list { list-style: none; padding: 0; margin: .3rem 0 .8rem; }
.alert-list li { padding: .35rem .55rem; border-radius: 6px; margin-bottom: .3rem; font-size: .87rem; background: var(--warn-soft); }
.alert-list li.red { background: var(--red-soft); color: var(--red); }
.alert-list li.info { background: var(--info-soft); }
.modal h2 { padding-right: 2rem; }
.modal hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
.person-checks { display: flex; flex-wrap: wrap; gap: .3rem 1rem; }

/* ---------- mobile */
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .topbar { flex-wrap: wrap; }
  .topbar nav { display: none; width: 100%; flex-direction: column; align-items: stretch; }
  .topbar nav.open { display: flex; }
  .topbar nav form button { width: 100%; }
  .grid-side { grid-template-columns: 1fr; }
  .grid-rows { grid-template-columns: 82px 1fr 46px 46px 52px; }
  .grid-rows .who { font-size: .8rem; padding: 0 .35rem; }
  .grid-rows .num { padding: 0 .3rem; font-size: .78rem; }
  .bar { font-size: .62rem; }
  .track .tlabel { font-size: .6rem; }
  .main { padding: .6rem; }
  .toolbar .week-label { width: 100%; order: -1; }
}
@media (max-width: 600px) {
  .grid-rows { grid-template-columns: 66px 1fr 50px; }
  .grid-rows .num.p, .grid-rows .num.c { display: none; }
  .bar:not(.full) { font-size: 0; }
  .track .tlabel.odd { display: none; }
  .cov span { font-size: 0; }
  .toolbar .seg { width: 100%; }
  .toolbar .seg button { flex: 1; }
}

/* ---------- lot 2 */
.period-state { padding: .6rem .8rem; border-radius: 8px; margin: .6rem 0; border: 1px solid var(--line); }
.period-state.locked { background: var(--warn-soft); border-color: #F2D39B; }
.period-state.open { background: var(--ok-soft); border-color: #B7DFC3; }
code.break { word-break: break-all; display: inline-block; }
.meter { display: inline-block; width: 110px; height: 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; vertical-align: middle; margin-right: .4rem; }
.meter span { display: block; height: 100%; background: #43A047; }
.meter.hot span { background: var(--warn); }
.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: .4rem; height: 190px; margin: .5rem 0 .3rem; }
.bar-col { display: flex; flex-direction: column; align-items: center; }
.bar-area { position: relative; flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid var(--line); }
.b-worked { width: 58%; border-radius: 5px 5px 0 0; min-height: 1px; }
.b-contract { position: absolute; left: 8%; right: 8%; border-top: 2px dashed var(--muted); bottom: 0; }
.bar-col.future .b-worked { opacity: .45; }
.b-label { font-size: .75rem; color: var(--muted); margin-top: .2rem; }
.legend-inline i { display: inline-block; width: 14px; height: 10px; vertical-align: middle; border-radius: 2px; }
.legend-inline .lg-contract { border-top: 2px dashed var(--muted); height: 0; }
tr.future td { color: var(--muted); }
tr.total th { border-top: 2px solid var(--line); }
table.month td.mcell { height: 96px; min-width: 105px; }
table.month td.mcell.out { opacity: .45; }
table.month td.mcell.today { box-shadow: inset 0 0 0 2px var(--blue); }
.mday { display: block; font-weight: 700; color: var(--muted); font-size: .8rem; }
.st { display: inline-block; padding: 0 .4rem; border-radius: 5px; color: #1C2430; font-size: .78rem; font-weight: 600; }
.mcell .hrs, .mcell .day-total { display: block; font-size: .82rem; }
.mcell .day-total { color: var(--muted); }

.hidden-dl { display: none; }

/* ---------- lot 3 */
.hbars { display: flex; flex-direction: column; gap: .35rem; }
.hbar { display: grid; grid-template-columns: 90px 1fr 64px; align-items: center; gap: .5rem; font-size: .86rem; }
.hb-track { height: 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.hb-fill { display: block; height: 100%; background: var(--blue); }
.hb-val { text-align: right; font-variant-numeric: tabular-nums; }
table.heat { border-collapse: separate; border-spacing: 2px; }
table.heat th { font-size: .75rem; color: var(--muted); padding: 2px 6px; }
table.heat td { width: 46px; height: 30px; text-align: center; font-size: .78rem; border-radius: 4px; color: #fff; font-weight: 600; }
.h-none { background: var(--surface-2); }
.h-low { background: var(--red); }
.h-mid { background: #81C784; color: #12351a !important; }
.h-high { background: #2E7D32; }
.bar .act { position: absolute; left: 0; top: 0; bottom: 0; width: 5px; }
.bar-act-label { font-weight: 700; margin-right: 3px; }
