/* ===== Cockpit — thème sombre aéronautique ===== */
:root {
  --bg: #070D1A;
  --bg-2: #0B1324;
  --panel: #101A2E;
  --panel-2: #142038;
  --line: #1C2A45;
  --line-2: #2A3B5E;
  --text: #E6EDF7;
  --muted: #94A3C0;
  --soft: #C3CEE2;
  --amber: #F5A623;
  --blue: #5BC8FF;
  --green: #3DDC97;
  --purple: #B69CFF;
  --red: #FF6B6B;
  --amber-bg: #3A2A0C;
  --blue-bg: #0D2A3D;
  --green-bg: #0C3027;
  --purple-bg: #251C42;
  --red-bg: #3A1418;
  --radius: 14px;
  --font: Barlow, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-cond: "Barlow Condensed", Barlow, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: #9ADBFF; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
svg.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ===== Layout ===== */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar { width: 248px; flex: none; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; padding: 18px 14px; background: var(--bg-2); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 16px; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.view { padding: 8px 28px 48px; display: flex; flex-direction: column; gap: 18px; outline: none; }

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; border-bottom: 1px solid var(--line); color: var(--text); }
.brand:hover { color: var(--text); }
.brand-logo { width: 38px; height: 38px; border-radius: 10px; background: var(--amber); display: grid; place-items: center; }
.brand-logo svg { width: 22px; height: 22px; fill: none; stroke: var(--bg); stroke-width: 2; stroke-linejoin: round; }
.brand-text { display: flex; flex-direction: column; }
.brand-text b { font-family: var(--font-cond); font-size: 22px; letter-spacing: 3px; }
.brand-text small { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }

.nav-list { display: flex; flex-direction: column; gap: 3px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: var(--soft); font-size: 15px; }
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active { background: var(--line); color: var(--amber); font-weight: 600; }
.nav-item span.lbl { flex: 1; }
.badge { font-family: var(--mono); font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: var(--line); color: var(--amber); }
.nav-item.active .badge { background: var(--bg-2); }
.badge.soon { color: var(--muted); }

.status-box { margin-top: auto; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); display: flex; flex-direction: column; gap: 6px; }
.status-box small { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.status-line { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.dot.off { background: var(--amber); }

/* ===== Topbar ===== */
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 20px 28px 10px; }
.titles { flex: 1 1 240px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.crumb { font-family: var(--mono); font-size: 11.5px; letter-spacing: 1px; color: var(--muted); }
.titles h1 { margin: 0; font-family: var(--font-cond); font-weight: 600; font-size: 32px; line-height: 1.1; }
.search-wrap { position: relative; flex: 1 1 260px; max-width: 420px; }
.search-wrap input { width: 100%; height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); }
.search-results { position: absolute; z-index: 30; top: 50px; left: 0; right: 0; max-height: 60vh; overflow-y: auto; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 12px; padding: 6px; box-shadow: 0 16px 40px rgba(0,0,0,.5); }
.search-results button { display: flex; width: 100%; gap: 10px; align-items: center; text-align: left; padding: 10px; border: none; background: none; border-radius: 8px; min-height: 44px; }
.search-results button:hover, .search-results button:focus-visible { background: var(--line); }
.search-results .kind { font-family: var(--mono); font-size: 10.5px; color: var(--muted); min-width: 64px; }
.clock { display: flex; flex-direction: column; align-items: flex-end; padding: 6px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); }
.clock-time { font-family: var(--mono); font-size: 20px; font-weight: 600; color: var(--green); }
.clock-date { font-family: var(--mono); font-size: 11px; color: var(--muted); text-transform: uppercase; }
.timer-chip { height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--amber); background: var(--amber-bg); color: var(--amber); font-family: var(--mono); font-weight: 600; }

