/* IUT Hub — styles */
@font-face { font-family: "Inter"; src: url("fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("fonts/space-grotesk.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/jetbrains-mono.woff2") format("woff2"); font-weight: 100 800; font-display: swap; }

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --line: #e3e5ea;
  --text: #12141a;
  --muted: #5f6573;
  --accent: #17775f;
  --accent-soft: #e3f2ec;
  --on-accent: #ffffff;
  --good: #0e7a43;
  --good-soft: #e3f5ea;
  --bad: #c0262d;
  --bad-soft: #fde8e8;
  --warn: #8a4a00;
  --warn-soft: #fcefd9;
  --hero: #12141a; --hero-2: #1f232c; --hero-text: #ffffff; --hero-muted: #a9afbd; --hero-accent: #7fe0c0;
  --c-CM: #3d6fe0; --c-TD: #7a52cc; --c-TP: #13915a; --c-DS: #d13b3b; --c-SAE: #d97a06; --c-AUTRE: #6b7180;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(16 24 40 / .05), 0 1px 3px rgb(16 24 40 / .06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Space Grotesk", var(--font);
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --surface: #171a21; --surface-2: #1e222b; --line: #2a2f3a;
    --text: #e8eaf0; --muted: #9aa1b2; --accent: #4fcfa4; --accent-soft: #143329; --on-accent: #0b1f19;
    --good: #46c785; --good-soft: #13291e; --bad: #ff6b6b; --bad-soft: #351717; --warn: #f0a640; --warn-soft: #33240f;
    --hero: #0b0d11; --hero-2: #1e222b;
    --shadow: none; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); font-optical-sizing: auto; overflow-x: clip; }
h1 { font-size: 1.45rem; margin: 0 0 1rem; letter-spacing: -.01em; }
h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 .75rem; font-weight: 600; }
a { color: var(--accent); }
code, .mono { font-family: var(--mono); font-size: .9em; }
.muted { color: var(--muted); }
.big, .num, .note-chip, .eval .n, .stats .val, .kpis .big, .crow .time, .due .when, .table td.n { font-variant-numeric: tabular-nums; }
.big, .num { font-family: var(--display); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.small { font-size: .85rem; }
[hidden] { display: none !important; }

/* Barre du haut */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1.5rem;
  padding: .6rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .55rem; font-family: var(--display); font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.logo { width: 28px; height: 28px; flex-shrink: 0; color: var(--accent); }
.logo .bg { fill: currentColor; } .logo .fg { fill: var(--on-accent); stroke: var(--on-accent); }
/* min-width: 0 : la barre défile au lieu d'élargir la page */
.tabs { flex: 1; min-width: 0; display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; color: var(--muted); font: inherit; font-weight: 500;
  padding: .45rem .8rem; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--text); background: var(--surface-2); }
.tabs button.active { color: var(--accent); background: var(--accent-soft); }

/* Barre du bas + menu « Plus » : visibles uniquement sur téléphone */
.bottomnav, .more-sheet { display: none; }
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line);
  padding: .3rem .25rem calc(.3rem + env(safe-area-inset-bottom)); }
.bottomnav button { border: 0; background: none; font: inherit; color: var(--muted); cursor: pointer;
  display: grid; justify-items: center; gap: .15rem; padding: .3rem 0; border-radius: 10px;
  font-size: .68rem; font-weight: 600; -webkit-tap-highlight-color: transparent; }
.bottomnav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bottomnav button.active { color: var(--accent); }
.bottomnav button.active svg { background: var(--accent-soft); border-radius: 99px; padding: 2px 14px; box-sizing: content-box; margin: -2px 0; }
.more-sheet { position: fixed; inset: 0; z-index: 35; background: rgb(0 0 0 / .35); }
.more-box { position: absolute; left: .75rem; right: .75rem; bottom: calc(4.6rem + env(safe-area-inset-bottom));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .4rem; display: grid; }
.more-box button { border: 0; background: none; font: inherit; font-weight: 500; color: var(--text); text-align: left;
  padding: .8rem .9rem; border-radius: 8px; cursor: pointer; }
