/* Tableau de bord — thème nordique (sombre par défaut, clair disponible) */
:root {
  color-scheme: dark;
  --bg: #0d1116;
  --bg-grad: radial-gradient(1200px 600px at 10% -10%, rgba(212, 162, 74, 0.07), transparent 60%),
             radial-gradient(900px 500px at 110% 10%, rgba(217, 89, 38, 0.05), transparent 60%);
  --surface: #161c23;
  --surface-2: #1d252e;
  --surface-3: #24303b;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #ece6d8;
  --text-2: #b9b3a6;
  --muted: #8b8f94;
  --gold: #d9a441;
  --gold-soft: rgba(217, 164, 65, 0.14);
  --ember: #e8703a;
  --wood: #8a6a45;
  --good: #3fbf62;
  --bad: #e25c5c;
  --warn: #e8b43a;
  --grid: rgba(255, 255, 255, 0.06);
  --axis: #6d737a;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.25);
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-title: "Segoe UI", system-ui, sans-serif;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3efe6;
  --bg-grad: radial-gradient(1200px 600px at 10% -10%, rgba(168, 122, 31, 0.08), transparent 60%);
  --surface: #fffdf8;
  --surface-2: #f6f1e7;
  --surface-3: #ece5d6;
  --border: rgba(40, 30, 10, 0.10);
  --border-strong: rgba(40, 30, 10, 0.2);
  --text: #1e2226;
  --text-2: #4d4a44;
  --muted: #7a766d;
  --gold: #9c6f12;
  --gold-soft: rgba(168, 122, 31, 0.12);
  --ember: #c24e22;
  --wood: #7a5a35;
  --good: #1d8a3a;
  --bad: #c43333;
  --warn: #a8740a;
  --grid: rgba(0, 0, 0, 0.07);
  --axis: #8d887d;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --shadow: 0 1px 2px rgba(60, 40, 10, 0.06), 0 6px 18px rgba(60, 40, 10, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-title); margin: 0; letter-spacing: 0.01em; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 15px; font-weight: 600; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ---------- Mise en page ---------- */
.layout { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand-name { font-family: var(--font-title); font-weight: 700; font-size: 18px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: 0.04em; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  color: var(--text-2); font-weight: 500; text-decoration: none; border: 1px solid transparent;
}
.nav a svg { width: 18px; height: 18px; flex: none; opacity: 0.85; }
.nav a:hover { background: var(--surface-3); color: var(--text); }
.nav a.active { background: var(--gold-soft); color: var(--gold); border-color: rgba(217, 164, 65, 0.25); }
.nav-sep { height: 1px; background: var(--border); margin: 10px 4px; }
.sidebar-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.user { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.user b { color: var(--text); font-weight: 600; }
.role { display: inline-block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; padding: 1px 6px; border-radius: 99px; border: 1px solid var(--border-strong); color: var(--text-2); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  padding: 12px 24px; background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.menu-btn { display: none; }
.page-title { flex: 1 1 auto; min-width: 160px; display: flex; align-items: baseline; gap: 10px; }
.page-title .sub { color: var(--muted); font-size: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.content { padding: 20px 24px 48px; display: flex; flex-direction: column; gap: 18px; max-width: 1600px; width: 100%; }

/* ---------- Contrôles ---------- */
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 10px; border-radius: 7px; cursor: pointer; color: var(--text-2); font-size: 13px; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface-3); color: var(--gold); font-weight: 600; }
.select, .input {
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 6px 10px; min-height: 34px;
}
.select:focus, .input:focus, .btn:focus-visible, .seg button:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; border-radius: 9px; padding: 6px 12px; min-height: 34px;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); font-weight: 500;
}
.btn:hover { border-color: var(--gold); }
.btn.primary { background: linear-gradient(180deg, #e3b04f, #c18a2a); color: #1b1407; border-color: transparent; font-weight: 650; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.small { min-height: 28px; padding: 3px 9px; font-size: 12px; }
.btn.ghost { background: transparent; }
.icon-btn { width: 34px; padding: 0; justify-content: center; }
.custom-dates { display: inline-flex; gap: 6px; align-items: center; }
.custom-dates input { width: 140px; }

.search { position: relative; }
.search .input { width: 220px; padding-left: 30px; }
.search svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); }
.suggest {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; min-width: 260px; z-index: 50;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden;
}
.suggest button { display: flex; width: 100%; justify-content: space-between; gap: 8px; border: 0; background: transparent; padding: 8px 12px; cursor: pointer; text-align: left; }
.suggest button:hover, .suggest button.sel { background: var(--surface-3); }
.suggest .empty { padding: 10px 12px; color: var(--muted); }

/* ---------- Cartes ---------- */
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; min-width: 0; position: relative;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { display: flex; align-items: center; gap: 6px; }
.card-head .actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.section-title { display: flex; align-items: center; gap: 10px; margin-top: 6px; color: var(--text-2); font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 600; }
.section-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border-strong), transparent); }

