:root {
  --bg: #0f1216; --bg2: #161b21; --card: #1b2129; --line: #2a323d;
  --text: #e6e9ee; --muted: #8b95a3; --accent: #ff7a1a; --accent2: #ffb36b;
  --ok: #3ccf7a; --err: #ff5566; --warn: #f5c04a; --radius: 10px;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent2); }
code { font-family: var(--mono); font-size: .9em; background: #0b0e11; border: 1px solid var(--line); padding: .05em .35em; border-radius: 5px; overflow-wrap: anywhere; }
h1 { font-size: 1.6rem; margin: .2em 0 .6em; display: flex; gap: .5em; align-items: center; flex-wrap: wrap; }
h1 small { font-size: .55em; font-weight: 400; }
h2 { font-size: 1.1rem; margin: 0 0 .8em; color: var(--accent2); }
h3 { font-size: 1rem; margin: 1.2em 0 .4em; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.mt { margin-top: 1em; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.ok-text { color: var(--ok); } .err-text { color: var(--err); }

/* Header */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1rem; padding: .6rem clamp(1rem, 3vw, 2rem); background: rgba(15,18,22,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; letter-spacing: .02em; white-space: nowrap; }
.brand em { font-style: normal; color: var(--accent); }
.brand.big { font-size: 1.6rem; text-align: center; margin-bottom: 1rem; }
.logo { color: var(--accent); }
.top nav { display: flex; gap: .2rem; flex-wrap: wrap; align-items: center; margin-left: auto; }
.top nav a, .linklike { color: var(--muted); text-decoration: none; padding: .45rem .7rem; border-radius: 8px; font: inherit; background: none; border: 0; cursor: pointer; }
.top nav a:hover, .linklike:hover { color: var(--text); background: var(--bg2); }
.top nav a.on { color: var(--text); background: var(--card); box-shadow: inset 0 -2px 0 var(--accent); }
.navtoggle, .burger { display: none; }
@media (max-width: 860px) {
  .burger { display: block; margin-left: auto; font-size: 1.4rem; cursor: pointer; padding: .2rem .5rem; }
  .top nav { display: none; width: 100%; flex-direction: column; align-items: stretch; }
  .navtoggle:checked ~ nav { display: flex; }
}

/* Layout */
.wrap { max-width: 1100px; margin: 0 auto; padding: 1.5rem clamp(1rem, 3vw, 2rem) 4rem; }
.wrap.wide { max-width: 1500px; }
.center { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); margin-bottom: 1rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; margin-bottom: 1rem; }
.grid > .card { margin-bottom: 0; }
.login { width: min(380px, 100%); }
.narrow { max-width: 520px; }
.headrow { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-end; }
.row > label { flex: 1 1 200px; }

/* Forms */
label { display: block; margin-bottom: .9rem; font-weight: 600; font-size: .92rem; }
label small { font-weight: 400; color: var(--muted); }
input:not([type=checkbox]):not([type=file]), select, textarea {
  display: block; width: 100%; margin-top: .3rem; padding: .55rem .7rem; font: inherit; font-weight: 400;
  color: var(--text); background: #0d1014; border: 1px solid var(--line); border-radius: 8px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
label.check { display: flex; gap: .55rem; align-items: baseline; font-weight: 500; }
label.check input { accent-color: var(--accent); transform: translateY(2px); }
.form h2:not(:first-of-type) { margin-top: 1.6rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }
.inline { display: inline; margin: 0; }

.btn { display: inline-flex; align-items: center; gap: .4em; padding: .55rem 1rem; border-radius: 8px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a0d00; }
.btn.primary:hover { background: var(--accent2); }
.btn.danger { color: var(--err); }
.btn.danger:hover { border-color: var(--err); }
.btn.small { padding: .3rem .65rem; font-size: .85rem; }
.btn.wide { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .5; cursor: wait; }
.controls { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Upload */
.upload { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; }
.drop { flex: 1 1 260px; margin: 0; border: 2px dashed var(--line); border-radius: var(--radius); padding: 1.2rem; text-align: center; cursor: pointer; font-weight: 400; color: var(--muted); }
.drop:hover, .drop.over { border-color: var(--accent); color: var(--text); }
.drop input { display: block; margin: 0 auto .5rem; max-width: 100%; color: var(--text); }
progress, meter { width: 100%; height: 10px; accent-color: var(--accent); }
.upload progress { flex: 1 1 100%; }

/* Flash & badges */
.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.flash.ok { border-color: rgba(60,207,122,.4); background: rgba(60,207,122,.08); }
.flash.error { border-color: rgba(255,85,102,.45); background: rgba(255,85,102,.08); }
.flash.warn { border-color: rgba(245,192,74,.45); background: rgba(245,192,74,.08); }
.badge { display: inline-block; font-size: .78rem; font-weight: 700; padding: .2em .65em; border-radius: 99px; border: 1px solid; letter-spacing: .02em; vertical-align: middle; }
.s-running { color: var(--ok); border-color: rgba(60,207,122,.5); background: rgba(60,207,122,.1); }
.s-exited, .s-absent, .s-dead { color: var(--err); border-color: rgba(255,85,102,.5); background: rgba(255,85,102,.08); }
.s-restarting, .s-created, .s-paused, .s-inconnu { color: var(--warn); border-color: rgba(245,192,74,.5); background: rgba(245,192,74,.08); }
.big-status { font-size: 1.15rem; display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; }
.big-status .badge { font-size: 1rem; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .85rem; }
tr.dim td { opacity: .55; }
td .inline + .inline, td .btn + .inline { margin-left: .3rem; }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: 0 0 1rem; }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; overflow-wrap: anywhere; }

/* Console / code */
pre { font-family: var(--mono); }
pre.small { font-size: .8rem; white-space: pre-wrap; color: var(--muted); }
.console { background: #07090b; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; height: 65vh; overflow: auto; font-size: .82rem; line-height: 1.45; white-space: pre-wrap; word-break: break-word; margin: .6rem 0; }
.console .l-err { color: #ff8090; } .console .l-warn { color: var(--warn); } .console .l-chat { color: #8fd3ff; }
.toolbar { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
.toolbar label { margin: 0; }
.toolbar input[type=search] { flex: 1 1 220px; width: auto; margin: 0; }
pre.code { background: #07090b; border: 1px solid var(--line); border-radius: 8px; padding: 1rem; overflow-x: auto; font-size: .85rem; }
.editor textarea { font-family: var(--mono); font-size: .88rem; line-height: 1.5; min-height: 65vh; tab-size: 4; white-space: pre; overflow: auto; }
.copy { cursor: copy; }

/* Tuto */
.lead { font-size: 1.08rem; color: var(--muted); max-width: 70ch; }
.toc ol { margin: .5rem 0 0; columns: 2 240px; }
.tuto { scroll-margin-top: 80px; }
.tuto p, .tuto li { max-width: 80ch; }
.steps li { margin-bottom: .5rem; }
.steps li::marker { color: var(--accent); font-weight: 800; }
.note { border-left: 3px solid var(--accent); background: rgba(255,122,26,.07); padding: .6rem .9rem; border-radius: 0 8px 8px 0; }
dl.defs dt { font-weight: 700; margin-top: .8rem; } dl.defs dd { margin: .2rem 0 0; color: var(--muted); }
.faq td:first-child { font-weight: 600; width: 35%; }
details summary { cursor: pointer; color: var(--muted); }

/* Statut en cours + loaders */
.s-busy { color: var(--warn); border-color: rgba(245,192,74,.5); background: rgba(245,192,74,.1); }
.spin { display: inline-block; width: .85em; height: .85em; margin-right: .45em; vertical-align: -.1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn.loading .ico { display: inline-block; width: .9em; height: .9em; font-size: 0; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn.loading { opacity: 1 !important; cursor: wait; }
.btn[disabled]:not(.loading) { opacity: .45; cursor: not-allowed; }
.toast { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 50; max-width: min(420px, calc(100vw - 32px)); padding: .8rem 1.1rem; border-radius: 10px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.45); border: 1px solid; animation: toastin .25s ease-out; }
.toast.ok { background: #13281d; border-color: rgba(60,207,122,.5); color: #b9f5cf; }
.toast.error { background: #2c1418; border-color: rgba(255,85,102,.5); color: #ffc2ca; }
@keyframes toastin { from { transform: translateY(12px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .spin, .btn.loading .ico { animation-duration: 2s; } .toast { animation: none; } }
