/* LEARN/OPS — le thème HUD, d'après le terminal CHART/OPS (le dossier « _HUD THEME TEST ») : fond bleu-vert très sombre,
   accent menthe, panneaux à équerres aux coins, petits titres en capitales espacées, boutons à coins coupés, fine trame de
   fond, barre du haut / rail d'icônes / barre d'état. Ici : les bases et les composants ; les pages sont dans app.css. */

:root {
  color-scheme: dark;
  --bg: #18252d;
  --panel: #1d2b33;
  --panel-2: #22343d;
  --accent: #4de0b0;
  --accent-ink: #112a25;
  --text: #dce6eb;
  --muted: #83959f;
  --dim: #6e8793;
  --border: rgba(177, 203, 215, .19);
  --line: rgba(168, 198, 209, .075);
  --blue: #50a5d5;
  --purple: #a28bdd;
  --negative: #f08086;
  --gold: #dbb97d;
  --font: 'Segoe UI', Arial, sans-serif;
  --mono: Consolas, 'Cascadia Mono', 'DejaVu Sans Mono', monospace;
  --header: 57px;
  --status: 26px;
  --rail: 53px;
  --cut: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 7px 100%, 0 calc(100% - 7px));
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--text); font: 14px/1.5 var(--font); min-height: 100vh;
  background: radial-gradient(ellipse at 45% 15%, #31434866, transparent 70%), linear-gradient(125deg, #17252d, #1d292f) fixed, #19272f;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background-image: linear-gradient(#9fbbcc06 1px, transparent 1px), linear-gradient(90deg, #9fbbcc06 1px, transparent 1px);
  background-size: 6px 6px;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; }
