/* Subzone — interface
   Principe : la frontière de propriété est le motif visuel. La partie d'un nom
   qui vous appartient est en encre pleine, le suffixe hérité est atténué. */

@font-face {
  font-family: "Instrument Sans";
  src: url("/assets/fonts/instrument-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

:root {
  --bg: #eceff3;
  --surface: #ffffff;
  --surface-2: #f5f7fa;
  --ink: #17202c;
  --muted: #5b6878;
  --faint: #8d97a5;
  --line: #dce1e8;
  --line-strong: #c5ccd6;
  --accent: #2741d6;
  --accent-hover: #1e33b3;
  --accent-ink: #ffffff;
  --accent-soft: #e8ebfd;
  --danger: #c9343a;
  --danger-soft: #fcebec;
  --ok: #11805a;
  --ok-soft: #e2f3eb;
  --warn: #8f6200;
  --warn-soft: #fbf1d6;
  --brand-panel: #17202c;
  --brand-panel-ink: #e9edf3;
  --shadow-pop: 0 18px 50px -12px rgba(23, 32, 44, 0.28), 0 2px 6px rgba(23, 32, 44, 0.08);
  --focus: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);

  --sans: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c131e;
    --surface: #131b28;
    --surface-2: #19222f;
    --ink: #e4e9f0;
    --muted: #9aa5b5;
    --faint: #6a7689;
    --line: #243042;
    --line-strong: #33415a;
    --accent: #8596ff;
    --accent-hover: #a2afff;
    --accent-ink: #0c131e;
    --accent-soft: #1d2650;
    --danger: #ff7b80;
    --danger-soft: #3a1a1f;
    --ok: #4fd3a0;
    --ok-soft: #12322a;
    --warn: #f2c25c;
    --warn-soft: #34290f;
    --brand-panel: #0a1019;
    --shadow-pop: 0 20px 60px -10px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c131e;
  --surface: #131b28;
  --surface-2: #19222f;
  --ink: #e4e9f0;
  --muted: #9aa5b5;
  --faint: #6a7689;
  --line: #243042;
  --line-strong: #33415a;
  --accent: #8596ff;
  --accent-hover: #a2afff;
  --accent-ink: #0c131e;
  --accent-soft: #1d2650;
  --danger: #ff7b80;
  --danger-soft: #3a1a1f;
  --ok: #4fd3a0;
  --ok-soft: #12322a;
  --warn: #f2c25c;
  --warn-soft: #34290f;
  --brand-panel: #0a1019;
  --shadow-pop: 0 20px 60px -10px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.5 var(--sans);
  font-feature-settings: "ss01";
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
:focus-visible { outline: none; box-shadow: var(--focus); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------------ */
/* Noms de domaine : propriété vs héritage                            */
/* ------------------------------------------------------------------ */

.fqdn { font-family: var(--mono); letter-spacing: -0.01em; overflow-wrap: anywhere; }
.fqdn .own { color: var(--ink); font-weight: 650; }
.fqdn .rest { color: var(--faint); font-weight: 400; }

.title-fqdn { font-size: clamp(22px, 3.4vw, 34px); line-height: 1.15; }
.title-fqdn .own { font-weight: 700; }

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

.gate {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 5fr) 7fr;
}
.gate-brand {
  background: var(--brand-panel);
  color: var(--brand-panel-ink);
  padding: 48px clamp(28px, 5vw, 64px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 48px;
}
.gate-brand .wordmark { color: #fff; }
.tree {
  font-family: var(--mono);
  font-size: 15px;
  line-height: 2;
  color: #8592a6;
  white-space: pre;
  margin: 0;
}
.tree .you { color: #fff; font-weight: 650; }
.tree .tag {
  font-family: var(--sans);
  font-size: 12px;
  color: #17202c;
  background: #b9c3ff;
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 10px;
  vertical-align: 1px;
}
.gate-brand .claim { max-width: 34ch; color: #b8c1cf; font-size: 15px; }
.gate-form {
  display: flex;
  align-items: center;
  padding: 48px clamp(24px, 6vw, 96px);
}
.gate-form form { width: 100%; max-width: 380px; display: grid; gap: 18px; }
.gate-form h1 { font-size: 28px; font-weight: 650; letter-spacing: -0.02em; }
.gate-form .lede { color: var(--muted); margin-top: -8px; }
.gate-alt { color: var(--muted); font-size: 14px; text-align: center; margin-top: -4px; }
button.link {
  border: 0; background: none; padding: 0; font: inherit; color: var(--accent);
  text-decoration: underline; text-underline-offset: 2px; cursor: pointer; border-radius: 2px;
}
button.link:hover { color: var(--accent-hover); }

@media (max-width: 820px) {
  .gate { grid-template-columns: 1fr; }
  .gate-brand { padding: 28px 24px; gap: 24px; }
  .tree { font-size: 13px; }
  .gate-form { padding: 32px 24px 48px; align-items: flex-start; }
}

/* ------------------------------------------------------------------ */
/* Structure de l'application                                         */
/* ------------------------------------------------------------------ */

.shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.content { min-width: 0; }

.side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 14px 14px;
  overflow-y: auto;
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  padding: 2px 8px 18px;
}
.wordmark svg { flex: none; }

.nav-group { display: grid; gap: 2px; margin-bottom: 22px; }
.nav-heading { font-size: 13px; color: var(--muted); padding: 0 10px 6px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}
.nav-link:hover { background: var(--surface-2); }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--ink); }
.nav-link[aria-current="page"] .icon { color: var(--accent); }
.nav-link .icon { color: var(--muted); flex: none; }
.nav-button { appearance: none; border: 0; background: none; cursor: pointer; width: 100%; text-align: left; font: inherit; }
.nav-link .fqdn { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-empty { font-size: 13px; color: var(--faint); padding: 2px 10px; }

.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 2px; }
.whoami { display: flex; align-items: center; gap: 10px; padding: 6px 10px 10px; }
.avatar {
  width: 30px; height: 30px; flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink); color: var(--surface);
  font-weight: 650; font-size: 13px;
}
.whoami .name { font-weight: 600; line-height: 1.2; }
.whoami .role { font-size: 12.5px; color: var(--muted); }

.main { min-width: 0; padding: 32px clamp(18px, 4vw, 48px) 64px; }
.page { max-width: 1120px; }

.topbar { display: none; }
.scrim { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side {
    position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 30;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .shell.nav-open .side { transform: none; box-shadow: var(--shadow-pop); }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(10, 15, 25, 0.4); z-index: 20; }
  .topbar {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 12px; background: var(--surface); border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 10;
  }
  .topbar .wordmark { padding: 0; font-size: 16px; }
  .main { padding-top: 20px; }
}

/* ------------------------------------------------------------------ */
/* En-tête de page                                                    */
/* ------------------------------------------------------------------ */

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 24px; }
.page-head h1:not(.fqdn) { font-size: 28px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; }
.page-head .sub { color: var(--muted); margin-top: 6px; max-width: 64ch; }
.head-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin-top: 12px; color: var(--muted); font-size: 14px; }
.head-meta strong { color: var(--ink); font-weight: 600; }