.more-box button + button { border-top: 1px solid var(--line); border-radius: 0; }
.more-box button.active { color: var(--accent); }

main { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }
.tab { display: none; }
.tab.active { display: block; }

/* Cartes */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; box-shadow: var(--shadow); min-width: 0; }
.grid-home { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.callout, .err, .crous-cat li, .modal dd { overflow-wrap: anywhere; }

/* Boutons / champs */
.btn { border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 500;
  padding: .45rem .9rem; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.ghost { background: transparent; }
.input, .select { width: 100%; font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px; padding: .45rem .6rem; }
.toolbar .select { width: auto; }
.form { display: grid; gap: .8rem; }
.form label { display: grid; gap: .3rem; font-weight: 500; font-size: .9rem; }
.form details summary { cursor: pointer; font-size: .9rem; color: var(--muted); }
.form-actions { grid-column: 1 / -1; display: flex; gap: 1rem; align-items: center; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.toolbar-title { margin: 0 0 0 .5rem; font-size: 1.2rem; }
.spacer { flex: 1; }
.legend { display: flex; align-items: center; gap: .35rem; font-size: .8rem; color: var(--muted); flex-wrap: wrap; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-left: .4rem; }
.t-CM { background: var(--c-CM); } .t-TD { background: var(--c-TD); } .t-TP { background: var(--c-TP); }
.t-DS { background: var(--c-DS); } .t-SAE { background: var(--c-SAE); } .t-AUTRE { background: var(--c-AUTRE); }

/* Grille EDT */
.edt { --hour: 56px; display: grid; grid-template-columns: 52px repeat(5, minmax(0, 1fr));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.edt .head { padding: .55rem .4rem; text-align: center; font-weight: 600; font-size: .85rem;
  border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); background: var(--surface); }
.edt .head .d { color: var(--muted); font-weight: 500; }
.edt .head.today { color: var(--accent); }
.edt .hours { position: relative; }
.edt .hours span { position: absolute; right: 6px; font-size: .72rem; color: var(--muted); transform: translateY(-50%); }
.edt .col { position: relative; border-left: 1px solid var(--line);
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--hour) - 1px), var(--line) calc(var(--hour) - 1px), var(--line) var(--hour)); }
.edt .col.today { background-color: var(--accent-soft); }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--bad); z-index: 3; }
.now-line::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.course { position: absolute; left: 3px; right: 3px; border-radius: 7px; padding: .3rem .45rem; overflow: hidden;
  font-size: .78rem; line-height: 1.25; cursor: pointer; border-left: 4px solid var(--c); background: color-mix(in srgb, var(--c) 14%, var(--surface));
  transition: transform .1s; }
.course:hover { transform: scale(1.015); z-index: 2; }
.course b { display: block; font-size: .82rem; }
.course .meta { color: var(--muted); }
.edt-empty { grid-column: 1 / -1; padding: 3rem; text-align: center; color: var(--muted); }

/* Liste du jour (téléphone) */
.daylist { display: none; }
.daylist h3 { margin: 0 0 .4rem; font-size: .95rem; }
.daylist h3.today { color: var(--accent); }

/* Ligne de cours (accueil / mobile) */
.crow { display: grid; grid-template-columns: 4.2rem 1fr; gap: .6rem; padding: .5rem 0; border-top: 1px solid var(--line); cursor: pointer; }
.crow:first-child { border-top: 0; }
.crow .time { font-family: var(--mono); font-size: .8rem; color: var(--muted); line-height: 1.35; }
.crow .what { border-left: 3px solid var(--c); padding-left: .55rem; min-width: 0; }
.crow .what b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crow.past { opacity: .5; }
.crow.now .time { color: var(--accent); font-weight: 600; }
.pill { display: inline-block; font-size: .7rem; font-weight: 600; padding: .05rem .4rem; border-radius: 99px;
  background: color-mix(in srgb, var(--c, var(--accent)) 18%, transparent); color: var(--c, var(--accent)); margin-right: .3rem; }

