/* Campus Web — espace de travail pour ordinateur : barre latérale, tableaux, grille de la semaine.
   Surfaces neutres ; la couleur du thème ne sert qu'aux actions, à la sélection et aux repères. */
@font-face { font-family: "Inter"; src: url("/assets/fonts/Inter-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/assets/fonts/Inter-SemiBold.ttf") format("truetype"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/assets/fonts/Poppins-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  color-scheme: light dark;
  --bg: #f5f6f8; --surface: #ffffff; --ink: #14181d; --muted: #5d6671; --line: #e3e6ea; --hover: #f0f2f5;
  --accent: #23717d; --navy: #2e5077; --alert: #b3372a; --ok: #1d7a55;
  --shadow: 0 1px 2px rgba(20, 24, 29, 0.05); --radius: 12px; --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --block-l: 93%; --block-ink: 24%; --block-s: 60%;
}
[data-theme="blue"] { --accent: #2c6387; --navy: #17324d; }
[data-theme="graphite"] { --accent: #46566a; --navy: #253142; }
@media (prefers-color-scheme: dark) {
  :root { --bg: #0d0f12; --surface: #15181c; --ink: #eef1f4; --muted: #98a2ad; --line: #262b32; --hover: #1c2026;
    --accent: #6cc7cf; --navy: #2e5077; --alert: #ff8f80; --ok: #6fd3a5; --shadow: none; --block-l: 19%; --block-ink: 90%; --block-s: 32%; }
  [data-theme="blue"] { --accent: #8fc0e0; }
  [data-theme="graphite"] { --accent: #b4c0ce; }
}
:root { --accent-soft: color-mix(in srgb, var(--accent) 13%, transparent); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 0.9375rem/1.45 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; text-align: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.alert { color: var(--alert); }
.fine { font-size: 0.8125rem; color: var(--muted); }
.nowrap { white-space: nowrap; }
.noscript { padding: 40px; text-align: center; }
[hidden] { display: none !important; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { to { background-position: -200% 0; } }
.rise { animation: rise 0.45s var(--ease) both; }
::view-transition-old(root) { animation: 0.12s ease-in both vt-out; }
::view-transition-new(root) { animation: 0.28s var(--ease) both vt-in; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- structure ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100dvh; }
.nav { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 18px; padding: 16px 12px; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px; color: var(--ink); font: 700 1.1rem "Poppins", sans-serif; }
.brand:hover { text-decoration: none; }
.brand img { border-radius: 8px; }
.brand small { padding: 2px 7px; border-radius: 6px; background: var(--hover); color: var(--muted); font: 600 0.7rem "Inter", sans-serif; letter-spacing: 0.04em; text-transform: uppercase; }
.nav-group { display: grid; gap: 2px; }
.nav-group p { padding: 0 10px 6px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.nav-group a { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 10px; border-radius: 8px; color: var(--ink); font-weight: 500; transition: background 0.15s; }
.nav-group a:hover { background: var(--hover); text-decoration: none; }
.nav-group a[aria-current] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-group svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-group:last-of-type { margin-top: auto; }
.account { display: flex; align-items: center; gap: 10px; padding: 12px 6px 0; border-top: 1px solid var(--line); }
.account div { display: grid; min-width: 0; flex: 1; font-size: 0.85rem; }
.account strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 600; font-size: 0.78rem; letter-spacing: 0.02em; }
.avatar[style*="--h"] { background: hsl(var(--h) 42% 46%); }
.avatar.large { width: 44px; height: 44px; font-size: 0.95rem; }
.sender { display: flex; align-items: center; gap: 12px; }
.sender div { display: grid; font-size: 0.9rem; }
.scrim { display: none; }
#view { min-width: 0; }
.bar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 16px; min-height: 64px; padding: 10px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.bar-title { min-width: 0; margin-right: auto; }
.bar h1 { font: 700 1.25rem/1.2 "Poppins", sans-serif; letter-spacing: -0.01em; }
.bar-title p { font-size: 0.85rem; min-height: 1.3em; }
.bar-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.button.menu { display: none; }
.content { padding: 22px 28px 48px; max-width: 1320px; display: grid; gap: 16px; animation: rise 0.4s var(--ease) both; }
.content > div { display: grid; gap: 16px; min-width: 0; }
.narrow { max-width: 620px; }
@media (prefers-reduced-transparency: reduce) { .bar { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; } }

@media (max-width: 900px) {
  .shell { display: block; }
  .nav { position: fixed; z-index: 10; left: 0; top: 0; width: 264px; transform: translateX(-100%); transition: transform 0.25s var(--ease); }
  .nav-open .nav { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, 0.3); }
  .nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 9; background: rgba(0, 0, 0, 0.4); }
  .button.menu { display: inline-flex; }
  .bar { padding: 8px 14px; flex-wrap: wrap; }
  .bar-actions { width: 100%; justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; }
  .content { padding: 14px 14px 40px; }
  .nav-group a { min-height: 44px; }
}

/* ---------- commandes ---------- */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 8px; background: var(--accent); color: var(--surface); font-weight: 600; white-space: nowrap; transition: background 0.15s, transform 0.1s; }
.button:active { transform: scale(0.98); }
.button:disabled { opacity: 0.55; cursor: default; }
.button.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow); }
.button.ghost:hover { background: var(--hover); }
.button.icon { width: 36px; padding: 0; font-size: 1.1rem; }
.button.danger { background: none; border: 1px solid var(--line); color: var(--alert); justify-self: start; }
.button.quiet { background: none; color: var(--accent); }
.button.quiet:hover { background: var(--accent-soft); }
.segmented { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--hover); border: 1px solid var(--line); }
.segmented button { min-height: 30px; padding: 0 12px; border-radius: 6px; font-weight: 500; color: var(--muted); white-space: nowrap; transition: background 0.15s, color 0.15s; }
.segmented button[aria-selected="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
.stepper { display: flex; gap: 6px; }
.input { width: 100%; min-height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; }
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 99px; background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.tag.alert { background: color-mix(in srgb, var(--alert) 13%, transparent); color: var(--alert); }

/* ---------- blocs ---------- */
.panel { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 0.95rem; font-weight: 600; }
.panel-head a { font-size: 0.85rem; font-weight: 600; }
.panel > .skeletons, .panel > .empty { margin: 14px 16px; }
.columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.columns.wide-left { grid-template-columns: minmax(0, 1fr) 320px; }
.stack { display: grid; gap: 16px; }
@media (max-width: 1100px) { .columns, .columns.wide-left { grid-template-columns: minmax(0, 1fr); } }
.skeletons { display: grid; gap: 8px; }
.skeleton { height: 38px; border-radius: 8px; background: linear-gradient(90deg, var(--hover) 25%, var(--line) 50%, var(--hover) 75%) 0 0 / 200% 100%; animation: shimmer 1.3s linear infinite; }
.empty { padding: 30px 16px; display: grid; gap: 6px; justify-items: center; text-align: center; }
.empty h3 { font-size: 1rem; }

.kpis { display: grid !important; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px !important; }
.kpi { display: grid; gap: 2px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); cursor: pointer; transition: border-color 0.15s, transform 0.2s var(--ease); }
.kpi:hover { border-color: var(--accent); transform: translateY(-1px); }
.kpi-label { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.kpi strong { font: 700 1.7rem/1.25 "Poppins", sans-serif; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi span { font-size: 0.85rem; }

.subject { display: inline-flex; align-items: center; gap: 9px; font-weight: 500; min-width: 0; }
.subject-name { overflow: hidden; text-overflow: ellipsis; }
.emoji { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: hsl(var(--h) 65% 50% / 0.14); font-size: 0.95rem; line-height: 1; }
.emoji.large { width: 46px; height: 46px; border-radius: 12px; font-size: 1.5rem; }
.rows > li + li { border-top: 1px solid var(--line); }
.rows > li { animation: rise 0.35s var(--ease) both; }
.rows > li:nth-child(2) { animation-delay: 0.03s; } .rows > li:nth-child(3) { animation-delay: 0.06s; } .rows > li:nth-child(n+4) { animation-delay: 0.09s; }
.row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 8px 16px; color: var(--ink); transition: background 0.12s; }
a.row:hover, button.row:hover { background: var(--hover); text-decoration: none; }
.row[aria-current] { background: var(--accent-soft); }
.row-end { margin-left: auto; font-size: 0.85rem; }
.chevron { font-size: 1.2rem; color: var(--muted); }
.grow { flex: 1; min-width: 0; }
.with-check { display: flex; align-items: stretch; }
.with-check.done .subject { text-decoration: line-through; color: var(--muted); }
.check { flex: none; width: 46px; display: grid; place-items: center; }
.check::before { content: ""; width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--muted); transition: background 0.15s, border-color 0.15s; }
.check[aria-checked="true"]::before { border-color: var(--accent); background: var(--accent) center / 12px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M2 7.5l3.2 3L12 3.5' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.session { display: grid; gap: 4px; padding: 12px 16px; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }

.timeline li { display: grid; grid-template-columns: 56px 1fr; gap: 12px; padding: 10px 16px; border-left: 3px solid hsl(var(--h) 58% 50%); animation: rise 0.35s var(--ease) both; }
.timeline li + li { border-top: 1px solid var(--line); }
.timeline time { font-weight: 600; font-variant-numeric: tabular-nums; }
.timeline time span { display: block; font-weight: 400; color: var(--muted); font-size: 0.85rem; }
.timeline div { display: grid; min-width: 0; }
.timeline div span { font-size: 0.85rem; }

/* ---------- tableaux ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 9px 16px; text-align: left; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: var(--hover); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.strong { font-weight: 600; }
td small { color: var(--muted); font-weight: 400; }
.sort { font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; }
.sort[aria-pressed="true"] { color: var(--ink); }
.sort[aria-pressed="true"]::after { content: " ↓"; }
.expander { display: flex; align-items: center; gap: 8px; width: 100%; }
.expander::before { content: "›"; color: var(--muted); transition: transform 0.2s; }
.expander[aria-expanded="true"]::before { transform: rotate(90deg); }
tr.detail > td { padding: 0 0 0 26px; background: var(--bg); }
tr.detail:hover { background: none; }
.trend { margin-left: 6px; font-size: 0.6rem; vertical-align: 2px; }
.trend.up { color: var(--ok); } .trend.down { color: var(--alert); }
.figure { padding: 14px 16px 4px; }
.big { font: 700 2.6rem/1.1 "Poppins", sans-serif; font-variant-numeric: tabular-nums; }
.figure small { color: var(--muted); font-weight: 600; margin-left: 4px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; padding: 10px 16px 16px; }
.facts dt { color: var(--muted); }
.facts dd { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.panel > .fine, .panel > .button, .panel > .swatches { margin: 0 16px 14px; }
.chart { display: block; width: 100%; height: auto; padding: 12px 10px; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1s 0.1s var(--ease) forwards; }
.chart-area { fill: var(--accent-soft); }
.chart-dot { fill: var(--accent); }
@keyframes draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .chart-line { stroke-dashoffset: 0; } }
@media (max-width: 700px) { .wide { display: none; } th, td { padding-left: 12px; padding-right: 12px; } }

/* ---------- liste + détail ---------- */
.split { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 16px; align-items: start; }
.split.single { grid-template-columns: minmax(0, 1fr); }
.split.single .split-detail { display: none; }
.split-list { display: grid; gap: 16px; min-width: 0; }
.split-list > div { display: grid; gap: 16px; }
.split-detail { position: sticky; top: 80px; min-width: 0; }
.reader { padding: 18px; display: grid; gap: 10px; align-content: start; min-height: 240px; outline: none; }
.reader h2 { font-size: 1.15rem; }
.back { display: none; margin-bottom: 10px; }
.mail { align-items: flex-start; }
.mail-text { display: grid; min-width: 0; flex: 1; }
.mail-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.mail.unread strong { font-weight: 700; } .mail.unread .mail-text span { color: var(--ink); }
.dot { flex: none; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; }
.mail.unread .dot { background: var(--accent); }
@media (max-width: 900px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .split-detail { display: none; position: static; }
  .split.reading .split-list { display: none; }
  .split.reading .split-detail { display: block; animation: rise 0.3s var(--ease) both; }
  .back { display: inline-flex; }
}

/* ---------- grille de la semaine ---------- */
.week-wrap { overflow-x: auto; }
.week { display: grid; grid-template-columns: 52px repeat(var(--days), minmax(128px, 1fr)); grid-template-rows: auto calc(var(--hours) * 62px); min-width: 0; }
.week-day { padding: 10px 8px; text-align: center; font-size: 0.8rem; color: var(--muted); border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); }
.week-day strong { display: block; font-size: 1.1rem; color: var(--ink); }
.week-day.today strong { color: var(--accent); }
.week-corner { border-bottom: 1px solid var(--line); }
.week-hours { position: relative; }
.week-hours span { position: absolute; right: 8px; transform: translateY(-50%); font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.week-hours span:first-child { transform: none; }
.week-col { position: relative; border-left: 1px solid var(--line); background: repeating-linear-gradient(to bottom, transparent 0 61px, var(--line) 61px 62px); }
.week-col.today { background-color: var(--accent-soft); }
.block { text-align: left; cursor: pointer; font: inherit; position: absolute; left: 4px; right: 4px; display: grid; align-content: start; gap: 1px; padding: 6px 8px; overflow: hidden; border-radius: 7px; border-left: 3px solid hsl(var(--h) 58% 50%);
  background: hsl(var(--h) var(--block-s) var(--block-l)); color: hsl(var(--h) 45% var(--block-ink)); font-size: 0.78rem; line-height: 1.3; animation: rise 0.4s var(--ease) both; transition: box-shadow 0.15s, transform 0.15s; }
.block:hover, .block:focus-visible { z-index: 2; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18); transform: scale(1.02); }
.block strong { font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.block span { opacity: 0.85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.block em { font-style: normal; font-weight: 700; }
.block.cancelled { opacity: 0.55; } .block.cancelled strong { text-decoration: line-through; }
.now { position: absolute; left: 0; right: 0; height: 2px; background: var(--alert); z-index: 1; }
.now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--alert); }

/* ---------- fichiers ---------- */
.browser-bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-right: auto; min-width: 0; color: var(--muted); }
.crumb { padding: 4px 8px; border-radius: 6px; font-weight: 500; color: var(--muted); }
.crumb:hover { background: var(--hover); }
.crumb[aria-current] { color: var(--ink); font-weight: 600; }
.search { max-width: 220px; }
.panel > .fine[role="status"] { margin: 0; padding: 8px 16px; min-height: 2.2em; border-top: 1px solid var(--line); }
.file { display: flex; align-items: center; gap: 10px; width: 100%; font-weight: 500; }
.file:hover span:last-child { color: var(--accent); text-decoration: underline; }
.file-name { overflow-wrap: anywhere; }
.file .chevron { margin-left: auto; }
/* Icône de fichier : une couleur par famille, comme dans le Finder ; le dossier a sa propre forme. */
.file-icon { --k: 212; flex: none; position: relative; display: grid; place-items: center; width: 30px; height: 36px; border-radius: 4px 9px 4px 4px; background: hsl(var(--k) 60% 50% / 0.13); color: hsl(var(--k) 55% 40%); font-size: 0.58rem; font-weight: 800; letter-spacing: 0.02em; }
.file-icon::after { content: ""; position: absolute; top: 0; right: 0; width: 9px; height: 9px; border-radius: 0 9px 0 4px; background: hsl(var(--k) 60% 50% / 0.25); }
.file-icon.pdf { --k: 4; } .file-icon.doc { --k: 216; } .file-icon.sheet { --k: 145; } .file-icon.slide { --k: 24; } .file-icon.image { --k: 282; font-size: 0.9rem; }
.file-icon.video { --k: 330; font-size: 0.8rem; } .file-icon.audio { --k: 190; font-size: 0.95rem; } .file-icon.archive { --k: 40; } .file-icon.text { --k: 212; }
.file-icon.link { --k: 190; font-size: 0.95rem; }
.file-icon.folder { width: 34px; height: 28px; margin: 4px 0; border-radius: 3px 6px 6px 6px; background: hsl(205 75% 58%); }
.file-icon.folder::before { content: ""; position: absolute; left: 0; top: -4px; width: 14px; height: 6px; border-radius: 3px 4px 0 0; background: hsl(205 70% 50%); }
.file-icon.folder::after { inset: 5px 0 0 0; width: auto; height: auto; border-radius: 4px 6px 6px 6px; background: hsl(205 85% 66%); }
@media (prefers-color-scheme: dark) { .file-icon { color: hsl(var(--k) 70% 72%); } }
.folder-row .file-name { font-weight: 600; }
.count { padding-top: 10px; }
.crumb-sep { color: var(--muted); }
.quota { display: grid; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.quota-text { display: flex; gap: 8px; align-items: baseline; font-size: 0.88rem; }
.quota-bar { display: block; height: 8px; border-radius: 99px; background: var(--hover); overflow: hidden; }
.quota-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width 0.6s var(--ease); }
.quota-bar.full i { background: var(--alert); }
.browser { position: relative; }
.drop-hint { display: none; }
.browser.dropping { border-color: var(--accent); }
.browser.dropping .drop-hint { display: grid; place-items: center; position: absolute; inset: 0; z-index: 2; border-radius: inherit; border: 2px dashed var(--accent); background: color-mix(in srgb, var(--surface) 88%, transparent); color: var(--accent); font-weight: 600; }
.button.small { width: 32px; min-height: 32px; font-size: 0.95rem; }
.danger-icon { opacity: 0.55; } tr:hover .danger-icon, .danger-icon:focus-visible { opacity: 1; }
.danger-icon:hover { border-color: var(--alert); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.spaces { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; padding: 16px; }
.space { display: grid; gap: 4px; align-content: start; padding: 14px; border-radius: 10px; border: 1px solid var(--line); transition: border-color 0.15s, transform 0.2s var(--ease); }
.space:not(:disabled):hover { border-color: var(--accent); transform: translateY(-2px); }
.space:disabled { opacity: 0.6; cursor: default; }
.space-mark { display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 4px; border-radius: 9px; background: hsl(var(--h) 45% 42%); color: #fff; font-weight: 700; font-size: 0.8rem; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 0.85rem; }
.space .fine { margin-top: 4px; color: var(--accent); font-weight: 600; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 14px; }
.swatch { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); font-weight: 500; }
.swatch i { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); }
.swatch:disabled { opacity: 0.6; cursor: default; }
.swatch[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }

/* ---------- connexion ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(400px, 100%); display: grid; gap: 14px; padding: 28px 26px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08); }
.login-card h1 { font: 700 1.6rem "Poppins", sans-serif; letter-spacing: -0.02em; }
.login-logo { border-radius: 16px; }
.field { display: grid; gap: 6px; }
.field-label { font-weight: 600; font-size: 0.875rem; }
.login-card .input { min-height: 46px; font-size: 1rem; background: var(--bg); }
.login-card .button { min-height: 46px; }
.button.primary { background: var(--navy); color: #fff; }
.form-error { color: var(--alert); font-weight: 600; font-size: 0.9rem; min-height: 1.45em; }
.question { font-weight: 600; font-size: 1.05rem; }
.choices { display: grid; gap: 8px; max-height: 46dvh; overflow-y: auto; }
.choice { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- notes ---------- */
.pad { padding: 0 16px 12px; }
.sticky { position: sticky; top: 80px; }
@media (max-width: 1100px) { .sticky { position: static; } }
.subject-card { overflow: hidden; border-top: 3px solid hsl(var(--h) 60% 52%); animation: rise 0.4s var(--ease) both; }
.subject-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 20px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.subject-id { display: grid; gap: 2px; min-width: 0; }
.subject-id .subject { font-weight: 600; font-size: 1rem; }
.subject-id .fine { padding-left: 37px; }
.stats { display: flex; align-items: center; gap: 18px; }
.stat { display: grid; justify-items: end; line-height: 1.2; }
.stat span { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.stat strong { font-variant-numeric: tabular-nums; font-weight: 600; }
.stat.strong strong { font: 700 1.25rem "Poppins", sans-serif; }
.trend-pill { padding: 2px 8px; border-radius: 99px; font-size: 0.78rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.trend-pill.up { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.trend-pill.down { background: color-mix(in srgb, var(--alert) 13%, transparent); color: var(--alert); }
.grades td { padding-top: 9px; padding-bottom: 9px; }
.grade-title { display: grid; gap: 1px; min-width: 160px; }
.grade { font: 700 1.05rem "Poppins", sans-serif; }
.grade.up { color: var(--ok); } .grade.down { color: var(--alert); }
.faded { opacity: 0.6; }
.muted-tag { background: var(--hover); color: var(--muted); }
.tag.premium { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.range-cell { width: 26%; min-width: 140px; }
.range { position: relative; display: block; height: 18px; }
.range::before { content: ""; position: absolute; left: 0; right: 0; top: 8px; height: 2px; border-radius: 2px; background: var(--line); }
.range-band { position: absolute; top: 6px; height: 6px; border-radius: 99px; background: hsl(var(--h, 212) 55% 50% / 0.25); }
.range-avg { position: absolute; top: 3px; width: 2px; height: 12px; margin-left: -1px; border-radius: 1px; background: var(--muted); }
.range-dot { position: absolute; top: 3px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2px var(--surface); animation: pop 0.5s var(--ease) both; }
.range-dot.below { background: var(--alert); }
@keyframes pop { from { transform: scale(0); } }
.histogram { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; padding: 4px 16px 16px; height: 130px; }
.bucket { display: grid; grid-template-rows: 1fr auto auto; justify-items: center; gap: 2px; font-size: 0.72rem; color: var(--muted); }
.bucket strong { color: var(--ink); font-size: 0.8rem; }
.bucket-bar { display: flex; align-items: flex-end; width: 100%; height: 100%; }
.bucket-bar i { display: block; width: 100%; min-height: 3px; border-radius: 5px 5px 2px 2px; background: var(--accent); animation: grow 0.7s var(--ease) both; transform-origin: bottom; }
@keyframes grow { from { transform: scaleY(0); } }
.simulator { display: grid; gap: 10px; padding: 14px 16px 16px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.simulation { padding: 10px 12px; border-radius: 8px; background: var(--hover); font-size: 0.9rem; }
.simulation strong { font: 700 1.1rem "Poppins", sans-serif; }
.simulation .up { color: var(--ok); font-weight: 600; } .simulation .down { color: var(--alert); font-weight: 600; }
select.input { appearance: auto; }

/* ---------- pièces jointes ---------- */
.attachments { display: grid; gap: 6px; }
.attachment { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 4px 12px; width: 100%; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); transition: border-color 0.15s, background 0.15s; }
.attachment:hover { border-color: var(--accent); background: var(--hover); }
.attachment[aria-busy] { opacity: 0.6; cursor: progress; }
.attachment-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-action { font-size: 0.82rem; font-weight: 600; color: var(--accent); }
@media (max-width: 600px) { .attachment { grid-template-columns: auto minmax(0, 1fr); } .attachment .fine, .attachment-action { grid-column: 2; } }

/* ---------- fenêtres ---------- */
.sheet { width: min(560px, calc(100% - 32px)); max-height: min(86dvh, 900px); padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3); }
.sheet[open] { animation: sheet-in 0.28s var(--ease) both; }
.sheet::backdrop { background: rgba(10, 14, 20, 0.45); backdrop-filter: blur(2px); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
.sheet-box { display: grid; gap: 0; }
.sheet-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.sheet-title { min-width: 0; }
.sheet-section { display: grid; gap: 14px; padding: 4px 16px 18px; }
.sheet-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.course-title { display: flex; align-items: center; gap: 12px; }
.course-title strong { display: block; font: 700 1.15rem "Poppins", sans-serif; }
.sheet .facts { padding-top: 14px; }
.sheet.viewer { width: min(1000px, calc(100% - 32px)); height: 90dvh; max-height: none; }
.viewer .sheet-box { grid-template-rows: auto 1fr auto; height: 100%; }
.viewer-body { min-height: 0; display: grid; place-items: center; background: var(--bg); }
.viewer-body iframe { width: 100%; height: 100%; border: 0; }
.viewer-body img { max-width: 100%; max-height: 100%; object-fit: contain; }
.file-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.file-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; max-width: calc(100% - 32px); padding: 10px 12px 10px 16px;
  border-radius: 12px; background: var(--ink); color: var(--surface); box-shadow: 0 12px 36px rgba(0, 0, 0, 0.25); font-weight: 500; animation: rise 0.3s var(--ease) both; }
.toast .button.quiet { color: var(--surface); text-decoration: underline; }
@media (max-width: 700px) { .grade-title { min-width: 120px; } .stats { gap: 12px; } .subject-head { padding: 12px; } }
