/* Agent Hub : design system et mise en page. Aucune ressource externe. */

:root {
  color-scheme: light;
  --font: ui-sans-serif, -apple-system, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;

  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f0f2f8;
  --surface-3: #e7eaf3;
  --border: #e1e4ee;
  --border-strong: #cdd2e1;
  --text: #151a2d;
  --muted: #5a6178;
  --faint: #878da3;

  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef0ff;
  --accent-text: #3730a3;
  --on-accent: #ffffff;

  --read: #0369a1;       --read-soft: #e0f2fe;
  --write: #b45309;      --write-soft: #fef3c7;
  --delete: #be123c;     --delete-soft: #ffe4e6;
  --safe: #047857;       --safe-soft: #d1fae5;
  --warning: #b45309;    --warning-soft: #fef3c7;
  --critical: #be123c;   --critical-soft: #ffe4e6;
  --deny: #334155;       --deny-soft: #e2e8f0;

  --side-bg: #10111f;
  --side-text: #c9cbe0;
  --side-muted: #7d80a0;
  --side-hover: #1b1d33;
  --side-active: #262a4d;

  --shadow-sm: 0 1px 2px rgba(20, 24, 45, .06);
  --shadow: 0 1px 2px rgba(20, 24, 45, .06), 0 6px 20px rgba(20, 24, 45, .06);
  --shadow-lg: 0 20px 60px rgba(10, 12, 30, .22);
  --radius: 12px;
  --radius-sm: 8px;
  --ring: 0 0 0 3px rgba(79, 70, 229, .28);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark;
    --bg: #0b0d15; --surface: #131624; --surface-2: #1a1e30; --surface-3: #22273d;
    --border: #262b42; --border-strong: #353b58; --text: #e7e9f3; --muted: #a0a6bd; --faint: #6e7590;
    --accent: #8b8cf8; --accent-hover: #a3a4fb; --accent-soft: #20224a; --accent-text: #c9caff; --on-accent: #0b0d15;
    --read: #7dd3fc; --read-soft: #0b2a3c; --write: #fcd34d; --write-soft: #33260a; --delete: #fda4af; --delete-soft: #3b0f1a;
    --safe: #6ee7b7; --safe-soft: #0a3124; --warning: #fcd34d; --warning-soft: #33260a; --critical: #fda4af;
    --critical-soft: #3b0f1a; --deny: #cbd5e1; --deny-soft: #1f2638;
    --side-bg: #080911; --side-hover: #141628; --side-active: #1f2240;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25); --shadow-lg: 0 24px 70px rgba(0, 0, 0, .55);
    --ring: 0 0 0 3px rgba(139, 140, 248, .35);
  }
}
:root[data-theme="dark"] { color-scheme: dark;
  --bg: #0b0d15; --surface: #131624; --surface-2: #1a1e30; --surface-3: #22273d;
  --border: #262b42; --border-strong: #353b58; --text: #e7e9f3; --muted: #a0a6bd; --faint: #6e7590;
  --accent: #8b8cf8; --accent-hover: #a3a4fb; --accent-soft: #20224a; --accent-text: #c9caff; --on-accent: #0b0d15;
  --read: #7dd3fc; --read-soft: #0b2a3c; --write: #fcd34d; --write-soft: #33260a; --delete: #fda4af; --delete-soft: #3b0f1a;
  --safe: #6ee7b7; --safe-soft: #0a3124; --warning: #fcd34d; --warning-soft: #33260a; --critical: #fda4af;
  --critical-soft: #3b0f1a; --deny: #cbd5e1; --deny-soft: #1f2638;
  --side-bg: #080911; --side-hover: #141628; --side-active: #1f2240;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25); --shadow-lg: 0 24px 70px rgba(0, 0, 0, .55);
  --ring: 0 0 0 3px rgba(139, 140, 248, .35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 15px; height: 15px; }
svg.i.lg { width: 22px; height: 22px; }

/* Structure ---------------------------------------------------------------------------------- */

.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; text-decoration: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, #6366f1, #a855f7 60%, #ec4899); box-shadow: 0 6px 18px rgba(124, 58, 237, .45); }
.brand-mark svg { width: 20px; height: 20px; stroke: #fff; }
.brand-name { font-weight: 700; letter-spacing: -.01em; font-size: 15px; }
.brand-sub { display: block; font-size: 11px; color: var(--side-muted); font-weight: 500; letter-spacing: .02em; }
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--side-muted);
  padding: 14px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; color: var(--side-text);
  text-decoration: none; font-weight: 500; transition: background .15s, color .15s;
}
.nav a:hover { background: var(--side-hover); color: #fff; }
.nav a[aria-current="page"] { background: var(--side-active); color: #fff; }
.nav a[aria-current="page"] svg { color: #a5a6ff; }
.nav .count { margin-left: auto; min-width: 20px; padding: 1px 7px; border-radius: 999px; font-size: 11.5px;
  font-weight: 700; background: #ef4444; color: #fff; text-align: center; }
.nav .count.soft { background: #2f3358; color: #d6d7ff; }
.side-foot { margin-top: auto; border-top: 1px solid #22243a; padding-top: 12px; display: flex; flex-direction: column; gap: 2px; }
.side-btn { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 12px; border: 0; background: none;
  color: var(--side-text); border-radius: 9px; cursor: pointer; text-align: left; font-weight: 500; }
.side-btn:hover { background: var(--side-hover); color: #fff; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 10px 12px 4px; color: var(--side-muted); font-size: 12.5px; }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px;
  background: linear-gradient(135deg, #334155, #475569); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 32px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .crumb { color: var(--muted); font-weight: 500; }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }
#content:focus { outline: none; box-shadow: none; }
.content { padding: 28px 32px 64px; max-width: 1280px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; line-height: 1.2; letter-spacing: -.02em; margin: 0 0 4px; }
.page-head p { margin: 0; color: var(--muted); max-width: 680px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* Gel global --------------------------------------------------------------------------------- */

.freeze { display: inline-flex; align-items: center; gap: 10px; padding: 6px 8px 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); font-weight: 600; font-size: 13px; cursor: pointer; }
.freeze .knob { width: 34px; height: 20px; border-radius: 999px; background: var(--surface-3); position: relative;
  transition: background .2s var(--ease); }
.freeze .knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s var(--ease); }
.freeze[aria-checked="true"] { border-color: var(--critical); color: var(--critical); background: var(--critical-soft); }
.freeze[aria-checked="true"] .knob { background: var(--critical); }
.freeze[aria-checked="true"] .knob::after { transform: translateX(14px); }
.banner { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: var(--radius);
  background: var(--critical-soft); color: var(--critical); font-weight: 600; margin-bottom: 18px; border: 1px solid; }

/* Boutons et champs -------------------------------------------------------------------------- */

.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 1px 2px rgba(79, 70, 229, .35); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 40%, var(--border)); }
.btn.danger:hover { background: var(--critical-soft); }
.btn.danger.solid { background: var(--critical); color: #fff; border-color: var(--critical); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon { width: 36px; padding: 0; }
.btn.sm.icon { width: 30px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-weight: 600; font-size: 13px; }
.field .hint { color: var(--faint); font-size: 12.5px; }
.input, select.input, textarea.input {
  width: 100%; height: 38px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.input.mono { font-family: var(--mono); font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search .input { padding-left: 36px; }

/* Cartes, KPI, listes ------------------------------------------------------------------------ */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { margin: 0; font-size: 15px; letter-spacing: -.01em; }
.card-head .sub { color: var(--muted); font-size: 13px; }
.card-head .end { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); font-weight: 700; margin: 26px 0 10px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi { padding: 16px 18px; position: relative; overflow: hidden; }
.kpi .k-label { color: var(--muted); font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.kpi .k-value { font-size: 28px; font-weight: 750; letter-spacing: -.03em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .k-foot { color: var(--faint); font-size: 12px; margin-top: 2px; }
.kpi.alert .k-value { color: var(--critical); }
.kpi .k-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.kpi.alert .k-icon { background: var(--critical-soft); color: var(--critical); }

.endpoint { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; padding: 22px 24px;
  margin-bottom: 18px; color: #e9e9ff; border: 0; position: relative; overflow: hidden;
  background: radial-gradient(1200px 300px at 110% -40%, rgba(236, 72, 153, .35), transparent 60%),
              radial-gradient(900px 300px at -10% 140%, rgba(99, 102, 241, .55), transparent 60%), #151735; }
.endpoint h2 { margin: 0 0 6px; font-size: 19px; letter-spacing: -.02em; color: #fff; }
.endpoint p { margin: 0; color: #b9bbe6; max-width: 620px; }
.endpoint .url { display: flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .14); padding: 8px 8px 8px 14px; border-radius: 10px; color: #fff; }
.endpoint .url code { font-size: 13.5px; }
.endpoint .btn { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .2); color: #fff; }
.endpoint .btn:hover { background: rgba(255, 255, 255, .2); }

.two-col { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; margin-top: 18px; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: 12px; align-items: flex-start; padding: 13px 20px; border-top: 1px solid var(--border); }
.list > li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; }
.list .meta { color: var(--muted); font-size: 12.5px; }
.dot { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: var(--surface-2); color: var(--muted); }
.dot.read { background: var(--read-soft); color: var(--read); }
.dot.write { background: var(--write-soft); color: var(--write); }
.dot.delete, .dot.critical { background: var(--critical-soft); color: var(--critical); }
.dot.safe { background: var(--safe-soft); color: var(--safe); }
.dot.accent { background: var(--accent-soft); color: var(--accent-text); }
.time { color: var(--faint); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Badges et droits --------------------------------------------------------------------------- */

.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 12px; font-weight: 650; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.read { background: var(--read-soft); color: var(--read); }
.badge.write { background: var(--write-soft); color: var(--write); }
.badge.delete { background: var(--delete-soft); color: var(--delete); }
.badge.safe { background: var(--safe-soft); color: var(--safe); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.critical { background: var(--critical-soft); color: var(--critical); }
.badge.deny { background: var(--deny-soft); color: var(--deny); }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }
.badge.outline { background: transparent; border: 1px solid var(--border-strong); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }

.rights { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); gap: 3px; }
.right { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 7px; border: 0;
  background: transparent; color: var(--faint); font-weight: 650; font-size: 12.5px; cursor: pointer; transition: all .15s var(--ease); }
.right:hover { color: var(--text); }
.right[aria-pressed="true"].read { background: var(--surface); color: var(--read); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--read-soft); }
.right[aria-pressed="true"].write { background: var(--write-soft); color: var(--write); }
.right[aria-pressed="true"].delete { background: var(--delete-soft); color: var(--delete); }
.right[disabled] { cursor: default; }
.right .tick { width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid currentColor; display: grid; place-items: center; }
.right[aria-pressed="true"] .tick { background: currentColor; }
.right[aria-pressed="true"] .tick svg { stroke: var(--surface); width: 10px; height: 10px; stroke-width: 3; }

.meter { display: flex; height: 6px; border-radius: 999px; overflow: hidden; background: var(--surface-3); gap: 2px; }
.meter span { display: block; height: 100%; }
.meter .read { background: var(--read); } .meter .write { background: var(--write); } .meter .delete { background: var(--delete); }
.legend { display: flex; gap: 12px; font-size: 12px; color: var(--muted); margin-top: 8px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }

/* Sources ------------------------------------------------------------------------------------- */

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.tab { border: 0; background: none; height: 30px; padding: 0 12px; border-radius: 7px; font-weight: 600; color: var(--muted); cursor: pointer; }
.tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tab .n { color: var(--faint); font-weight: 600; margin-left: 4px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.source { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; cursor: pointer; text-align: left;
  transition: transform .15s var(--ease), box-shadow .15s, border-color .15s; font: inherit; color: inherit; }
.source:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.source .top { display: flex; gap: 12px; align-items: center; }
.logo { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: #fff; font-weight: 750; font-size: 15px; flex: none; }
.logo svg { stroke: #fff; }
.library .logo { width: 34px; height: 34px; border-radius: 9px; }
.library .logo svg { width: 18px; height: 18px; }
.source .name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.source .host { color: var(--faint); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px; }
.source .foot { display: flex; align-items: center; gap: 8px; justify-content: space-between; color: var(--muted); font-size: 12.5px; }
.status-line { display: inline-flex; align-items: center; gap: 6px; }
.led { width: 8px; height: 8px; border-radius: 50%; background: var(--safe); box-shadow: 0 0 0 3px var(--safe-soft); }
.led.off { background: var(--critical); box-shadow: 0 0 0 3px var(--critical-soft); }
.led.warn { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
.add-card { border: 1.5px dashed var(--border-strong); background: transparent; box-shadow: none; display: grid;
  place-items: center; min-height: 150px; color: var(--muted); font-weight: 650; gap: 8px; }
.add-card:hover { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }

.tool { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; padding: 14px 20px; border-top: 1px solid var(--border); }
.tool:first-child { border-top: 0; }
.tool .t-name { font-family: var(--mono); font-size: 13px; font-weight: 600; }
.tool .t-desc { color: var(--muted); font-size: 13px; grid-column: 1 / -1; overflow-wrap: anywhere; }
.tool .t-side { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.diff { grid-column: 1 / -1; border: 1px solid color-mix(in srgb, var(--warning) 35%, var(--border)); background: var(--warning-soft);
  border-radius: 8px; padding: 10px 12px; font-size: 12.5px; color: var(--text); overflow-wrap: anywhere; }
.diff b { color: var(--warning); }

/* Playlists ----------------------------------------------------------------------------------- */

.pl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(214px, 1fr)); gap: 18px; }
.pl { text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 10px; }
.cover { aspect-ratio: 1; border-radius: 14px; position: relative; overflow: hidden; display: flex; flex-direction: column;
  justify-content: space-between; padding: 16px; color: #fff; box-shadow: var(--shadow);
  transition: transform .2s var(--ease), box-shadow .2s; }
.pl:hover .cover { transform: translateY(-3px) scale(1.01); box-shadow: var(--shadow-lg); }
.cover::before { content: ""; position: absolute; inset: 0; background:
  radial-gradient(120% 80% at 100% 0%, rgba(255, 255, 255, .28), transparent 55%),
  repeating-linear-gradient(135deg, rgba(255, 255, 255, .05) 0 2px, transparent 2px 14px); }
.cover > * { position: relative; }
.cover .c-kind { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; opacity: .85; }
.cover .c-title { font-size: 21px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; text-shadow: 0 2px 10px rgba(0, 0, 0, .18); overflow-wrap: anywhere; }
.cover .c-tracks { display: flex; gap: 5px; flex-wrap: wrap; }
.cover .c-tracks span { background: rgba(0, 0, 0, .22); backdrop-filter: blur(4px); padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.cover .paused { position: absolute; top: 14px; right: 14px; background: rgba(0, 0, 0, .35); border-radius: 999px; padding: 2px 9px; font-size: 11px; font-weight: 700; }
.pl .p-name { font-weight: 700; }
.pl .p-meta { color: var(--muted); font-size: 12.5px; margin-top: -8px; }
.pl-new { aspect-ratio: 1; border-radius: 14px; border: 1.5px dashed var(--border-strong); display: grid; place-items: center;
  color: var(--muted); font-weight: 650; text-align: center; background: transparent; cursor: pointer; }
.pl-new:hover { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.pl-new .plus { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); margin: 0 auto 10px; }

.editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.hero { display: grid; grid-template-columns: 172px minmax(0, 1fr); gap: 22px; padding: 20px; align-items: center; }
.hero .cover { aspect-ratio: 1; width: 172px; }
.hero-fields { display: grid; gap: 12px; }
.name-input { font-size: 22px; font-weight: 800; letter-spacing: -.02em; height: 46px; }
.hue { -webkit-appearance: none; appearance: none; width: 100%; height: 10px; border-radius: 999px;
  background: linear-gradient(90deg, hsl(0 75% 55%), hsl(60 75% 50%), hsl(120 60% 45%), hsl(180 65% 45%), hsl(240 70% 60%), hsl(300 65% 55%), hsl(360 75% 55%)); }
.hue::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid rgba(0, 0, 0, .25); cursor: pointer; }
.hue::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid rgba(0, 0, 0, .25); cursor: pointer; }

.tracks { list-style: none; margin: 0; padding: 0; counter-reset: track; }
.track { display: grid; grid-template-columns: 26px 38px minmax(0, 1fr) auto auto; gap: 12px; align-items: center;
  padding: 12px 18px; border-top: 1px solid var(--border); }
.track:first-child { border-top: 0; }
.track::before { counter-increment: track; content: counter(track); color: var(--faint); font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.track .logo { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 750; }
.track .t-title { font-weight: 650; }
.track .t-sub { color: var(--faint); font-size: 12.5px; }
.track .t-actions { min-width: 168px; justify-content: flex-end; }
.track-tools { grid-column: 3 / -1; display: flex; flex-wrap: wrap; gap: 6px; padding-top: 2px; }
.chip-toggle { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong); background: var(--surface);
  padding: 3px 9px; border-radius: 999px; font-size: 12px; cursor: pointer; font-family: var(--mono); }
.chip-toggle[aria-pressed="false"] { opacity: .5; text-decoration: line-through; }
.chip-toggle .badge { height: 18px; font-family: var(--font); font-size: 11px; padding: 0 6px; }
.schedule { display: grid; gap: 12px; }
.sched-now { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sched-now .meta { color: var(--muted); font-size: 12.5px; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.day { width: 34px; height: 34px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--muted); font-weight: 650; font-size: 13px; cursor: pointer; }
.day[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.day:focus-visible { outline: none; box-shadow: var(--ring); }
.time-range { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: center; }
.time-range span { color: var(--muted); }
.watchdog { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; }
.wd-row { display: flex; gap: 8px; align-items: center; }
.wd-row .input { width: 120px; }
.wd-row .btn { margin-left: auto; }
.wd-before { color: var(--muted); font-size: 13px; }
.library li { cursor: default; }
.library .add { margin-left: auto; }
.empty-tracks { padding: 34px 20px; text-align: center; color: var(--muted); }

.savebar { position: sticky; bottom: 16px; z-index: 15; margin-top: 18px; display: flex; gap: 10px; align-items: center;
  padding: 10px 12px 10px 18px; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg);
  transform: translateY(12px); opacity: 0; pointer-events: none; transition: all .25s var(--ease); }
.savebar.show { transform: none; opacity: 1; pointer-events: auto; }
.savebar .grow { flex: 1; font-weight: 600; }
.savebar .btn.ghost { color: var(--bg); opacity: .8; }
.savebar .btn.ghost:hover { background: rgba(127, 127, 127, .2); }

.token-once { border: 1px solid color-mix(in srgb, var(--safe) 40%, var(--border)); background: var(--safe-soft); border-radius: 10px; padding: 12px; }
.token-box { display: flex; gap: 8px; align-items: stretch; }
.token-box code { flex: 1; min-width: 0; overflow-wrap: anywhere; background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 12px; line-height: 1.45; }
pre.snippet { margin: 0; background: #0f1222; color: #d8dbf5; border-radius: 10px; padding: 14px; font-size: 12px; line-height: 1.55;
  overflow: auto; white-space: pre-wrap; word-break: break-all; font-family: var(--mono); max-height: 230px; }

/* Validations --------------------------------------------------------------------------------- */

.approval { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; padding: 18px 20px; }
.approval + .approval { border-top: 1px solid var(--border); }
.approval .a-line { font-family: var(--mono); font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.approval pre { margin: 10px 0 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px;
  font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 240px; overflow: auto; font-family: var(--mono); }
.intent { margin-top: 10px; padding: 9px 12px; border-left: 3px solid var(--warning); background: var(--warning-soft); border-radius: 0 8px 8px 0; font-size: 13px; }
.intent b { color: var(--warning); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; display: block; }
.approval .a-actions { display: flex; flex-direction: column; gap: 8px; min-width: 132px; }

/* Portefeuille et journal --------------------------------------------------------------------- */

.money { font-size: 30px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.money small { font-size: 14px; color: var(--muted); font-weight: 600; margin-left: 4px; }
.bar-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 90px; gap: 12px; align-items: center; padding: 8px 0; }
.bar-row .bar { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-row .bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #a855f7); border-radius: 999px; }
.bar-row .v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; color: var(--faint); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 10px 20px; border-bottom: 1px solid var(--border); }
.table td { padding: 11px 20px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.kv { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.kv span b { color: var(--text); font-weight: 600; }
.integrity { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid; font-weight: 600; }
.integrity.ok { color: var(--safe); background: var(--safe-soft); }
.integrity.ko { color: var(--critical); background: var(--critical-soft); }

/* Etats vides, squelettes, toasts ------------------------------------------------------------- */

.empty { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty .art { width: 92px; height: 92px; margin: 0 auto 14px; border-radius: 26px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface-2)); color: var(--accent-text); }
.empty .art svg { width: 40px; height: 40px; stroke-width: 1.5; }
.empty h3 { color: var(--text); margin: 0 0 6px; font-size: 16px; }
.empty p { margin: 0 auto 16px; max-width: 420px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear; border-radius: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; gap: 10px; align-items: flex-start; min-width: 280px; max-width: 420px; padding: 12px 14px; border-radius: 12px;
  background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); animation: toast-in .25s var(--ease); font-weight: 500; }
.toast.error { background: var(--critical); color: #fff; }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }

/* Modales et panneaux ------------------------------------------------------------------------- */

.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(8, 10, 24, .5); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 16px; animation: fade .2s var(--ease); }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: 16px;
  box-shadow: var(--shadow-lg); border: 1px solid var(--border); animation: pop .25s var(--ease); }
.modal.wide { width: min(720px, 100%); }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px 0; }
.modal-head h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.modal-head .btn { margin-left: auto; }
.modal-body { padding: 16px 22px; display: grid; gap: 14px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 22px 20px; }
.drawer-scrim { place-items: stretch end; padding: 0; }
.drawer { width: min(640px, 100%); height: 100%; background: var(--bg); overflow: auto; box-shadow: var(--shadow-lg);
  animation: slide .28s var(--ease); display: flex; flex-direction: column; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer-head { position: sticky; top: 0; background: var(--surface); border-bottom: 1px solid var(--border); padding: 18px 22px; display: flex; gap: 14px; align-items: center; z-index: 2; }
.drawer-body { padding: 18px 22px 40px; display: grid; gap: 16px; }

/* Connexion ----------------------------------------------------------------------------------- */

.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: radial-gradient(900px 500px at 20% 10%, rgba(99, 102, 241, .55), transparent 60%),
  radial-gradient(700px 500px at 90% 90%, rgba(236, 72, 153, .35), transparent 60%), #0d0e20; color: #fff;
  padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.login-art h1 { font-size: 40px; line-height: 1.08; letter-spacing: -.035em; margin: 0 0 14px; max-width: 520px; }
.login-art p { color: #b9bbe6; font-size: 16px; max-width: 480px; margin: 0; }
.login-art .flow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 32px; }
.login-art .flow span { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); padding: 7px 12px; border-radius: 999px; font-weight: 600; font-size: 13px; }
.login-art .flow svg { opacity: .6; }
.login-form { display: grid; place-items: center; padding: 40px 24px; }
.login-form.solo { min-height: 100vh; }
.brand-inline { display: flex; align-items: center; gap: 10px; font-size: 16px; margin-bottom: 8px; }
.login-card .hint { color: var(--muted); margin: 0; }
.login-card { width: min(400px, 100%); display: grid; gap: 16px; }
.login-card h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.login-card .or { color: var(--faint); font-size: 12.5px; }
.cmd { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }

/* Visite guidee ------------------------------------------------------------------------------- */

.tour-layer { position: fixed; inset: 0; z-index: 90; }
.tour-block { position: absolute; inset: 0; background: transparent; }
.tour-spot { position: fixed; border-radius: 12px; pointer-events: none; transition: all .35s var(--ease);
  box-shadow: 0 0 0 9999px rgba(8, 9, 22, .62), 0 0 0 2px rgba(165, 166, 255, .9), 0 0 30px rgba(139, 140, 248, .6); }
.tour-spot.center { top: 50%; left: 50%; width: 0; height: 0; box-shadow: 0 0 0 9999px rgba(8, 9, 22, .7); }
.tour-card { position: fixed; width: min(400px, calc(100vw - 32px)); background: var(--surface); color: var(--text); border-radius: 16px;
  box-shadow: var(--shadow-lg); border: 1px solid var(--border); overflow: hidden; transition: top .35s var(--ease), left .35s var(--ease); }
.tour-card.center { width: min(520px, calc(100vw - 32px)); }
.tour-visual { height: 132px; display: grid; place-items: center; position: relative; overflow: hidden;
  background: radial-gradient(400px 160px at 80% 0%, rgba(236, 72, 153, .45), transparent 65%),
              radial-gradient(400px 200px at 10% 110%, rgba(99, 102, 241, .8), transparent 60%), #14163a; color: #fff; }
.tour-visual .glyph { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .22); backdrop-filter: blur(6px); }
.tour-visual .glyph svg { width: 32px; height: 32px; stroke: #fff; }
.tour-visual .orbit { position: absolute; display: flex; gap: 8px; bottom: 14px; }
.tour-visual .orbit span { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, .14); }
.tour-body { padding: 18px 20px 6px; }
.tour-step { font-size: 12px; font-weight: 700; color: var(--accent-text); letter-spacing: .06em; text-transform: uppercase; }
.tour-body h2 { font-size: 19px; margin: 6px 0 8px; letter-spacing: -.02em; }
.tour-body p { margin: 0; color: var(--muted); }
.tour-body .rights-demo { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.tour-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tour-foot { display: flex; align-items: center; gap: 8px; padding: 14px 20px 16px; }
.tour-foot .skip { margin-right: auto; }
.tour-dots { display: flex; gap: 5px; }
.tour-dots i { width: 7px; height: 7px; border-radius: 999px; background: var(--surface-3); transition: all .25s var(--ease); }
.tour-dots i.on { width: 20px; background: var(--accent); }
.tour-replay { border-top: 1px solid var(--border); padding: 11px 20px; background: var(--surface-2); font-size: 13px; color: var(--muted); display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* Adaptation ---------------------------------------------------------------------------------- */

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col, .editor { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 264px; z-index: 70; transform: translateX(-102%); transition: transform .25s var(--ease); }
  .app.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .menu-btn { display: inline-flex; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .endpoint { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
  .hero .cover { width: 140px; }
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 32px 24px; }
  .login-art h1 { font-size: 30px; }
  .grid-2 { grid-template-columns: 1fr; }
  .track { grid-template-columns: 38px minmax(0, 1fr); }
  .track::before { display: none; }
  .track > .rights, .track > .t-actions { grid-column: 1 / -1; }
  .track-tools { grid-column: 1 / -1; }
  .approval { grid-template-columns: 1fr; }
  .approval .a-actions { flex-direction: row; }
  .bar-row { grid-template-columns: 90px minmax(0, 1fr) 76px; }
  .freeze .lbl { display: none; }
}
@media (max-width: 520px) { .kpis { grid-template-columns: 1fr 1fr; } .kpi .k-value { font-size: 22px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Comptes, cles, consommation ---------------------------------------------------------------- */

button.user-chip { border: 0; background: none; width: 100%; text-align: left; cursor: pointer; border-radius: 9px; padding: 10px 12px; }
button.user-chip:hover { background: var(--side-hover); }
.user-chip .who { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.user-chip .who b { color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .who small { color: var(--side-muted); font-size: 11.5px; }
.avatar.lg { width: 36px; height: 36px; font-size: 14px; flex: none; background: linear-gradient(135deg, var(--accent), #a855f7); }
.login-card .hint { color: var(--muted); }
details.rescue { border-top: 1px solid var(--border); padding-top: 12px; color: var(--muted); font-size: 13px; }
details.rescue summary { cursor: pointer; font-weight: 600; }
.pw-meter { display: flex; align-items: center; gap: 10px; margin-top: -6px; }
.pw-bar { flex: 1; height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.pw-bar span { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--critical); transition: width .25s var(--ease); }
.pw-bar span[data-level="ok"] { background: var(--warning); }
.pw-bar span[data-level="good"] { background: var(--safe); }
.chart-wrap { position: relative; }
svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
svg.chart .grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 4; }
svg.chart .axis { stroke: var(--border-strong); stroke-width: 1; }
svg.chart .tick { fill: var(--faint); font-size: 11px; font-family: var(--font); }
svg.chart .bar-mark { fill: var(--accent); }
svg.chart .hit { fill: transparent; cursor: default; outline: none; }
svg.chart .hit:hover, svg.chart .hit:focus { fill: color-mix(in srgb, var(--accent) 8%, transparent); }
.chart-tip { position: absolute; top: -6px; transform: translate(-50%, -100%); background: var(--text); color: var(--bg); padding: 7px 10px;
  border-radius: 8px; font-size: 12.5px; white-space: nowrap; pointer-events: none; display: grid; gap: 1px; box-shadow: var(--shadow); }
.bar-row.wide { grid-template-columns: minmax(0, 190px) minmax(0, 1fr) 90px; }
table.matrix td:first-child { font-weight: 600; }
table.matrix .yes { color: var(--safe); display: inline-grid; place-items: center; }
table.matrix .no { color: var(--faint); }
.freeze:disabled { opacity: .5; cursor: not-allowed; }

.integrity.warn { color: var(--warning); background: var(--warning-soft); }
.token-box code.one-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; word-break: normal; }

/* Passkeys ------------------------------------------------------------------------------------ */
.passkey-btn { width: 100%; justify-content: center; height: 44px; font-weight: 650; border-color: var(--border-strong); }
.passkey-btn .i { width: 20px; height: 20px; }
.or-sep { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12px; margin: 2px 0; }
.or-sep::before, .or-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.pk-section { display: grid; gap: 10px; }
.pk-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pk-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.pk-list .pk-empty { border-style: dashed; color: var(--muted); align-items: flex-start; }
.pk-list .pk-empty .i { width: 28px; height: 28px; color: var(--accent); flex: none; }
.pk-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.codes-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--surface-2, var(--bg)); display: grid; gap: 12px; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.codes code { font-size: 14px; letter-spacing: .04em; padding: 6px 8px; border-radius: 6px; background: var(--surface, #fff); border: 1px solid var(--border); text-align: center; }
.codes-actions { display: flex; gap: 8px; }
.checks-row { display: flex; flex-wrap: wrap; gap: 10px 22px; }
@media (max-width: 520px) { .codes { grid-template-columns: 1fr; } }
.pk-list .grow { flex: 1; min-width: 0; }

/* Coffre ------------------------------------------------------------------------------------- */
.faint { color: var(--faint); }
.mono.faint { font-size: 12px; }
.ellipsis { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.grid-3 { display: grid; grid-template-columns: 2fr 90px 1fr; gap: 14px; }
.card-head.wrap { flex-wrap: wrap; row-gap: 10px; }
.click-row { cursor: pointer; }
.click-row:hover td, .click-row:focus-visible td { background: var(--surface-2); }
.click-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.dest-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.dest-chips code { font-size: 11.5px; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); }
.alarm-card { border-color: color-mix(in srgb, var(--critical) 45%, var(--border)); background: linear-gradient(0deg, var(--surface), var(--critical-soft)); margin-bottom: 18px; }
.alarm-head { display: flex; gap: 12px; align-items: flex-start; padding: 16px 20px; color: var(--critical); }
.alarm-head .i { width: 22px; height: 22px; flex: none; margin-top: 1px; }
.alarm-head b { color: var(--text); }
.rings { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.ring { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); padding: 16px; display: grid; gap: 12px; box-shadow: var(--shadow-sm);
  background-image: radial-gradient(circle at 100% 0, var(--accent-soft), transparent 55%); }
.ring-top { display: flex; gap: 12px; align-items: center; }
.ring-top .btn { margin-left: auto; }
.ring-top .title { font-weight: 700; }
.ring-icon { width: 38px; height: 38px; flex: none; border-radius: 11px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(140deg, #3b3b98, #1e1b4b); box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.ring-icon .i { width: 20px; height: 20px; }
.ring-icon.kind-canary { background: linear-gradient(140deg, #e11d48, #7f1d1d); }
.ring-icon.kind-ssh_key { background: linear-gradient(140deg, #0f766e, #134e4a); }
.ring-icon.kind-password { background: linear-gradient(140deg, #7c3aed, #3b0764); }
.ring-items { display: flex; flex-wrap: wrap; gap: 6px; }
.ring-item { display: inline-flex; align-items: center; gap: 5px; font: 600 12px var(--mono, ui-monospace, monospace); padding: 4px 8px; border-radius: 7px;
  background: var(--surface-2); border: 1px solid var(--border); }
.ring-item.off { opacity: .55; text-decoration: line-through; }
.ring-foot { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; border-top: 1px dashed var(--border); padding-top: 10px; }
.badge.kind-canary { background: var(--critical-soft); color: var(--critical); }
.badge.kind-ssh_key { background: var(--safe-soft); color: var(--safe); }
.badge.kind-api_token, .badge.kind-password, .badge.kind-note { background: var(--accent-soft); color: var(--accent-text); }
.facts { display: grid; gap: 10px; }
.fact { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 12px; align-items: baseline; font-size: 13.5px; }
.fact > span { color: var(--muted); }
.cmd-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cmd-list code { font-size: 12.5px; padding: 3px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.list.feed > li { padding: 10px 0; }
.reveal-value { display: block; font-size: 14px; padding: 12px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--border-strong);
  word-break: break-all; white-space: pre-wrap; max-height: 260px; overflow: auto; }
.kind-picker { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.kind-opt { display: grid; justify-items: center; gap: 6px; padding: 12px 6px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font: 600 12.5px inherit; cursor: pointer; text-align: center; }
.kind-opt .i { width: 22px; height: 22px; }
.kind-opt[aria-checked="true"] { border-color: var(--accent); color: var(--text); background: var(--accent-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.kind-opt.kind-canary[aria-checked="true"] { border-color: var(--critical); background: var(--critical-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--critical) 22%, transparent); }
.ring-picks { display: grid; gap: 6px; max-height: 260px; overflow: auto; padding: 4px; border: 1px solid var(--border); border-radius: 10px; }
.ring-pick { padding: 6px 8px; border-radius: 8px; }
.ring-pick:hover { background: var(--surface-2); }
@media (max-width: 720px) {
  .kind-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: 1fr 90px; }
  .fact { grid-template-columns: 1fr; gap: 2px; }
}
.ring-items { align-items: flex-start; align-content: flex-start; }

/* Validations : paliers, votes, Telegram, page de revue ---------------------------------------- */
.votes { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.votes li { display: flex; align-items: center; gap: 8px; }
.votes b { color: var(--text); }
.tiers { display: grid; gap: 18px; }
.tier-ladder { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.rung { display: flex; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.rung p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.rung-n { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px;
  background: var(--surface-3); color: var(--text); }
.rung-n.accent { background: var(--accent-soft); color: var(--accent-text); }
.rung-n.critical { background: var(--critical-soft); color: var(--critical); }
.tiers-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.checks-col { display: grid; gap: 8px; }
.bot-slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.bot-slot { border: 1px dashed var(--border-strong); border-radius: 14px; padding: 16px; display: grid; gap: 10px; align-content: start; }
.bot-slot.on { border-style: solid; background: var(--surface); box-shadow: var(--shadow-sm); }
.bot-slot.on.finance { border-color: color-mix(in srgb, var(--critical) 45%, var(--border)); }
.bot-top { display: flex; align-items: center; gap: 10px; }
.bot-ico { width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center; color: #fff; background: #64748b; }
.bot-ico.sm { width: 28px; height: 28px; }
.bot-ico.operations { background: linear-gradient(140deg, #4f46e5, #1e1b4b); }
.bot-ico.finance { background: linear-gradient(140deg, #e11d48, #7f1d1d); }
.bot-ico.info { background: linear-gradient(140deg, #0ea5e9, #075985); }
.bot-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.steps { margin: 8px 0 10px; padding-left: 18px; display: grid; gap: 4px; }
.tg-links { display: grid; gap: 8px; }
.tg-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.tg-link .grow { flex: 1; min-width: 0; }
.review-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.review-card { width: min(720px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 24px;
  box-shadow: var(--shadow-lg, 0 20px 50px rgba(0,0,0,.12)); display: grid; gap: 14px; }
.review-card h1 { font-size: 20px; margin: 0; letter-spacing: -.01em; overflow-wrap: anywhere; }
.review-card pre { margin: 0; max-height: 340px; overflow: auto; }
.review-brand { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.review-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.review-final { display: flex; align-items: center; gap: 10px; }
@media (max-width: 860px) { .tier-ladder, .bot-slots, .tiers-grid { grid-template-columns: 1fr; } }
.approval pre, .review-card pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Messages ------------------------------------------------------------------------------------ */
.inbox { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; align-items: start; }
.threads { display: grid; padding: 6px; position: sticky; top: 80px; }
.thread { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; color: inherit; text-decoration: none; }
.thread:hover { background: var(--surface-2); }
.thread[aria-current="page"] { background: var(--accent-soft); }
.thread .grow { flex: 1; min-width: 0; display: grid; }
.thread small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-meta { display: grid; justify-items: end; gap: 3px; }
.thread-meta .count { background: var(--critical); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.thread-cover { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; flex: none; }
.thread-cover.lg { width: 42px; height: 42px; border-radius: 12px; }
.conv { display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 520px; }
.conv-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.conv-head .grow { flex: 1; min-width: 0; }
.diffusion { display: grid; gap: 4px; }
.diffusion .input { height: 34px; }
.conv-body { padding: 18px; display: grid; gap: 18px; max-height: 68vh; overflow: auto; background:
  radial-gradient(circle at 0 0, var(--accent-soft), transparent 40%), var(--surface); }
.exchange { display: grid; gap: 8px; }
.bubble { max-width: min(640px, 92%); border-radius: 16px; padding: 12px 14px; display: grid; gap: 8px; border: 1px solid var(--border); }
.bubble.agent { background: var(--surface-2); border-top-left-radius: 4px; justify-self: start; }
.bubble.agent.urgent { border-color: color-mix(in srgb, var(--critical) 50%, var(--border)); box-shadow: 0 0 0 3px var(--critical-soft); }
.bubble.human { background: var(--accent); color: #fff; border-color: transparent; border-top-right-radius: 4px; justify-self: end; }
.bubble.human .time { color: rgba(255,255,255,.8); }
.bubble-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.q-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.q-context { margin: 0; font-size: 13px; color: var(--muted); }
.answer-box { display: grid; gap: 8px; border-top: 1px dashed var(--border); padding-top: 10px; }
.choices { display: flex; flex-wrap: wrap; gap: 6px; }
.answer-free { display: grid; gap: 6px; }
.answer-actions { display: flex; justify-content: space-between; gap: 8px; }
@media (max-width: 900px) { .inbox { grid-template-columns: 1fr; } .threads { position: static; } }
.grants { border-top: 1px solid var(--border); padding-top: 12px; }
.oauth-note { display: grid; gap: 10px; padding: 12px; border-radius: 10px; background: var(--accent-soft); }
.consent-form { display: grid; gap: 14px; }
.consent-form .field { display: grid; gap: 6px; }
.consent-form .field > span:first-child { font-weight: 600; font-size: 13.5px; }
.review-card.consent h1 { font-size: 21px; }