/* Notes */
.big { font-size: 2.2rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.ok { color: var(--good); } .ko { color: var(--bad); }
.stats { display: flex; gap: 1.6rem; flex-wrap: wrap; align-items: flex-end; }
.stats .lbl { font-size: .78rem; color: var(--muted); }
.stats .val { font-weight: 600; }
.ue-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); margin: 1rem 0 1.5rem; }
.ue { cursor: pointer; }
.ue .top { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.ue .code { font-weight: 700; }
.ue .titre { color: var(--muted); font-size: .85rem; }
.bar { height: 6px; border-radius: 99px; background: var(--surface-2); margin: .6rem 0 .3rem; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; }
.ue ul { list-style: none; padding: 0; margin: .6rem 0 0; display: none; font-size: .85rem; }
.ue.open ul { display: block; }
.ue li { display: flex; justify-content: space-between; gap: .5rem; padding: .25rem 0; border-top: 1px dashed var(--line); }
.ue li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.modules { display: grid; gap: .75rem; }
.module summary { list-style: none; cursor: pointer; display: flex; gap: .75rem; align-items: center; }
.module summary::-webkit-details-marker { display: none; }
.module summary .name { flex: 1; min-width: 0; }
.module summary .name b { margin-right: .4rem; }
.module summary .chev { transition: transform .15s; color: var(--muted); }
.module[open] summary .chev { transform: rotate(90deg); }
.evals { margin-top: .75rem; display: grid; gap: .25rem; }
.eval { display: grid; grid-template-columns: 1fr auto auto; gap: 1rem; align-items: center; padding: .4rem .5rem; border-radius: 8px; font-size: .88rem; }
.eval:nth-child(odd) { background: var(--surface-2); }
.eval .n { font-weight: 700; min-width: 3.2rem; text-align: right; }
.eval .ctx { color: var(--muted); font-size: .78rem; text-align: right; }
.new { display: inline-block; font-size: .65rem; font-weight: 700; padding: .05rem .35rem; border-radius: 99px; background: var(--accent); color: var(--on-accent); margin-left: .35rem; vertical-align: middle; }
.note-chip { font-weight: 700; padding: .1rem .5rem; border-radius: 7px; }
.note-chip.ok { background: var(--good-soft); } .note-chip.ko { background: var(--bad-soft); }

.steps { margin: 0; padding-left: 1.2rem; display: grid; gap: .5rem; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.err { color: var(--bad); }
.callout { padding: .7rem .9rem; border-radius: 9px; background: var(--surface-2); font-size: .88rem; }
.callout.err { background: var(--bad-soft); }

/* Modale / toast */
.modal { position: fixed; inset: 0; background: rgb(0 0 0 / .45); display: grid; place-items: center; z-index: 50; padding: 1rem; }
.modal[hidden] { display: none; }
.modal-box { background: var(--surface); border-radius: var(--radius); padding: 1.4rem; width: min(420px, 100%); position: relative; border-top: 5px solid var(--c, var(--accent)); }
.modal-close { position: absolute; top: .4rem; right: .6rem; border: 0; background: none; font-size: 1.5rem; color: var(--muted); cursor: pointer; }
.modal dl { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: 1rem 0 0; }
.modal dt { color: var(--muted); }
.modal dd { margin: 0; }
.toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: .6rem 1rem; border-radius: 9px; font-size: .9rem; z-index: 60; max-width: calc(100% - 2rem); }
.skeleton { height: 1rem; border-radius: 6px; background: var(--surface-2); margin: .4rem 0; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .5; } }

