/* ESGI · Gestion des VPS */
:root {
  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #f2f4f8;
  --hover: #f7f8fc;
  --border: #e3e6ee;
  --border-strong: #cdd2de;
  --text: #161a27;
  --muted: #646b80;
  --accent: #3b5bdb;
  --accent-hover: #2f4bc0;
  --accent-soft: #e9eeff;
  --on-accent: #ffffff;
  --ok: #1d7f46;
  --ok-soft: #e2f4e9;
  --warn: #9a5800;
  --warn-soft: #fff0d4;
  --danger: #c4302b;
  --danger-soft: #ffe8e6;
  --info: #1864ab;
  --info-soft: #e2efff;
  --sidebar: #12162b;
  --sidebar-text: #b9bfd6;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .07);
  --shadow-lg: 0 24px 60px rgba(16, 24, 40, .28);
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1020;
    --surface: #151a2d;
    --surface-2: #1b2137;
    --hover: #1a1f35;
    --border: #252b44;
    --border-strong: #353c5c;
    --text: #e7e9f3;
    --muted: #949ab3;
    --accent: #8098ff;
    --accent-hover: #98abff;
    --accent-soft: #222a50;
    --on-accent: #0b0f24;
    --ok: #57c98c;
    --ok-soft: #15301f;
    --warn: #f2b552;
    --warn-soft: #362a12;
    --danger: #ff7f78;
    --danger-soft: #3a1a1d;
    --info: #74b4ff;
    --info-soft: #162a44;
    --sidebar: #090c19;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.5 var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 650; }
h3 { font-size: 13px; font-weight: 600; color: var(--muted); }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; }
svg { flex: none; }

.muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.pve-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.pve-line .badge { font-size: 11px; padding: 3px 7px; }
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 14px; margin: 0; }
.kv dt { color: var(--muted); font-weight: 550; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
input[readonly] { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.steps-list { margin: 0; padding-left: 20px; }
.steps-list li { margin: 0 0 10px; }
.secret-key { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.secret-key code { font-size: 16px; letter-spacing: .08em; padding: 6px 10px; user-select: all; }
.table th.sel-cell, .table td.sel-cell { width: 38px; padding-right: 0; }
.table tbody tr.is-selected td { background: var(--accent-soft); }
.big-secret { font-size: 17px; letter-spacing: .06em; padding: 4px 10px; user-select: all; }
@media (max-width: 860px) { .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; } .kv dd { margin-bottom: 8px; } }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------- structure ---------- */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; padding: 18px 12px;
}
.view { padding: 28px 32px 56px; min-width: 0; width: 100%; max-width: 1440px; }

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #4c6ef5, #7048e8);
  box-shadow: 0 4px 14px rgba(76, 110, 245, .35);
}
.brand .logo svg { width: 18px; height: 18px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { color: #fff; font-size: 15px; letter-spacing: .06em; }
.brand-text span { font-size: 12px; opacity: .8; }
.brand.big { justify-content: center; padding: 0 0 18px; }
.brand.big .logo { width: 42px; height: 42px; border-radius: 11px; }
.brand.big .logo svg { width: 22px; height: 22px; }
.brand.big .brand-text strong { color: var(--text); font-size: 17px; }
.brand.big .brand-text span { color: var(--muted); opacity: 1; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px;
  color: var(--sidebar-text); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.active { background: rgba(128, 152, 255, .17); color: #fff; }
.nav a.active svg { color: #a5b6ff; }
.side-foot {
  margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 14px 6px 0; border-top: 1px solid rgba(255, 255, 255, .08);
}
.me { display: flex; align-items: center; gap: 9px; min-width: 0; color: #e6e8f2; }
.me span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: rgba(128, 152, 255, .25); color: #fff; font-weight: 700; font-size: 12px;
}
.side-foot .icon-btn { color: var(--sidebar-text); }
.side-foot .icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }

/* ---------- en-têtes ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .sub { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 550;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--hover); border-color: var(--muted); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { filter: brightness(.94); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 7px; }
.btn.block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 7px;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- cartes & stats ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 20px; min-width: 0;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head.spaced { margin-top: 20px; }
.card-head .link { font-size: 13px; text-decoration: none; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .card, .grid-2 + .grid-2 { margin-top: 20px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
  display: block; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px; position: relative; overflow: hidden;
  transition: border-color .12s, transform .12s;
}
.stat:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); opacity: .8; }
.stat.ok::before { background: var(--ok); }
.stat.warn::before { background: var(--warn); }
.stat.danger::before { background: var(--danger); }
.stat .label { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.stat .value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.stat .value .of { font-size: 16px; color: var(--muted); font-weight: 600; margin-left: 3px; }
.stat.danger .value { color: var(--danger); }
.stat .hint { font-size: 12px; color: var(--muted); }

.onboarding { border-style: dashed; background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.onboarding ol { margin: 10px 0 4px; padding-left: 20px; }
.onboarding li { margin: 4px 0; }

/* ---------- barres d'outils ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .search { flex: 1 1 260px; max-width: 420px; position: relative; }
.toolbar .search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.toolbar .search input { padding-left: 34px; }
.toolbar select { width: auto; min-width: 150px; }
.toolbar .spacer { flex: 1; }
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 550; font-size: 13px;
  padding: 5px 11px; border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.segmented button span { font-size: 11.5px; background: var(--border); color: var(--muted); border-radius: 10px; padding: 0 6px; font-variant-numeric: tabular-nums; }
.segmented button:hover { color: var(--text); }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.segmented button.on span { background: var(--accent-soft); color: var(--accent); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs button {
  border: 0; background: none; font: inherit; font-weight: 600; color: var(--muted); padding: 9px 12px;
  border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer;
}
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- tableaux ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); background: var(--surface-2); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--hover); }
.table th.right, .table td.right { text-align: right; }
.table.compact td, .table.compact th { padding: 8px 10px; }
.table .empty-row td { text-align: center; color: var(--muted); padding: 36px 14px; }
.table-foot { padding: 9px 14px; border-top: 1px solid var(--border); }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions > * { vertical-align: middle; }
.clamp { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tr.is-off td { color: var(--muted); }

.copy {
  border: 0; background: none; padding: 2px 6px; margin-left: -6px; border-radius: 5px; color: inherit;
  cursor: copy; font-family: var(--mono); font-size: 12.5px;
}
.copy:hover { background: var(--accent-soft); color: var(--accent); }

/* ---------- badges & puces ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; line-height: 1;
  padding: 4px 8px; border-radius: 20px; white-space: nowrap; background: var(--surface-2); color: var(--muted);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 6px;
  background: var(--accent-soft); color: var(--text); font-size: 13px; font-weight: 550; white-space: nowrap;
}
.chip em { font-style: normal; font-weight: 500; font-size: 11.5px; color: var(--muted); }
.chip.late { background: var(--danger-soft); }
.chip.late em { color: var(--danger); }

/* ---------- listes ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .when { font-size: 12px; color: var(--muted); white-space: nowrap; }
.empty { color: var(--muted); margin: 6px 0; }

.progress { height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; min-width: 80px; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.progress.full span { background: var(--ok); }
.progress.warn span { background: var(--warn); }
.progress.danger span { background: var(--danger); }

/* ---------- ressources ---------- */
.section-title { font-size: 17px; margin: 28px 0 12px; }
.res-server .card-head h2 { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.res-node + .res-node { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.res-node-name { margin: 0 0 12px; color: var(--text); }
.meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px 24px; }
.meter-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 7px; }
.meter-label { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.meter-label .badge { font-size: 11px; padding: 2px 7px; margin-left: 4px; }
.meter-value { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.meter-value .muted { font-weight: 500; }
.meter-sub { font-size: 12px; color: var(--muted); margin-top: 6px; overflow-wrap: anywhere; }
.res-facts { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 14px 0 0; font-size: 12.5px; color: var(--muted); }
.sparks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; margin-top: 18px; }
.spark-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.spark-title { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.spark-empty { margin: 4px 0 0; }
.spark-plot { position: relative; height: 64px; touch-action: pan-y; cursor: crosshair; }
.spark-plot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark-area { fill: var(--accent); opacity: .12; }
.spark-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.spark-base { stroke: var(--border-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.spark-scale { position: absolute; right: 0; top: 2px; font-size: 10.5px; line-height: 1; color: var(--muted); pointer-events: none; }
.spark-scale.mid { top: calc(50% + 2px); }
.spark-cross { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border-strong); pointer-events: none; }
.spark-dot { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); pointer-events: none; }
.spark-tip {
  position: absolute; top: -8px; transform: translate(-50%, -100%); background: var(--text); color: var(--surface);
  font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none;
  font-variant-numeric: tabular-nums; box-shadow: var(--shadow); z-index: 2;
}
.spark-tip.edge-left { transform: translate(0, -100%); }
.spark-tip.edge-right { transform: translate(-100%, -100%); }
.spark-axis { display: flex; justify-content: space-between; margin-top: 4px; font-variant-numeric: tabular-nums; }
.res-alloc { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px 24px; margin-top: 18px; padding: 14px 16px; background: var(--surface-2); border-radius: 10px; }
.res-alloc-value { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.res-alloc-value .muted { font-size: 13px; font-weight: 500; }
.res-alloc-value .badge { font-size: 11px; vertical-align: middle; }
.cell-meter { min-width: 130px; font-variant-numeric: tabular-nums; }
.cell-meter .progress { margin-top: 6px; }
.cell-meter .badge { font-size: 10.5px; padding: 1px 6px; margin-left: 2px; }
.motif.clamp { max-width: 220px; }
.batch-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.batch-line > svg { color: var(--accent); }
.batch-line > span { flex: 1; min-width: 220px; }
.lot-table { max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.lot-table thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.lot-apercu { margin-top: 12px; }
.res-machines td:first-child { min-width: 210px; }
.res-machines td:nth-child(3) { min-width: 170px; }
.chips + .motif { margin-top: 4px; }

.log-action { font-weight: 600; }
.log-line { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.log-line:last-child { border-bottom: 0; }

/* ---------- formulaires ---------- */
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--text); }
input, select, textarea {
  width: 100%; font: inherit; font-weight: 400; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 11px; min-height: 36px;
  transition: border-color .12s, box-shadow .12s;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"] { width: 16px; height: 16px; min-height: 0; padding: 0; accent-color: var(--accent); margin: 0; flex: none; }
input[type="file"] { padding: 6px; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.hint { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.c2 { grid-column: span 2; }
.c3 { grid-column: span 3; }
.c6 { grid-column: span 6; }
.c4 { grid-column: span 4; }
.field-label { font-size: 13px; font-weight: 600; margin-bottom: 5px; display: block; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.form-error {
  background: var(--danger-soft); color: var(--danger); border-radius: 8px; padding: 9px 12px; font-weight: 500; font-size: 13px;
}
.notice { background: var(--info-soft); color: var(--info); border-radius: 8px; padding: 9px 12px; font-size: 13px; margin-bottom: 14px; }
.callout { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.callout label.check { color: var(--text); margin-top: 8px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* sélecteur d'étudiants */
.picker { border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden; }
.picker input[type="search"] { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; box-shadow: none; }
.picker-list { max-height: 240px; overflow-y: auto; }
.pick {
  flex-direction: row; align-items: center; gap: 10px; padding: 7px 12px; font-weight: 500; cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.pick:last-child { border-bottom: 0; }
.pick:hover { background: var(--hover); }
.pick .who { flex: 1; min-width: 0; }
.pick em { font-style: normal; font-size: 12px; color: var(--muted); }
.pick small { font-size: 11.5px; color: var(--warn); font-weight: 500; }
.pick:has(input:checked) { background: var(--accent-soft); }
.picker-foot { padding: 6px 12px; background: var(--surface-2); border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }

pre.sample {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
  font-family: var(--mono); font-size: 12px; overflow-x: auto; margin: 8px 0 0; white-space: pre;
}
.cols { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.cols code.req { border-color: var(--accent); color: var(--accent); }

/* ---------- modales ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(10, 13, 28, .5); backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto;
  animation: fade .15s ease-out;
}
.modal {
  width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-lg); animation: pop .16s ease-out;
}
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 16px; }
.modal-body { padding: 18px 20px; }
.modal-body p:first-child { margin-top: 0; }
.modal .form-error { margin: 0 20px 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 14px 14px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } }

/* ---------- toasts ---------- */
.update-banner {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 45;
  display: flex; align-items: center; gap: 10px; max-width: calc(100% - 32px);
  background: var(--surface); color: var(--text); border: 1px solid var(--accent); border-radius: 10px;
  padding: 8px 8px 8px 14px; box-shadow: var(--shadow-lg); font-weight: 550;
}
.update-banner > svg { color: var(--accent); }
.update-banner span { flex: 1; }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 9px; box-shadow: var(--shadow-lg);
  font-weight: 550; max-width: 380px; animation: pop .16s ease-out; transition: opacity .3s, transform .3s;
}
.toast.error { background: var(--danger); color: #fff; }
.toast.warn { background: var(--warn); color: #fff; }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ---------- connexion ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent),
  radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, #7048e8 14%, transparent), transparent), var(--bg); }
.auth-card {
  width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-lg); padding: 30px 28px;
}
.auth-card h1 { font-size: 20px; text-align: center; }
.auth-card > p { text-align: center; margin: 6px 0 20px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card .btn { height: 40px; margin-top: 4px; }
.auth-card ul { padding-left: 18px; }

.loading { color: var(--muted); padding: 40px 0; text-align: center; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    height: auto; z-index: 20; flex-direction: row; align-items: center; gap: 6px; padding: 8px 12px;
    overflow-x: auto;
  }
  .brand { padding: 0 6px 0 0; }
  .brand-text { display: none; }
  .nav { flex-direction: row; }
  .nav a { padding: 8px 10px; }
  .nav a span { display: none; }
  .sidebar { scrollbar-width: none; }
  .sidebar::-webkit-scrollbar { display: none; }
  .nav { gap: 0; }
  .nav a { padding: 8px 9px; }
  .side-foot { margin: 0 0 0 auto; padding: 0; border: 0; }
  .me { display: none; }
  .view { padding: 20px 16px 48px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .c2, .c3, .c4, .c6 { grid-column: auto; }
  .toolbar .search { max-width: none; }
  .log-line { grid-template-columns: 1fr; gap: 2px; }
  .modal-backdrop { padding: 16px; }
  .sparks { grid-template-columns: minmax(0, 1fr); }
}
