/* DANKE OS — feuille de l'application (P0 : dashboard « Autonomy Node »). */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--fg);
  font-family: var(--font-ui); font-size: 16px; line-height: 1.45;
  background-image: radial-gradient(900px 500px at 8% -5%, var(--glow-a), transparent 60%), radial-gradient(800px 600px at 100% 100%, var(--glow-b), transparent 60%);
  background-attachment: fixed;
}
body::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 900; background: url("../../assets/grain.svg"); opacity: var(--grain-opacity); mix-blend-mode: overlay; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.ico { flex: none; }
[hidden] { display: none !important; }

/* ---------- Boot ---------- */
dk-boot { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: #0c0b08; color: #f4efdd; cursor: pointer; }
dk-boot .boot-inner { width: min(560px, calc(100% - 40px)); display: grid; gap: 28px; justify-items: center; }
dk-boot .boot-logo { width: min(220px, 52vw); height: auto; overflow: visible; }
dk-boot .boot-logo path, dk-boot .boot-logo line { stroke: #f4efdd; }
dk-boot .boot-logo circle { fill: #f4efdd; }
dk-boot .boot-brand { font-weight: 800; font-size: 20px; letter-spacing: -0.01em; }
dk-boot .boot-brand span { color: #e8c33a; }
dk-boot .boot-log { font-family: var(--font-mono); font-size: 13px; line-height: 1.7; width: 100%; min-height: 9.5em; color: rgba(244, 239, 221, 0.7); }
dk-boot .boot-line { display: flex; gap: 10px; }
dk-boot .boot-line .tag { width: 3.2em; flex: none; }
dk-boot .boot-line.ok .tag { color: #4fe3a1; }
dk-boot .boot-line.warn .tag { color: #e8c33a; }
dk-boot .boot-line.fail .tag { color: #ff7a4d; }
dk-boot .boot-line.run .tag { color: rgba(244, 239, 221, 0.5); }
dk-boot .boot-bar { width: 100%; height: 3px; background: rgba(244, 239, 221, 0.14); overflow: hidden; border-radius: 3px; }
dk-boot .boot-bar i { display: block; height: 100%; width: 0; background: #e8c33a; }
dk-boot .boot-skip { position: absolute; bottom: 24px; font-family: var(--font-mono); font-size: 12px; color: rgba(244, 239, 221, 0.45); }
dk-boot .boot-fail { color: #ff7a4d; font-family: var(--font-mono); font-size: 13px; white-space: pre-wrap; }

/* ---------- Topbar ---------- */
.topbar { flex-wrap: wrap; position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: var(--s4); padding: 10px clamp(16px, 4vw, 40px); background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(14px) saturate(1.3); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; letter-spacing: -0.01em; text-decoration: none; color: var(--fg); }
.brand svg { width: 36px; height: 26px; }
.brand .node { font-family: var(--font-mono); font-weight: 400; font-size: 12px; color: var(--muted); letter-spacing: 0.06em; }
.spacer { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; font-family: var(--font-mono); font-size: 12px; background: var(--panel); white-space: nowrap; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: pulse 2.4s infinite; }
.pill.warn .dot { background: var(--accent); }
.pill.off .dot { background: var(--danger); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(79, 227, 161, 0.55); } 70% { box-shadow: 0 0 0 8px rgba(79, 227, 161, 0); } 100% { box-shadow: 0 0 0 0 rgba(79, 227, 161, 0); } }
.pill.warn .dot { animation-name: pulse-y; }
@keyframes pulse-y { 0% { box-shadow: 0 0 0 0 rgba(232, 195, 58, 0.55); } 70% { box-shadow: 0 0 0 8px rgba(232, 195, 58, 0); } 100% { box-shadow: 0 0 0 0 rgba(232, 195, 58, 0); } }

/* ---------- Layout ---------- */
main, .node-app { padding: clamp(16px, 4vw, 40px); max-width: 1320px; margin: 0 auto; }
.node-app { container-type: inline-size; max-width: none; }
.hero { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.8fr); gap: var(--s6); align-items: center; padding: clamp(12px, 3vw, 32px) 0 var(--s6); }
.hero .kicker { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.hero h1 { font-weight: 800; font-size: clamp(48px, 9.5vw, 128px); line-height: 0.88; letter-spacing: -0.045em; margin: 14px 0 18px; text-transform: uppercase; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero .lede { max-width: 52ch; color: var(--muted); font-size: clamp(16px, 1.6vw, 19px); }
.hero .cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.sticker { display: inline-block; background: var(--accent); color: var(--on-accent); font-family: var(--font-display); font-size: 22px; padding: 4px 14px 2px; transform: rotate(-3deg); margin-top: 22px; box-shadow: 4px 4px 0 var(--fg); }
.hero-art { position: relative; display: grid; place-items: center; min-height: 240px; }
.hero-art svg { width: min(100%, 360px); height: auto; overflow: visible; color: var(--accent); filter: drop-shadow(6px 8px 0 color-mix(in srgb, var(--fg) 14%, transparent)); }
.hero-art .tape { position: absolute; width: 120px; height: 34px; background: color-mix(in srgb, var(--accent) 75%, transparent); transform: rotate(-12deg); top: 8%; left: 6%; mix-blend-mode: multiply; }
.hero-art .barcode { position: absolute; right: 2%; bottom: 4%; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em; color: var(--muted); writing-mode: vertical-rl; }

.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap, 16px); }
.span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }
@media (max-width: 560px) { .brand .node { display: none; } .topbar { gap: 8px; } }
@container (max-width: 860px) { .span-4, .span-5, .span-6, .span-7, .span-8 { grid-column: span 12; } .hero { grid-template-columns: 1fr; } .hero-art { display: none; } }
@container (min-width: 861px) and (max-width: 1100px) { .span-4 { grid-column: span 6; } .span-8 { grid-column: span 12; } }

/* ---------- Tiles ---------- */
.tile { position: relative; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); display: flex; flex-direction: column; gap: 14px; min-width: 0; overflow: hidden; will-change: transform; }
.tile::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.25s; background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 0%), var(--glow-a), transparent 70%); }
.tile:hover::before { opacity: 1; }
.tile > * { position: relative; }
.tile-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.kicker { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.tile-title { font-weight: 800; font-size: 22px; letter-spacing: -0.02em; line-height: 1.1; }
.tile p.hint { color: var(--muted); font-size: 14px; }
.stat { font-weight: 800; font-size: 40px; letter-spacing: -0.04em; line-height: 1; }
.stat small { font-size: 14px; font-weight: 700; color: var(--muted); letter-spacing: 0; margin-left: 6px; }

/* ---------- Controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border: 2px solid var(--accent); background: var(--accent); color: var(--on-accent); font-weight: 700; border-radius: var(--radius-sm); cursor: pointer; text-decoration: none; line-height: 1.1; will-change: transform; }
.btn:hover { background: var(--yellow-hi); border-color: var(--yellow-hi); }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--line); }
.btn.ghost:hover { background: var(--panel-hi); border-color: var(--fg); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: var(--bg); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 7px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.chip-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 1px solid transparent; background: transparent; color: var(--muted); border-radius: 8px; cursor: pointer; }
.chip-btn:hover { background: var(--panel-hi); color: var(--fg); border-color: var(--line); }
.chip-btn.danger:hover { color: var(--danger); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

input[type="text"], input[type="password"], select { width: 100%; padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--fg); }
select { width: auto; padding-right: 28px; }
label.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
label.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14px; }
label.check input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; }
.meter { height: 10px; border-radius: 6px; background: var(--panel-hi); overflow: hidden; }
.meter > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 6px; }
.meter.over > i { background: var(--danger); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 6px; font-family: var(--font-mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
.badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.badge.warn { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.badge.bad { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.violet { color: var(--violet-text); }

.rows { display: flex; flex-direction: column; margin: 0 -8px; }
.row { display: flex; align-items: center; gap: 12px; padding: 9px 8px; border-radius: 8px; min-width: 0; }
.row + .row { border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.row:hover { background: var(--panel); }
.row .grow { flex: 1; min-width: 0; }
.row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.row .sub { font-size: 12px; color: var(--muted); font-family: var(--font-mono); }
.row .actions { display: flex; gap: 2px; opacity: 0.55; }
.row:hover .actions, .row:focus-within .actions { opacity: 1; }
.row button.link { all: unset; cursor: pointer; display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; border-radius: 6px; }
.row button.link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.swatch { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-family: var(--font-mono); font-size: 13px; }
.crumbs button { all: unset; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.crumbs button:hover { background: var(--panel-hi); }
.crumbs button:focus-visible { outline: 2px solid var(--focus); }
.empty { padding: 24px 8px; text-align: center; color: var(--muted); font-size: 14px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; font-family: var(--font-mono); font-size: 13px; overflow-wrap: anywhere; }
.quote { font-family: var(--font-display); font-size: 26px; line-height: 1.15; color: var(--accent); }
.num { font-family: var(--font-mono); color: var(--muted); font-size: 12px; }

/* ---------- Modal ---------- */
dialog.dk-modal { width: min(580px, calc(100% - 28px)); max-height: calc(100vh - 40px); padding: 0; border: 1px solid var(--line); border-radius: 20px; background: var(--bg-2); color: var(--fg); overflow: auto; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55); }
dialog.dk-modal::backdrop { background: rgba(5, 4, 2, 0.62); backdrop-filter: blur(6px); }
.modal-head { padding: 22px 24px 4px; display: grid; gap: 4px; }
.modal-body { padding: 14px 24px; display: grid; gap: 14px; }
.modal-foot { padding: 14px 24px 22px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.callout { padding: 12px 14px; border-radius: var(--radius-sm); border: 1px dashed var(--line); font-size: 14px; color: var(--muted); }
.callout.danger { border-color: var(--danger); color: var(--danger); }
.opt { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.opt:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.opt input { margin-top: 3px; accent-color: var(--accent); }
.opt b { font-weight: 700; } .opt span { color: var(--muted); font-size: 13px; grid-column: 2; }

/* ---------- Toasts & overlay ---------- */
.toasts { position: fixed; z-index: 950; bottom: 18px; left: 50%; transform: translateX(-50%); display: grid; gap: 10px; justify-items: center; width: min(520px, calc(100% - 28px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; background: var(--paper); color: var(--ink); padding: 11px 14px; border-radius: 10px; font-weight: 600; font-size: 14px; border-left: 6px solid var(--accent); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); }
.toast.bad { border-left-color: var(--spray); }
.toast.ok { border-left-color: #1db37a; }
.toast .btn { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.dropzone { position: fixed; inset: 12px; z-index: 940; display: grid; place-items: center; border: 3px dashed var(--accent); border-radius: 24px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(4px); pointer-events: none; font-family: var(--font-display); font-size: clamp(28px, 6vw, 64px); color: var(--accent); text-align: center; padding: 20px; }
.progress { display: grid; gap: 8px; }
.progress .meter > i { transition: width 0.12s linear; }

/* ---------- Motion off ---------- */
@media (prefers-reduced-motion: reduce) { .pill .dot { animation: none; } .tile::before { transition: none; } }
:root[data-motion="off"] .pill .dot { animation: none; }