/* ===== Cartes / panneaux ===== */
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 16px; }
.row > * { min-width: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.panel h2 { margin: 0; font-family: var(--font-cond); font-weight: 600; font-size: 22px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.label { font-family: var(--mono); font-size: 11px; letter-spacing: 1.5px; color: var(--muted); text-transform: uppercase; }
.big { font-family: var(--mono); font-size: 40px; font-weight: 600; line-height: 1.05; }
.big small { font-size: 22px; color: var(--muted); }
.gauge-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: var(--green); }
.c-amber { color: var(--amber); } .c-blue { color: var(--blue); } .c-green { color: var(--green); } .c-purple { color: var(--purple); }

.empty { padding: 18px; border: 1px dashed var(--line-2); border-radius: 10px; color: var(--muted); font-size: 14px; text-align: center; }

/* ===== Boutons ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); font-weight: 600; font-size: 14px; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--amber); border-color: var(--amber); color: var(--bg); }
.btn.primary:hover { background: #FFB840; }
.btn.outline { background: transparent; border-color: var(--amber); color: var(--amber); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--soft); }
.btn.ghost:hover { background: var(--panel-2); }
.btn.danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn.icon { padding: 0; width: 44px; }
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.seg button { min-height: 36px; padding: 0 12px; border-radius: 7px; border: none; background: transparent; color: var(--muted); font-size: 14px; }
.seg button.on { background: var(--line); color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--soft); font-size: 13px; }
.chip.on { background: var(--line); color: var(--text); border-color: var(--muted); }
.chip .sw { width: 10px; height: 10px; border-radius: 3px; }

/* ===== Types (couleurs) ===== */
.t-exam { --c: var(--amber); --cb: var(--amber-bg); }
.t-cours { --c: var(--blue); --cb: var(--blue-bg); }
.t-projet { --c: var(--green); --cb: var(--green-bg); }
.t-perso { --c: var(--purple); --cb: var(--purple-bg); }
.t-task { --c: var(--soft); --cb: transparent; }
.ev { display: flex; flex-direction: column; gap: 1px; padding: 5px 8px; border-radius: 7px; background: var(--cb); box-shadow: inset 3px 0 0 var(--c); border: none; text-align: left; color: var(--text); width: 100%; min-height: 32px; }
.ev.task { border: 1px dashed var(--line-2); box-shadow: none; }
.ev .tm { font-family: var(--mono); font-size: 10px; color: var(--c); }
.ev .tt { font-size: 13px; font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; }
.tag { align-self: flex-start; font-family: var(--mono); font-size: 11px; padding: 2px 7px; border-radius: 5px; background: var(--cb, var(--line)); color: var(--c, var(--soft)); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }

/* ===== Calendrier ===== */
.cal-scroll { overflow-x: auto; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(92px, 1fr)); gap: 6px; min-width: 680px; }
.cal-head div { font-family: var(--mono); font-size: 11px; color: var(--muted); padding: 0 8px; }
.cal-cell { min-height: 112px; padding: 6px; border-radius: 9px; background: var(--bg-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; cursor: pointer; }
.cal-cell.out { opacity: .45; }
.cal-cell.today { border-color: var(--amber); }
.cal-cell .num { font-family: var(--mono); font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }
.cal-cell.today .num { color: var(--amber); font-weight: 600; }
.cal-cell .more { font-size: 12px; color: var(--muted); padding-left: 4px; }
.week-grid .cal-cell { min-height: 260px; }
.list-day { display: flex; flex-direction: column; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.list-day h3 { margin: 0; font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }
.list-day.today h3 { color: var(--amber); }

/* ===== Tâches ===== */
.quick-add { display: flex; gap: 8px; }
.quick-add input { flex: 1; min-width: 0; height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); }
.task-group { display: flex; flex-direction: column; gap: 6px; }
.task-group h3 { margin: 6px 0 2px; font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 1.5px; color: var(--muted); text-transform: uppercase; }
.task-group.late h3 { color: var(--red); }
.task { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 10px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.task.done .task-title { text-decoration: line-through; color: var(--muted); }
.check { flex: none; width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--line-2); background: transparent; display: grid; place-items: center; padding: 0; }
.check svg { width: 16px; height: 16px; stroke: var(--bg); stroke-width: 3; fill: none; opacity: 0; }
.task.done .check { background: var(--green); border-color: var(--green); }
.task.done .check svg { opacity: 1; }
.task-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; border: none; background: none; text-align: left; padding: 4px 0; }
.task-title { font-size: 15px; font-weight: 500; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.prio { font-family: var(--mono); font-size: 11px; font-weight: 600; }
.prio.p3 { color: var(--red); } .prio.p2 { color: var(--amber); } .prio.p1 { color: var(--muted); }
.kanban { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.kcol { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 12px; background: var(--bg-2); min-height: 200px; border: 1px solid transparent; }
.kcol.over { border-color: var(--amber); }
.kcol-head { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; letter-spacing: 1px; color: var(--muted); padding: 2px 4px; }
.kcard { padding: 10px 12px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; cursor: grab; text-align: left; color: var(--text); }
.kcard.dragging { opacity: .4; }
.kcard .kt { font-size: 14px; font-weight: 600; }
.kmove { display: flex; gap: 6px; }

/* ===== Notes ===== */
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.note { padding: 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; text-align: left; color: var(--text); min-height: 130px; }
.note:hover { border-color: var(--line-2); }
.note h3 { margin: 0; font-size: 16px; }
.note p { margin: 0; font-size: 13.5px; color: var(--soft); white-space: pre-line; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; }
.note .foot { margin-top: auto; font-family: var(--mono); font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; }
.note.pinned { border-color: var(--amber); }

/* ===== Favoris ===== */
.fav-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.fav { position: relative; min-height: 84px; padding: 10px; border-radius: 11px; background: var(--bg-2); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--soft); font-size: 13px; text-align: center; }
.fav:hover { border-color: var(--line-2); color: var(--text); }
.fav .ini { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-family: var(--mono); font-weight: 600; font-size: 14px; color: var(--bg); }
.fav.add { border-style: dashed; color: var(--muted); background: transparent; }
.fav-edit { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border-radius: 8px; border: none; background: var(--line); color: var(--text); display: grid; place-items: center; padding: 0; }
.mail-link { min-height: 60px; padding: 0 16px; border-radius: 11px; background: var(--bg-2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--text); }
.mail-link b { display: block; font-size: 15px; }
.mail-link small { color: var(--muted); font-size: 12px; }

.chat-row { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 8px 10px 8px 12px; border-radius: 11px; background: var(--bg-2); border: 1px solid var(--line); }
.chat-row .ini { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-family: var(--mono); font-weight: 600; font-size: 12px; color: #fff; flex: none; }
.chat-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-name b { font-size: 15px; }
.chat-name small { color: var(--muted); font-size: 12px; }
.mail-wrap { position: relative; }
.mail-cfg { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.guide { margin: 8px 0 0; padding-left: 20px; line-height: 1.65; font-size: 14px; color: var(--soft); }
.guide code, .panel code { font-family: var(--mono); font-size: 12.5px; padding: 1px 6px; border-radius: 5px; background: var(--line); color: var(--text); }
.pin { position: absolute; top: -7px; right: -7px; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; background: #ED4245; color: #fff; border: 3px solid var(--panel); font-family: var(--mono); font-size: 12px; font-weight: 600; display: grid; place-items: center; line-height: 1; }
button.pin { cursor: pointer; }
.pin.grey { background: #5B6780; }
.pins { display: inline-flex; gap: 4px; }
.pin.mini { position: static; height: 20px; min-width: 0; padding: 0 6px; border: none; font-size: 10.5px; }
.tab-dot { position: absolute; top: 8px; right: calc(50% - 16px); width: 9px; height: 9px; border-radius: 50%; background: #ED4245; }
.net-hint { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.net-hint .dot { display: inline-block; }

/* ===== Plan de vol ===== */
.plan-item { display: flex; gap: 12px; align-items: flex-start; }
.plan-item .pt { font-family: var(--mono); font-size: 13px; color: var(--amber); min-width: 50px; padding-top: 2px; }
.plan-item .pb { flex: 1; display: flex; flex-direction: column; gap: 2px; padding-bottom: 10px; border-bottom: 1px solid var(--line); min-width: 0; }
.plan-item .pb b { font-size: 15px; }
.plan-item .pb small { font-size: 13px; color: var(--muted); }
.minibars { display: flex; align-items: flex-end; gap: 4px; height: 44px; }
.minibars i { width: 9px; border-radius: 2px; background: #2E4470; min-height: 2px; }
.minibars i.today { background: var(--amber); }

/* ===== Suivi / chrono ===== */
.timer-face { font-family: var(--mono); font-size: 64px; font-weight: 600; text-align: center; letter-spacing: 2px; }
.timer-face.run { color: var(--green); }
.timer-face.pause { color: var(--blue); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.hist-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }

/* ===== Cours & révisions ===== */
.subj { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.subj-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.subj-sw { width: 12px; height: 34px; border-radius: 4px; background: var(--sc); flex: none; }
.subj-name { display: flex; flex-direction: column; min-width: 110px; }
.subj-name b { font-family: var(--font-cond); font-size: 22px; font-weight: 600; line-height: 1.1; }
.subj-name small { color: var(--muted); font-size: 13px; }
.subj-gauge { display: flex; align-items: center; gap: 8px; flex: 1 1 140px; max-width: 260px; }
.subj-gauge .bar { flex: 1; }
.subj-gauge .mono { font-size: 13px; min-width: 36px; text-align: right; }
.subj-meta { font-size: 12px; color: var(--muted); }
.subj-acts { display: flex; gap: 6px; margin-left: auto; }
.chap-list { display: flex; flex-direction: column; gap: 8px; }
.chap { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main acts" "files files"; gap: 6px 10px; align-items: center; padding: 8px 10px 8px 14px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); box-shadow: inset 3px 0 0 var(--sc); }
.chap.due { border-color: #6B4E17; }
.chap-main { grid-area: main; display: flex; flex-direction: column; gap: 4px; min-width: 0; border: none; background: none; text-align: left; padding: 4px 0; color: var(--text); }
.chap-title { font-size: 15px; font-weight: 600; }
.chap-acts { grid-area: acts; display: flex; gap: 4px; align-items: center; }
.chap .file-chips { grid-area: files; }
.st { font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .5px; padding: 2px 6px; border-radius: 5px; }
.s-new { color: var(--muted); background: var(--line); }
.s-learning { color: var(--amber); background: var(--amber-bg); }
.s-mastered { color: var(--green); background: var(--green-bg); }
.lvl { display: flex; gap: 3px; }
.lvl i { width: 18px; height: 4px; border-radius: 2px; background: var(--line-2); }
.lvl i.on { background: var(--sc, var(--green)); }
.file-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; max-width: 100%; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel); color: var(--soft); font-size: 12.5px; }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip svg.ic { width: 14px; height: 14px; }
.file-chip small { font-family: var(--mono); font-size: 9.5px; color: var(--muted); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 3px; }
.file-chip:hover { color: var(--text); border-color: var(--muted); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ===== Import Auriga ===== */
.sync-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; border-radius: 10px; background: var(--blue-bg); border: 1px solid #1B4A66; color: var(--soft); font-size: 13.5px; }
.sync-bar > span { flex: 1 1 220px; }
.sync-bar svg.ic { color: var(--blue); }
.sync-bar.stale { background: var(--amber-bg); border-color: #6B4E17; }
.sync-bar.stale svg.ic { color: var(--amber); }
.import-box { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.import-box h2 { margin: 0; font-family: var(--font-cond); font-size: 24px; font-weight: 600; }
.steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; color: var(--soft); font-size: 14px; line-height: 1.5; }
.steps li { padding-left: 4px; }
.steps li .btn { margin-top: 6px; display: flex; width: max-content; }
.steps code { font-family: var(--mono); font-size: 12.5px; padding: 1px 6px; border-radius: 5px; background: var(--line); color: var(--text); }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 130px; border: 2px dashed var(--line-2); border-radius: 12px; background: var(--bg-2); color: var(--soft); cursor: pointer; text-align: center; padding: 12px; }
.drop:hover, .drop.over { border-color: var(--amber); color: var(--text); }
.drop svg.ic { width: 26px; height: 26px; color: var(--amber); }
.drop small { color: var(--muted); }

/* ===== Formulaires / modale ===== */
.modal, .sheet { border: 1px solid var(--line-2); border-radius: 16px; background: var(--panel); color: var(--text); padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
.modal::backdrop, .sheet::backdrop { background: rgba(3, 6, 14, .72); }
.modal form, .sheet .sheet-body { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.modal h2 { margin: 0; font-family: var(--font-cond); font-size: 24px; font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--soft); font-weight: 500; }
.field input, .field select, .field textarea { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-2); }
.field textarea { min-height: 120px; resize: vertical; line-height: 1.45; }
.field textarea.tall { min-height: 280px; }
.field.check-field { flex-direction: row; align-items: center; gap: 10px; }
.field.check-field input { width: 22px; min-height: 22px; height: 22px; accent-color: var(--amber); }
.fields-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.modal-actions .spacer { flex: 1; }
.sheet { margin: auto auto 0; border-radius: 16px 16px 0 0; width: 100%; max-width: 560px; }
.sheet-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sheet-links a { min-height: 64px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); display: flex; align-items: center; gap: 10px; padding: 0 14px; color: var(--text); }

.toasts { position: fixed; z-index: 60; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 10px 16px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line-2); box-shadow: 0 10px 30px rgba(0,0,0,.45); font-size: 14px; }

/* ===== Barre d'onglets mobile ===== */
.tabbar { display: none; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .topbar { padding: 14px 16px 6px; }
  .titles h1 { font-size: 26px; }
  .clock { display: none; }
  .search-wrap { max-width: none; order: 3; flex-basis: 100%; }
  .view { padding: 6px 14px calc(96px + env(safe-area-inset-bottom)); gap: 14px; }
  .panel { padding: 14px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .big { font-size: 30px; }
  .big small { font-size: 18px; }
  .big { white-space: nowrap; }
  .grid-4 .minibars { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; padding: 6px 6px calc(10px + env(safe-area-inset-bottom)); background: var(--bg-2); border-top: 1px solid var(--line); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px; border: none; background: none; color: var(--muted); font-size: 11px; border-radius: 10px; }
  .tabbar .active { color: var(--amber); }
  .tabbar svg.ic { width: 22px; height: 22px; }
  .toasts { bottom: calc(90px + env(safe-area-inset-bottom)); }
  .timer-face { font-size: 52px; }
  .chap { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "files" "acts"; }
  .subj-acts { margin-left: 0; }
}
@media (max-width: 420px) {
  .grid-4 .panel .label { font-size: 10px; letter-spacing: 1px; }
}