/* Segmented control */
.seg { display: inline-flex; max-width: 100%; overflow-x: auto; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.seg button { border: 0; background: none; font: inherit; font-weight: 500; color: var(--muted); padding: .35rem .85rem; border-radius: 7px; cursor: pointer; white-space: nowrap; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* Simulateur */
.sim-head { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); margin-bottom: 1.25rem; }
.sim-ue .now { display: flex; align-items: baseline; gap: .6rem; margin: .3rem 0; flex-wrap: wrap; }
.sim-ue .delta { font-size: .85rem; font-weight: 600; }
.sim-ue .need { font-size: .85rem; margin-top: .4rem; padding: .4rem .6rem; border-radius: 8px; background: var(--surface-2); }
.status { font-size: .72rem; font-weight: 700; padding: .1rem .45rem; border-radius: 99px; }
.status.ok { background: var(--good-soft); color: var(--good); } .status.ko { background: var(--bad-soft); color: var(--bad); }
.sim-eval { display: grid; grid-template-columns: 1fr 5.2rem 4.4rem 1.6rem; gap: .5rem; align-items: center; padding: .3rem .4rem; border-radius: 8px; font-size: .88rem; }
.sim-eval:nth-child(odd) { background: var(--surface-2); }
.sim-eval input { width: 100%; font: inherit; text-align: right; padding: .25rem .4rem; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.sim-eval input.changed { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.sim-eval input.pending { border-style: dashed; }
.sim-eval .x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; }
.sim-eval .lbl { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sim-eval .hdr { font-size: .72rem; color: var(--muted); text-align: right; }
.sim-tools { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: 1rem; }

/* Absences */
.kpis { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); margin-bottom: 1rem; }
.kpis .big { font-size: 1.8rem; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: .5rem; border-bottom: 1px solid var(--line); }
.table td { padding: .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table-wrap { overflow-x: auto; }
.tag { font-size: .72rem; font-weight: 600; padding: .1rem .45rem; border-radius: 99px; white-space: nowrap; }
.tag.absent { background: var(--bad-soft); color: var(--bad); }
.tag.justifie { background: var(--good-soft); color: var(--good); }
.tag.retard { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) 3.5rem; gap: .6rem; align-items: center; font-size: .88rem; padding: .25rem 0; }
.hbar .track { grid-column: 1 / -1; height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: -.2rem; }
.hbar .track span { display: block; height: 100%; background: var(--bad); border-radius: 99px; }

/* Resto U' */
.crous-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); }
.crous-day h3 { margin: 0 0 .6rem; font-size: 1rem; }
.crous-day.today { border-color: var(--accent); }
.crous-day.today h3 { color: var(--accent); }
.crous-cat { margin-bottom: .6rem; }
.crous-cat b { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.crous-cat ul { margin: .2rem 0 0; padding-left: 1.1rem; font-size: .9rem; }
.moment { font-size: .8rem; font-weight: 700; color: var(--accent); margin: .4rem 0; text-transform: capitalize; }

/* Bilan de l'année */
.status.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.callout.ok-callout { background: var(--good-soft); }
.year .table.blocs td.n { text-align: right; white-space: nowrap; }
.year .table.blocs th:nth-child(n+2):nth-child(-n+4) { text-align: right; }
.year .table { margin: .6rem 0 .8rem; }
.rule input { width: 3.4rem; font: inherit; padding: .15rem .35rem; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); text-align: center; }

/* Agenda (.ics) */
.copy-row { display: flex; gap: .5rem; align-items: center; }
.copy-row .input { font-family: var(--mono); font-size: .8rem; }

/* Tchat */
.chat-wrap { height: calc(100vh - 10rem); min-height: 420px; }
#chat-frame { width: 100%; height: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); display: block; }