.kpi { padding: 14px 16px; }
.kpi .label { color: var(--text-2); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 26px; font-weight: 650; margin-top: 4px; letter-spacing: -0.01em; }
.kpi .foot { display: flex; align-items: center; gap: 8px; margin-top: 2px; font-size: 12px; color: var(--muted); min-height: 18px; }
.kpi::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); opacity: 0.55; }
.delta { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--muted); }

.info {
  display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; font-size: 10px; font-weight: 700; font-style: normal;
  border: 1px solid var(--border-strong); color: var(--muted); cursor: help; position: relative; flex: none; text-transform: none; letter-spacing: 0;
}
.info:hover, .info:focus { color: var(--gold); border-color: var(--gold); outline: none; }
.info:hover::after, .info:focus::after {
  content: attr(data-tip); position: absolute; z-index: 60; left: 50%; top: calc(100% + 8px); transform: translateX(-50%);
  width: max-content; max-width: min(320px, 80vw); white-space: normal; text-align: left;
  background: var(--surface-3); color: var(--text); border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 8px 10px; font-size: 12px; font-weight: 400; line-height: 1.45; box-shadow: var(--shadow);
}

/* ---------- En direct ---------- */
.live { display: grid; grid-template-columns: minmax(180px, 240px) 1fr; gap: 14px; align-items: stretch; }
.live-total { display: flex; flex-direction: column; justify-content: center; }
.live-total .big { font-size: 44px; font-weight: 700; color: var(--gold); line-height: 1.1; }
.pulse { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 rgba(63, 191, 98, 0.6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(63, 191, 98, 0); } 100% { box-shadow: 0 0 0 0 rgba(63, 191, 98, 0); } }
.servers-live { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.srv { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); }
.srv .name { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.srv .dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.srv .row { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12.5px; color: var(--text-2); }
.srv .count { font-size: 22px; font-weight: 650; color: var(--text); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; border: 1px solid; white-space: nowrap; }
.badge.ok { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); background: color-mix(in srgb, var(--good) 10%, transparent); }
.badge.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: color-mix(in srgb, var(--bad) 10%, transparent); }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.badge.neutral { color: var(--text-2); border-color: var(--border-strong); }

/* ---------- Graphiques ---------- */
.chart { position: relative; height: 260px; }
.chart.tall { height: 320px; }
.chart.short { height: 200px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-weight: 600; color: var(--text-2); font-size: 12px; position: sticky; top: 0; background: var(--surface); user-select: none; }
th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--text); }
th .arrow { opacity: 0.4; margin-left: 4px; font-size: 10px; }
th.sorted .arrow { opacity: 1; color: var(--gold); }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-3) 50%, transparent); }
td.wrap { white-space: normal; min-width: 180px; }
.table-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }

/* Heatmaps */
.heat { display: grid; grid-template-columns: 38px repeat(24, minmax(14px, 1fr)); gap: 2px; font-size: 11px; }
.heat .lbl { color: var(--muted); display: flex; align-items: center; }
.heat .hlbl { color: var(--muted); text-align: center; font-size: 10px; }
.heat .cell { aspect-ratio: 1.3; border-radius: 3px; background: var(--surface-2); min-height: 14px; }
.heat .cell:hover { outline: 1px solid var(--gold); }
.scale { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); margin-top: 10px; }
.scale .bar { width: 140px; height: 8px; border-radius: 4px; }
table.cohort td, table.cohort th { padding: 5px 7px; text-align: center; font-size: 12px; }
table.cohort td.c { border-radius: 4px; border: 2px solid var(--surface); font-variant-numeric: tabular-nums; }
table.cohort td.partial { font-style: italic; opacity: 0.85; }
table.cohort td:first-child, table.cohort th:first-child { text-align: left; }

/* ---------- États ---------- */
.state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 140px; color: var(--muted); text-align: center; padding: 20px; }
.state svg { width: 30px; height: 30px; opacity: 0.6; }
.state.error { color: var(--bad); }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }
.loading-bar { position: fixed; top: 0; left: 0; height: 2px; width: 0; background: var(--gold); z-index: 100; transition: width 0.3s ease, opacity 0.3s; }
.toast { position: fixed; bottom: 18px; right: 18px; background: var(--surface-3); border: 1px solid var(--border-strong); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); z-index: 100; }

