:root {
  --navy: #0B2E3F;
  --navy-2: #0f4a63;
  --navy-deep: #061d29;
  --yellow: #EEEE22;
  --sky: #2a8fb8;
  --bg: #eaf2f6;
  --surface: #ffffff;
  --fg: #07131a;
  --muted: #425a68;
  --soft: #d3e0e7;
  --chip: rgba(11, 46, 63, .08);
  --line: #0B2E3F;
  --danger: #c0102f;
  --ok: #17803d;
  --shadow: 0 2px 4px rgba(11, 46, 63, .06), 0 8px 22px rgba(11, 46, 63, .10);
  --shadow-sm: 0 1px 3px rgba(11, 46, 63, .10);
  --r: 18px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #04121a; --surface: #0c2735; --fg: #ffffff; --muted: #bfd0d9; --soft: #1d4256;
    --chip: rgba(255, 255, 255, .10); --line: #EEEE22; --danger: #ff8a80; --ok: #5be08a;
    --shadow: 0 2px 4px rgba(0, 0, 0, .35), 0 8px 22px rgba(0, 0, 0, .35); --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 17px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
body.noscroll { overflow: hidden; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.ic { flex: none; vertical-align: -3px; }

/* ---------- En-tête ---------- */
.bar {
  background: linear-gradient(135deg, var(--navy-deep) 0%, var(--navy) 45%, var(--navy-2) 100%); color: #fff;
  display: flex; align-items: center; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 14px; position: sticky; top: 0; z-index: 5;
  border-radius: 0 0 22px 22px; box-shadow: 0 6px 18px rgba(6, 29, 41, .35);
}
.bar::after { content: ""; position: absolute; left: 22px; right: 22px; bottom: 0; height: 3px; background: var(--yellow); border-radius: 3px 3px 0 0; }
.logo { width: 40px; height: 40px; border-radius: 12px; flex: none; box-shadow: 0 0 0 2px rgba(238, 238, 34, .9); }
.bar .titles { flex: 1; min-width: 0; line-height: 1.15; }
.bar h1 { font-size: 1.12rem; margin: 0; letter-spacing: .01em; }
.bar .hello { font-size: .9rem; color: #cfe3ec; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .hello[hidden] { display: none; }
.icon { background: rgba(255, 255, 255, .12); color: #fff; border: 1.5px solid rgba(255, 255, 255, .55); border-radius: 12px; padding: 8px 14px; font-size: .92rem; font-weight: 700; }
.banner { margin: 10px 12px 0; background: var(--yellow); color: var(--navy); font-weight: 800; font-size: .9rem; padding: 6px 14px; border-radius: 999px; text-align: center; box-shadow: var(--shadow-sm); }
.banner.err { background: var(--danger); color: #fff; }
.install { margin: 10px 12px 0; display: flex; align-items: center; gap: 10px; background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; padding: 10px 10px 10px 16px; font-weight: 600; border-radius: var(--r); box-shadow: var(--shadow); }
.install[hidden] { display: none; }
.install span { flex: 1; }
.install .go { background: var(--yellow); color: var(--navy); border: 0; border-radius: 12px; padding: 10px 16px; font-weight: 800; min-height: 44px; }
.install .x { background: none; border: 0; color: #fff; padding: 8px; }
main { padding: 12px 12px 48px; max-width: 760px; margin: 0 auto; }

/* ---------- Connexion ---------- */
.login-hero { text-align: center; padding: 28px 8px 8px; }
.login-hero img { width: 92px; height: 92px; border-radius: 24px; box-shadow: 0 0 0 3px var(--yellow), var(--shadow); }
.login-hero h2 { font-size: 1.55rem; margin: 16px 0 4px; color: var(--navy); }
@media (prefers-color-scheme: dark) { .login-hero h2 { color: #fff; } }
.login-hero p { margin: 0; color: var(--muted); }
.login { background: var(--surface); border-radius: 22px; padding: 6px 18px 20px; margin-top: 18px; box-shadow: var(--shadow); }
button.primary {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff; border: 0; border-radius: 14px;
  padding: 14px 20px; font-weight: 800; width: 100%; min-height: 56px; box-shadow: 0 0 0 3px var(--yellow), 0 6px 16px rgba(11, 46, 63, .3); font-size: 1.05rem;
}
button.primary:disabled { opacity: .6; }
label { display: block; font-weight: 800; margin: 16px 0 6px; }
input { width: 100%; padding: 14px; border: 2px solid var(--soft); border-radius: 14px; background: var(--bg); min-height: 54px; }
input:focus { outline: 3px solid var(--yellow); outline-offset: 1px; border-color: var(--navy); }
input.code { font-size: 1.9rem; letter-spacing: .4em; text-align: center; font-weight: 800; }
.msg { margin: 12px 0; font-weight: 600; }
.msg.err { color: var(--danger); }
.link { background: none; border: 0; text-decoration: underline; padding: 8px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }

/* ---------- Bascule Mon planning / Équipe ---------- */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 2px 0 12px; padding: 4px; background: var(--soft); border-radius: 16px; }
.seg button { border: 0; background: transparent; min-height: 46px; font-weight: 800; border-radius: 12px; color: var(--muted); transition: background .15s, color .15s; }
.seg button[aria-pressed="true"] { background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; box-shadow: 0 2px 8px rgba(11, 46, 63, .35), inset 0 -3px 0 var(--yellow); }

/* ---------- Bandeau de jours ---------- */
.strip { display: grid; grid-template-columns: 30px repeat(7, 1fr) 30px; gap: 4px; align-items: stretch; margin: 2px 0 12px; background: var(--surface); padding: 8px 4px; border-radius: 20px; box-shadow: var(--shadow); }
.sarrow { background: none; border: 0; padding: 0; color: var(--navy); border-radius: 10px; }
@media (prefers-color-scheme: dark) { .sarrow { color: var(--yellow); } }
.sday { border: 0; background: transparent; border-radius: 14px; padding: 6px 0 5px; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 68px; transition: transform .12s, background .15s; }
.sday .sw { font-size: .7rem; text-transform: uppercase; color: var(--muted); font-weight: 800; letter-spacing: .04em; }
.sday .sn { font-size: 1.28rem; font-weight: 800; }
.sday .sc { font-size: .7rem; min-height: 1.15em; font-weight: 800; }
.sday .sc.on { background: var(--yellow); color: var(--navy); border-radius: 9px; padding: 0 6px; }
.sday.today .sn { color: var(--sky); }
.sday.today::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--sky); }
.sday.sel { background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff; box-shadow: 0 4px 12px rgba(11, 46, 63, .4), 0 0 0 2px var(--yellow); transform: translateY(-1px); }
.sday.sel .sw { color: #d6e6ee; }
.sday.sel .sn { color: #fff; }
.sday.sel::after { background: var(--yellow); }

.dayhead { display: flex; align-items: flex-end; justify-content: space-between; margin: 6px 4px 4px; }
.dh-wd { font-size: .85rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--sky); }
.dh-date { font-size: 1.7rem; font-weight: 800; line-height: 1.1; }
.todaybtn { border: 0; background: var(--navy); color: var(--yellow); border-radius: 999px; padding: 8px 16px; font-weight: 800; box-shadow: var(--shadow-sm); }
.who { color: var(--muted); display: flex; align-items: center; justify-content: space-between; margin: 4px 4px 4px; font-weight: 700; font-size: .95rem; }
.who .count { background: var(--chip); border-radius: 999px; padding: 3px 12px; color: var(--fg); }
.refresh { background: none; border: 0; padding: 8px; color: var(--muted); }
.viewing { display: flex; align-items: center; gap: 8px; margin: 2px 0 8px; }

/* ---------- Navigation jour (vue équipe) ---------- */
.nav { display: grid; grid-template-columns: 54px 1fr 54px; align-items: center; gap: 10px; margin: 4px 0 10px; }
.nav button { background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; border: 0; border-radius: 16px; min-height: 52px; box-shadow: var(--shadow-sm); }
.nav .title { background: none; color: var(--fg); font-size: 1.3rem; font-weight: 800; box-shadow: none; }
.search { padding: 12px 16px; min-height: 50px; margin-bottom: 10px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.fchip { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 0; background: var(--surface); border-radius: 999px; padding: 8px 14px; font-weight: 800; min-height: 40px; box-shadow: var(--shadow-sm); }
.fchip .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--pc); display: inline-block; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--pc); }
.fchip.on { background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; box-shadow: 0 0 0 2px var(--yellow); }
.phead { display: flex; align-items: center; gap: 10px; margin: 18px 2px 6px; position: sticky; top: 74px; background: var(--bg); padding: 6px 0; z-index: 2; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: linear-gradient(135deg, var(--navy), var(--sky)); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; box-shadow: 0 0 0 2px var(--yellow); flex: none; }
.pname { flex: 1; display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.pname strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pname small { color: var(--muted); font-weight: 600; }
.pweek { background: var(--surface); border: 0; border-radius: 999px; padding: 8px 12px; font-weight: 800; display: inline-flex; align-items: center; gap: 2px; box-shadow: var(--shadow-sm); }

/* ---------- Cartes ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.card {
  display: grid; grid-template-columns: 76px 1fr; gap: 12px; width: 100%; text-align: left; position: relative; overflow: hidden;
  background: var(--surface); border: 0; border-radius: var(--r); padding: 10px 12px 10px 10px; margin: 10px 0; box-shadow: var(--shadow);
  animation: rise .35s ease-out both; animation-delay: calc(var(--i, 0) * 45ms);
}
.card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--pc, var(--yellow)); }
.card:active { transform: scale(.985); transition: transform .08s; }
.tcol {
  background: var(--pc, var(--navy)); color: var(--pt, #fff); border-radius: 14px; text-align: center; line-height: 1.15;
  padding: 10px 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; align-self: stretch;
}
.tcol .ts { font-size: 1.3rem; font-weight: 800; }
.tcol .ts.day { font-size: .95rem; }
.tcol .te { font-weight: 700; opacity: .85; }
.tcol .td { margin-top: 5px; font-size: .78rem; font-weight: 800; background: rgba(255, 255, 255, .88); color: #0a1a22; border-radius: 8px; padding: 1px 7px; }
.cbody { min-width: 0; padding-top: 4px; }
.ctop { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ctop .sp { flex: 1; }
.tag { display: inline-block; border-radius: 8px; padding: 1px 9px; font-weight: 800; font-size: .9rem; box-shadow: var(--shadow-sm); }
.dayn { font-weight: 800; font-size: .82rem; color: var(--muted); background: var(--chip); border-radius: 999px; padding: 0 8px; }
.ctitle { font-size: 1.1rem; margin: 4px 0 0; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.psub { color: var(--muted); font-size: .88rem; }
.cmeta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: .88rem; font-weight: 700; }
.mi { display: inline-flex; align-items: center; gap: 5px; background: var(--chip); border-radius: 999px; padding: 3px 10px; max-width: 100%; }
.ccomment { margin-top: 8px; color: var(--muted); font-size: .88rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cwho { margin-top: 6px; font-weight: 800; font-size: .9rem; display: flex; align-items: center; gap: 4px; }
.pill { font-size: .78rem; font-weight: 800; border-radius: 999px; padding: 2px 10px; background: var(--chip); color: var(--fg); white-space: nowrap; }
.pill.s-todo { background: #dbeaf5; color: #0b3a57; }
.pill.s-in_progress { background: var(--yellow); color: var(--navy); }
.pill.s-done { background: var(--ok); color: #fff; }
@media (prefers-color-scheme: dark) { .pill.s-todo { background: #1d4a66; color: #fff; } .pill.s-done { color: #04210f; } }
.empty { text-align: center; padding: 28px 0 10px; font-size: 1.2rem; font-weight: 800; color: var(--muted); }
.empty svg { display: block; margin: 0 auto 8px; }
.empty small { display: block; font-size: .95rem; font-weight: 600; margin-top: 2px; }

/* Avertissement d'aptitude */
.warn { display: inline-flex; align-items: center; gap: 4px; background: var(--danger); color: #fff; font-weight: 800; font-size: .78rem; border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.warn.big { font-size: .95rem; padding: 4px 14px; margin-right: 8px; }
@media (prefers-color-scheme: dark) { .warn { color: #1a0000; } }

/* ---------- Fiche détaillée ---------- */
.sheet { position: fixed; inset: 0; z-index: 20; background: var(--bg); overflow-y: auto; transform: translateY(100%); transition: transform .24s cubic-bezier(.2, .8, .2, 1); padding-bottom: env(safe-area-inset-bottom); }
.sheet[hidden] { display: none; }
.sheet.open { transform: none; }
.sh-top { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 12px 12px; z-index: 2; border-radius: 0 0 22px 22px; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }
.sh-back { background: rgba(255, 255, 255, .22); border: 0; color: inherit; font-weight: 800; display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px 0 8px; border-radius: 14px; }
.sh-proj { font-weight: 800; text-align: right; }
.sh-body { padding: 16px 14px 40px; max-width: 760px; margin: 0 auto; }
.sh-hero { background: var(--surface); border-radius: 22px; padding: 16px 18px; box-shadow: var(--shadow); border-top: 6px solid var(--pc, var(--yellow)); }
.sh-time .big { font-size: 2.2rem; font-weight: 800; letter-spacing: -.01em; }
.sh-time .dur { margin-left: 10px; font-weight: 800; color: var(--muted); background: var(--chip); border-radius: 999px; padding: 2px 12px; font-size: .95rem; }
.sh-date { color: var(--sky); font-weight: 800; margin-top: 2px; }
.sh-title { font-size: 1.5rem; line-height: 1.2; margin: 12px 0 6px; }
.sh-status { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.sh-status .pill { font-size: .95rem; padding: 4px 14px; }
.drows { margin-top: 14px; background: var(--surface); border-radius: 22px; padding: 4px 18px; box-shadow: var(--shadow); }
.drow { padding: 12px 0; border-bottom: 1.5px solid var(--soft); }
.drow:last-child { border-bottom: 0; }
.dk { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--sky); font-weight: 800; display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.dv { font-size: 1.1rem; font-weight: 700; overflow-wrap: anywhere; }
.dv a, .sh-comment a { color: inherit; font-weight: 800; }
.mates { margin: 0; padding-left: 20px; }
.cmwrap { margin-top: 14px; background: var(--surface); border-radius: 22px; padding: 12px 18px 16px; box-shadow: var(--shadow); }
.sh-comment { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1.05rem; }

/* ---------- Écran d'installation ---------- */
.ins-screen { position: fixed; inset: 0; z-index: 30; background: radial-gradient(circle at 50% 0%, var(--navy-2) 0%, var(--navy) 50%, var(--navy-deep) 100%); color: #fff; display: flex; align-items: center; justify-content: center; padding: 24px; overflow-y: auto; }
.ins-box { max-width: 420px; width: 100%; text-align: center; }
.ins-logo { border-radius: 24px; box-shadow: 0 0 0 3px var(--yellow), 0 10px 30px rgba(0, 0, 0, .4); }
.ins-box h2 { font-size: 1.6rem; margin: 16px 0 6px; }
.ins-sub { color: #dbe6ec; margin: 0 0 24px; }
.ins-go { display: block; width: 100%; min-height: 64px; background: var(--yellow); color: var(--navy); border: 0; border-radius: 18px; font-size: 1.3rem; font-weight: 800; box-shadow: 0 8px 24px rgba(238, 238, 34, .3); }
.ins-go:disabled { opacity: .6; }
.ins-steps { text-align: left; padding-left: 22px; font-size: 1.1rem; line-height: 1.5; }
.ins-steps li { margin: 12px 0; }
.ins-ic { display: inline-flex; vertical-align: middle; background: #fff; color: var(--navy); border-radius: 8px; padding: 4px; margin: 0 2px; }
.ins-note { color: #dbe6ec; font-size: 1.05rem; }
.ins-skip { margin-top: 28px; background: none; border: 0; color: #dbe6ec; text-decoration: underline; font-size: 1rem; padding: 12px; }
.ins-done { width: 84px; height: 84px; margin: 0 auto; border-radius: 50%; background: var(--yellow); color: var(--navy); display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 24px rgba(238, 238, 34, .35); }

@media (min-width: 560px) { body { font-size: 18px; } }
@media (max-width: 360px) { .card { grid-template-columns: 64px 1fr; } .tcol .ts { font-size: 1.15rem; } .strip { grid-template-columns: 24px repeat(7, 1fr) 24px; gap: 2px; } .dh-date { font-size: 1.45rem; } }
@media (prefers-reduced-motion: reduce) { .sheet, .card { transition: none; animation: none; } }
.ins-open { text-align: center; text-decoration: none; line-height: 64px; margin-top: 22px; }
/* sh-time-fix : heures et duree sur une ligne, la pastille passe entiere sous les heures si la place manque */
.sh-time { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.sh-time .big, .sh-time .dur { white-space: nowrap; }
.sh-time .dur { margin-left: 0; }