/* Connexion */
.login { position: fixed; inset: 0; z-index: 70; background: var(--bg); overflow-y: auto; display: grid; place-items: center; padding: 1.5rem 1rem; }
.login-box { width: min(440px, 100%); }
.login-box .brand { font-size: 1.3rem; margin-bottom: 1rem; justify-content: center; }
.login .form { margin-top: .5rem; }
.login .reassure { background: var(--surface-2); border-radius: 9px; padding: .6rem .75rem; margin: 0; }
.login .btn.primary { width: 100%; padding: .6rem; }
.login [data-err]:empty { display: none; }
.top-user { display: flex; gap: .5rem; align-items: center; white-space: nowrap; }

.legal-links { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem 1.5rem; text-align: center; }

/* Échéances IRIS */
.due-group { margin-bottom: 1.25rem; }
.due-group h2 { margin-bottom: .5rem; }
.due { display: grid; grid-template-columns: auto 1fr auto; gap: .75rem; align-items: center; padding: .7rem .9rem; margin-bottom: .5rem; }
.due input[type=checkbox] { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); }
.due .t { font-weight: 600; overflow-wrap: anywhere; }
.due .c { font-size: .82rem; color: var(--muted); }
.due .when { text-align: right; font-size: .82rem; white-space: nowrap; }
.due .when b { display: block; font-size: .9rem; }
.due.late .when b { color: var(--bad); }
.due.soon .when b { color: var(--warn); }
.due.done { opacity: .5; }
.due.done .t { text-decoration: line-through; }
.warn-txt { color: var(--warn); font-weight: 600; }

/* ── Accueil ── */
.hello { margin: 0; font-family: var(--display); font-size: 2rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.hello-sub { margin: .25rem 0 1.25rem; color: var(--muted); }
.home { display: grid; gap: 1.1rem; }
.bento { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); align-items: start; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; margin-bottom: .75rem; }
.card-head h2 { margin: 0; }
.card-head a { font-size: .88rem; font-weight: 500; text-decoration: none; }
.card-head a:hover { text-decoration: underline; }

