/* ==========================================================================
   Théo — Liquid Glass bleu
   Fond bleu lumineux, matériaux en verre (bords réfléchissants, reflets),
   navigation flottante. SF Pro sur Apple, Inter ailleurs.
   ========================================================================== */

@font-face {
  font-family: 'InterVar';
  src: url('fonts/inter.woff2') format('woff2');
  font-weight: 100 900; font-display: swap;
}

:root {
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'InterVar', 'Segoe UI Variable Text', system-ui, sans-serif;

  --ink: #0a1630;
  --ink-2: #34425e;
  --ink-3: #66748f;
  --hair: rgba(16, 40, 96, .10);
  --hair-strong: rgba(16, 40, 96, .18);

  --accent: #0a6cff;
  --accent-hi: #4b93ff;
  --accent-soft: rgba(10, 108, 255, .12);
  --red: #ff3b30;   --red-soft: rgba(255, 59, 48, .13);   --red-ink: #d70015;
  --orange: #ff9500; --orange-soft: rgba(255, 149, 0, .15); --orange-ink: #c46a00;
  --green: #34c759;  --green-soft: rgba(52, 199, 89, .15);  --green-ink: #1f8f3e;

  /* Verre */
  --glass: rgba(255, 255, 255, .60);
  --glass-strong: rgba(255, 255, 255, .78);
  --glass-chrome: rgba(255, 255, 255, .46);
  --rim-a: rgba(255, 255, 255, .95);
  --rim-b: rgba(255, 255, 255, .28);
  --rim-c: rgba(255, 255, 255, 0);
  --inner-hi: inset 0 1px 0 rgba(255, 255, 255, .75);
  --lift: 0 1px 1px rgba(0, 30, 90, .04), 0 14px 36px -12px rgba(0, 48, 140, .26);
  --lift-strong: 0 2px 4px rgba(0, 30, 90, .06), 0 24px 60px -16px rgba(0, 48, 140, .38);
  --track: rgba(255, 255, 255, .42);

  --r-s: 12px; --r-m: 18px; --r-l: 26px; --r-xl: 34px;
  --tab-h: 62px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eef3ff;
    --ink-2: #bdc9e4;
    --ink-3: #8595b6;
    --hair: rgba(190, 210, 255, .12);
    --hair-strong: rgba(190, 210, 255, .2);
    --accent: #2f8bff; --accent-hi: #6aaeff; --accent-soft: rgba(47, 139, 255, .2);
    --red: #ff453a; --red-soft: rgba(255, 69, 58, .2); --red-ink: #ff6961;
    --orange: #ff9f0a; --orange-soft: rgba(255, 159, 10, .2); --orange-ink: #ffb340;
    --green: #30d158; --green-soft: rgba(48, 209, 88, .2); --green-ink: #5be37d;
    --glass: rgba(22, 38, 82, .46);
    --glass-strong: rgba(24, 40, 86, .72);
    --glass-chrome: rgba(30, 48, 98, .38);
    --rim-a: rgba(255, 255, 255, .34);
    --rim-b: rgba(255, 255, 255, .08);
    --inner-hi: inset 0 1px 0 rgba(255, 255, 255, .14);
    --lift: 0 1px 1px rgba(0, 0, 0, .2), 0 16px 40px -14px rgba(0, 0, 0, .6);
    --lift-strong: 0 2px 6px rgba(0, 0, 0, .3), 0 28px 70px -18px rgba(0, 0, 0, .75);
    --track: rgba(255, 255, 255, .08);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body {
  font: 16px/1.4 var(--font); color: var(--ink); letter-spacing: -.011em;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  background: #e4eeff;
}
@media (prefers-color-scheme: dark) { body { background: #030b22; } }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--accent); }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 10px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Fond : bleu liquide ---------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  background:
    radial-gradient(62% 42% at 8% 4%, #a9d0ff 0%, rgba(169, 208, 255, 0) 70%),
    radial-gradient(48% 36% at 96% 10%, #c4c8ff 0%, rgba(196, 200, 255, 0) 70%),
    radial-gradient(70% 46% at 78% 100%, #9ccbff 0%, rgba(156, 203, 255, 0) 70%),
    radial-gradient(44% 30% at 0% 78%, #d6ebff 0%, rgba(214, 235, 255, 0) 70%),
    linear-gradient(180deg, #eaf3ff 0%, #dde9ff 55%, #d3e3ff 100%);
}
.bg i { position: absolute; border-radius: 50%; filter: blur(48px); opacity: .55; }
.bg i:nth-child(1) { width: 58vmax; height: 58vmax; left: -18vmax; top: 18vh; background: radial-gradient(circle at 40% 40%, #7fb6ff, rgba(127, 182, 255, 0) 65%); }
.bg i:nth-child(2) { width: 44vmax; height: 44vmax; right: -14vmax; top: -10vmax; background: radial-gradient(circle at 50% 50%, #8f9cff, rgba(143, 156, 255, 0) 62%); opacity: .38; }
.bg i:nth-child(3) { width: 50vmax; height: 50vmax; right: -10vmax; bottom: -22vmax; background: radial-gradient(circle at 50% 50%, #5aa9ff, rgba(90, 169, 255, 0) 62%); opacity: .42; }
@media (prefers-color-scheme: dark) {
  .bg { background:
      radial-gradient(60% 42% at 10% 0%, #1546c8 0%, rgba(21, 70, 200, 0) 70%),
      radial-gradient(46% 36% at 98% 8%, #3a24b8 0%, rgba(58, 36, 184, 0) 70%),
      radial-gradient(70% 50% at 70% 108%, #0a5bea 0%, rgba(10, 91, 234, 0) 66%),
      linear-gradient(180deg, #040d29 0%, #061638 60%, #071a44 100%); }
  .bg i { opacity: .35; }
}

/* ---------- Matériau verre ---------- */
.glass { position: relative; background: var(--glass); border-radius: var(--r-l); box-shadow: var(--lift), var(--inner-hi); isolation: isolate; }
.glass::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; z-index: 2;
  background: linear-gradient(145deg, var(--rim-a) 0%, var(--rim-b) 30%, var(--rim-c) 52%, var(--rim-b) 78%, var(--rim-a) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.glass.sheen::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 1;
  background: radial-gradient(120% 70% at 0% 0%, rgba(255, 255, 255, .5), rgba(255, 255, 255, 0) 46%);
}
@media (prefers-color-scheme: dark) { .glass.sheen::after { background: radial-gradient(120% 70% at 0% 0%, rgba(160, 200, 255, .16), rgba(160, 200, 255, 0) 46%); } }
.glass > * { position: relative; z-index: 3; }
.blur { -webkit-backdrop-filter: blur(24px) saturate(185%); backdrop-filter: blur(24px) saturate(185%); }
.glass.strong { background: var(--glass-strong); }

/* Verre teinté bleu (boutons d'action) */
.tint {
  background: linear-gradient(180deg, var(--accent-hi) 0%, var(--accent) 62%) !important; color: #fff;
  box-shadow: 0 10px 24px -8px rgba(10, 108, 255, .55), inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -2px 6px rgba(0, 40, 140, .25) !important;
}
.tint::before { --rim-a: rgba(255, 255, 255, .9); --rim-b: rgba(255, 255, 255, .25); }

/* ---------- Structure ---------- */
main {
  max-width: 720px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px calc(var(--tab-h) + 64px + env(safe-area-inset-bottom, 0px));
}

/* Barre du haut compacte (apparaît au défilement, comme le grand titre iOS qui se replie) */
.topbar {
  position: fixed; z-index: 30; top: 0; left: 0; right: 0; height: calc(env(safe-area-inset-top, 0px) + 48px);
  padding-top: env(safe-area-inset-top, 0px); display: grid; place-items: center;
  font-weight: 650; font-size: 16px; opacity: 0; transform: translateY(-8px); pointer-events: none;
  transition: opacity .22s, transform .22s;
  background: var(--glass-chrome); -webkit-backdrop-filter: blur(24px) saturate(185%); backdrop-filter: blur(24px) saturate(185%);
  border-bottom: 1px solid var(--hair);
}
body.scrolled .topbar { opacity: 1; transform: none; }

.head { display: flex; align-items: flex-start; gap: 12px; margin: 6px 2px 18px; }
.head .t { flex: 1; min-width: 0; }
.head h1 { font-size: 34px; line-height: 1.08; font-weight: 750; letter-spacing: -.025em; margin: 0; }
.head h1 small { display: block; font-size: 17px; font-weight: 600; color: var(--ink-3); letter-spacing: -.01em; margin-top: 4px; }
.head p { margin: 8px 0 0; color: var(--ink-2); font-size: 15px; line-height: 1.4; }
.iconbtn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; color: var(--ink); }
.iconbtn svg { width: 20px; height: 20px; position: relative; z-index: 3; }
.avatar { font-weight: 700; font-size: 15px; }
.avatar span { position: relative; z-index: 3; }

h2.sec { font-size: 20px; font-weight: 700; letter-spacing: -.02em; margin: 28px 4px 10px; display: flex; align-items: center; gap: 8px; }
h2.sec .n { font-size: 13px; font-weight: 650; color: var(--ink-3); background: var(--track); padding: 1px 8px; border-radius: 999px; font-variant-numeric: tabular-nums; }
h2.sec.late { color: var(--red-ink); }
h2.sec.late .n { color: var(--red-ink); background: var(--red-soft); }
h2.sec .more { margin-left: auto; font-size: 14px; font-weight: 600; color: var(--accent); }

/* ---------- Barre d'onglets flottante ---------- */
.tabbar {
  position: fixed; z-index: 40; left: 16px; right: 84px; bottom: calc(env(safe-area-inset-bottom, 0px) * .55 + 10px);
  height: var(--tab-h); border-radius: 999px; display: flex; align-items: stretch; padding: 4px;
  background: var(--glass-chrome); transition: height .3s cubic-bezier(.3, .9, .3, 1), right .3s cubic-bezier(.3, .9, .3, 1);
}
.tabbar .brand, .tabbar .newbtn, .tabbar .foot { display: none; }
.tab {
  position: relative; z-index: 3; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--ink-2); text-decoration: none; font-size: 10.5px; font-weight: 600; border-radius: 999px; letter-spacing: 0;
}
.tab svg { width: 25px; height: 25px; }
.tab[aria-current="page"] { color: var(--accent); }
.tab .badge { position: absolute; top: 5px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2px rgba(255, 255, 255, .7); }
.thumb {
  position: absolute; z-index: 1; top: 4px; bottom: 4px; left: 4px; width: 0; border-radius: 999px;
  background: rgba(255, 255, 255, .62); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 4px 14px -4px rgba(0, 40, 120, .25);
  transition: left .42s cubic-bezier(.3, 1.25, .4, 1), width .42s cubic-bezier(.3, 1.25, .4, 1);
}
@media (prefers-color-scheme: dark) { .thumb { background: rgba(255, 255, 255, .14); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22); } .tab .badge { box-shadow: 0 0 0 2px rgba(10, 20, 50, .8); } }
body.mini .tabbar { height: 50px; right: 96px; }
body.mini .tab span { display: none; }
body.mini .tab svg { width: 23px; height: 23px; }
body.mini .tab .badge { top: 2px; }

.fab {
  position: fixed; z-index: 40; right: 16px; bottom: calc(env(safe-area-inset-bottom, 0px) * .55 + 10px);
  width: var(--tab-h); height: var(--tab-h); border-radius: 50%; display: grid; place-items: center;
  transition: width .3s cubic-bezier(.3, .9, .3, 1), height .3s cubic-bezier(.3, .9, .3, 1);
}
.fab svg { width: 26px; height: 26px; position: relative; z-index: 3; }
body.mini .fab { width: 50px; height: 50px; }
.fab:active, .btn:active, .chip:active { transform: scale(.96); }

/* ---------- Groupes de lignes (listes) ---------- */
.group { overflow: hidden; }
.group > * { position: relative; z-index: 3; }
.row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; column-gap: 12px; align-items: center; padding: 12px 14px 12px 16px; min-height: 60px; }
.row + .row::before, .exam + .exam::before, .line + .line::before, .grade-row + .grade-row::before {
  content: ''; position: absolute; top: 0; right: 0; left: 56px; height: 1px; background: var(--hair);
}
.exam + .exam::before { left: 84px; }
.line + .line::before, .grade-row + .grade-row::before { left: 16px; }
.row .body { min-width: 0; text-align: left; width: 100%; padding: 2px 0; }
.row .title { font-size: 16px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.row .meta { display: flex; align-items: center; gap: 10px; margin-top: 3px; font-size: 13px; color: var(--ink-3); flex-wrap: wrap; }
.row .desc { margin-top: 3px; font-size: 13.5px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.row.done .title { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--hair-strong); }
.subj { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.subj::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--c, #8e8e93); box-shadow: 0 0 0 2px color-mix(in srgb, var(--c, #8e8e93) 22%, transparent); }

/* Échéance à droite, façon tableau des départs */
.due { font-size: 13px; font-weight: 650; color: var(--ink-3); white-space: nowrap; padding: 3px 9px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.due.late { color: var(--red-ink); background: var(--red-soft); }
.due.today { color: var(--accent); background: var(--accent-soft); }
.due.soon { color: var(--ink-2); background: var(--track); }

/* Charge : 1 à 3 barres */
.load { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.load i { width: 3px; border-radius: 2px; background: var(--hair-strong); }
.load i:nth-child(1) { height: 5px; } .load i:nth-child(2) { height: 8px; } .load i:nth-child(3) { height: 12px; }
.load.l1 i:nth-child(-n+1), .load.l2 i:nth-child(-n+2) { background: var(--ink-3); }
.load.l3 i { background: var(--orange); }
.tag { font-size: 12px; font-weight: 650; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }

/* Case à cocher */
.check { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; position: relative; }
.check::before { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--hair-strong); transition: border-color .2s, background .2s; }
.check:hover::before { border-color: var(--accent); }
.check svg { width: 15px; height: 15px; color: #fff; position: relative; stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset .25s .05s; }
.row.progress .check::before { border-color: var(--accent); background: conic-gradient(var(--accent-soft) 0 50%, transparent 50% 100%); }
.row.done .check::before, .check.on::before { border-color: transparent; background: linear-gradient(180deg, var(--accent-hi), var(--accent)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5); }
.row.done .check svg, .check.on svg { stroke-dashoffset: 0; }
.check.pop { animation: pop .42s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.22); } 100% { transform: scale(1); } }
.row.leaving { animation: leave .45s .25s ease forwards; }
@keyframes leave { to { opacity: 0; transform: translateX(14px); } }

.empty { padding: 22px 18px; text-align: center; color: var(--ink-3); font-size: 14.5px; }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 2px; }

/* ---------- Carte « Ta journée » ---------- */
.day { padding: 18px 18px 6px; }
.day .top { display: flex; align-items: baseline; gap: 10px; }
.day .top h3 { margin: 0; font-size: 17px; font-weight: 700; flex: 1; }
.day .top .range { font-size: 13px; color: var(--ink-3); font-weight: 600; font-variant-numeric: tabular-nums; }
.rail { position: relative; height: 44px; margin: 30px 0 6px; border-radius: 14px; background: var(--track); box-shadow: inset 0 1px 2px rgba(0, 30, 90, .1); }
@media (prefers-color-scheme: dark) { .rail { box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35); } }
.seg {
  position: absolute; top: 4px; bottom: 4px; border-radius: 10px; overflow: hidden;
  background: var(--c); color: #fff; font-size: 11px; font-weight: 750; letter-spacing: .02em;
  display: grid; place-items: center; transition: opacity .3s;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -6px 10px -6px rgba(0, 0, 0, .25);
}
.seg::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255, 255, 255, .38), rgba(255, 255, 255, 0) 55%); }
.seg span { position: relative; z-index: 1; text-shadow: 0 1px 1px rgba(0, 0, 0, .18); }
.seg.var { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 70%, transparent) 0 6px, color-mix(in srgb, var(--c) 35%, transparent) 6px 12px); }
.seg.past { opacity: .38; }
.seg .due-dot { position: absolute; z-index: 2; top: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px var(--red); }
.needle { position: absolute; z-index: 4; top: -6px; bottom: -6px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(10, 108, 255, .5), 0 0 12px 2px rgba(10, 108, 255, .45); }
.needle b { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 750; color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ticks { position: relative; height: 16px; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ticks span { position: absolute; transform: translateX(-50%); }
.day .lines { margin: 6px -18px 0; }
.line { position: relative; display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; padding: 11px 18px; font-size: 15px; align-items: baseline; }
.line .k { font-size: 13px; font-weight: 650; color: var(--ink-3); }
.line .v { min-width: 0; }
.line .v small { display: block; color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.line.free .k { color: var(--green-ink); }
.line.hand .k { color: var(--red-ink); }
.day.off { padding-bottom: 18px; }
.day.off .big { font-size: 26px; font-weight: 750; letter-spacing: -.02em; margin: 8px 0 4px; }
.day.off p { margin: 0; color: var(--ink-2); }

/* ---------- Priorités du jour ---------- */
.prio { padding: 6px 0; }
.prio .hd { display: flex; align-items: baseline; padding: 10px 18px 4px; }
.prio .hd h3 { margin: 0; font-size: 17px; font-weight: 700; flex: 1; }
.prio .hd span { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.prow { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 18px; min-height: 48px; }
.prow .txt { font-size: 16px; font-weight: 550; text-align: left; width: 100%; overflow-wrap: anywhere; }
.prow.done .txt { color: var(--ink-3); text-decoration: line-through; }
.prow .x { width: 28px; height: 28px; border-radius: 50%; color: var(--ink-3); display: grid; place-items: center; opacity: .7; }
.prow .x svg { width: 14px; height: 14px; }
.prow input { width: 100%; border: 0; background: var(--track); border-radius: 10px; padding: 8px 10px; font-size: 16px; font-weight: 550; outline: none; }
.prow input:focus { box-shadow: 0 0 0 2px var(--accent); }
.addp { color: var(--accent); font-weight: 600; font-size: 15.5px; text-align: left; display: flex; align-items: center; gap: 12px; width: 100%; }
.addp i { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); font-style: normal; }
.addp i svg { width: 14px; height: 14px; }
.sugg { display: flex; gap: 8px; overflow-x: auto; padding: 4px 18px 12px; scrollbar-width: none; }
.sugg::-webkit-scrollbar { display: none; }
.sugg .chip { flex: 0 0 auto; }

/* ---------- Puces, contrôles ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 999px; white-space: nowrap;
  font-size: 14px; font-weight: 600; color: var(--ink-2); background: var(--track); transition: background .15s, color .15s, box-shadow .15s;
  box-shadow: inset 0 0 0 1px var(--hair);
}
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.chip[aria-pressed="true"] { background: var(--accent); color: #fff; box-shadow: 0 6px 16px -6px rgba(10, 108, 255, .6), inset 0 1px 0 rgba(255, 255, 255, .45); }
.chip[aria-pressed="true"] .dot { background: #fff; box-shadow: 0 0 0 2px var(--c); }
.chip small { font-weight: 650; color: var(--red-ink); }
.chip[aria-pressed="true"] small { color: #fff; }

.segc { position: relative; display: flex; padding: 3px; border-radius: 999px; background: var(--track); box-shadow: inset 0 0 0 1px var(--hair); }
.segc button { position: relative; z-index: 2; flex: 1; height: 34px; padding: 0 12px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--ink-2); transition: color .2s; white-space: nowrap; }
.segc button[aria-pressed="true"] { color: var(--ink); }
.segc .knob { position: absolute; z-index: 1; top: 3px; bottom: 3px; border-radius: 999px; background: var(--glass-strong); box-shadow: 0 3px 10px -3px rgba(0, 40, 120, .3), inset 0 1px 0 rgba(255, 255, 255, .8); transition: left .38s cubic-bezier(.3, 1.25, .4, 1), width .38s cubic-bezier(.3, 1.25, .4, 1); }
@media (prefers-color-scheme: dark) { .segc .knob { background: rgba(255, 255, 255, .16); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2); } }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0 0 6px; }
.toolbar .segc { flex: 0 1 260px; }
.search { position: relative; flex: 1 1 180px; }
.search svg { position: absolute; left: 12px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--ink-3); }
.search input { width: 100%; height: 40px; border-radius: 999px; border: 0; padding: 0 14px 0 36px; background: var(--track); box-shadow: inset 0 0 0 1px var(--hair); font-size: 16px; outline: none; }
.search input:focus { box-shadow: inset 0 0 0 1px var(--hair), 0 0 0 3px var(--accent-soft); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 20px; border-radius: 999px; font-weight: 650; font-size: 15.5px; position: relative; }
.btn > * { position: relative; z-index: 3; }
.btn.plain { background: var(--track); color: var(--ink); box-shadow: inset 0 0 0 1px var(--hair); }
.btn.danger { color: var(--red-ink); }
.btn:disabled { opacity: .5; }
.btn svg { width: 18px; height: 18px; }
.btn.small { height: 36px; padding: 0 14px; font-size: 14.5px; }

/* ---------- Semaine (page Devoirs) ---------- */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; padding: 6px; margin-bottom: 4px; }
.wd { position: relative; z-index: 3; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0 10px; border-radius: 18px; min-height: 86px; }
.wd .n { font-size: 11.5px; font-weight: 650; color: var(--ink-3); }
.wd .d { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.wd .dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; max-width: 34px; margin-top: auto; }
.wd .dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.wd .dots i.big { width: 9px; height: 9px; }
.wd .dots em { font-style: normal; font-size: 10.5px; font-weight: 700; line-height: 9px; }
.wd .dots i.ex { background: transparent; box-shadow: inset 0 0 0 2px var(--c); width: 9px; height: 9px; }
.wd.off .d, .wd.off .n { color: var(--ink-3); opacity: .7; }
.wd.today { background: linear-gradient(180deg, var(--accent-hi), var(--accent)); box-shadow: 0 8px 20px -8px rgba(10, 108, 255, .65), inset 0 1px 0 rgba(255, 255, 255, .5); }
.wd.today .n, .wd.today .d { color: #fff; }
.wd.today .dots i { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .85); }

/* ---------- Examens ---------- */
.exam { display: grid; grid-template-columns: 56px minmax(0, 1fr); column-gap: 14px; padding: 14px 16px; align-items: start; }
.cd { width: 56px; height: 60px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--track); box-shadow: inset 0 0 0 1px var(--hair); }
.cd b { font-size: 22px; line-height: 1; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.cd small { font-size: 11px; font-weight: 650; color: var(--ink-3); margin-top: 3px; }
.cd.hot { background: linear-gradient(180deg, #ff6a5e, var(--red)); color: #fff; box-shadow: 0 8px 18px -8px rgba(255, 59, 48, .7), inset 0 1px 0 rgba(255, 255, 255, .5); }
.cd.warm { background: linear-gradient(180deg, #ffb340, var(--orange)); color: #fff; box-shadow: 0 8px 18px -8px rgba(255, 149, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .5); }
.cd.hot small, .cd.warm small { color: rgba(255, 255, 255, .9); }
.cd.grade b { font-size: 21px; }
.cd.grade.low { background: var(--red-soft); color: var(--red-ink); }
.exam .body { text-align: left; width: 100%; min-width: 0; }
.exam .title { font-size: 16px; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.exam .meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 3px; font-size: 13px; color: var(--ink-3); }
.exam .desc { margin-top: 4px; font-size: 13.5px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.phase { margin-top: 10px; padding: 10px 12px; border-radius: 14px; background: var(--track); box-shadow: inset 0 0 0 1px var(--hair); font-size: 14px; color: var(--ink-2); }
.phase b { display: block; color: var(--ink); font-size: 14px; margin-bottom: 1px; }
.phase.hot { background: var(--red-soft); box-shadow: none; }
.phase.warm { background: var(--orange-soft); box-shadow: none; }
.fc { display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; font-size: 14px; font-weight: 600; text-decoration: none; }
.fc svg { width: 14px; height: 14px; }

/* ---------- Notes ---------- */
.hero { padding: 22px 20px 20px; display: flex; gap: 18px; align-items: center; }
.hero .big { font-size: 76px; line-height: .9; font-weight: 750; letter-spacing: -.045em; font-variant-numeric: tabular-nums; position: relative; z-index: 3; }
.hero .lbl { position: relative; z-index: 3; color: var(--ink-2); font-size: 14.5px; line-height: 1.45; }
.hero .lbl b { color: var(--ink); font-size: 16px; display: block; }
.srow { display: grid; grid-template-columns: minmax(0, 1fr) 90px 44px; gap: 12px; align-items: center; padding: 13px 16px; width: 100%; text-align: left; }
.srow + .srow::before { content: ''; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--hair); }
.srow .bar { position: relative; height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.srow .bar i { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--c); }
.srow .bar u { position: absolute; top: 0; bottom: 0; left: 60%; width: 2px; background: var(--red); opacity: .55; }
.srow b { text-align: right; font-variant-numeric: tabular-nums; font-size: 16px; }
.srow b.low { color: var(--red-ink); }
.grades { padding: 0 0 6px; background: color-mix(in srgb, var(--track) 50%, transparent); }
.grade-row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 9px 16px 9px 34px; font-size: 14px; color: var(--ink-2); }
.grade-row b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- Feuille (ajout / modification) ---------- */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(4, 16, 48, .28); opacity: 0; transition: opacity .25s; }
.scrim.open { opacity: 1; }
.sheet {
  position: fixed; z-index: 61; left: 8px; right: 8px; bottom: 8px; max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 24px);
  display: flex; flex-direction: column; border-radius: var(--r-xl); background: var(--glass-strong);
  transform: translateY(calc(100% + 20px)); transition: transform .42s cubic-bezier(.25, 1.1, .35, 1);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.sheet.open { transform: none; }
.sheet .grab { width: 38px; height: 5px; border-radius: 3px; background: var(--hair-strong); margin: 8px auto 0; flex: 0 0 auto; position: relative; z-index: 3; }
.sheet .bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 8px 10px 6px; position: relative; z-index: 3; flex: 0 0 auto; }
.sheet .bar h3 { margin: 0; font-size: 17px; font-weight: 700; text-align: center; }
.sheet .bar .l { justify-self: start; color: var(--accent); font-size: 16.5px; padding: 8px 10px; }
.sheet .bar .r { justify-self: end; }
.sheet .scroll { overflow-y: auto; padding: 6px 16px 18px; position: relative; z-index: 3; -webkit-overflow-scrolling: touch; }
.fgroup { background: var(--track); border-radius: 20px; box-shadow: inset 0 0 0 1px var(--hair); margin-bottom: 14px; }
.fgroup > * + * { border-top: 1px solid var(--hair); }
.fgroup .ttl { width: 100%; border: 0; background: none; padding: 15px 16px; font-size: 19px; font-weight: 650; outline: none; }
.fgroup textarea { width: 100%; border: 0; background: none; padding: 13px 16px; min-height: 84px; resize: vertical; outline: none; font-size: 16px; line-height: 1.4; }
.hint { padding: 9px 16px; font-size: 13.5px; color: var(--accent); font-weight: 600; }
.hint:empty { display: none; }
.flabel { font-size: 13px; font-weight: 650; color: var(--ink-3); margin: 4px 6px 8px; }
.hscroll { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.frow { display: flex; align-items: center; gap: 12px; padding: 0 16px; min-height: 50px; }
.frow label { flex: 1; font-size: 16px; }
.frow input { border: 0; background: none; text-align: right; font-size: 16px; outline: none; min-width: 0; width: 130px; }
.frow input[type="date"] { width: auto; }
.err { color: var(--red-ink); font-size: 14px; font-weight: 600; margin: 2px 6px 10px; min-height: 0; }
.err:empty { display: none; }
.delete { width: 100%; height: 50px; border-radius: 20px; background: var(--track); box-shadow: inset 0 0 0 1px var(--hair); color: var(--red-ink); font-weight: 650; font-size: 16px; }

/* ---------- Bandeau de confirmation ---------- */
.toast {
  position: fixed; z-index: 70; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) * .55 + var(--tab-h) + 22px);
  transform: translate(-50%, 16px) scale(.96); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 14px; padding: 11px 12px 11px 18px; border-radius: 999px; max-width: calc(100% - 32px);
  font-size: 15px; font-weight: 600; transition: opacity .25s, transform .35s cubic-bezier(.3, 1.3, .4, 1);
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); pointer-events: auto; }
.toast > * { position: relative; z-index: 3; }
.toast span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast button { color: var(--accent); font-weight: 700; padding: 6px 10px; border-radius: 999px; background: var(--accent-soft); }

/* ---------- Connexion ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login .card { width: min(400px, 100%); padding: 30px 24px 24px; }
.login .card > * { position: relative; z-index: 3; }
.login .mark { width: 64px; height: 64px; border-radius: 18px; margin-bottom: 18px; display: grid; place-items: center; font-weight: 800; font-size: 30px; }
.login h1 { font-size: 34px; font-weight: 750; letter-spacing: -.025em; margin: 0 0 6px; }
.login p { color: var(--ink-2); margin: 0 0 22px; }
.login .fgroup input { width: 100%; border: 0; background: none; padding: 15px 16px; font-size: 16px; outline: none; }
.login .btn { width: 100%; height: 50px; font-size: 16.5px; }

/* ---------- Mise en page « Aujourd'hui » ---------- */
.today-grid .side > * + * { margin-top: 14px; }

/* ---------- Grand écran : barre latérale flottante ---------- */
@media (min-width: 1000px) {
  main { max-width: 1120px; margin: 0 0 0 272px; padding: 36px 40px 60px; }
  .topbar { display: none; }
  .tabbar {
    left: 16px; top: 16px; bottom: 16px; right: auto; width: 240px; height: auto !important; border-radius: 30px;
    flex-direction: column; align-items: stretch; padding: 22px 12px 14px; gap: 4px;
  }
  .tabbar .brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 18px; font-size: 22px; font-weight: 750; letter-spacing: -.02em; position: relative; z-index: 3; }
  .tabbar .brand i { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-style: normal; font-size: 17px; }
  .tabbar .newbtn { display: flex; height: 44px; margin: 0 2px 14px; justify-content: flex-start; padding: 0 16px; }
  .tabbar .foot { display: block; margin-top: auto; position: relative; z-index: 3; padding: 0 4px; }
  .tab { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 12px; height: 46px; padding: 0 14px; font-size: 15.5px; color: var(--ink-2); }
  .tab svg { width: 22px; height: 22px; }
  .tab .badge { position: static; margin-left: auto; box-shadow: none; }
  body.mini .tab span { display: inline; }
  .thumb { left: 12px !important; right: 12px; width: auto !important; top: 0; bottom: auto; height: 46px; transition: top .42s cubic-bezier(.3, 1.25, .4, 1); }
  .fab { display: none; }
  .toast { bottom: 28px; left: calc(50% + 136px); }
  .head h1 { font-size: 40px; }
  .head .avatar { display: none; }
  .srow { grid-template-columns: 240px minmax(0, 1fr) 60px; gap: 20px; }
  .today-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
  .today-grid .main { grid-column: 1; grid-row: 1; }
  .today-grid .side { grid-column: 2; grid-row: 1; position: sticky; top: 24px; }
  .today-grid .side > * + * { margin-top: 16px; }
  .today-grid .main h2.sec:first-child { margin-top: 4px; }
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: 560px; max-height: min(760px, calc(100dvh - 60px)); transform: translate(-50%, -46%) scale(.97); opacity: 0; pointer-events: none; transition: transform .3s cubic-bezier(.25, 1.1, .35, 1), opacity .2s; }
  .sheet.open { transform: translate(-50%, -50%); opacity: 1; pointer-events: auto; }
  .sheet .grab { display: none; }
  .row:hover, .exam:hover, .srow:hover { background: rgba(255, 255, 255, .18); }
}
@media (min-width: 1000px) and (prefers-color-scheme: dark) { .row:hover, .exam:hover, .srow:hover { background: rgba(255, 255, 255, .04); } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
@media (prefers-reduced-transparency: reduce) {
  .glass, .topbar { background: var(--glass-strong) !important; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