.quota { display: inline-flex; align-items: center; gap: 10px; }
.quota-bar { width: 96px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.quota-bar span { display: block; height: 100%; background: var(--ink); border-radius: 3px; }
.quota.high .quota-bar span { background: var(--warn); }
.quota.full .quota-bar span { background: var(--danger); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tab {
  appearance: none; background: none; border: 0; cursor: pointer;
  padding: 10px 12px; margin-bottom: -1px;
  color: var(--muted); font-weight: 500; white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.tab .count { color: var(--faint); font-weight: 400; margin-left: 4px; }

/* ------------------------------------------------------------------ */
/* Panneaux, tableaux                                                 */
/* ------------------------------------------------------------------ */

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.panel + .panel { margin-top: 20px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 17px; font-weight: 650; }
.panel-head p { color: var(--muted); font-size: 14px; margin-top: 2px; }
.panel-body { padding: 20px; }
.panel-body > * + * { margin-top: 14px; }

/* L'attribut hidden l'emporte toujours sur un display déclaré par une classe. */
[hidden] { display: none !important; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.toolbar .grow { flex: 1 1 200px; }

.search { position: relative; }
.search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search input[type="search"] { padding-left: 36px; }

.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-filter {
  appearance: none; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 3px 10px; font-size: 13px; color: var(--muted);
}
.chip-filter:hover { border-color: var(--line-strong); color: var(--ink); }
.chip-filter[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-weight: 500; font-size: 13px; color: var(--muted);
  padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { text-align: right; white-space: nowrap; width: 1%; }
th.c-check, td.c-check { width: 1%; padding-right: 0; }
td.c-check input, th.c-check input { width: 16px; height: 16px; accent-color: var(--accent); }
tr.selected td { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.bulk-bar { background: var(--accent-soft); }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check-line input { width: 16px; height: 16px; accent-color: var(--accent); }
.mail-list li.unread .title { font-weight: 750; }
.mail-list > li.unread { box-shadow: inset 3px 0 0 var(--accent); }
td .fqdn { font-size: 13.5px; }
.value { font-family: var(--mono); font-size: 13.5px; overflow-wrap: anywhere; max-width: 52ch; }
.value.long { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.comment { display: block; margin-top: 3px; font-family: var(--sans); font-size: 13px; color: var(--muted); }
.cont td { padding-top: 4px; }
.cont td.c-name .fqdn { visibility: hidden; }
tr.cont-prev td { border-bottom-color: transparent; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }

/* Types d'enregistrements : couleur = information */
.rtype {
  display: inline-block; min-width: 52px; text-align: center;
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  padding: 2px 7px; border-radius: 5px;
  color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent);
}
.t-A { --c: #2741d6; }
.t-AAAA { --c: #7a3fd1; }
.t-CNAME { --c: #0b7f86; }
.t-MX { --c: #a65b00; }
.t-TXT { --c: #4d5b6d; }
.t-SRV { --c: #bb2f6a; }
.t-CAA { --c: #1d7f3e; }
.t-NS { --c: #17202c; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .t-A { --c: #8fa0ff; }
  :root:not([data-theme="light"]) .t-AAAA { --c: #c3a1ff; }
  :root:not([data-theme="light"]) .t-CNAME { --c: #5fd4d9; }
  :root:not([data-theme="light"]) .t-MX { --c: #ffb35c; }
  :root:not([data-theme="light"]) .t-TXT { --c: #aab6c6; }
  :root:not([data-theme="light"]) .t-SRV { --c: #ff8ab8; }
  :root:not([data-theme="light"]) .t-CAA { --c: #6fdc90; }
  :root:not([data-theme="light"]) .t-NS { --c: #e4e9f0; }
}
:root[data-theme="dark"] .t-A { --c: #8fa0ff; }
:root[data-theme="dark"] .t-AAAA { --c: #c3a1ff; }
:root[data-theme="dark"] .t-CNAME { --c: #5fd4d9; }
:root[data-theme="dark"] .t-MX { --c: #ffb35c; }
:root[data-theme="dark"] .t-TXT { --c: #aab6c6; }
:root[data-theme="dark"] .t-SRV { --c: #ff8ab8; }
:root[data-theme="dark"] .t-CAA { --c: #6fdc90; }
:root[data-theme="dark"] .t-NS { --c: #e4e9f0; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; font-weight: 500; line-height: 1.6;
  padding: 0 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
  white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }

/* ------------------------------------------------------------------ */
/* Formulaires et boutons                                             */
/* ------------------------------------------------------------------ */

.field { display: grid; gap: 6px; align-content: start; }
.field > label, .field > .label { font-size: 14px; font-weight: 550; }
.field .hint { font-size: 13px; color: var(--muted); }
.row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.row > .span-2 { grid-column: span 2; }
@media (max-width: 480px) { .row > .span-2 { grid-column: auto; } }

input[type="text"], input[type="password"], input[type="number"], input[type="search"], input[type="email"], select, textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 8px 11px;
  min-height: 38px;
  transition: border-color 0.12s;
}
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
input.mono, textarea.mono { font-family: var(--mono); font-size: 14px; }
textarea { resize: vertical; min-height: 92px; line-height: 1.45; }
input[aria-invalid="true"] { border-color: var(--danger); }

.name-input { display: flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); overflow: hidden; }
.name-input:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.name-input input { border: 0; border-radius: 0; box-shadow: none !important; flex: 1 1 8ch; min-width: 6ch; font-family: var(--mono); font-size: 14px; font-weight: 600; }
.name-input .suffix {
  display: flex; align-items: center; padding: 0 11px;
  font-family: var(--mono); font-size: 13.5px; color: var(--faint);
  background: var(--surface-2); border-left: 1px solid var(--line);
  max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  appearance: none; cursor: pointer; text-decoration: none;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  border-radius: var(--r-sm); padding: 7px 14px; min-height: 36px;
  font-weight: 550; white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.wide { width: 100%; min-height: 42px; }
.btn.icon-only { padding: 0; width: 34px; min-height: 34px; color: var(--muted); }
.btn.icon-only:hover { color: var(--ink); }
.btn.icon-only.danger:hover { color: var(--danger); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-row.end { justify-content: flex-end; }
.icon { width: 18px; height: 18px; flex: none; }
.btn .icon { width: 16px; height: 16px; }

.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.segmented button {
  appearance: none; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface);
  border-radius: var(--r-sm); padding: 5px 10px;
  font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--muted);
}
.segmented button:hover { color: var(--ink); border-color: var(--faint); }
.segmented button[aria-pressed="true"] { color: var(--c, var(--accent)); border-color: var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) 10%, var(--surface)); }

.error-box { background: var(--danger-soft); color: var(--danger); border-radius: var(--r-sm); padding: 10px 12px; font-size: 14px; }
.error-box:empty { display: none; }
.note { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; font-size: 14px; color: var(--muted); }
.note strong { color: var(--ink); }
.note.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.note.warn strong { color: inherit; }

.zoneline {
  font-family: var(--mono); font-size: 13px; color: var(--muted);
  background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--r-sm);
  padding: 9px 12px; overflow-x: auto; white-space: pre;
}
.zoneline .own { color: var(--ink); font-weight: 600; }

.secret {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 14px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  padding: 8px 8px 8px 12px; overflow-wrap: anywhere;
}
.secret span { flex: 1; min-width: 0; }

.meter { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; transition: width 0.2s, background 0.2s; }

/* ------------------------------------------------------------------ */
/* Répartition des réponses                                           */
/* ------------------------------------------------------------------ */

.seg-0 { --seg: var(--accent); }
.seg-1 { --seg: #0b9aa5; }
.seg-2 { --seg: #c2750b; }
.seg-3 { --seg: #b83b78; }
.seg-4 { --seg: #2f8f4e; }
.seg-5 { --seg: #6c4fd1; }

.share { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 13px; color: var(--muted); font-family: var(--sans); }
.share-bar { width: 56px; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; flex: none; }
.share-bar span { display: block; height: 100%; background: var(--accent); }
.share.paused { color: var(--warn); }

.btn.icon-only.on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line-strong)); background: var(--accent-soft); }

.choices { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.choice {
  display: flex; gap: 10px; align-items: flex-start; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: var(--r-md); padding: 12px 14px;
}
.choice:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.choice:has(input:focus-visible) { box-shadow: var(--focus); }
.choice.disabled { cursor: not-allowed; opacity: 0.6; }
.choice input { margin: 3px 0 0; accent-color: var(--accent); }
.choice-title { display: block; font-weight: 600; }
.choice-text { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }

.label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.small-btn { min-height: 28px; padding: 2px 8px; font-size: 13px; }

.split-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--line); }
.split-bar span { display: block; height: 100%; background: var(--seg); transition: width 0.15s; }
.split-bar span + span { box-shadow: -2px 0 0 var(--surface); }

.weights { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.weight-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.weight-row:last-child { border-bottom: 0; }
.weight-row .grow { flex: 1; min-width: 0; display: grid; gap: 1px; }
.weight-row input { width: 84px; flex: none; }
.swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--seg); flex: none; }
.weight-row .grow input { width: 100%; }
.share-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; min-height: 18px; margin-top: 3px; }
.no-weights .w { display: none !important; }
.split-bar.mini { height: 6px; margin: 8px 0 6px; max-width: 360px; }
.rot-values { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.rot-values li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.checks { display: grid; gap: 10px; }
.check { border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; }
.check-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px; }
.verdicts { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; font-size: 13.5px; }
.verdict { padding-left: 18px; position: relative; }
.verdict::before { content: ""; position: absolute; left: 2px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.verdict.ok::before { background: var(--ok); }
.verdict.warn::before { background: var(--warn); }
.verdict.error::before { background: var(--danger); }

/* ------------------------------------------------------------------ */
/* Journal des requêtes                                               */
/* ------------------------------------------------------------------ */

.btn.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.btn.live.on { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--line-strong)); }
.btn.live.on .dot { background: var(--ok); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.tag-tcp { margin-left: 6px; font-size: 11px; font-weight: 600; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 4px; }
table.querylog td { padding-top: 8px; padding-bottom: 8px; vertical-align: middle; }
table.querylog .fqdn { white-space: nowrap; overflow-wrap: normal; }
table.querylog .answer { background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 0 6px; }
tr.fresh td { animation: fresh 2.4s ease-out; }
@keyframes fresh { from { background: var(--accent-soft); } }
.panel-note { margin: 0; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }

/* ------------------------------------------------------------------ */
/* Puits de mail                                                      */
/* ------------------------------------------------------------------ */

.list.mail-list > li { padding: 0; flex-wrap: nowrap; gap: 0; }
.list.mail-list > li.empty { padding: 32px 20px; }
.mail-list > li.selected { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.mail-list > li > .mail-row { flex: 1 1 auto; min-width: 0; padding-left: 8px; }
.mail-check { display: grid; place-items: center; align-self: stretch; padding: 0 4px 0 20px; cursor: pointer; }
.mail-check.all { padding: 0 4px 0 0; }
.mail-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.mail-del { margin-right: 14px; opacity: .55; }
.mail-list > li:hover .mail-del, .mail-del:focus-visible { opacity: 1; }

/* Étiquettes : teinte fixe mêlée aux couleurs du thème, lisible en clair comme en sombre. */
.tag {
  display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; line-height: 1.7;
  padding: 0 8px; border-radius: 6px; white-space: nowrap;
  background: color-mix(in srgb, var(--t) 16%, var(--surface));
  color: color-mix(in srgb, var(--t) 72%, var(--ink));
  border: 1px solid color-mix(in srgb, var(--t) 30%, var(--surface));
}
.tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
dd.tags { margin-top: 0; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--t); margin-right: 6px; }
.c-blue { --t: #3a6ff2; }
.c-green { --t: #1f9d6a; }
.c-amber { --t: #d08a00; }
.c-red { --t: #d8434a; }
.c-violet { --t: #8a52e0; }
.c-slate { --t: #6b7a90; }
.tag-rules > li { padding-top: 10px; padding-bottom: 10px; }
.mail-row {
  appearance: none; border: 0; background: none; width: 100%; text-align: left; cursor: pointer; font: inherit; color: inherit;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 14px 20px;
}
.mail-row:hover { background: var(--surface-2); }
.mail-row .grow { flex: 1 1 320px; min-width: 0; display: grid; gap: 2px; }
.mail-row .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-row .meta { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-side { display: grid; justify-items: end; gap: 4px; }
.mail-list li.fresh .mail-row { animation: fresh 2.4s ease-out; }
.mail-source {
  margin: 0; max-height: 55vh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.5;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px;
}
.mail-headers summary { cursor: pointer; font-weight: 550; font-size: 14px; }
.mail-headers > .btn-row { margin: 10px 0; }
.mail-text {
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 45vh; overflow: auto;
  font-size: 14.5px; line-height: 1.6; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface);
}
.attachments { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.attachments li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.attachments .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.attachments .title { font-weight: 550; }
.mail-headers .kv { margin-top: 10px; max-height: 220px; overflow: auto; }
.mail-headers dd { overflow-wrap: anywhere; }
.steps { margin: 0; padding: 16px 20px 18px 40px; display: grid; gap: 10px; font-size: 14px; }
.steps code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; }
.badge .icon { width: 12px; height: 12px; }

/* ------------------------------------------------------------------ */
/* Listes                                                             */
/* ------------------------------------------------------------------ */

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1 1 260px; min-width: 0; }
.list .title { font-weight: 600; }
.list .meta { font-size: 13px; color: var(--muted); margin-top: 2px; }

.ns-list { display: grid; gap: 6px; }
.ns-list .secret { font-weight: 500; }

.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--ink); font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.empty p { max-width: 46ch; margin: 0 auto 18px; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.loading { padding: 40px; color: var(--muted); }

/* ------------------------------------------------------------------ */
/* Dialogues                                                          */
/* ------------------------------------------------------------------ */

dialog {
  border: 0; padding: 0; border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink);
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  box-shadow: var(--shadow-pop);
}
dialog.wide { width: min(880px, calc(100vw - 32px)); }
dialog.wide.xl { width: min(1100px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(12, 18, 28, 0.45); }
dialog[open] { animation: pop 0.16s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.99); } }
.dlg { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.dlg-head { padding: 20px 22px 0; }
.dlg-head h2 { font-size: 19px; font-weight: 650; letter-spacing: -0.01em; }
.dlg-head p { color: var(--muted); margin-top: 4px; font-size: 14px; }
.dlg-body { padding: 18px 22px; overflow-y: auto; display: grid; gap: 16px; }
.dlg-foot { padding: 14px 22px 18px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

/* ------------------------------------------------------------------ */
/* Notifications                                                      */
/* ------------------------------------------------------------------ */

.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 100; max-width: calc(100vw - 40px); }
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: var(--surface);
  padding: 10px 14px; border-radius: var(--r-md);
  box-shadow: var(--shadow-pop); font-size: 14px;
  animation: toast-in 0.18s ease-out;
}
.toast.error { background: var(--danger); color: #fff; }
.toast .icon { width: 16px; height: 16px; }
.toast-action {
  appearance: none; cursor: pointer; margin-left: 6px; font: inherit; font-weight: 600;
  background: transparent; color: inherit; border: 1px solid currentColor; border-radius: var(--r-sm); padding: 2px 10px;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--r-md); background: var(--warn-soft); color: var(--warn); margin-bottom: 20px; font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 640px) {
  th, td { padding-left: 12px; padding-right: 12px; }

  /* Enregistrements : une fiche par ligne */
  table.records thead { display: none; }
  table.records, table.records tbody { display: block; }
  table.records tr {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "name name actions" "type ttl actions" "value value value";
    gap: 6px 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
  }
  table.records tr.cont { grid-template-areas: "type ttl actions" "value value value"; padding-top: 0; }
  table.records tr.cont-prev { border-bottom-color: transparent; }
  table.records td { display: block; padding: 0; border: 0; background: none !important; }
  table.records td[colspan] { grid-column: 1 / -1; }
  table.records .c-name { grid-area: name; }
  table.records .c-check { display: none; }
  table.records tr.cont .c-name { display: none; }
  table.records .c-type { grid-area: type; }
  table.records .c-ttl { grid-area: ttl; text-align: left; align-self: center; color: var(--muted); font-size: 13px; }
  table.records .c-value { grid-area: value; }
  table.records .c-actions { grid-area: actions; align-self: start; }
  table.records .value { max-width: none; }
  .hide-sm { display: none; }
  .panel-head, .panel-body { padding-left: 16px; padding-right: 16px; }
  .list > li { padding-left: 16px; padding-right: 16px; }
  .list.mail-list > li { padding: 0; }
  .mail-check { padding-left: 12px; }
  .mail-del { opacity: 1; margin-right: 8px; }
}