/* Carte « prochain cours » */
.hero { background: var(--hero); color: var(--hero-text); border-radius: 18px; padding: 1.6rem 1.9rem; display: grid; gap: 1.4rem; border: 1px solid var(--hero-2); }
.hero-main { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; cursor: pointer; }
.hero-main > div:first-child { min-width: 0; display: grid; gap: .55rem; }
.hero-lbl { font-size: .8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--hero-muted); }
.hero-title { margin: 0; font-family: var(--display); font-size: 1.85rem; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; text-transform: none; letter-spacing: -.01em; color: inherit; }
.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.1rem; color: #c9cdd6; }
.hero-meta .time { font-family: var(--mono); font-size: .92em; font-variant-numeric: tabular-nums; }
.hero-type { background: var(--c); color: #fff; font-size: .75rem; font-weight: 700; padding: .15rem .6rem; border-radius: 99px; }
.hero-count { text-align: right; flex-shrink: 0; }
.hero-count .num { font-size: 3.5rem; font-weight: 700; line-height: 1; color: var(--hero-accent); white-space: nowrap; }
.hero-count .num small { font-size: 1.5rem; margin-left: .2rem; }
.hero-count .lbl { color: var(--hero-muted); font-size: .88rem; margin-top: .35rem; }
.hero-progress { height: 6px; border-radius: 99px; background: var(--hero-2); overflow: hidden; margin-top: .3rem; }
.hero-progress span { display: block; height: 100%; background: var(--hero-accent); border-radius: 99px; }
.hero-empty { color: var(--hero-muted); margin: 0; }
.tl { display: grid; gap: .45rem; }
.tl-track { position: relative; height: 34px; background: var(--hero-2); border-radius: 10px; }
.tl-seg { position: absolute; top: 4px; bottom: 4px; background: var(--c); border: 0; color: #fff; font: inherit; font-size: .75rem; font-weight: 600;
  border-radius: 7px; padding: 0 .6rem; display: flex; align-items: center; overflow: hidden; white-space: nowrap; cursor: pointer; min-width: 6px; }
.tl-seg.past { opacity: .4; }
.tl-now { position: absolute; top: -4px; bottom: -4px; width: 2px; background: #ff6b6b; border-radius: 2px; pointer-events: none; }
.tl-ticks { display: flex; justify-content: space-between; font-family: var(--mono); font-size: .75rem; color: #8a909e; }

/* Moyenne */
.avg { display: flex; align-items: center; gap: 1.25rem; }
.ring { position: relative; width: 112px; height: 112px; flex-shrink: 0; }
.ring svg { display: block; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring .track { stroke: var(--surface-2); }
.ring .val { stroke: var(--accent); stroke-linecap: round; transition: stroke-dasharray .8s cubic-bezier(.2, .8, .2, 1); }
.ring.ko .val { stroke: var(--bad); }
.ring .center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .center .num { font-size: 1.75rem; font-weight: 700; line-height: 1; }
.ring .center small { color: var(--muted); font-size: .75rem; }
.ue-bars { flex: 1; min-width: 0; display: grid; gap: .55rem; }
.ue-bars .title { font-weight: 600; font-size: .92rem; }
.ue-bar .row { justify-content: space-between; font-size: .85rem; flex-wrap: nowrap; }
.ue-bar .row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ue-bar .bar { margin: .2rem 0 0; height: 5px; }
.avg-foot { margin: .9rem 0 0; font-size: .85rem; }

/* Listes de l'accueil (notes, échéances) */
.hl { display: flex; align-items: center; gap: .75rem; padding: .55rem 0; border-top: 1px solid var(--line); }
.hl:first-of-type { border-top: 0; padding-top: 0; }
.hl > div { flex: 1; min-width: 0; }
.hl .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hl .c { font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hl input[type=checkbox] { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); flex-shrink: 0; }
.chip { font-size: .75rem; font-weight: 700; padding: .15rem .55rem; border-radius: 99px; white-space: nowrap; color: var(--muted); }
.chip.late { background: var(--bad-soft); color: var(--bad); }
.chip.soon { background: var(--warn-soft); color: var(--warn); }
.new.pulse { animation: pop 1.6s ease-out 1; }
@keyframes pop { 0% { transform: scale(.6); } 25% { transform: scale(1.15); } 50%, 100% { transform: scale(1); } }

/* Resto U' en une ligne */
.crous-line { display: flex; align-items: center; gap: 1rem 2rem; flex-wrap: wrap; }
.crous-line .head { display: grid; gap: .1rem; min-width: 150px; }
.crous-line .head h2 { margin: 0; }
.crous-line .head a { font-size: .88rem; font-weight: 500; text-decoration: none; }
.crous-line .items { display: flex; gap: .75rem 2rem; flex: 1; flex-wrap: wrap; }
.crous-line .items div { min-width: 0; }
.crous-line .items b { display: block; font-size: .75rem; color: var(--muted); font-weight: 600; }
.crous-line .items span { font-weight: 600; }

/* Pastilles sur la navigation */
.badge { display: inline-grid; place-items: center; min-width: 1.1rem; height: 1.1rem; padding: 0 .3rem; border-radius: 99px;
  background: #c8323a; color: #fff; font-size: .68rem; font-weight: 700; line-height: 1; margin-left: .35rem; vertical-align: 1px; }
.badge.dot { min-width: 0; width: .55rem; height: .55rem; padding: 0; }
.badge:empty:not(.dot) { display: none; }
.bottomnav button { position: relative; }
.bottomnav .badge { position: absolute; top: .1rem; left: calc(50% + .4rem); margin: 0; border: 2px solid var(--surface); box-sizing: content-box; }

/* Transitions entre onglets */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  .ring .val { transition: none; }
  .new.pulse, .skeleton { animation: none; }
}

/* ════════ Responsive ════════ */

/* Tablette : grille EDT plus compacte */
@media (min-width: 761px) and (max-width: 1000px) {
  .topbar { padding: .6rem 1rem; gap: 1rem; }
  main { padding: 1.25rem 1rem; }
  .edt { grid-template-columns: 44px repeat(5, minmax(0, 1fr)); }
  .course { font-size: .72rem; padding: .25rem .35rem; }
  .course .meta { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Téléphone */
@media (max-width: 760px) {
  body { font-size: 14.5px; }
  h1 { font-size: 1.25rem; }

  /* Navigation : onglets du haut remplacés par la barre du bas */
  .topbar { padding: .65rem 1rem; }
  .tabs { display: none; }
  .bottomnav { display: grid; }
  .more-sheet:not([hidden]) { display: block; }

  main { padding: .9rem .75rem calc(5.5rem + env(safe-area-inset-bottom)); }
  .card { padding: .9rem; }
  .grid-home, .grid-2 { grid-template-columns: 1fr; }
  .hello { font-size: 1.5rem; }
  .hello-sub { margin-bottom: 1rem; font-size: .9rem; }
  .home, .bento { gap: .85rem; }
  .hero { padding: 1.1rem; gap: 1rem; border-radius: 16px; }
  .hero-main { gap: .8rem; }
  .hero-title { font-size: 1.25rem; }
  .hero-meta { font-size: .88rem; gap: .3rem .8rem; }
  .hero-count .num { font-size: 2.2rem; }
  .hero-count .num small { font-size: 1rem; }
  .hero-count .lbl { font-size: .78rem; }
  .tl-track { height: 26px; }
  .tl-seg { font-size: 0; padding: 0; }
  .ring { width: 92px; height: 92px; }
  .ring svg { width: 92px; height: 92px; }
  .ring .center .num { font-size: 1.4rem; }
  .crous-line { flex-direction: column; align-items: flex-start; gap: .6rem; }
  .crous-line .head { min-width: 0; }

  /* iOS zoome sur les champs en dessous de 16 px */
  .input, .select, .sim-eval input, .rule input { font-size: 16px; }

  /* Barres d'outils : titre sur sa propre ligne */
  .toolbar-title { order: -1; flex-basis: 100%; margin: 0 0 .25rem !important; font-size: 1.05rem; }
  .toolbar .spacer { display: none; }
  .toolbar .select { flex: 1; min-width: 0; }

  /* EDT : liste par jour au lieu de la grille */
  .edt { display: none; }
  .daylist { display: grid; gap: 1rem; }
  .crow { grid-template-columns: 3.4rem 1fr; }

  .big { font-size: 1.8rem; }
  .stats { gap: 1rem 1.4rem; }

  /* Évaluations : stats sous l'intitulé, note à droite */
  .eval { grid-template-columns: 1fr auto; gap: .2rem .75rem; }
  .eval .ctx { grid-column: 1; grid-row: 2; text-align: left; }
  .eval .n { grid-column: 2; grid-row: 1 / span 2; }

  .sim-eval { grid-template-columns: 1fr 4.2rem 3.6rem 1.6rem; gap: .35rem; }

  /* Fiche d'un cours : panneau en bas de l'écran */
  .modal { place-items: end center; padding: 0; }
  .modal-box { width: 100%; border-radius: var(--radius) var(--radius) 0 0; max-height: 85vh; overflow-y: auto;
    padding-bottom: calc(1.4rem + env(safe-area-inset-bottom)); }

  .table th, .table td { padding: .4rem .35rem; }
  .toast { bottom: calc(5rem + env(safe-area-inset-bottom)); }

  .chat-wrap { height: calc(100dvh - 11.5rem); min-height: 320px; }
  .legal-links { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
  .top-user .muted { display: none; }
}

/* Petits téléphones */
@media (max-width: 380px) {
  .sim-eval { grid-template-columns: 1fr 3.8rem 3.2rem 1.4rem; font-size: .82rem; }
  .table { font-size: .82rem; }
}
