/* LTF Espace outils — feuille de style, sans dépendance externe.
   Le hub porte la marque LTF (bandeau marine, écusson) ; chaque tuile garde l'identité de son outil
   (Émargement clair et marine, Pilotage sombre et menthe). Police Plus Jakarta Sans (OFL, auto-hébergée). */

@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/static/fonts/plus-jakarta-sans-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/static/fonts/plus-jakarta-sans-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --navy: #1f3863; --navy-hover: #172a4b; --navy-50: #eef2f9; --navy-100: #dfe6f3;
  --text: #1a2233; --muted: #5c6880; --faint: #8b95a8;
  --bg: #f6f8fc; --surface: #ffffff; --surface-2: #fafbfe;
  --border: #e3e8f1; --border-strong: #c9d2e0;
  --focus: #2e5aac;
  --success: #067647; --success-bg: #ecfdf3;
  --warning: #93370d; --warning-bg: #fffaeb;
  --danger: #b42318; --danger-bg: #fef3f2;
  /* Bandeau de marque LTF (barre haute + accueil) */
  --band: #12203b; --band-2: #1b2d52; --band-fg: #ffffff; --band-dim: #a9b8d6; --band-hover: rgba(255, 255, 255, 0.09);
  /* Aperçus : chaque outil garde sa propre identité */
  --pe-bg: #f6f8fc; --pe-card: #ffffff; --pe-line: #e3e8f1; --pe-navy: #1f3863; --pe-plan: #2f5ea8; --pe-live: #0f8a5f; --pe-close: #c2412d;
  --pv-bg: #0d1117; --pv-card: #161b22; --pv-line: #2a313c; --pv-fg: #e6edf3; --pv-dim: #8b949e; --pv-mint: #6ee7b7; --pv-ink: #0d1117;
  --shadow: 0 1px 2px rgba(31, 56, 99, 0.06), 0 1px 1px rgba(31, 56, 99, 0.04);
  --shadow-hover: 0 18px 34px -20px rgba(20, 35, 70, 0.5);
  --radius: 14px; --radius-sm: 10px; --radius-lg: 20px;
  --font: "Plus Jakarta Sans", -apple-system, "Segoe UI", system-ui, Roboto, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Couleur de chaque apparence d'outil : --c (accent), --cbg (fond doux), --ink (texte sur fond doux). */
