/* Astreintes IT — feuille de style unique (mobile d'abord, thème clair / sombre) */

:root {
  --brand: #1f4e79;
  --brand-strong: #163a5b;
  --brand-soft: #e8f0f8;
  --accent: #2f7bd8;
  --bg: #f2f5f9;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --border: #e2e8f0;
  --text: #0f1b2d;
  --muted: #64748b;
  --night: #4f46e5; --night-bg: #eef0ff;
  --day: #c2410c;   --day-bg: #fff1e6;
  --sun: #be185d;   --sun-bg: #fdeaf3;
  --ok: #047857;    --ok-bg: #dcfce7;
  --err: #b91c1c;   --err-bg: #fee2e2;
  --warn-text: #92400e; --warn-bg: #fef3c7;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 27, 45, .05), 0 6px 20px rgba(15, 27, 45, .06);
  --shadow-lg: 0 10px 30px rgba(15, 27, 45, .14);
  --tabbar-h: 62px;
  --sidebar-w: 252px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #5b9be0;
    --brand-strong: #0b1220;
    --brand-soft: #16263b;
    --accent: #7cb4f0;
    --bg: #0b1220;
    --surface: #131c2c;
    --surface-2: #182336;
    --border: #243147;
    --text: #e6edf6;
    --muted: #8fa0b8;
    --night: #a5b4fc; --night-bg: #23264a;
    --day: #fdba74;   --day-bg: #3a2516;
    --sun: #f9a8d4;   --sun-bg: #3d1a2e;
    --ok: #6ee7b7;    --ok-bg: #0f3227;
    --err: #fca5a5;   --err-bg: #3f1515;
    --warn-text: #fcd34d; --warn-bg: #3a2c0b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

/* --- Base ------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; font-weight: 750; }
h2 { font-size: 1.1rem; font-weight: 700; }
p { margin: .5rem 0; }
a { color: var(--accent); }
code { font-size: .88em; background: var(--surface-2); padding: .05em .35em; border-radius: 5px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small, small { font-size: .82rem; }
.nowrap { white-space: nowrap; }
.ico { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }
.ico.big { width: 48px; height: 48px; color: var(--muted); opacity: .6; }
.night-txt { color: var(--night); }
.day-txt { color: var(--day); }
.sun-txt { color: var(--sun); }
.ok-txt { color: var(--ok); }
.ok-ico { color: var(--ok); }

/* --- Structure : barre du haut + onglets (mobile), barre latérale (ordinateur) --- */
.main {
  padding: 16px 14px calc(var(--tabbar-h) + var(--safe-b) + 24px);
  min-width: 0;
}
body.no-nav .main { padding-bottom: 32px; }

.appbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-t) + 10px) 14px 10px;
  background: var(--brand-strong);
  background: linear-gradient(135deg, #1f4e79, #163a5b);
  color: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .12);
}
.brand { display: flex; align-items: center; gap: .6rem; color: inherit; text-decoration: none; font-weight: 750; font-size: 1.05rem; }
.brand img { border-radius: 9px; }
.appbar-user { display: flex; text-decoration: none; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--border);
}
.tabbar a {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: .68rem; font-weight: 600;
}
.tabbar a span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab-ico { display: grid; place-items: center; width: 44px; height: 28px; border-radius: 14px; transition: background .2s; }
.tab-ico .ico { width: 22px; height: 22px; }
.tabbar a.active { color: var(--brand); }
.tabbar a.active .tab-ico { background: var(--brand-soft); }
.tabbar a.tab-primary .tab-ico { background: var(--brand); color: #fff; width: 48px; height: 32px; box-shadow: 0 4px 12px rgba(31, 78, 121, .35); }
.tabbar a.tab-primary { color: var(--brand); }

.sidebar { display: none; }

@media (min-width: 900px) {
  .appbar, .tabbar, .mobile-only { display: none !important; }
  .sidebar {
    display: flex; flex-direction: column; gap: 1.25rem;
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 20;
    padding: 22px 14px 16px;
    background: linear-gradient(180deg, #1f4e79 0%, #142f4b 100%);
    color: #fff;
  }
  .sidebar .brand { padding: 0 8px; font-size: 1.1rem; }
  .side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
  .side-nav a {
    display: flex; align-items: center; gap: .75rem;
    padding: .7rem .8rem; border-radius: 12px;
    color: rgba(255, 255, 255, .78); text-decoration: none; font-weight: 600; font-size: .95rem; white-space: nowrap;
    transition: background .15s, color .15s;
  }
  .side-nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
  .side-nav a.active { background: rgba(255, 255, 255, .16); color: #fff; }
  .side-user {
    display: flex; align-items: center; gap: .6rem;
    padding: .7rem; border-radius: 14px; background: rgba(255, 255, 255, .08);
  }
  .side-user .who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
  .side-user .who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side-user .who small { color: rgba(255, 255, 255, .65); }
  .side-user .icon-btn { color: #fff; background: transparent; }
  .side-user .icon-btn:hover { background: rgba(255, 255, 255, .14); }
  body.has-nav .main { margin-left: var(--sidebar-w); padding: 28px 32px 48px; }
}
@media (max-width: 899.98px) { .desktop-only { display: none !important; } }

/* --- En-tête de page, navigation de mois ---------------------------------------- */
.page-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem;
  margin-bottom: 1rem;
}
.page-head > div:first-child { flex: 1 1 auto; min-width: 12rem; }
.page-head .sub { margin: .15rem 0 0; color: var(--muted); font-size: .92rem; }
.sub { color: var(--muted); }
.month-nav {
  display: flex; align-items: center; gap: .25rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 4px;
  box-shadow: var(--shadow);
}
.month-nav .month { min-width: 9.5rem; text-align: center; font-weight: 700; }
@media (max-width: 899.98px) { .page-head .month-nav { width: 100%; justify-content: space-between; } }

/* --- Boutons -------------------------------------------------------------------- */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 44px; padding: .6rem 1.1rem;
  font: inherit; font-weight: 650; font-size: .95rem; line-height: 1.2;
  color: #fff; background: var(--brand);
  border: 1px solid transparent; border-radius: 12px;
  text-decoration: none; cursor: pointer;
  transition: filter .15s, background .15s, transform .05s;
}
@media (prefers-color-scheme: dark) { button, .btn { color: #0b1220; } }
button:hover, .btn:hover { filter: brightness(1.08); }
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: .6; cursor: progress; }
.btn.secondary, button.secondary { background: var(--brand-soft); color: var(--brand); }
.btn.ghost, button.ghost { background: transparent; color: var(--brand); border-color: var(--border); }
.btn.danger, button.danger { background: var(--err); color: #fff; }
.btn.danger.ghost, button.danger.ghost { background: transparent; color: var(--err); border-color: color-mix(in srgb, var(--err) 35%, transparent); }
.btn.small, button.small { min-height: 36px; padding: .4rem .8rem; font-size: .87rem; border-radius: 10px; }
.btn.block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; min-height: 0; padding: 0;
  border-radius: 999px; border: 0; background: transparent; color: var(--text);
  text-decoration: none; cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); filter: none; }
.icon-btn .ico { width: 20px; height: 20px; }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.btn-row form { margin: 0; }

/* --- Cartes, messages ----------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 1rem;
}
.card-title { display: flex; align-items: center; gap: .5rem; font-size: 1rem; margin-bottom: .9rem; }
.card-title .ico { color: var(--brand); }

.flash {
  display: flex; align-items: flex-start; gap: .6rem;
  padding: .8rem 1rem; margin: 0 0 1rem;
  border-radius: 12px; font-weight: 500;
  background: var(--ok-bg); color: var(--ok);
  animation: pop .25s ease-out;
}
.flash .ico { margin-top: .15em; }
.flash.error { background: var(--err-bg); color: var(--err); }
.flash.warn { background: var(--warn-bg); color: var(--warn-text); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }

.install-banner {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem .75rem .75rem 1rem; margin-bottom: 1rem;
  background: var(--brand-soft); color: var(--brand); border-radius: 14px;
}
.install-banner > .ico { width: 28px; height: 28px; }
.install-banner div { flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.install-banner span { font-size: .85rem; color: var(--text); opacity: .8; }

.empty { text-align: center; padding: 40px 20px; }
.empty h2 { margin: .8rem 0 .3rem; }
.empty .btn { margin-top: .8rem; }

/* --- Puces (filtres, raccourcis) ------------------------------------------------- */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1rem; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -14px; padding: 2px 14px; }
.chips.scroll::-webkit-scrollbar { display: none; }
@media (min-width: 900px) { .chips.scroll { flex-wrap: wrap; margin-inline: 0; padding: 0; } }
.chips.small { margin: .5rem 0 0; gap: .4rem; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem; flex: none;
  min-height: 36px; padding: .35rem .85rem;
  font: inherit; font-size: .88rem; font-weight: 600;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.chip:hover { border-color: var(--brand); filter: none; }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
@media (prefers-color-scheme: dark) { .chip.active { color: #0b1220; } }
.chip.ghost { background: transparent; color: var(--brand); border-style: dashed; }
.chips.small .chip { min-height: 32px; font-size: .82rem; padding: .25rem .7rem; background: var(--surface-2); }
.chip .ico { width: 16px; height: 16px; }

/* --- Indicateurs (KPI) ----------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; margin-bottom: 1rem; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: .75rem .9rem; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: .15rem;
}
.kpi strong { font-size: 1.5rem; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi-label { display: flex; align-items: center; gap: .35rem; color: var(--muted); font-size: .8rem; font-weight: 600; }
.kpi.brand { grid-row: span 1; background: linear-gradient(135deg, #1f4e79, #2f6aa3); border-color: transparent; color: #fff; }
.kpi.brand .kpi-label { color: rgba(255, 255, 255, .8); }
.kpi.night .kpi-label, .kpi.night strong { color: var(--night); }
.kpi.day .kpi-label, .kpi.day strong { color: var(--day); }
.kpi.sun .kpi-label, .kpi.sun strong { color: var(--sun); }
@media (min-width: 600px) { .kpis { grid-template-columns: repeat(4, 1fr); } }

/* --- Liste des interventions (mobile) ------------------------------------------- */
.call-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.call-card {
  display: flex; gap: .85rem;
  padding: .9rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  color: inherit; text-decoration: none;
}
a.call-card:active { background: var(--surface-2); }
.call-date {
  flex: none; width: 50px; height: 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 12px; background: var(--brand-soft); color: var(--brand); line-height: 1.1;
}
.call-date.special { background: var(--sun-bg); color: var(--sun); }
.call-date .dow { font-size: .7rem; font-weight: 700; text-transform: uppercase; }
.call-date .dom { font-size: 1.35rem; font-weight: 800; }
.call-body { flex: 1; min-width: 0; }
.call-top { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.caller { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.paid { flex: none; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--brand); }
.call-time { color: var(--muted); font-size: .85rem; display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.call-time .ico { width: 14px; height: 14px; }
.call-time em, .jplus { font-style: normal; font-size: .72rem; font-weight: 700; padding: 0 .35rem; border-radius: 6px; background: var(--night-bg); color: var(--night); }
.call-reason {
  margin: .3rem 0 .45rem; font-size: .9rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tags { display: flex; flex-wrap: wrap; gap: .35rem; }
.tag {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .15rem .55rem; border-radius: 999px;
  font-size: .78rem; font-weight: 650; font-variant-numeric: tabular-nums;
  background: var(--surface-2); color: var(--muted);
}
.tag .ico { width: 13px; height: 13px; }
.tag.night { background: var(--night-bg); color: var(--night); }
.tag.day { background: var(--day-bg); color: var(--day); }
.tag.sun { background: var(--sun-bg); color: var(--sun); }

/* --- Tableaux (ordinateur) ------------------------------------------------------- */
.table-card { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.data th, table.data td { padding: .65rem .7rem; text-align: left; vertical-align: top; }
table.data thead th {
  position: sticky; top: 0;
  background: var(--surface-2); color: var(--muted);
  font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
}
table.data tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
table.data tbody tr[data-href] { cursor: pointer; }
table.data tbody tr[data-href]:hover { background: var(--brand-soft); }
table.data tfoot th { background: var(--surface-2); font-variant-numeric: tabular-nums; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .center { text-align: center; }
table.data td.reason { min-width: 10rem; }
table.data th:first-child, table.data td:first-child { padding-left: 1rem; }
table.data th:last-child, table.data td:last-child { padding-right: 1rem; }

/* --- Formulaires ---------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .9rem; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.field label, .field > label { font-size: .85rem; font-weight: 650; color: var(--muted); }
input, select, textarea {
  width: 100%; min-height: 48px;
  padding: .65rem .85rem;
  font: inherit; font-size: 16px; /* ≥ 16 px : pas de zoom automatique sur iOS */
  color: var(--text); background: var(--surface-2);
  border: 1.5px solid var(--border); border-radius: 12px;
  transition: border-color .15s, box-shadow .15s, background .15s;
  -webkit-appearance: none; appearance: none;
}
input[type="checkbox"] { width: 22px; min-height: 0; height: 22px; padding: 0; accent-color: var(--brand); -webkit-appearance: auto; appearance: auto; }
input[type="date"], input[type="time"] { font-variant-numeric: tabular-nums; }
textarea { resize: vertical; min-height: 96px; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); background: var(--surface);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent);
}
.stack { display: flex; flex-direction: column; gap: .2rem; }
.stack > button, .stack > .btn { align-self: flex-start; margin-top: .4rem; }
.stack > .btn.block { align-self: stretch; }
.sep { border-top: 1px solid var(--border); margin-top: 1rem; padding-top: 1rem; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.row-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 1rem; margin-bottom: .6rem; }
.row-auto .field:last-child { margin-bottom: .9rem; }
.input-action { display: flex; flex-direction: column; gap: .4rem; }
.input-action .chip { align-self: flex-start; min-height: 32px; font-size: .8rem; padding: .25rem .7rem; background: var(--surface-2); }
.hint { display: flex; gap: .4rem; align-items: flex-start; color: var(--muted); font-size: .82rem; margin: .2rem 0 0; }
.hint .ico { margin-top: .15em; }
label.check { display: inline-flex; align-items: center; gap: .55rem; font-weight: 550; cursor: pointer; min-height: 40px; }

/* Interrupteur */
.switch { display: flex; align-items: center; gap: .75rem; cursor: pointer; padding: .4rem 0; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track {
  flex: none; position: relative; width: 50px; height: 30px; border-radius: 999px;
  background: var(--border); transition: background .2s;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s;
}
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 25%, transparent); }
.switch-label { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; }

/* Formulaire d'intervention */
.form-grid { display: grid; gap: 0 1rem; }
@media (min-width: 900px) {
  .form-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(260px, .8fr); align-items: start; }
  .form-grid .preview { position: sticky; top: 28px; }
}
@media (min-width: 600px) and (max-width: 899.98px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .preview { grid-column: 1 / -1; }
}
.submit-bar {
  position: sticky; z-index: 10;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 10px);
  display: flex; gap: .6rem; justify-content: flex-end;
  padding: .6rem; margin-top: .25rem;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg);
}
.submit-bar button { flex: 1; }
.submit-bar .btn.secondary { flex: none; }
@media (min-width: 900px) {
  .submit-bar { bottom: 16px; position: sticky; max-width: 460px; margin-left: auto; }
}

/* Aperçu du calcul */
.preview { background: linear-gradient(160deg, var(--surface) 60%, var(--brand-soft)); }
.preview-date { margin: 0 0 .3rem; font-weight: 600; color: var(--muted); font-size: .9rem; }
.preview-paid { display: flex; align-items: baseline; gap: .4rem; margin-bottom: .6rem; }
.preview-paid strong { font-size: 2.4rem; font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.preview-paid span { color: var(--muted); font-weight: 600; }
.preview-split { display: flex; flex-wrap: wrap; gap: .4rem; margin: .7rem 0 .3rem; }
.preview-split .tag { font-size: .84rem; padding: .25rem .65rem; }
.preview .tags { margin-top: .5rem; }
.preview .tags .tag { background: var(--warn-bg); color: var(--warn-text); }

.bar { height: 10px; border-radius: 999px; background: var(--day-bg); overflow: hidden; }
.bar-night { display: block; height: 100%; width: 0; background: var(--night); border-radius: 999px; transition: width .35s ease; }

/* --- Récap -------------------------------------------------------------------- */
.person-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 0 1rem; }
.card.person { display: block; color: inherit; text-decoration: none; transition: transform .15s, box-shadow .15s; }
.card.person:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.person-head { display: flex; align-items: center; gap: .75rem; margin-bottom: .85rem; }
.person-head > div { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.person-head small { color: var(--muted); }
.person-paid { font-size: 1.7rem; font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.person-paid small { font-size: .9rem; color: var(--muted); font-weight: 600; }
.person-split { display: flex; justify-content: space-between; gap: .5rem; margin-top: .6rem; font-size: .88rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.person-split span { display: inline-flex; align-items: center; gap: .3rem; }

/* Tableau du récap (même forme que le tableau de paie) */
table.recap { font-size: 1rem; }
table.recap thead th { background: var(--brand); color: #fff; text-align: right; font-size: .78rem; }
table.recap thead th:first-child { background: var(--surface-2); }
table.recap tbody th { font-weight: 650; white-space: nowrap; }
table.recap td.num, table.recap tfoot .num { font-size: 1.05rem; }
table.recap tbody td:nth-child(3) { color: var(--night); }
table.recap tbody td:nth-child(4) { color: var(--sun); }
@media (min-width: 900px) { .recap-card { max-width: 860px; } .recap-note { max-width: 860px; } }
@media (max-width: 599.98px) {
  table.recap th, table.recap td { padding: .65rem .55rem; }
  table.recap thead th { font-size: .7rem; letter-spacing: .02em; }
  table.recap tbody th { white-space: normal; }
  table.recap .avatar, .hide-sm { display: none; }
}
@media (min-width: 600px) { .show-sm { display: none; } }

/* --- Équipe -------------------------------------------------------------------- */
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 0 1rem; align-items: start; }
@media (max-width: 400px) { .user-grid { grid-template-columns: 1fr; } }
.user-card.inactive { opacity: .65; }
.user-head { display: flex; align-items: center; gap: .75rem; }
.user-id { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.user-id small { color: var(--muted); overflow-wrap: anywhere; }
.badges { display: flex; flex-wrap: wrap; gap: .35rem; margin: .75rem 0 .2rem; }
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .15rem .6rem; border-radius: 999px; font-size: .76rem; font-weight: 700;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.badge .ico { width: 13px; height: 13px; }
.badge.brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.badge.warn { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }
.badge.danger { background: var(--err-bg); color: var(--err); border-color: transparent; }
.badge.muted { background: transparent; }
details.manage { margin-top: .6rem; border-top: 1px solid var(--border); padding-top: .4rem; }
details.manage summary {
  display: inline-flex; align-items: center; gap: .4rem; list-style: none;
  padding: .45rem .1rem; cursor: pointer; font-weight: 650; color: var(--brand); font-size: .92rem;
}
details.manage summary::-webkit-details-marker { display: none; }
details.manage[open] summary { margin-bottom: .6rem; }

/* --- Compte ------------------------------------------------------------------- */
.account-grid { display: grid; gap: 0 1rem; }
@media (min-width: 900px) {
  .account-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .account-grid .profile { grid-column: 1 / -1; }
}
.profile { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.profile > div { flex: 1; min-width: 12rem; display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; }
.profile strong { font-size: 1.15rem; }
.profile small { color: var(--muted); overflow-wrap: anywhere; }
.profile-logout { margin: 0; }
.steps { margin: .3rem 0 0; padding-left: 1.3rem; }
.steps li { margin: .25rem 0; }

/* --- Avatars ------------------------------------------------------------------ */
.avatar {
  --h: 210;
  flex: none; display: inline-grid; place-items: center;
  width: 42px; height: 42px; border-radius: 50%;
  font-size: .9rem; font-weight: 800; letter-spacing: .02em;
  color: hsl(var(--h) 55% 30%); background: hsl(var(--h) 70% 88%);
}
@media (prefers-color-scheme: dark) { .avatar { color: hsl(var(--h) 80% 85%); background: hsl(var(--h) 35% 28%); } }
.avatar.sm { width: 34px; height: 34px; font-size: .78rem; box-shadow: 0 0 0 2px rgba(255, 255, 255, .5); }
.avatar.xs { width: 22px; height: 22px; font-size: .6rem; vertical-align: middle; }
.avatar.lg { width: 64px; height: 64px; font-size: 1.3rem; }

/* --- Connexion ---------------------------------------------------------------- */
body.no-nav { background: radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--brand) 22%, var(--bg)), var(--bg)); min-height: 100vh; }
.auth { max-width: 400px; margin: 0 auto; padding-top: calc(var(--safe-t) + 6vh); text-align: center; }
.auth-logo img { border-radius: 20px; box-shadow: var(--shadow-lg); }
.auth h1 { margin: 1rem 0 .25rem; }
.auth .sub { margin: 0 0 1.5rem; }
.auth .card { text-align: left; padding: 22px; }
.auth > .btn { margin-top: .5rem; }

/* --- Encart astreinte (accueil, planning) -------------------------------------- */
.duty-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.duty-card {
  display: flex; align-items: center; gap: .8rem;
  padding: .85rem 1rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  color: inherit; text-decoration: none;
}
.duty-card > div { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.duty-card strong { font-size: .95rem; }
.duty-card span:not(.duty-ico):not(.avatar) { font-size: .88rem; color: var(--muted); }
.duty-ico { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: rgba(255, 255, 255, .18); }
.duty-ico .ico { width: 22px; height: 22px; }
.duty-ico.soft { background: var(--brand-soft); color: var(--brand); }
.duty-card.on {
  background: linear-gradient(135deg, #312e81, #4f46e5 60%, #6d63ff); border-color: transparent; color: #fff;
  box-shadow: 0 8px 24px rgba(79, 70, 229, .35);
}
.duty-card.on span:not(.duty-ico) { color: rgba(255, 255, 255, .85) !important; }
.duty-card.on .duty-ico { color: #fde68a; }

/* --- Planning ------------------------------------------------------------------ */
.plan-tools { display: grid; gap: 0 1rem; }
@media (min-width: 1100px) { .plan-tools { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; } }
details.tool > summary { list-style: none; cursor: pointer; margin: 0; }
details.tool > summary::-webkit-details-marker { display: none; }
details.tool > summary::after { content: "▾"; margin-left: auto; color: var(--muted); transition: transform .2s; }
details.tool[open] > summary { margin-bottom: .9rem; }
details.tool[open] > summary::after { transform: rotate(180deg); }
.field-btn { justify-content: flex-end; }
.rot-list { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .9rem; }
.rot-item {
  display: flex; align-items: center; gap: .55rem;
  padding: .35rem .5rem .35rem .7rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2);
}
.rot-item span { flex: 1; font-weight: 600; }
.rot-item input.order { width: 64px; min-height: 36px; padding: .3rem .5rem; text-align: center; }

.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; padding: .8rem 1rem; border-bottom: 1px solid var(--border); font-size: .88rem; font-weight: 600; }
.legend-item { display: inline-flex; align-items: center; gap: .4rem; }
.legend-item i { width: 14px; height: 14px; border-radius: 4px; background: hsl(var(--h) 62% 52%); }
.plan-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.plan { border-collapse: separate; border-spacing: 0; font-size: .7rem; }
table.plan th, table.plan td { padding: 0; text-align: center; }
table.plan .pname {
  position: sticky; left: 0; z-index: 2; background: var(--surface);
  min-width: 120px; max-width: 160px; padding: 0 .7rem; text-align: left; font-size: .82rem; font-weight: 650;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-right: 1px solid var(--border);
}
table.plan thead th { color: var(--muted); font-weight: 600; }
table.plan tr.pm th:not(.pname) { padding: .45rem 0 .1rem; text-align: left; padding-left: 4px; border-left: 1px solid var(--border); font-weight: 700; color: var(--text); }
table.plan tr.pw th:not(.pname) { padding: .15rem 0; border-left: 1px solid var(--border); background: var(--surface-2); }
table.plan tr.pw th.cur { background: var(--brand); color: #fff; }
table.plan tr.pd th:not(.pname) { min-width: 20px; height: 22px; font-variant-numeric: tabular-nums; }
table.plan th.we, table.plan td.we { background: var(--surface-2); }
table.plan th.today { background: var(--err); color: #fff; border-radius: 6px 6px 0 0; }
table.plan tbody th.pname { height: 30px; }
table.plan td { height: 30px; border-top: 1px solid var(--border); }
table.plan td.today { box-shadow: inset 2px 0 0 var(--err), inset -2px 0 0 var(--err); }
table.plan td.on { background: hsl(var(--h) 62% 52%); }
@media (prefers-color-scheme: dark) { table.plan td.on { background: hsl(var(--h) 55% 48%); } }
table.plan td.on + td.on { box-shadow: inset 1px 0 0 hsl(var(--h) 62% 45%); }
table.plan.editable td { cursor: pointer; }
table.plan.editable td:hover { outline: 2px solid var(--brand); outline-offset: -2px; }

.section-title { margin: 1.4rem 0 .7rem; }
.week-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: .5rem; }
.week {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem .7rem; border-radius: 14px; background: var(--surface); border: 1px solid var(--border);
}
.week.past { opacity: .55; }
.week.current { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.week-num { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--brand-soft); color: var(--brand); font-weight: 800; font-size: .9rem; }
.week-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .3rem; }
.week-dates { font-size: .82rem; color: var(--muted); display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.week-who { display: flex; flex-wrap: wrap; gap: .3rem; min-width: 0; }
details.past-weeks { margin-top: 1rem; }
details.past-weeks > summary {
  display: inline-flex; align-items: center; gap: .45rem; list-style: none; cursor: pointer;
  padding: .5rem .9rem; margin-bottom: .7rem; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); font-weight: 650; color: var(--brand); font-size: .9rem;
}
details.past-weeks > summary::-webkit-details-marker { display: none; }
.who-chip {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .2rem .7rem; border-radius: 999px; font-size: .85rem; font-weight: 700;
  color: hsl(var(--h) 60% 28%); background: hsl(var(--h) 70% 90%);
}
@media (prefers-color-scheme: dark) { .who-chip { color: hsl(var(--h) 80% 85%); background: hsl(var(--h) 35% 28%); } }
.who-chip.me { box-shadow: 0 0 0 2px hsl(var(--h) 62% 52%); }
.who-chip small { font-weight: 500; opacity: .8; }

/* --- Divers ------------------------------------------------------------------- */
.actions-card .btn-row { margin-bottom: .6rem; }
@media (max-width: 599.98px) {
  .actions-card .btn-row > *, .actions-card .btn-row form button { flex: 1 1 100%; width: 100%; }
}
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
@media print {
  .sidebar, .appbar, .tabbar, .install-banner, .btn, button, .chips { display: none !important; }
  body.has-nav .main { margin: 0; padding: 0; }
  .card { box-shadow: none; }
}