/* ---------- Fiche joueur ---------- */
.profile-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.avatar { width: 64px; height: 64px; border-radius: 12px; background: linear-gradient(135deg, var(--wood), var(--gold)); display: grid; place-items: center; font-size: 28px; font-weight: 800; color: #1b1407; flex: none; }
.profile-head .who { flex: 1; min-width: 200px; }
.profile-head .who h1 { font-size: 24px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.kv div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; }
.kv b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.kv span { font-size: 11.5px; color: var(--muted); }
.list { display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow-y: auto; }
.list div { display: flex; justify-content: space-between; gap: 8px; padding: 5px 8px; border-radius: 6px; background: var(--surface-2); font-size: 12.5px; }

/* ---------- Connexion ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; padding: 28px; }
.login-card .brand { justify-content: center; flex-direction: column; text-align: center; border: 0; padding-bottom: 8px; }
.login-card .brand svg { width: 56px; height: 56px; }
.login-card .brand-name { font-size: 26px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.field .input { width: 100%; min-height: 40px; }
.form-error { color: var(--bad); font-size: 13px; min-height: 20px; margin-bottom: 8px; }
.login-card .btn { width: 100%; justify-content: center; min-height: 42px; }
.rune-line { height: 1px; margin: 14px 0 18px; background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: 0.5; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; left: 0; top: 0; width: 260px; transform: translateX(-105%); transition: transform 0.2s ease; box-shadow: var(--shadow); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 30; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 10px 16px; position: static; }
  .servers-live { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .srv { padding: 8px 10px; }
  .srv .row { flex-wrap: wrap; gap: 4px; }
  .kpi .foot { flex-wrap: wrap; row-gap: 0; }
  .live-total .big { font-size: 36px; }
  .content { padding: 16px 16px 40px; }
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .live { grid-template-columns: 1fr; }
  .search { flex: 1 1 100%; order: 3; }
  .search .input { width: 100%; }
  .filters { width: 100%; }
  .seg { overflow-x: auto; max-width: 100%; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi .value { font-size: 21px; }
  .chart { height: 230px; }
  .heat { grid-template-columns: 30px repeat(24, minmax(8px, 1fr)); gap: 1px; }
  .heat .hlbl:nth-child(odd) { visibility: hidden; }
}
@media (max-width: 420px) {
  .kpi { padding: 12px; }
  .kpi .value { font-size: 19px; }
  .custom-dates input { width: 128px; }
}
.kpis.tight { grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); }
.server-cards { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }

/* --- Pilotage : équilibrage, configs, contrôle --------------------------------------------- */
.page-root > .card, .page-root > .bal-card, .page-root > .grid { margin-bottom: 16px; }
.cfg-toolbar { margin: 10px 0; }
.cfg-toolbar .input, #cf-fq { width: 100%; max-width: 420px; margin-bottom: 10px; }
.cfg-list { display: flex; flex-direction: column; }
.cfg-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 340px); gap: 14px; padding: 10px 0; border-top: 1px solid var(--border); align-items: start; }
.cfg-row:first-child { border-top: 0; }
.cfg-label b { display: block; }
.cfg-label .mono { display: block; font-size: 11px; word-break: break-all; }
.cfg-label p { margin: 4px 0; color: var(--text-2); font-size: 13px; white-space: pre-line; }
.cfg-label > span { font-size: 12px; }
.cfg-label .badge { margin-top: 4px; display: inline-block; }
.cfg-label, .cfg-input { min-width: 0; }
.cfg-input { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cfg-input .input, .cfg-input .select { width: 100%; }
.cfg-input .input.num { width: 140px; }
.spawn-rows { grid-column: 1 / -1; width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; }
.cfg-row:has(.spawn-rows) { grid-template-columns: 1fr; }
.spawn-rows table { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.spawn-rows th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 500; padding: 4px; }
.spawn-rows td { padding: 3px 4px; }
.spawn-rows td .input.num { width: 80px; }
.spawn-rows td .input { width: 100%; min-width: 160px; }
.bal-result { margin-top: 10px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cfg-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.cfg-files { position: sticky; top: 12px; max-height: calc(100vh - 120px); display: flex; flex-direction: column; gap: 10px; }
.cfg-filelist { overflow-y: auto; }
.cfg-filelist details { border-top: 1px solid var(--border); }
.cfg-filelist summary { cursor: pointer; padding: 6px 2px; font-weight: 600; }
.cfg-filelist a { display: block; padding: 4px 10px; font-size: 13px; color: var(--text-2); text-decoration: none; border-radius: 6px; word-break: break-all; }
.cfg-filelist a:hover { background: var(--surface-3); color: var(--text); }
.cfg-filelist a.active { background: var(--surface-3); color: var(--gold); }
.cfg-raw { width: 100%; min-height: 60vh; font-size: 12.5px; line-height: 1.45; resize: vertical; white-space: pre; }
.cfg-save { margin-top: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cfg-hist { display: flex; flex-direction: column; max-height: 320px; overflow-y: auto; }
.cfg-hist > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 5px 0; border-top: 1px solid var(--border); }
.ctl-servers { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.ctl-srv { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.ctl-row { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.ctl-row .input { flex: 1 1 200px; }
.ctl-out, .ctl-log { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px; font-size: 12px; white-space: pre-wrap; word-break: break-word; overflow-y: auto; margin: 10px 0 0; }
.ctl-out { max-height: 260px; min-height: 80px; }
.ctl-log { max-height: 480px; }
.ctl-log .l-bad { color: var(--bad); }
.ctl-log .l-warn { color: var(--warn); }
.ctl-world { padding: 8px 0; border-top: 1px solid var(--border); }
.ctl-world:first-child { border-top: 0; }
.ctl-world .chips { margin-top: 6px; }
.linkish { background: none; border: 0; color: inherit; cursor: pointer; padding: 0 0 0 4px; }
@media (max-width: 900px) {
  .cfg-layout { grid-template-columns: 1fr; }
  .cfg-files { position: static; max-height: 45vh; }
  .cfg-row { grid-template-columns: 1fr; }
}

/* --- Apparitions des dragons --------------------------------------------------------------------- */
.sp-top { align-items: center; margin-top: 10px; }
.sp-toggle { display: flex; align-items: center; gap: 8px; }
.sp-rows { display: flex; flex-direction: column; gap: 6px; }
.sp-dragon { border: 1px solid var(--border); border-radius: 10px; }
.sp-dragon.open { border-color: var(--gold); }
.sp-head { width: 100%; display: grid; grid-template-columns: minmax(140px, 1.2fr) minmax(120px, 1fr) minmax(80px, 2fr) 90px; gap: 12px; align-items: center;
  background: none; border: 0; color: inherit; padding: 10px 12px; cursor: pointer; text-align: left; font: inherit; }
.sp-head:hover { background: var(--surface-3); border-radius: 10px; }
.sp-bar { height: 8px; background: var(--surface); border-radius: 4px; overflow: hidden; }
.sp-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--ember)); }
.sp-body { padding: 0 12px 12px; overflow-x: auto; }
.sp-table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.sp-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 500; padding: 4px; }
.sp-table td { padding: 3px 4px; }
.sp-table td .input { width: 100%; min-width: 200px; }
.sp-table td .input.num { width: 90px; min-width: 0; }
@media (max-width: 700px) { .sp-head { grid-template-columns: 1fr auto; } .sp-head .sp-bar, .sp-head > .muted { grid-column: 1 / -1; } }

/* --- Comptes, e-mails, tests, connexion ---------------------------------------------------------- */
.u-form { display: flex; flex-direction: column; gap: 12px; }
.u-row { display: flex; gap: 12px; flex-wrap: wrap; }
.u-row .field { flex: 1 1 200px; min-width: 0; }
.u-row .field.grow { flex: 2 1 260px; }
.u-presets { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.perm-group { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px 10px; margin: 0; min-width: 0; }
.perm-group legend { padding: 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--gold); }
.perm { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; cursor: pointer; }
.perm input { margin-top: 3px; accent-color: var(--gold); flex: none; }
.perm span { display: flex; flex-direction: column; min-width: 0; }
.perm small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.perm.inline { display: inline-flex; align-items: center; padding: 0; }
.perm.inline input { margin-top: 0; }
.owner-box { border: 1px dashed var(--gold); border-radius: 10px; padding: 8px 12px; }
.notice { background: var(--surface-3); border-left: 3px solid var(--warn); padding: 8px 12px; border-radius: 6px; margin: 0; }
.ok-text { color: var(--good); margin: 0; }
.u-list { display: flex; flex-direction: column; }
.u-item { padding: 12px 0; border-top: 1px solid var(--border); }
.u-item:first-child { border-top: 0; }
.u-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.u-head .chips { margin-top: 0; }
.u-perms { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip-perm { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); }
.u-edit { margin-top: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; display: flex; flex-direction: column; gap: 12px; }
.u-msg:empty { display: none; }
.u-msg { margin-top: 8px; }
.btn.danger:hover { border-color: var(--bad); color: var(--bad); }
.mail-preview { width: 100%; height: 640px; border: 1px solid var(--border); border-radius: 10px; background: #0B141C; }
.m-subject { margin-bottom: 8px; font-size: 13px; }
.t-summary { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.t-score { display: flex; flex-direction: column; }
.t-score b { font-family: var(--font-title); font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }
.t-score.all b { color: var(--good); }
.t-score.some b { color: var(--warn); }
.t-score span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.t-fails { margin-top: 12px; padding: 10px 12px; border-left: 3px solid var(--bad); background: var(--surface-3); border-radius: 6px; display: flex; flex-direction: column; gap: 4px; }
.t-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.t-list li { display: flex; gap: 10px; padding: 7px 0; border-top: 1px solid var(--border); align-items: flex-start; }
.t-list li:first-child { border-top: 0; }
.t-list li span:last-child { display: flex; flex-direction: column; min-width: 0; }
.t-list small { color: var(--muted); font-size: 12px; word-break: break-word; }
.t-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; margin-top: 5px; }
.t-list li.ok .t-dot { background: var(--good); }
.t-list li.ko .t-dot { background: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 25%, transparent); }
.login-link { display: block; text-align: center; margin-top: 14px; color: var(--muted); font-size: 13px; }
.login-link:hover { color: var(--gold); }
.login-title { font-family: var(--font-title); font-size: 20px; margin: 0 0 6px; color: var(--text); }
.login-message p { margin: 0 0 10px; }
.login-card form { display: flex; flex-direction: column; gap: 4px; }
.login-card [hidden] { display: none !important; }
.seg.wrap { flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
.st-table td { vertical-align: middle; }
.st-table .input.num { width: 90px; }
.st-dirty { background: color-mix(in srgb, var(--gold) 8%, transparent); }
.chips.nowrap { flex-wrap: nowrap; }
.small { font-size: 12px; }