.th-emargement { --c: #1f3863; --cbg: #e9eef8; --ink: #1f3863; }
.th-pilotage   { --c: #10b981; --cbg: #d7f6ea; --ink: #04694a; }
.th-devis      { --c: #6b4bb8; --cbg: #efe9fb; --ink: #553a96; }
.th-turquoise  { --c: #0d7f8c; --cbg: #e1f4f6; --ink: #0a6470; }
.th-ambre      { --c: #b26a00; --cbg: #fdf1dc; --ink: #8a5200; }
.th-hub        { --c: #1f3863; --cbg: #eef2f9; --ink: #1f3863; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font-family: var(--font); font-size: 15px; line-height: 1.55; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0 0 12px; color: var(--navy); letter-spacing: -0.02em; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 1.75rem; font-weight: 750; }
h2 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0 0 16px; }
a { color: var(--navy); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--navy-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 0.85rem; word-break: break-all; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: 16px; top: -48px; z-index: 50; padding: 8px 16px; background: var(--navy); color: #fff; border-radius: var(--radius-sm); }
.skip-link:focus { top: 8px; color: #fff; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.icon { width: 20px; height: 20px; flex: none; overflow: visible; }
.icon .duo { fill: currentColor; stroke: none; opacity: 0.18; }

/* --- Barre haute (bandeau de marque) ------------------------------------------------------- */
.top { background: var(--band); color: var(--band-fg); }
.top-in { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand:hover { color: inherit; }
.brand img { width: 38px; height: auto; padding: 3px; background: #fff; border-radius: 10px; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.15; }
.brand-org { font-weight: 800; letter-spacing: 0.05em; color: var(--band-fg); font-size: 0.76rem; }
.brand-app { color: var(--band-dim); font-size: 0.86rem; font-weight: 500; }
.top-nav { display: flex; gap: 4px; margin-left: 12px; }
.top-nav a {
  padding: 8px 12px; border-radius: 10px; color: var(--band-dim); font-weight: 600; text-decoration: none;
  display: inline-flex; gap: 8px; align-items: center;
}
.top-nav a .icon { width: 18px; height: 18px; }
.top-nav a:hover, .top-nav a[aria-current="page"] { background: var(--band-hover); color: var(--band-fg); }
.me { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.me-link { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; border-radius: 999px; }
.me-link:hover { color: inherit; }
.me-name { font-weight: 650; font-size: 0.9rem; text-align: right; line-height: 1.2; }
.me-name small { display: block; color: var(--band-dim); font-weight: 500; font-size: 0.76rem; }
.logout-btn {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 0; cursor: pointer;
  background: transparent; color: var(--band-dim);
}
.logout-btn:hover { background: var(--band-hover); color: var(--band-fg); }
.logout-btn .icon { width: 18px; height: 18px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-weight: 750; font-size: 0.82rem; background: var(--navy); color: #fff;
}
.top .avatar { box-shadow: 0 0 0 2px var(--band), 0 0 0 4px rgba(255, 255, 255, 0.22); }
.avatar.sm { width: 34px; height: 34px; font-size: 0.76rem; }
.av-0 { background: #1f3863; } .av-1 { background: #0f8a5f; } .av-2 { background: #b26a00; }
.av-3 { background: #c2412d; } .av-4 { background: #2f5ea8; } .av-5 { background: #6b4bb8; }

/* --- Bandeau d'accueil -------------------------------------------------------------------- */
.band { background: linear-gradient(180deg, var(--band) 0%, var(--band-2) 100%); color: var(--band-fg); position: relative; overflow: hidden; }
.band::after {
  content: ""; position: absolute; right: -10%; bottom: -70%; width: 70%; height: 140%;
  background: radial-gradient(closest-side, rgba(110, 231, 183, 0.1), transparent 70%); pointer-events: none;
}
.band > .wrap { position: relative; padding-block: 34px 96px; }
.band-thin { height: 10px; }
.hello { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; }
.hello-date { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--band-dim); margin-bottom: 6px; }
.hello h1 { font-size: clamp(1.7rem, 3.2vw, 2.25rem); color: var(--band-fg); margin: 0; }
.hello p { color: var(--band-dim); margin: 6px 0 0; max-width: 56ch; }
.secure-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.08); color: var(--band-fg); border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.84rem; font-weight: 650;
}
.secure-pill .icon { width: 18px; height: 18px; color: var(--pv-mint); }

main { flex: 1; width: 100%; }
/* minmax(0, 1fr) : un tableau large défile dans son cadre au lieu d'élargir la page. */
.home { padding-block: 0 56px; margin-top: -64px; position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
.page { padding-block: 32px 56px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-content: start; }
.page-narrow { max-width: 760px; }

/* --- Tuiles des outils --------------------------------------------------------------------- */
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 20px; }
.app {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  text-decoration: none; color: inherit; overflow: hidden;
}
.app:hover { color: inherit; }
.app-hero { position: relative; height: 150px; background: var(--cbg); display: flex; align-items: center; padding: 0 24px; overflow: hidden; }
.app-hero .art { position: absolute; right: -6px; bottom: -2px; width: 240px; height: 132px; }
.th-emargement .app-hero { background: linear-gradient(135deg, #e3e9f6, #f6f8fc); }
.th-pilotage .app-hero { background: radial-gradient(120% 140% at 100% 100%, rgba(110, 231, 183, 0.18), transparent 60%), var(--pv-bg); }
.app-ico {
  position: relative; width: 64px; height: 64px; border-radius: 18px; background: #fff; color: var(--c);
  display: grid; place-items: center; box-shadow: 0 6px 16px -10px rgba(20, 35, 70, 0.5);
}
.app-ico .icon { width: 32px; height: 32px; }
.th-pilotage .app-ico { background: var(--pv-card); color: var(--pv-mint); box-shadow: 0 0 0 1px var(--pv-line), 0 8px 22px -12px rgba(110, 231, 183, 0.6); }
.role {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 700; background: var(--cbg); color: var(--ink); white-space: nowrap;
}
.role::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.app-hero .role { position: absolute; top: 14px; right: 14px; background: #fff; }
.th-pilotage .app-hero .role { background: var(--pv-card); color: var(--pv-mint); box-shadow: 0 0 0 1px var(--pv-line); }
.app-body { padding: 20px 24px 8px; display: grid; gap: 6px; flex: 1; align-content: start; }
.app-body h2 { font-size: 1.3rem; font-weight: 750; color: var(--text); margin: 0; }
.app-body p { color: var(--muted); font-size: 0.92rem; margin: 0; }
.app-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 24px 20px; }
.app-url { font-family: var(--mono); font-size: 0.78rem; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.app-go { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 0.9rem; color: var(--ink); flex: none; }
.app-go .icon { width: 17px; height: 17px; }
.app.is-soon { box-shadow: none; background: var(--surface-2); border-style: dashed; }
.app.is-soon .app-hero { filter: saturate(0.55); }
.app.is-soon .app-go { color: var(--faint); }

.empty { padding: 40px 24px; text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); display: grid; gap: 8px; justify-items: center; grid-column: 1 / -1; }
.empty .app-ico { box-shadow: none; background: var(--navy-50); color: var(--navy); }
.empty h2 { margin: 0; color: var(--text); }
.empty p { margin: 0; }

/* --- Cartes ---------------------------------------------------------------------------------- */
.cols { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.cols-even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 22px 24px; min-width: 0; }
.card > :last-child { margin-bottom: 0; }
.card-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.card-title .icon { width: 19px; height: 19px; }
.kv { display: grid; gap: 10px; margin: 0; }
.kv div { display: flex; justify-content: space-between; gap: 16px; font-size: 0.9rem; border-top: 1px solid var(--border); padding-top: 10px; }
.kv div:first-child { border-top: 0; padding-top: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 650; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.kv dd.ok { color: var(--success); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.steps li { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; font-size: 0.9rem; }
.steps .dot { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font-weight: 750; font-size: 0.8rem; background: var(--navy-50); color: var(--navy); }
.steps li.done .dot { background: var(--success-bg); color: var(--success); }
.steps b { display: block; color: var(--text); }
.steps span { color: var(--muted); }

.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 20px; }
.page-head h1 { margin: 0; }
.page-head p { color: var(--muted); margin: 4px 0 0; max-width: 62ch; }
.back { display: inline-flex; align-items: center; gap: 6px; font-size: 0.88rem; font-weight: 650; text-decoration: none; color: var(--muted); }
.back .icon { width: 16px; height: 16px; transform: rotate(180deg); }

/* --- Droits d'accès ------------------------------------------------------------------------- */
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 14px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; gap: 14px; align-items: center; }
.stat .app-ico, .tool-row .app-ico { width: 44px; height: 44px; border-radius: 12px; background: var(--cbg); color: var(--c); box-shadow: none; }
.stat .app-ico .icon, .tool-row .app-ico .icon { width: 22px; height: 22px; }
.stat b { display: block; font-size: 1.5rem; font-weight: 750; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--text); }
.stat span { color: var(--muted); font-size: 0.84rem; }
/* position: relative : les libellés masqués (position absolue) restent dans le cadre qui défile. */
.matrix-box { position: relative; overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.matrix { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 960px; font-size: 0.9rem; }
.matrix th, .matrix td { padding: 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.matrix tbody tr:last-child > * { border-bottom: 0; }
.matrix thead th { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
.matrix thead th.tool { color: var(--ink); }
.matrix th.tool > span { display: inline-flex; align-items: center; gap: 8px; }
.matrix th.tool .icon { width: 17px; height: 17px; }
.matrix tbody tr:hover > * { background: var(--surface-2); }
.matrix td:last-child { width: 1%; white-space: nowrap; }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person b { display: block; font-weight: 700; white-space: nowrap; color: var(--text); }
.person small { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.tr-off .person, .tr-off .pick, .tr-off .mfa, .tr-off .when { opacity: 0.5; }
/* Sélecteur de rôle en pastille */
.pick { position: relative; display: inline-flex; align-items: center; }
.pick select {
  appearance: none; -webkit-appearance: none; min-height: 0; width: auto; border: 1px solid transparent; border-radius: 999px;
  padding: 6px 30px 6px 26px; font: inherit; font-weight: 700; font-size: 0.82rem; cursor: pointer;
  background: var(--cbg); color: var(--ink);
}
.pick::before { content: ""; position: absolute; left: 11px; width: 8px; height: 8px; border-radius: 50%; background: var(--c); pointer-events: none; }
.pick::after {
  content: ""; position: absolute; right: 12px; width: 6px; height: 6px; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink);
  transform: translateY(-2px) rotate(45deg); pointer-events: none; opacity: 0.7;
}
.pick.is-none select { background: transparent; border-color: var(--border-strong); color: var(--faint); font-weight: 600; }
.pick.is-none::before { background: transparent; border: 1.5px solid var(--faint); }
.pick.is-none::after { border-color: var(--faint); }
.pick select:hover { filter: brightness(0.97); }
.pick select:disabled { cursor: not-allowed; }
.pick.flash select { animation: ltf-flash 0.9s var(--ease); }
.pick-save { margin-left: 6px; }
.js .pick-save { display: none; }
@keyframes ltf-flash { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 55%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }
.mfa { display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; font-weight: 650; white-space: nowrap; }
.mfa .icon { width: 16px; height: 16px; }
.mfa.on { color: var(--success); } .mfa.wait { color: var(--warning); } .mfa.off { color: var(--muted); }
.when { color: var(--muted); font-size: 0.84rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-actions form { margin: 0; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  display: grid; place-items: center; cursor: pointer; padding: 0;
}
.icon-btn:hover { color: var(--navy); border-color: var(--border-strong); background: var(--navy-50); }
.icon-btn.danger:hover { color: var(--danger); border-color: #f1c0bb; background: var(--danger-bg); }
.icon-btn .icon { width: 17px; height: 17px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 0.84rem; color: var(--muted); margin: -8px 0 0; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.sw { width: 12px; height: 12px; border-radius: 4px; background: var(--navy); }
.sw.none { background: transparent; border: 1.5px solid var(--faint); }
.tool-list { display: grid; gap: 12px; }
.tool-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); }
.tool-row b { display: block; color: var(--text); }
.tool-row .app-url { display: block; }
.tool-row.is-new { border-style: dashed; text-decoration: none; color: inherit; }
.tool-row.is-new:hover { background: var(--surface-2); color: inherit; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.chip { font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--cbg); color: var(--ink); }
.chip.muted { background: #eef0f4; color: var(--muted); }
.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.log li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 9px 0; border-top: 1px solid var(--border); font-size: 0.88rem; }
.log li:first-child { border-top: 0; }
.log i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--navy)); transform: translateY(-1px); }
.log time { color: var(--faint); font-size: 0.8rem; white-space: nowrap; }
.log b { font-weight: 700; }
.card-foot { margin: 14px 0 0; font-size: 0.86rem; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px);
  background: var(--text); color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 650; font-size: 0.88rem;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.3s var(--ease); z-index: 40; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: var(--danger); }

/* --- Formulaires ------------------------------------------------------------------------------ */
.field { margin-bottom: 16px; }
.field label, .field .label { display: block; font-weight: 650; font-size: 0.9rem; margin-bottom: 6px; }
.field .hint { display: block; color: var(--muted); font-size: 0.84rem; margin-top: 6px; }
.optional { color: var(--faint); font-weight: 500; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="number"], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; font-size: 0.95rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
input:hover, select:hover, textarea:hover { border-color: #aeb9cb; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--focus); box-shadow: 0 0 0 4px rgba(46, 90, 172, 0.18); }
input[aria-invalid="true"] { border-color: var(--danger); }
.code-input { font-family: var(--mono); font-size: 1.35rem; letter-spacing: 0.25em; text-align: center; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 0.92rem; margin-bottom: 12px; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--navy); }
.check small { display: block; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
fieldset { border: 0; padding: 0; margin: 0 0 8px; min-width: 0; }
legend { font-weight: 700; color: var(--navy); margin-bottom: 10px; padding: 0; }
.role-grid { display: grid; gap: 10px; }
.role-line { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.role-line .label { display: flex; align-items: center; gap: 10px; font-weight: 650; margin: 0; }
.role-line .app-ico { width: 32px; height: 32px; border-radius: 9px; background: var(--cbg); color: var(--c); box-shadow: none; }
.role-line .app-ico .icon { width: 17px; height: 17px; }
.roles-edit { display: grid; gap: 8px; }
.roles-edit .row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.roles-edit .row .check { margin: 0; white-space: nowrap; }
.themes { display: flex; flex-wrap: wrap; gap: 8px; }
.theme-opt { position: relative; }
.theme-opt input { position: absolute; opacity: 0; }
.theme-opt span {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--border-strong);
  font-size: 0.86rem; font-weight: 650; cursor: pointer; background: var(--surface);
}
.theme-opt span::before { content: ""; width: 12px; height: 12px; border-radius: 4px; background: var(--c); }
.theme-opt input:checked + span { border-color: var(--c); background: var(--cbg); color: var(--ink); box-shadow: 0 0 0 1px var(--c); }
.theme-opt input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  font: inherit; font-size: 0.93rem; font-weight: 700; border-radius: 12px; border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: background-color 150ms ease, border-color 150ms ease, transform 150ms var(--ease);
}
.btn .icon { width: 18px; height: 18px; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-hover); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--navy); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--navy-50); color: var(--navy); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); background: var(--surface); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: #f1c0bb; }
.btn-danger:hover { background: var(--danger-bg); color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 0.84rem; border-radius: 10px; }
.btn[aria-busy="true"] { opacity: 0.65; cursor: progress; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 20px; }
.inline-form { display: inline; margin: 0; }

.alert { border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; border: 1px solid; font-size: 0.93rem; }
.alert ul { margin: 0; padding-left: 1.2em; }
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: #f6c6c0; }
.alert-success { background: var(--success-bg); color: var(--success); border-color: #b4e6cb; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: #f5d79b; }
.alert-info { background: var(--navy-50); color: var(--navy); border-color: var(--navy-100); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 0.76rem; font-weight: 650; background: var(--navy-50); color: var(--navy); white-space: nowrap; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-muted { background: #eef0f4; color: var(--muted); }

.table-wrap { position: relative; overflow-x: auto; }
table.plain { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
table.plain th, table.plain td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.plain th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; white-space: nowrap; }

/* --- Pages d'authentification ------------------------------------------------------------------ */
.auth-page { background: radial-gradient(900px 420px at 15% -10%, var(--navy-100), transparent 70%), var(--bg); }
.auth-page main { display: grid; place-items: center; padding: 48px 16px; }
.auth-card { width: min(100%, 440px); background: var(--surface); border: 1px solid var(--border); border-radius: 24px; box-shadow: 0 30px 60px -40px rgba(20, 35, 70, 0.55); padding: 34px 32px 28px; }
.auth-head { display: grid; justify-items: center; gap: 10px; text-align: center; margin-bottom: 22px; }
.auth-head img { width: 54px; height: auto; }
.auth-head h1 { font-size: 1.45rem; margin: 0; }
.auth-head p { color: var(--muted); font-size: 0.92rem; margin: 0; }
.stepper { display: flex; gap: 6px; justify-content: center; }
.stepper i { width: 26px; height: 5px; border-radius: 3px; background: var(--border); }
.stepper i.on { background: var(--navy); }
.ma { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 14px; background: var(--navy-50); margin-bottom: 16px; }
.ma-logo { width: 44px; height: 44px; border-radius: 12px; background: #fff; display: grid; place-items: center; flex: none; }
.ma-logo svg { width: 24px; height: 24px; }
.ma p { font-size: 0.86rem; color: var(--muted); margin: 0; }
.ma b { color: var(--text); }
.ol { margin: 0 0 16px; padding-left: 20px; display: grid; gap: 6px; font-size: 0.9rem; color: var(--muted); }
.ol b { color: var(--text); }
.qr-box { display: flex; justify-content: center; padding: 14px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; }
.qr-box img { width: 200px; height: 200px; image-rendering: pixelated; }
.secret-key { font-family: var(--mono); font-size: 1rem; letter-spacing: 0.08em; background: var(--bg); padding: 8px 12px; border-radius: var(--radius-sm); display: inline-block; }
.codes-list {
  list-style: none; margin: 0 0 16px; padding: 16px; display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 8px 24px; background: var(--bg); border-radius: var(--radius); font-family: var(--mono); font-size: 1.05rem;
}
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; font-family: var(--mono); font-size: 0.86rem; }
details summary { cursor: pointer; color: var(--navy); font-weight: 650; min-height: 44px; display: flex; align-items: center; gap: 8px; }
.after-form { margin-top: 16px; margin-bottom: 0; text-align: center; font-size: 0.84rem; color: var(--muted); }

.footer { padding: 16px 16px 24px; color: var(--muted); font-size: 0.82rem; text-align: center; }

/* --- Aperçus animés et micro-interactions -------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .app:not(.is-soon), .btn, .icon-btn { transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.15s, background-color 0.15s; }
  .app:not(.is-soon):hover, .app:not(.is-soon):focus-visible { transform: translateY(-4px); box-shadow: var(--shadow-hover); border-color: var(--border-strong); }
  .app .art { transition: transform 0.6s var(--ease); }
  .app:not(.is-soon):hover .art { transform: translate(-6px, -6px); }
  .app-go .icon { transition: transform 0.2s var(--ease); }
  .app:hover .app-go .icon { transform: translateX(4px); }
  .icon .check { stroke-dasharray: 14; }
  .icon .needle { transform-box: view-box; transform-origin: 12px 15px; }
  .icon .shield { transform-box: view-box; transform-origin: 12px 20px; }
  .app:hover .check { animation: ltf-draw 0.7s ease-out; }
  .app:hover .needle { animation: ltf-sweep 1s cubic-bezier(0.5, 0, 0.3, 1); }
  .secure-pill:hover .shield { animation: ltf-wobble 0.7s ease-in-out; }
  .art .fill { transform-box: fill-box; transform-origin: left; animation: ltf-fill 1.2s var(--ease) 0.2s both; }
  .app:hover .art .fill { animation: ltf-fill2 1s var(--ease) both; }
  .art .sig { stroke-dasharray: 90; }
  .app:hover .art .sig { animation: ltf-sign 1.1s ease-out; }
  @keyframes ltf-draw { from { stroke-dashoffset: 14; } to { stroke-dashoffset: 0; } }
  @keyframes ltf-sweep { 0% { transform: rotate(0); } 40% { transform: rotate(-70deg); } 75% { transform: rotate(18deg); } 100% { transform: rotate(0); } }
  @keyframes ltf-wobble { 20% { transform: rotate(-9deg); } 50% { transform: rotate(7deg); } 80% { transform: rotate(-3deg); } }
  @keyframes ltf-fill { from { transform: scaleX(0.2); } }
  @keyframes ltf-fill2 { from { transform: scaleX(0.2); } }
  @keyframes ltf-sign { from { stroke-dashoffset: 90; } to { stroke-dashoffset: 0; } }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media (max-width: 900px) {
  .cols, .cols-even { grid-template-columns: 1fr; }
  .top-nav a span { display: none; }
  .me-name { display: none; }
}
@media (max-width: 560px) {
  .brand-txt { display: none; }
  .auth-card { padding: 26px 20px 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .role-line { grid-template-columns: 1fr; }
  .codes-list { grid-template-columns: 1fr; }
  .kv div { flex-direction: column; gap: 2px; }
  .kv dd { text-align: left; }
  h1 { font-size: 1.5rem; }
}

/* --- Dessins des aperçus (classes plutôt que styles en ligne : CSP) ------------------------------ */
.art .e-bg { fill: var(--pe-bg); stroke: var(--pe-line); }
.art .e-card { fill: var(--pe-card); stroke: var(--pe-line); }
.art .e-side { fill: var(--pe-card); }
.art .e-line { fill: var(--pe-line); }
.art .e-navy { fill: var(--pe-navy); }
.art .e-live { fill: var(--pe-live); }
.art .e-plan { fill: var(--pe-plan); }
.art .e-close { fill: var(--pe-close); }
.art .e-stroke-plan { fill: none; stroke: var(--pe-plan); stroke-width: 1.6; }
.art .e-stroke-close { fill: none; stroke: var(--pe-close); stroke-width: 1.6; stroke-linecap: round; }
.art .sig { fill: none; stroke: var(--pe-navy); stroke-width: 2; stroke-linecap: round; }
.art .soft { opacity: 0.18; }
.art .p-bg { fill: var(--pv-bg); stroke: var(--pv-line); }
.art .p-card { fill: var(--pv-card); stroke: var(--pv-line); }
.art .p-out { fill: none; stroke: var(--pv-line); }
.art .p-mint { fill: var(--pv-mint); }
.art .p-ink { fill: var(--pv-ink); opacity: 0.7; }
.art .p-fg { fill: var(--pv-fg); }
.art .p-fg-soft { fill: var(--pv-fg); opacity: 0.7; }
.art .p-dim { fill: var(--pv-dim); opacity: 0.7; }
.art .p-track { fill: var(--pv-line); }
.art .p-cut { fill: var(--pv-card); }
.art .g-doc { fill: var(--cbg); stroke: var(--c); stroke-opacity: 0.4; stroke-dasharray: 5 5; }
.art .g-line { fill: none; stroke: var(--c); stroke-opacity: 0.35; stroke-width: 2; stroke-linecap: round; }
.art .g-txt { fill: var(--c); font-family: var(--font); font-weight: 800; }

/* --- Pages légales ----------------------------------------------------------------------------- */
.legal h1 { font-size: 1.6rem; }
.legal h2 { font-size: 1.05rem; margin-top: 22px; }
.legal ul { padding-left: 1.2em; margin: 0 0 16px; }
.legal li { margin: 4px 0; }
