/* ===== Clinique – planning / pointage / congés ===== */
:root {
  --primary: #1f7a6d;
  --primary-soft: color-mix(in srgb, var(--primary) 12%, white);
  --primary-ink: color-mix(in srgb, var(--primary) 70%, black);
  --bg: #f5f4f0;
  --surface: #ffffff;
  --ink: #1d2422;
  --muted: #6b7470;
  --line: #e4e2dc;
  --danger: #c0392b;
  --warn: #b7791f;
  --ok: #2f855a;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 4px 16px rgba(20, 30, 25, .04);
  font-size: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.45;
}
a { color: var(--primary-ink); }
h1 { font-size: 1.6rem; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.08rem; margin: 0 0 .9rem; display: flex; align-items: center; gap: .45rem; }
h3.subtle { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1rem 0 .4rem; }
code { background: #f0efea; padding: .05rem .35rem; border-radius: 5px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.mt { margin-top: 1rem; }

/* ----- Barre du haut ----- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-inner { max-width: 1280px; margin: 0 auto; padding: .7rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--ink); min-width: 0; }
.brand-logo { height: 40px; width: auto; max-width: 160px; object-fit: contain; }
.brand-mark { width: 40px; height: 40px; border-radius: 10px; background: var(--primary); color: #fff; display: grid; place-items: center; flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: var(--muted); font-size: .8rem; }
.userbox { display: flex; align-items: center; gap: .75rem; flex: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-weight: 600; font-size: .8rem; text-decoration: none; }
.mainnav { max-width: 1280px; margin: 0 auto; padding: 0 .6rem; display: flex; gap: .2rem; overflow-x: auto; scrollbar-width: none; }
.mainnav a { padding: .55rem .8rem; text-decoration: none; color: var(--muted); border-bottom: 2.5px solid transparent; white-space: nowrap; font-weight: 500; }
.mainnav a:hover { color: var(--ink); }
.mainnav a.active { color: var(--primary-ink); border-bottom-color: var(--primary); }
.count { display: inline-block; min-width: 1.25rem; padding: 0 .35rem; border-radius: 1rem; background: var(--danger); color: #fff; font-size: .72rem; text-align: center; margin-left: .2rem; line-height: 1.25rem; }

/* ----- Mise en page ----- */
.container { max-width: 1280px; margin: 0 auto; padding: 1.4rem 1rem 3rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.page-head p { margin: .2rem 0 0; }
.grid { display: grid; gap: 1rem; margin-bottom: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.span-all { grid-column: 1 / -1; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1.2rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.grid > .card { margin-bottom: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .8rem; margin-bottom: .9rem; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1rem 0 2rem; }

/* ----- Formulaires ----- */
label { display: flex; flex-direction: column; gap: .3rem; font-size: .86rem; font-weight: 500; color: #3c4542; }
.label { display: block; font-size: .86rem; font-weight: 500; color: #3c4542; margin-bottom: .3rem; }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; align-self: end; padding-bottom: .5rem; }
input[type=text], input[type=password], input[type=email], input[type=date], input[type=time], input[type=number], input[type=month], select, textarea {
  font: inherit; font-size: .95rem; padding: .55rem .65rem; border: 1px solid #d3d1ca; border-radius: 8px; background: #fff; color: var(--ink); width: 100%; min-width: 0;
}
input[type=color] { width: 3.2rem; height: 2.4rem; padding: .15rem; border: 1px solid #d3d1ca; border-radius: 8px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--primary) 40%, transparent); outline-offset: 1px; border-color: var(--primary); }
textarea { resize: vertical; }
.stack { display: flex; flex-direction: column; gap: .85rem; }
.form-row { display: flex; flex-wrap: wrap; gap: .7rem; align-items: flex-end; }
.form-row > label { flex: 1 1 140px; }
.form-row.compact { gap: .45rem; align-items: center; }
.form-row.compact input[type=text] { flex: 1 1 180px; width: auto; }
.form-row.compact input[type=time] { width: 7.2rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.span-2 { grid-column: span 2; }
form.inline { display: inline; margin: 0; }
.filters { align-items: flex-end; }

/* ----- Boutons ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 600; font-size: .92rem; padding: .58rem 1rem; border-radius: 8px;
  border: 1px solid #d3d1ca; background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #f6f5f1; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-ink); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #a02f23; }
.btn-ghost-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, white); }
.btn-sm { padding: .35rem .7rem; font-size: .84rem; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; padding: 0; font: inherit; color: var(--primary-ink); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; font-size: .88rem; }
.btn-link.danger { color: var(--danger); }
.actions { white-space: nowrap; }
.actions > * + * { margin-left: .6rem; }

/* ----- Segmented control / onglets ----- */
.toolbar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.toolbar.end { justify-content: flex-end; margin-bottom: 1rem; }
.seg { display: inline-flex; border: 1px solid #d3d1ca; border-radius: 9px; overflow: hidden; background: #fff; }
.seg a { padding: .42rem .8rem; text-decoration: none; color: var(--ink); font-size: .9rem; font-weight: 500; border-left: 1px solid #e7e5df; }
.seg a:first-child { border-left: 0; }
.seg a:hover { background: #f6f5f1; }
.seg a.active { background: var(--primary); color: #fff; }
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin-bottom: 1.1rem; overflow-x: auto; }
.tabs a { padding: .55rem .9rem; text-decoration: none; color: var(--muted); font-weight: 500; border-bottom: 2.5px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.active { color: var(--primary-ink); border-bottom-color: var(--primary); }

/* ----- Alertes / badges ----- */
.alert { padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1rem; border: 1px solid; font-size: .93rem; }
.alert-success { background: #eaf6ef; border-color: #b9e0c8; color: #1e5b3a; }
.alert-error { background: #fbecea; border-color: #f0c4be; color: #8a271c; }
.alert-info { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 25%, white); color: var(--primary-ink); }
.alert-warn { background: #fdf5e6; border-color: #f1d8a8; color: #7a4f10; }
.badge { display: inline-block; padding: .12rem .5rem; border-radius: 1rem; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge-valide { background: #e3f3ea; color: #23643f; }
.badge-en_attente { background: #fdf0d9; color: #8a5a10; }
.badge-refuse { background: #f8e3e0; color: #8a271c; }
.badge-open { background: var(--primary-soft); color: var(--primary-ink); }
.warn-text { color: var(--warn); }
.pos { color: var(--ok); font-weight: 600; }
.neg { color: var(--danger); font-weight: 600; }

/* ----- Listes ----- */
.dot { display: inline-block; width: .65rem; height: .65rem; border-radius: 50%; margin-right: .45rem; flex: none; vertical-align: baseline; }
.people, .list { list-style: none; margin: 0 0 .8rem; padding: 0; }
.people li { display: flex; align-items: center; gap: .1rem; padding: .32rem 0; flex-wrap: wrap; }
.people li .muted { margin-left: auto; font-size: .86rem; }
.list li { padding: .5rem 0; border-bottom: 1px solid #efeee9; }
.list li:last-child { border-bottom: 0; }
.row-between { display: flex; justify-content: space-between; gap: 1rem; }

/* ----- Tableaux ----- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; padding: .5rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: .6rem; border-bottom: 1px solid #efeee9; vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-inactive td { opacity: .5; }

/* ----- Pointage ----- */
.clock-card { display: flex; flex-direction: column; gap: .7rem; }
.clock-card h2 { margin-bottom: 0; }
.big-clock { font-size: 3.2rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--primary-ink); line-height: 1; }
.clock-state { margin: 0; font-size: .98rem; display: flex; align-items: center; gap: .5rem; }
.clock-state::before { content: ""; width: .6rem; height: .6rem; border-radius: 50%; background: #b8bdb9; }
.clock-state.on::before { background: #2fb36e; box-shadow: 0 0 0 4px #2fb36e33; }
.clock-state.warn::before { background: var(--warn); }
.btn-clock { width: 100%; padding: 1rem; font-size: 1.08rem; border-radius: 10px; }
.meter { height: 8px; background: #ecebe6; border-radius: 4px; overflow: hidden; }
.meter-bar { height: 100%; background: var(--primary); border-radius: 4px; }
.stats { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.stat { flex: 1 1 140px; background: #f8f7f3; border-radius: 10px; padding: .75rem .9rem; display: flex; flex-direction: column; }
.stat-val { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-lbl { color: var(--muted); font-size: .82rem; }
.weeks { margin-bottom: 1rem; }
.week-line { display: grid; grid-template-columns: 1fr auto 5.5rem; gap: 1rem; padding: .4rem 0; border-bottom: 1px dashed #e7e5df; font-variant-numeric: tabular-nums; }
.week-line span:last-child { text-align: right; }

/* ----- Planning semaine ----- */
.admin-panel summary { cursor: pointer; font-weight: 600; color: var(--primary-ink); }
.admin-panel[open] summary { margin-bottom: 1rem; }
.admin-panel .form-row + .form-row { margin-top: .8rem; }
.planning { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 860px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: .88rem; }
.planning th, .planning td { border-bottom: 1px solid #ecebe6; border-right: 1px solid #f0efea; padding: .45rem; vertical-align: top; }
.planning thead th { background: #faf9f6; font-weight: 600; text-align: center; padding: .55rem .4rem; }
.planning thead .dow { display: block; font-size: .76rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.planning thead .dnum { font-size: .98rem; }
.planning .sticky { position: sticky; left: 0; background: #faf9f6; z-index: 2; text-align: left; min-width: 150px; }
.planning tbody .person { background: #fff; font-weight: 600; white-space: nowrap; }
.planning tr.is-me .person { background: var(--primary-soft); }
.planning th.is-today, .planning td.is-today { background: color-mix(in srgb, var(--primary) 6%, white); }
.planning thead th.is-today { color: var(--primary-ink); box-shadow: inset 0 3px 0 var(--primary); }
.planning .is-off { background: #f7f6f2; }
.planning .cell { position: relative; min-width: 104px; height: 64px; }
.planning .total { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.shift { position: relative; background: color-mix(in srgb, var(--c) 14%, white); border-left: 3px solid var(--c); border-radius: 6px; padding: .25rem .45rem; margin-bottom: .3rem; font-variant-numeric: tabular-nums; font-weight: 600; font-size: .83rem; }
.shift small { display: block; font-weight: 400; color: var(--muted); font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shift-del { position: absolute; top: 1px; right: 2px; margin: 0; }
.shift-del button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: .1rem .2rem; opacity: 0; }
.shift:hover .shift-del button { opacity: 1; }
.shift-del button:hover { color: var(--danger); }
.abs { background: repeating-linear-gradient(135deg, #fbe7e3, #fbe7e3 6px, #f8dcd6 6px, #f8dcd6 12px); color: #8a271c; border-radius: 6px; padding: .3rem .45rem; margin-bottom: .3rem; font-weight: 600; font-size: .8rem; }
.abs small { display: block; font-weight: 400; font-size: .72rem; }
.abs-pending { background: #fff; border: 1.5px dashed #e3a296; color: #a04030; }
.cell-add { position: absolute; bottom: 3px; right: 4px; width: 22px; height: 22px; border-radius: 6px; border: 1px dashed #c8c6bf; background: #fff; color: var(--muted); cursor: pointer; line-height: 1; opacity: 0; transition: opacity .15s; }
.cell:hover .cell-add, .cell-add:focus { opacity: 1; }
@media (hover: none) { .cell-add, .shift-del button { opacity: .7; } }
.planning tfoot td, .planning tfoot th { background: #faf9f6; font-size: .8rem; border-bottom: 0; }
.planning tfoot td { text-align: center; }
.planning tfoot .present { display: block; color: var(--ok); font-weight: 600; }
.planning tfoot .absent { display: block; color: var(--danger); font-weight: 600; }
.planning tfoot td.is-busy { background: #fbecea; }

/* ----- Planning mois ----- */
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.month-dow { text-align: center; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: .2rem 0; }
.month-day { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; min-height: 104px; padding: .4rem; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.month-day:hover { border-color: var(--primary); }
.month-day.is-out { opacity: .45; }
.month-day.is-off { background: #f7f6f2; }
.month-day.is-today { box-shadow: inset 0 0 0 2px var(--primary); }
.month-day.is-busy { border-color: #e3a296; background: #fff8f6; }
.month-num { font-weight: 700; font-size: .92rem; display: flex; justify-content: space-between; align-items: center; }
.month-count { font-size: .7rem; background: var(--danger); color: #fff; border-radius: 1rem; padding: 0 .4rem; font-weight: 600; }
.mchip { display: flex; align-items: center; gap: .3rem; font-size: .76rem; background: color-mix(in srgb, var(--c) 16%, white); border-left: 3px solid var(--c); border-radius: 4px; padding: .1rem .3rem; min-width: 0; }
.mchip-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mchip small { color: var(--muted); flex: none; }
.chip-pending { background: #fff !important; border: 1.5px dashed var(--c) !important; }
.legend { margin-top: .8rem; }

/* ----- Accueil : absences 14 jours ----- */
.upcoming { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.up-day { border: 1px solid var(--line); border-radius: 9px; padding: .45rem; min-height: 72px; display: flex; flex-wrap: wrap; gap: 4px; align-content: flex-start; }
.up-day.is-today { box-shadow: inset 0 0 0 2px var(--primary); }
.up-day.is-off { background: #f7f6f2; }
.up-day.is-busy { border-color: #e3a296; background: #fff8f6; }
.up-date { width: 100%; font-size: .78rem; font-weight: 600; color: var(--muted); }
.chip { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--c); color: #fff; font-size: .7rem; font-weight: 700; border: 1.5px solid var(--c); }
.chip.chip-pending { color: var(--c); }

/* ----- Congés (validation) ----- */
.requests { display: flex; flex-direction: column; gap: .8rem; }
.request { border: 1px solid var(--line); border-radius: 10px; padding: .8rem .9rem; }
.request-head { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem; margin-bottom: .4rem; }
.request p { margin: .3rem 0 .6rem; }

/* ----- Paramètres ----- */
.logo-preview { width: 100%; min-height: 90px; border: 1px dashed #d3d1ca; border-radius: 10px; display: grid; place-items: center; padding: .8rem; margin-bottom: .6rem; background: repeating-conic-gradient(#f4f3ef 0 25%, #fff 0 50%) 50% / 16px 16px; }
.logo-preview img { max-height: 90px; max-width: 100%; object-fit: contain; }

/* ----- Connexion ----- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: radial-gradient(circle at 20% 10%, var(--primary-soft), transparent 55%), var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 2rem 1.8rem; box-shadow: 0 10px 40px rgba(20, 30, 25, .08); }
.login-head { text-align: center; margin-bottom: 1.4rem; }
.login-head h1 { font-size: 1.4rem; }
.login-head p { margin: .3rem 0 0; }
.login-logo { max-height: 84px; max-width: 220px; object-fit: contain; margin-bottom: .8rem; }

/* ----- Responsive ----- */
@media (max-width: 960px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-2-1 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  :root { font-size: 15px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .container { padding: 1rem .75rem 2.5rem; }
  h1 { font-size: 1.35rem; }
  .brand-text small { display: none; }
  .userbox .btn-link { font-size: .8rem; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .month { gap: 3px; }
  .month-day { min-height: 64px; padding: .25rem; }
  .mchip { font-size: .66rem; padding: 0 .2rem; }
  .mchip small { display: none; }
  .month-count { display: none; }
  .upcoming { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .week-line { grid-template-columns: 1fr auto auto; }
}

/* ----- Horaires théoriques ----- */
.nowrap { white-space: nowrap; }
.cycle-box { display: flex; flex-wrap: wrap; gap: .8rem 1.2rem; align-items: flex-end; padding: .8rem .9rem; background: #f8f7f3; border-radius: 10px; margin-bottom: 1rem; }
.cycle-box > label { flex: 0 1 260px; }
.cycle-box .cycle-hint { flex: 1 1 100%; margin: 0; }
#tpl-form:not(.has-cycle) .cycle-only { display: none; }
.tpl-week { border: 0; padding: 0; margin: 0 0 1.2rem; min-width: 0; }
.tpl-week legend { font-weight: 700; color: var(--primary-ink); padding: 0; margin-bottom: .5rem; font-size: 1rem; }
.tpl-grid { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.tpl-head, .tpl-day { display: grid; grid-template-columns: 7.5rem 1fr 1fr 5rem; gap: .6rem; align-items: center; padding: .45rem .7rem; }
.tpl-head { background: #faf9f6; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.tpl-day { border-top: 1px solid #efeee9; }
.tpl-day.is-weekend { background: #fbfaf7; }
.tpl-day.is-rest .tpl-dname { color: var(--muted); }
.tpl-dname { font-weight: 600; }
.day-total { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.rest { display: inline-block; font-size: .78rem; font-weight: 600; color: var(--muted); background: #f0efea; border-radius: 1rem; padding: .05rem .55rem; }
.time-pair { display: flex; align-items: center; gap: .35rem; min-width: 0; }
.time-pair input { flex: 1 1 0; min-width: 0; max-width: 8rem; padding: .4rem .45rem; }
.tp-arrow { color: var(--muted); }
.tp-label { display: none; }
.tpl-week-foot { display: flex; flex-wrap: wrap; gap: .5rem .8rem; align-items: center; margin-top: .6rem; }
.tpl-week-foot .muted { margin-left: auto; }
.tpl-actions { margin-top: .4rem; align-items: center; }
.tpl-actions .spacer { flex: 1; }
.cycle-tag { display: inline-block; font-size: .7rem; font-weight: 700; color: var(--primary-ink); background: var(--primary-soft); border-radius: 1rem; padding: .02rem .45rem; margin-left: .3rem; vertical-align: middle; }
.next-weeks .nw-row { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; }
.nw-date { font-weight: 600; min-width: 7.5rem; }
.nw-sat { font-size: .8rem; color: var(--muted); }
.nw-sat.on { color: var(--primary-ink); font-weight: 700; }
.nw-total { margin-left: auto; font-variant-numeric: tabular-nums; }
.team-week { display: flex; flex-direction: column; gap: .55rem; }
.tw-day { display: grid; grid-template-columns: 3rem 1fr; gap: .5rem; align-items: start; }
.tw-name { font-weight: 600; font-size: .85rem; line-height: 1.1; }
.tw-name small { display: block; font-weight: 400; color: var(--muted); font-size: .7rem; }
.tw-bars { display: flex; flex-direction: column; gap: 3px; min-height: 1.2rem; border-bottom: 1px dashed #ecebe6; padding-bottom: .4rem; }
.tw-row { display: grid; grid-template-columns: 1.9rem 1fr; gap: .3rem; align-items: center; }
.tw-who { font-size: .68rem; font-weight: 700; color: var(--muted); }
.tw-track { position: relative; height: 12px; background: #f3f2ee; border-radius: 3px; }
.tw-bar { position: absolute; top: 0; bottom: 0; background: var(--c); border-radius: 3px; }
.tw-scale { display: flex; justify-content: space-between; margin-left: 5.7rem; font-size: .68rem; color: var(--muted); }

/* ----- Planning : horaires théoriques & repos ----- */
.shift.shift-theo { background: #fff; border: 1.5px dashed color-mix(in srgb, var(--c) 70%, white); border-left-width: 3px; font-weight: 500; color: #4a5350; }
.cell .rest, .pm-what .rest { margin-bottom: .3rem; }
.planning-mobile { display: none; }

/* ----- Couverture des congés ----- */
.coverage { margin: .2rem 0 .7rem; border: 1px solid var(--line); border-radius: 8px; padding: .5rem .7rem; background: #fcfcfa; }
.coverage summary { cursor: pointer; font-size: .9rem; font-weight: 600; }
.coverage[open] summary { margin-bottom: .5rem; }
.cov-table td, .cov-table th { padding: .4rem .5rem; font-size: .86rem; }
.cov-ok { color: var(--ok); font-weight: 600; }
.cov-warn { color: var(--warn); font-weight: 600; }
.cov-bad { color: var(--danger); font-weight: 600; }
.cov-row-none td { background: #fdf0ee; }
.cov-row-partial td { background: #fdf8ec; }

.shift.shift-off { opacity: .45; text-decoration: line-through; border-left-style: dashed; }
.mchip-ini { display: none; }

/* ----- Navigation mobile (barre du bas) ----- */
.bottomnav { display: none; }

/* ===================== MOBILE ===================== */
@media (max-width: 720px) {
  /* iOS ne zoome plus sur les champs */
  input[type=text], input[type=password], input[type=email], input[type=date], input[type=time], input[type=number], input[type=month], select, textarea { font-size: 16px; }

  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .mainnav { display: none; }
  .topbar-inner { padding: .55rem .8rem; }
  .brand-logo { height: 34px; }
  .brand-mark { width: 34px; height: 34px; }
  .userbox form { display: none; }

  .bottomnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(20, 30, 25, .06);
  }
  .bottomnav > a, .bn-more > summary {
    flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 2px; text-decoration: none; color: var(--muted); font-size: .7rem; font-weight: 600;
    position: relative; list-style: none; cursor: pointer; border-radius: 10px;
  }
  .bn-more { flex: 1 1 0; display: flex; position: relative; }
  .bn-more > summary { width: 100%; }
  .bn-more > summary::-webkit-details-marker { display: none; }
  .bottomnav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .bn-more svg { fill: currentColor; stroke: none; }
  .bottomnav > a.active, .bn-more.active > summary { color: var(--primary-ink); background: var(--primary-soft); }
  .bottomnav .count { position: absolute; top: 2px; left: 55%; margin: 0; font-size: .62rem; min-width: 1.05rem; line-height: 1.05rem; }
  .bn-menu {
    position: absolute; bottom: calc(100% + 8px); right: 0; min-width: 200px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
    box-shadow: 0 10px 30px rgba(20, 30, 25, .15); padding: .4rem; display: flex; flex-direction: column;
  }
  .bn-menu a, .bn-menu button {
    display: block; text-align: left; padding: .7rem .8rem; border-radius: 8px; text-decoration: none;
    color: var(--ink); font: inherit; font-weight: 500; background: none; border: 0; width: 100%; cursor: pointer;
  }
  .bn-menu a.active { background: var(--primary-soft); color: var(--primary-ink); }
  .bn-menu form { margin: 0; border-top: 1px solid var(--line); margin-top: .3rem; padding-top: .3rem; }
  .bn-menu button { color: var(--danger); }

  .page-head { align-items: stretch; }
  .page-head .toolbar { width: 100%; justify-content: space-between; }
  .card { padding: 1rem; }

  /* Planning semaine : liste jour par jour */
  .planning-desktop { display: none; }
  .planning-mobile { display: flex; flex-direction: column; gap: .7rem; }
  .pm-day { margin: 0; padding: .8rem .9rem; scroll-margin-top: 70px; }
  .pm-day.is-today { box-shadow: inset 4px 0 0 var(--primary), var(--shadow); }
  .pm-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; margin-bottom: .5rem; }
  .pm-eff { font-size: .78rem; color: var(--ok); font-weight: 600; }
  .pm-eff.is-busy { color: var(--danger); }
  .pm-row { display: grid; grid-template-columns: 7.2rem 1fr; gap: .5rem; padding: .45rem 0; border-top: 1px solid #f0efea; align-items: start; }
  .pm-row.is-me .pm-who { color: var(--primary-ink); }
  .pm-who { font-weight: 600; font-size: .88rem; display: flex; align-items: center; padding-top: .2rem; }
  .pm-what { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; position: relative; padding-right: 1.8rem; }
  .pm-what .shift, .pm-what .abs, .pm-what .rest { margin: 0; }
  .pm-what .shift { padding-right: 1.4rem; }
  .pm-what .shift-del button, .cell-add { opacity: 1; }
  .pm-add { position: absolute; right: 0; top: 0; bottom: auto; width: 26px; height: 26px; }

  /* Mois : initiales */
  .mchip-name { display: none; }
  .mchip-ini { display: inline; font-weight: 700; }
  .mchip { justify-content: center; border-left-width: 0; border-radius: 4px; background: var(--c); color: #fff; font-size: .62rem; }
  .mchip.chip-pending { color: var(--c); }

  /* Horaires : une carte par jour */
  .tpl-head { display: none; }
  .tpl-day { grid-template-columns: 1fr auto; grid-template-areas: "name total" "m m" "a a"; gap: .4rem; padding: .6rem .7rem; }
  .tpl-dname { grid-area: name; }
  .day-total { grid-area: total; }
  .tpl-day .time-pair:nth-of-type(1) { grid-area: m; }
  .tpl-day .time-pair:nth-of-type(2) { grid-area: a; }
  .tp-label { display: inline-block; width: 5.6rem; font-size: .78rem; color: var(--muted); flex: none; }
  .time-pair input { max-width: none; }
  .tpl-day.is-rest .time-pair { opacity: .75; }
  .tpl-week-foot .muted { margin-left: 0; width: 100%; }
  .tw-scale { margin-left: 5.7rem; }

  /* Tableaux en cartes */
  .table.stack-mobile thead { display: none; }
  .table.stack-mobile, .table.stack-mobile tbody, .table.stack-mobile tr, .table.stack-mobile td { display: block; width: 100%; }
  .table.stack-mobile tr { border: 1px solid var(--line); border-radius: 10px; padding: .5rem .75rem; margin-bottom: .6rem; background: #fff; }
  .table.stack-mobile td { border: 0; padding: .22rem 0; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  .table.stack-mobile td::before { content: attr(data-label); color: var(--muted); font-size: .82rem; text-align: left; flex: none; }
  .table.stack-mobile td.cell-title { font-weight: 700; font-size: 1rem; justify-content: flex-start; text-align: left; }
  .table.stack-mobile td.cell-title::before { display: none; }
  .table.stack-mobile td.cell-actions { justify-content: flex-end; }
  .table.stack-mobile td.cell-actions:empty { display: none; }
  .table.stack-mobile td.cell-actions::before { display: none; }

  .coverage { padding: .5rem; }
  .cov-table td, .cov-table th { font-size: .8rem; padding: .35rem; }
  .request .form-row.compact input[type=text] { flex: 1 1 100%; }
  .stats { gap: .5rem; }
  .stat { flex: 1 1 30%; padding: .6rem; }
  .stat-val { font-size: 1.1rem; }
}

/* ----- Bouton d'aide ----- */
.help-btn {
  width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center;
  border: 1.5px solid color-mix(in srgb, var(--primary) 45%, white); color: var(--primary-ink);
  font-weight: 800; font-size: .95rem; text-decoration: none; cursor: pointer; list-style: none; background: #fff;
}
.help-btn:hover { background: var(--primary-soft); }
.help-menu { position: relative; }
.help-menu > summary::-webkit-details-marker { display: none; }
.help-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; min-width: 250px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(20, 30, 25, .14); padding: .5rem; display: flex; flex-direction: column;
}
.help-pop strong { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .3rem .6rem; }
.help-pop a { padding: .6rem; border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 500; }
.help-pop a:hover { background: var(--primary-soft); }
.help-pop small { color: var(--muted); font-weight: 400; }
.login-card label.check { align-self: flex-start; padding: 0; font-size: .88rem; color: var(--muted); }

/* ----- Visite guidée ----- */
.tour-overlay { position: fixed; inset: 0; z-index: 1000; background: transparent; }
.tour-overlay.is-dim { background: rgba(15, 25, 22, .55); }
.tour-spot {
  position: absolute; z-index: 1001; border-radius: 12px; pointer-events: none;
  box-shadow: 0 0 0 4px var(--primary), 0 0 0 200vmax rgba(15, 25, 22, .55);
}
body.tour-on { overscroll-behavior: none; }
.tour-overlay { touch-action: none; }
.tour-tip {
  position: fixed; z-index: 1002; width: min(360px, calc(100vw - 24px));
  background: var(--surface); border-radius: 14px; padding: 1rem 1.1rem .9rem;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .25); animation: tour-in .2s ease;
}
.tour-tip.is-center { left: 50% !important; top: 50% !important; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 24px)); }
.tour-tip h3 { margin: .2rem 0 .4rem; font-size: 1.08rem; }
.tour-tip p { margin: 0 0 .9rem; color: #3c4542; font-size: .94rem; line-height: 1.5; }
.tour-progress { display: flex; gap: 5px; }
.tour-progress span { width: 7px; height: 7px; border-radius: 50%; background: #dddbd4; }
.tour-progress span.done { background: color-mix(in srgb, var(--primary) 45%, white); }
.tour-progress span.on { background: var(--primary); width: 18px; border-radius: 4px; }
.tour-actions { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.tour-spacer { flex: 1; }
.tour-skip { color: var(--muted); font-size: .84rem; }
@keyframes tour-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.tour-tip.is-center { animation: none; }
@media (max-width: 720px) {
  .tour-tip:not(.is-center) { left: 12px !important; right: 12px; width: auto; top: auto !important; bottom: calc(76px + env(safe-area-inset-bottom)); }
  .tour-tip.at-top:not(.is-center) { top: 12px !important; bottom: auto; }
  .help-pop { position: fixed; right: 12px; top: 60px; }
}

/* ----- Compteurs CP ----- */
.cp-counters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.cp-box { background: #f8f7f3; border-radius: 10px; padding: .75rem .9rem; display: flex; flex-direction: column; gap: .3rem; }
.cp-label { font-weight: 700; font-size: .92rem; }
.cp-label small { display: block; font-weight: 400; color: var(--muted); font-size: .74rem; }
.cp-line { display: flex; justify-content: space-between; gap: .5rem; font-size: .88rem; font-variant-numeric: tabular-nums; }
.cp-line span { color: var(--muted); }
.cp-rest { border-top: 1px dashed #dddbd4; padding-top: .3rem; }
.cp-rest span { color: var(--ink); font-weight: 600; }
.cp-total { background: var(--primary-soft); }
.cp-total.is-neg { background: #fbecea; }
.cp-big { font-size: 1.8rem; font-weight: 800; color: var(--primary-ink); font-variant-numeric: tabular-nums; line-height: 1.1; }
.cp-total.is-neg .cp-big { color: var(--danger); }
.cp-table tr.is-selected td { background: var(--primary-soft); }
.days-edit { display: inline-flex; align-items: center; gap: .3rem; margin: 0; }
.days-edit input { width: 4.4rem; padding: .25rem .35rem; }
.check-list { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; }
.check-list label.check { padding: 0; }
.export-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 720px) {
  .cp-counters { grid-template-columns: 1fr; }
  .export-grid { grid-template-columns: 1fr; }
}
.cp-mini { margin: -.3rem 0 .6rem; font-size: .9rem; }

/* ----- Choix de l'ASV (horaires) ----- */
.asv-picker { display: flex; gap: .6rem; overflow-x: auto; padding: .15rem .1rem .6rem; margin-bottom: .6rem; scrollbar-width: thin; }
.asv-card {
  flex: 0 0 auto; display: flex; align-items: center; gap: .6rem; min-width: 190px;
  padding: .6rem .85rem .6rem .6rem; background: var(--surface); border: 1.5px solid var(--line);
  border-radius: 12px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: border-color .15s;
}
.asv-card:hover { border-color: color-mix(in srgb, var(--c) 60%, white); }
.asv-card.active { border-color: var(--c); background: color-mix(in srgb, var(--c) 9%, white); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); }
.asv-card .avatar { flex: none; }
.asv-card-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.asv-card-text strong { font-size: .95rem; white-space: nowrap; }
.asv-card-text small { color: var(--muted); font-size: .78rem; }
.asv-card-text .asv-todo { color: var(--warn); font-weight: 600; }
@media (max-width: 720px) {
  .asv-picker { margin: 0 -.75rem .6rem; padding: .15rem .75rem .6rem; }
  .asv-card { min-width: 160px; }
}

/* ----- Alternance / école ----- */
.abs.abs-school { background: repeating-linear-gradient(135deg, #e6eefb, #e6eefb 6px, #dbe6f8 6px, #dbe6f8 12px); color: #24508f; }
.mchip.mchip-school { --c: #3b6fc4 !important; }
.badge-school { background: #e6eefb; color: #24508f; }
.school-card { border-left: 4px solid #3b6fc4; }
.school-ico { font-size: 1.1rem; }
.school-form > label { flex: 1 1 130px; }
#school-list .table td:first-child, #school-list .table th:first-child { width: 2rem; }
#school-list .btn-ghost-danger { margin-top: .6rem; }
.apprentice-hint { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; padding: .6rem .9rem; margin-bottom: 1rem; border: 1px dashed #b9cbe9; border-radius: 10px; background: #f4f7fd; color: #24508f; font-size: .92rem; }
.school-card { margin-bottom: 1rem; }
.school-mode { flex: 0 0 auto; align-self: flex-end; }
.school-mode label { flex-direction: row; align-items: center; gap: .35rem; padding: .5rem .8rem; border-left: 1px solid #e7e5df; font-weight: 500; cursor: pointer; margin: 0; }
.school-mode label:first-child { border-left: 0; }
.school-mode input { accent-color: var(--primary); }
.school-mode label:has(input:checked) { background: var(--primary); color: #fff; }
.week-preview { display: block; min-height: 1.1em; font-weight: 500; }

/* ----- Semaine du cycle ----- */
.cycle-current { display: flex; flex-direction: column; gap: .3rem; }
.cycle-letters label { flex-direction: row; align-items: center; gap: .3rem; padding: .45rem .75rem; border-left: 1px solid #e7e5df; font-weight: 500; cursor: pointer; margin: 0; }
.cycle-letters label:first-child { border-left: 0; }
.cycle-letters label[hidden] { display: none; }
.cycle-letters input { accent-color: var(--primary); }
.cycle-letters label:has(input:checked) { background: var(--primary); color: #fff; }
.cycles-panel summary { cursor: pointer; font-weight: 600; color: var(--primary-ink); }
.cycles-panel[open] summary { margin-bottom: .8rem; }
.cycles-list { display: flex; flex-direction: column; gap: .4rem; }
.cycle-row { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; padding: .35rem 0; border-bottom: 1px solid #efeee9; margin: 0; }
.cycle-who { min-width: 13rem; font-weight: 600; display: flex; align-items: center; gap: .3rem; }
.cycle-row .seg button { font: inherit; font-weight: 700; padding: .35rem .8rem; border: 0; border-left: 1px solid #e7e5df; background: #fff; cursor: pointer; color: var(--ink); }
.cycle-row .seg button:first-child { border-left: 0; }
.cycle-row .seg button.active { background: var(--primary); color: #fff; }

/* ----- Échanges ----- */
.swap-card { margin-top: 1rem; border-left: 4px solid #8a5cc2; }
.swap-form > label { flex: 1 1 150px; }
.swap-form small { font-weight: 400; font-size: .74rem; }
.swap-list .swap-item { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; }
.shift.shift-swap { box-shadow: inset 0 0 0 1.5px #8a5cc2; }
.rest.rest-swap { background: #f1eafa; color: #5d3a8c; white-space: normal; text-align: left; }
.swap-list { margin-top: 1rem; }

/* ----- Fiche de paie ----- */
#payslip-form { display: flex; flex-direction: column; gap: .8rem; }
.payslip-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.payslip-table th, .payslip-table td { border: 1px solid var(--line); padding: .35rem .5rem; text-align: center; }
.payslip-table thead th { background: #264653; color: #fff; font-weight: 600; font-size: .85rem; }
.payslip-table tbody th { text-align: left; background: #faf9f6; width: 6rem; }
.payslip-table input { text-align: right; padding: .35rem .45rem; }
.payslip-total td { font-weight: 800; font-size: 1.05rem; color: var(--primary-ink); }

/* ----- Compteur d'heures ----- */
.hc-card { border-left: 4px solid var(--primary); }
.hc-main { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.hc-main h2 { margin-bottom: .2rem; }
.hc-main p { margin: 0; }
.hc-value { font-size: 2.2rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hc-big { font-size: 1.05rem; }
.hc-mini { margin: 0; font-size: .9rem; }
.hc-mini a { text-decoration: none; }
.hc-manage { margin-top: 1rem; }
.hc-box { background: #f8f7f3; border-radius: 10px; padding: .9rem 1rem; }
.hc-box h3 { margin: 0 0 .6rem; font-size: 1rem; display: flex; align-items: center; }
.hc-detail { margin-top: .4rem; }
.week-line { grid-template-columns: 1fr 4.5rem 4.5rem 4.5rem !important; }
.week-line span:not(:first-child), .week-line strong { text-align: right; }
.week-head { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 1px solid var(--line) !important; }
.table tr.is-selected td { background: var(--primary-soft); }
@media (max-width: 720px) { .hc-value { font-size: 1.7rem; } .week-line { grid-template-columns: 1fr 3.8rem 3.8rem 4rem !important; font-size: .88rem; } }

/* ----- Pointage sur site ----- */
.net-off { display: flex; flex-direction: column; gap: .25rem; background: #fdf5e6; border: 1px solid #f1d8a8; color: #7a4f10; border-radius: 10px; padding: .8rem .9rem; margin: 0; }
.net-ok { color: var(--ok); margin: 0; font-weight: 600; }
.net-status { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .6rem .8rem; border-radius: 10px; background: #f8f7f3; margin-bottom: .9rem; font-size: .92rem; }
.net-status.is-in { background: #eaf6ef; color: #1e5b3a; }
.stack > label.check { align-self: flex-start; padding-bottom: 0; }