button, a, input, select { -webkit-tap-highlight-color: transparent; outline-offset: 3px; }
:focus-visible { outline: 1px solid var(--accent); }
svg.ic { width: 18px; height: 18px; flex-shrink: 0; }
code, kbd, pre { font-family: var(--mono); }
code { font-size: .92em; color: #c4d6de; background: #adc8d10d; border: 1px solid var(--line); padding: 1px 5px; }
[hidden] { display: none !important; }
::selection { background: #4de0b055; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #75909b40; }
::-webkit-scrollbar-thumb:hover { background: #75909b70; }
::-webkit-scrollbar-track { background: transparent; }

.muted { color: var(--muted); }
.positive { color: var(--accent); }
.negative { color: var(--negative); }
.small-label { font-size: 10px; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }
.status-dot { display: inline-block; width: 5px; height: 5px; background: var(--accent); box-shadow: 0 0 8px #4de0b040; margin-right: 6px; vertical-align: 2px; }

/* ── la mise en page « terminal » : barre du haut, rail, espace de travail, barre d'état ─────────────────────────────── */
body.app { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
.terminal-header {
  height: var(--header); flex-shrink: 0; display: flex; align-items: center; gap: 26px; padding: 0 19px;
  border-bottom: 1px solid var(--border); background: #17242cd9; position: relative; z-index: 20;
}
.terminal-brand { display: flex; align-items: center; }
.wordmark { font: 600 23px var(--font); letter-spacing: 1px; white-space: nowrap; }
.wordmark > span { color: var(--accent); margin: 0 2px; }
.revision {
  position: relative; font: 10px var(--font); color: var(--muted); letter-spacing: .5px; padding: 4px 6px; margin: 0 0 10px 8px;
  border: 1px solid var(--border); cursor: pointer; background: transparent;
}
.revision:hover { color: var(--accent); border-color: var(--accent); }
.has-updates::after { content: ""; position: absolute; width: 5px; height: 5px; background: var(--accent); right: -3px; top: -3px; box-shadow: 0 0 8px #4de0b080; }
.terminal-nav { display: flex; align-self: stretch; gap: 24px; margin-left: 8px; }
.terminal-nav a { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); position: relative; }
.terminal-nav a svg { width: 15px; height: 15px; }
.terminal-nav a:hover { color: var(--text); }
.terminal-nav a.active { color: var(--accent); }
.terminal-nav a.active::after { content: ""; position: absolute; bottom: -1px; height: 2px; background: var(--accent); left: 0; right: 0; }
.header-search {
  display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); padding: 6px 9px; color: var(--muted);
  margin-left: auto; width: min(340px, 30vw); background: #0f1b231c;
}
.header-search:focus-within { border-color: #4de0b080; }
.header-search svg { width: 14px; height: 14px; }
.header-search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; font-size: 12px; color: var(--text); }
.header-search input::placeholder { color: #7f939d; }
.header-search kbd { font-size: 10px; border: 1px solid var(--border); padding: 0 4px; color: var(--dim); }
.terminal-header-right { display: flex; align-items: center; gap: 14px; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 5px; color: #a4b5bf; position: relative; }
.icon-button:hover { color: var(--accent); background: #4de0b010; }
.avatar {
  background: #34494c; color: var(--accent); border: 1px solid #4de0b060; width: 30px; height: 30px; display: grid; place-items: center;
  font-size: 11px; letter-spacing: .5px; flex-shrink: 0;
}
.avatar.sm { width: 26px; height: 26px; font-size: 10px; }
button.avatar:hover { border-color: var(--accent); }
.user-menu { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 10px); min-width: 250px; background: #1e2e37; border: 1px solid #728e9a;
  box-shadow: 0 20px 60px #0009; padding: 6px; z-index: 50;
}
.menu-head { padding: 10px 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-head b { display: block; font-weight: 500; }
.menu-head small { font-size: 9px; letter-spacing: 1.2px; color: var(--accent); }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; font-size: 13px; color: #b9cad3; text-align: left; }
.menu a:hover, .menu button:hover { background: #4de0b00f; color: var(--text); }
.menu svg { width: 16px; height: 16px; color: var(--muted); }
.menu-val { margin-left: auto; font-size: 10px; color: var(--accent); }
.menu form { margin: 0; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; }
.menu .menu-danger:hover { color: var(--negative); background: #f080860d; }

.terminal-layout { display: flex; flex: 1; min-height: 0; }
.terminal-rail {
  width: var(--rail); flex-shrink: 0; border-right: 1px solid var(--border); display: flex; align-items: center; flex-direction: column;
  gap: 12px; padding: 19px 0 12px; background: #15222a44;
}
.rail-button { color: #829ba8; width: 35px; height: 35px; display: grid; place-items: center; position: relative; border: 1px solid transparent; }
.rail-button svg { width: 19px; height: 19px; }
.rail-button:hover { color: var(--text); background: #adc8d108; }
.rail-button.active { color: var(--accent); background: #4de0b011; border-color: #4de0b02b; }
.rail-button.active::before { content: ""; position: absolute; left: -10px; height: 15px; width: 2px; background: var(--accent); }
.rail-bottom { margin-top: auto; }
.rail-number { font: 9px var(--font); color: #718b98; }
.terminal-workspace { flex: 1; min-width: 0; overflow-y: auto; padding: 22px 28px 40px; scroll-padding-top: 20px; }
.terminal-workspace.flush { padding: 12px 14px; overflow: hidden; display: flex; flex-direction: column; }

.terminal-status {
  height: var(--status); flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-top: 1px solid var(--border); padding: 0 16px; background: #14212abf; color: #7993a3; font: 9px var(--font); letter-spacing: .7px;
}
.terminal-status .status-dot { width: 4px; height: 4px; vertical-align: 1px; }
.status-separator { margin: 0 9px; color: #476879; }
.status-hint { letter-spacing: 1.5px; color: #65818f; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.status-version { font: 10px var(--font); color: #a7bdc7; margin-left: 9px; padding: 1px 5px; border: 1px solid var(--border); }
.status-version:hover { color: var(--accent); border-color: var(--accent); }

/* ── les pages sans barres (connexion, installation) ─────────────────────────────────────────────────────────────────── */
body.bare { display: flex; flex-direction: column; min-height: 100dvh; }
.bare-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 16px; gap: 14px; }
.bare .terminal-status { position: sticky; bottom: 0; }
.login-card { width: min(420px, 100%); padding: 30px 30px 26px; }
.login-brand { display: flex; align-items: center; margin-bottom: 6px; }
.login-brand .wordmark { font-size: 27px; }
.login-sub { color: var(--muted); margin: 0 0 22px; font-size: 13px; }
.login-sub b { color: var(--text); font-weight: 500; }
.login-links { text-align: center; font-size: 12px; margin: 14px 0 0; }
.login-links a { color: var(--accent); }
.login-note { text-align: center; font-size: 12px; color: var(--muted); margin: 14px 0 0; line-height: 1.6; }
.login-note.left { text-align: left; }
.or { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 11px; margin: 16px 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.bare-main > .alert { width: min(420px, 100%); }

/* ── panneaux : les équerres du HUD ───────────────────────────────────────────────────────────────────────────────── */
.panel { position: relative; background: linear-gradient(115deg, #adc8d106, #adc8d101); border: 1px solid var(--border); min-width: 0; }
.panel::before, .panel::after {
  content: ""; position: absolute; inset: -1px; pointer-events: none; opacity: .7;
  background: linear-gradient(#a4bdc6, #a4bdc6) left top / 8px 2px no-repeat, linear-gradient(#a4bdc6, #a4bdc6) left top / 2px 8px no-repeat,
    linear-gradient(#a4bdc6, #a4bdc6) right bottom / 8px 2px no-repeat, linear-gradient(#a4bdc6, #a4bdc6) right bottom / 2px 8px no-repeat;
}
.panel::after { transform: scaleX(-1); opacity: .45; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); padding: 13px 16px; min-height: 46px; }
.section-heading h2 { font: 600 11px var(--font); letter-spacing: 1.1px; margin: 0; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.section-heading h2 a:hover { color: var(--accent); }
.panel-id { color: #718b98; font: 10px var(--font); letter-spacing: 1px; white-space: nowrap; }
.panel-body { padding: 16px; }
.panel + .panel, .panel + .grid-2, .grid-2 + .panel, .narrow + .panel, .panel + .narrow, .narrow > .panel + .panel { margin-top: 16px; }
.panel-title { font: 500 10px var(--font); letter-spacing: 1px; color: #a7bac4; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.panel-title svg { width: 16px; height: 16px; color: #738d98; }

/* ── en-tête de page ───────────────────────────────────────────────────────────────────────────────────────────────── */
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 0 0 22px; flex-wrap: wrap; }
.breadcrumb { font: 10px var(--font); letter-spacing: 1.2px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.breadcrumb b { font-weight: 400; color: #c7d6df; }
.breadcrumb a:hover { color: var(--accent); }
.page-heading h1, h1 { font: 500 28px var(--font); letter-spacing: .2px; margin: 10px 0 0; line-height: 1.25; }
.heading-slashes { font-weight: 400; color: var(--accent); font-size: .8em; margin-left: 9px; }
.page-heading p { color: var(--muted); margin: 7px 0 0; font-size: 13px; }
.page-heading p b { color: var(--text); font-weight: 500; }
.heading-actions { display: flex; gap: 10px; align-items: center; }

/* ── boutons ───────────────────────────────────────────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid #718b9566; padding: 8px 13px;
  font-size: 12px; color: #c3d3db; background: #adc8d104; white-space: nowrap; line-height: 1.3; text-align: center;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.disabled { opacity: .35; pointer-events: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; clip-path: var(--cut); }
.btn-primary:hover { color: var(--accent-ink); filter: brightness(1.1); }
.btn-danger:hover, .btn.btn-danger:hover { border-color: var(--negative); color: var(--negative); }
.btn-primary.btn-danger { background: var(--negative); border-color: var(--negative); color: #301a20; }
.btn-block { width: 100%; padding: 12px; }
.btn-lg { padding: 12px 18px; font-size: 13px; }
.btn-sm { padding: 5px 9px; font-size: 11px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn.is-done { color: var(--accent); border-color: #4de0b060; background: #4de0b00f; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.link-button { color: var(--muted); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; margin-top: 10px; }
.link-button:hover { color: var(--accent); }
form.inline { display: inline-flex; margin: 0; }

/* ── formulaires ───────────────────────────────────────────────────────────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 14px; }
.form > .btn:not(.btn-block) { align-self: flex-start; }
.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin: 0 0 14px; }
.form-row .field { flex: 1 1 180px; }
.field { display: flex; flex-direction: column; gap: 7px; margin: 0; }
.field-label { font: 10px var(--font); letter-spacing: .9px; color: var(--muted); text-transform: uppercase; }
.field-hint { font-size: 11px; color: var(--dim); }
.input, select.input {
  width: 100%; background: #0f1b2326; border: 1px solid #aac5d038; padding: 10px 11px; color: var(--text); font-size: 14px; outline: 0;
}
.input:focus { border-color: var(--accent); }
.input.sm { padding: 5px 8px; font-size: 12px; width: 170px; }
.input.otp { font-family: var(--mono); letter-spacing: 3px; font-size: 18px; }
.input::placeholder { color: #6f8590; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #b9cad3; padding-bottom: 10px; }
.check input, .switch input { accent-color: var(--accent); }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui { width: 34px; height: 18px; border: 1px solid var(--border); background: #0f1b2340; position: relative; flex-shrink: 0; }
.switch-ui::after { content: ""; position: absolute; width: 12px; height: 12px; left: 2px; top: 2px; background: var(--muted); transition: transform .15s, background .15s; }
.switch input:checked + .switch-ui { border-color: #4de0b070; background: #4de0b014; }
.switch input:checked + .switch-ui::after { transform: translateX(16px); background: var(--accent); }
.switch input:focus-visible + .switch-ui { outline: 1px solid var(--accent); outline-offset: 2px; }
.switch b { font-weight: 500; }

/* ── messages, étiquettes, tableaux, encadrés ──────────────────────────────────────────────────────────────────────── */
.alert { border: 1px solid var(--border); border-left: 2px solid var(--accent); background: #4de0b00a; padding: 10px 14px; font-size: 13px; margin: 0 0 16px; line-height: 1.6; }
.alert-danger { border-left-color: var(--negative); background: #f080860d; }
.alert-warning { border-left-color: var(--gold); background: #dbb97d0d; }
.alert-info { border-left-color: var(--blue); background: #50a5d50d; }
.tag { display: inline-block; font: 9px var(--font); letter-spacing: .8px; padding: 3px 6px; color: var(--muted); border: 1px solid var(--border); white-space: nowrap; vertical-align: 1px; }
.tag-ok { color: var(--accent); border-color: #4de0b035; background: #4de0b00d; }
.tag-info { color: var(--blue); border-color: #50a5d535; background: #50a5d50d; }
.tag-bad { color: var(--negative); border-color: #f0808635; background: #f080860d; }
.table-scroll { overflow-x: auto; }
.table { border-collapse: collapse; width: 100%; text-align: left; }
.table td, .table th { padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #c0dde804; }
.table td.muted { font-size: 12px; }
.table td.num { text-align: right; white-space: nowrap; }
.table td.actions { text-align: right; white-space: nowrap; }
.table td.actions form { margin-left: 4px; }
.table .pw .input { margin-right: 4px; }
.who { display: inline-flex; align-items: center; gap: 10px; }
.who b { font-weight: 500; }
.callout { border: 1px solid #4de0b040; background: #4de0b00a; padding: 16px; margin: 0 0 16px; }
.callout h3 { font: 600 12px var(--font); letter-spacing: .8px; margin: 0 0 6px; text-transform: uppercase; color: var(--accent); }
.callout p { margin: 0 0 12px; color: #b4c6cf; font-size: 13px; }
.copy-box { display: flex; align-items: flex-start; gap: 8px; border: 1px solid var(--border); background: #0f1b2340; padding: 10px 10px 10px 14px; }
.copy-box pre { margin: 0; flex: 1; white-space: pre-wrap; word-break: break-all; font-size: 13px; color: #d4e2e8; }
.muted-p { color: var(--muted); font-size: 13px; margin: 0 0 12px; line-height: 1.6; }
.muted-p b { color: var(--text); font-weight: 500; }
.small { font-size: 12px; }
.empty { color: var(--muted); padding: 22px; text-align: center; margin: 0; }
.steps { color: #b4c6cf; font-size: 13px; padding-left: 18px; line-height: 1.7; margin: 0 0 14px; }
.qr-row { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; margin: 0 0 16px; }
.qr { background: #fff; padding: 10px; width: 180px; height: 180px; }
.qr svg { width: 100%; height: 100%; display: block; }
.qr-manual { flex: 1; min-width: 200px; }

/* ── barres de progression (segments du HUD) ───────────────────────────────────────────────────────────────────────── */
.seg-bar { display: block; height: 4px; background: repeating-linear-gradient(90deg, #adc8d126 0 8px, transparent 8px 11px); position: relative; overflow: hidden; }
.seg-bar i { position: absolute; inset: 0 auto 0 0; background: repeating-linear-gradient(90deg, var(--accent) 0 8px, transparent 8px 11px); }
.seg-bar.mini { width: 60px; height: 3px; flex-shrink: 0; background: repeating-linear-gradient(90deg, #adc8d126 0 4px, transparent 4px 6px); }
.seg-bar.mini i { background: repeating-linear-gradient(90deg, var(--accent) 0 4px, transparent 4px 6px); }

/* ── le journal des modifications (dialogue du HUD) ─────────────────────────────────────────────────────────────────── */
dialog { color: var(--text); }
.changelog-dialog {
  background: #1c2a32; border: 1px solid #728e9a; padding: 0; width: min(760px, calc(100% - 32px)); max-width: 760px; max-height: 85dvh;
  box-shadow: 0 20px 100px #0008;
}
.changelog-dialog::backdrop { background: #09151dcc; backdrop-filter: blur(5px); }
.dialog-head { padding: 22px 25px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.eyebrow { font: 10px var(--font); letter-spacing: 1.5px; color: var(--accent); margin: 0 0 8px; }
.dialog-head h2 { font: 500 22px var(--font); margin: 0; }
.changelog-tools { padding: 20px 25px 12px; display: flex; flex-direction: column; gap: 14px; }
.changelog-search { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border: 1px solid var(--border); color: var(--muted); }
.changelog-search input { width: 100%; font-size: 13px; background: none; color: var(--text); border: 0; outline: 0; min-width: 0; }
.changelog-search svg { width: 15px; height: 15px; }
.changelog-filters { display: flex; gap: 4px; flex-wrap: wrap; }
.changelog-filters button { font-size: 12px; padding: 7px 10px; border: 1px solid transparent; color: var(--muted); }
.changelog-filters button.selected { color: var(--accent); border-color: #4de0b03b; background: #4de0b00d; }
.changelog-summary { display: flex; justify-content: space-between; padding: 0 25px 15px; color: var(--muted); font-size: 11px; letter-spacing: .6px; }
.changelog-summary b { color: var(--accent); font-weight: 500; margin-left: 7px; }
.changelog-list { padding: 0 25px 25px; }
.release { border-top: 1px solid var(--border); padding-top: 18px; margin-top: 4px; }
.release-heading { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.release-version { font: 500 19px var(--font); padding: 8px 9px; border: 1px solid #4de0b042; color: var(--accent); background: #4de0b009; }
.release-heading time { font-size: 12px; color: var(--muted); letter-spacing: .7px; }
.release-current, .release-unread { font: 10px var(--font); padding: 4px 6px; color: var(--accent); background: #4de0b014; letter-spacing: .5px; }
.release-current { margin-left: auto; }
.release-unread { color: var(--gold); background: #dbb97d14; }
.change-item { display: flex; gap: 11px; padding: 10px 0; border-top: 1px solid #adc8d112; font-size: 13.5px; line-height: 1.65; color: #c5d4db; }
.change-kind { width: 20px; height: 20px; display: grid; place-items: center; border: 1px solid #4de0b030; color: var(--accent); font-size: 13px; flex-shrink: 0; margin-top: 2px; }
.change-kind.fix { color: var(--negative); border-color: #f0808630; }
.change-kind.improve { color: #70bada; border-color: #70bada30; }
.changelog-empty { text-align: center; padding: 30px; color: var(--muted); }

/* ── petit message (en bas à droite) ───────────────────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 40px; right: 24px; background: #22343d; border: 1px solid var(--accent); color: var(--text); padding: 12px 18px;
  z-index: 60; max-width: calc(100vw - 40px); box-shadow: 0 10px 40px #0005; font-size: 13px;
}
.toast.bad { border-color: var(--negative); }
