/* ==================================================================
   D3X reprend l'identité de V3X : mêmes polices, mêmes fonds (sombre,
   jour, bleu nuit), mêmes accents au choix du membre, même barre latérale.
   Variables du site (globals.css) recopiées ici ; html[data-theme] et
   html[data-accent] sont posés par theme.js puis par l'état de D3X.
   ================================================================== */

@font-face { font-family: "Bricolage Grotesque"; src: url("vendor/fonts/bricolage-grotesque-latin.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Hanken Grotesk"; src: url("vendor/fonts/hanken-grotesk-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Spline Sans Mono"; src: url("vendor/fonts/spline-sans-mono-latin.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }

:root {
  /* Fond sombre du site (défaut) */
  --ground: #0b0c0e;
  --surface: #121316;
  --sunk: #191b1f;
  --raised: #23262b;
  --line: #2a2d33;
  --line-bright: #40454e;
  --ink: #eceef1;
  --muted: #aab1bb;
  --faint: #838a94;
  /* Accent par défaut (bleu), surchargé par html[data-accent] */
  --accent: #4d8dff;
  --accent-dim: #2563eb;
  --accent-deep: #101b30;
  --accent-ink: #0b0c0e; /* texte posé sur l'accent, sombre dans les 3 fonds */
  --accent-soft: var(--accent-deep);
  --ok: #4bd6a0;
  --warn: #ffbe3d;
  --bad: #ff4d54;
  --ok-soft: color-mix(in srgb, var(--ok) 14%, var(--surface));
  --warn-soft: color-mix(in srgb, var(--warn) 14%, var(--surface));
  --bad-soft: color-mix(in srgb, var(--bad) 14%, var(--surface));
  --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 10px 30px rgb(0 0 0 / 35%);
  --display: "Bricolage Grotesque", "Hanken Grotesk", system-ui, sans-serif;
  --sans: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Spline Sans Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  --rail-w: 84px;
  color-scheme: dark;
}

/* Accents au choix du membre (mêmes noms et couleurs que le site). */
html[data-accent="bleu"] { --accent: #4d8dff; --accent-dim: #2563eb; --accent-deep: #101b30; }
html[data-accent="rose"] { --accent: #ff5d8f; --accent-dim: #db2777; --accent-deep: #2e1019; }
html[data-accent="vert"] { --accent: #3ddc84; --accent-dim: #16a34a; --accent-deep: #0c2417; }
html[data-accent="violet"] { --accent: #a78bfa; --accent-dim: #7c3aed; --accent-deep: #1c1430; }
html[data-accent="cyan"] { --accent: #26d0e8; --accent-dim: #0891b2; --accent-deep: #0a2127; }
html[data-accent="ambre"] { --accent: #ffb02e; --accent-dim: #d97706; --accent-deep: #2a1d07; }
html[data-accent="braise"] { --accent: #ff5a1f; --accent-dim: #c2410c; --accent-deep: #290f05; }
html[data-accent="lime"] { --accent: #b8e62e; --accent-dim: #84cc16; --accent-deep: #1e2506; }

/* Jour : placé après les accents pour que le fond « deep » devienne un
   voile clair de l'accent courant (comme sur le site). */
html[data-theme="light"] {
  color-scheme: light;
  --ground: #f4f2ee;
  --surface: #ffffff;
  --sunk: #eeebe4;
  --raised: #e2ded5;
  --line: #d9d4ca;
  --line-bright: #bdb6a8;
  --ink: #1a1c1f;
  --muted: #565b62;
  --faint: #8b8f97;
  --accent-deep: color-mix(in srgb, var(--accent) 14%, #ffffff);
  --ok: #138a5a;
  --warn: #a96410;
  --bad: #c43a3a;
  --shadow: 0 1px 2px rgb(26 28 31 / 6%), 0 8px 26px rgb(26 28 31 / 8%);
}
/* Bleu nuit */
html[data-theme="blue"] {
  --ground: #0a1526;
  --surface: #0f1d33;
  --sunk: #16273f;
  --raised: #21344f;
  --line: #26384f;
  --line-bright: #3b5474;
  --ink: #e9eef6;
  --muted: #a6b6cd;
  --faint: #839ab8;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--ground);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  font-feature-settings: "tnum", "ss01";
  -webkit-font-smoothing: antialiased;
  padding-left: var(--rail-w);
  padding-bottom: 104px;
}
/* Grain de papier du site (overlay simple, sans mélange de calques). */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
::selection { background: var(--accent); color: #100c09; }
a { color: var(--accent); text-underline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; border: 3px solid var(--ground); }
::-webkit-scrollbar-thumb:hover { background: var(--line-bright); }

/* ---------- logo (comme le site : V3 + X en accent, halo) ---------- */
.wordmark { font-family: var(--display); font-weight: 800; letter-spacing: -.03em; line-height: .92; font-size: 22px; color: var(--ink); }
.wordmark .x { color: var(--accent); text-shadow: 0 0 22px color-mix(in srgb, var(--accent) 42%, transparent); }

/* ---------- barre latérale (comme celle du site) ---------- */
.rail {
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 40; width: var(--rail-w);
  display: flex; flex-direction: column; align-items: center;
  background: var(--surface); border-right: 1px solid var(--line); padding-bottom: 14px;
}
.rail-logo {
  height: 56px; width: 100%; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border-bottom: 1px solid var(--line); user-select: none;
}
.rail-sub { font: 600 9px/1 var(--mono); letter-spacing: .32em; color: var(--faint); padding-left: .32em; }
.rail-nav { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 14px; }
.rail-foot { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 10px; }
.rail-item {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: 0; background: none; padding: 0; cursor: pointer; color: var(--muted); font: inherit; width: 72px;
}
.rail-ico {
  display: flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: 10px; border: 1px solid transparent; transition: background .15s, border-color .15s, color .15s;
}
.rail-ico svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rail-label { font: 600 9.5px/1.15 var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--faint); max-width: 76px; text-align: center; }
.rail-item:hover .rail-ico { border-color: var(--line); background: var(--sunk); color: var(--ink); }
.rail-item:hover .rail-label { color: var(--muted); }
.rail-item[aria-current="page"] .rail-ico { border-color: var(--accent-dim); background: var(--accent-deep); color: var(--accent); }
.rail-item[aria-current="page"] .rail-ico svg { stroke-width: 2.4; }
.rail-item[aria-current="page"] .rail-label { color: var(--accent); }
.rail-item[aria-current="page"]::before {
  content: ""; position: absolute; left: -6px; top: 10px; width: 4px; height: 20px; border-radius: 0 4px 4px 0; background: var(--accent);
}
.ver { font: 500 10px var(--mono); color: var(--faint); }
.ver-check {
  margin-top: -6px; padding: 2px 6px; border: 0; border-radius: 6px; background: none; cursor: pointer;
  font: 500 10px var(--mono); color: var(--faint); text-decoration: underline dotted; text-underline-offset: 2px;
}
.ver-check:hover, .ver-check:focus-visible { color: var(--ink); }
.ver-check:disabled { cursor: default; opacity: .6; }

/* ---------- barre du haut : état des connexions ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: 56px; display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 0 20px; background: color-mix(in srgb, var(--surface) 92%, transparent); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.chip {
  display: inline-flex; align-items: center; gap: 8px; max-width: 280px;
  border: 1px solid var(--line); background: var(--sunk); color: var(--ink);
  font: 500 13px var(--sans); padding: 6px 12px; border-radius: 999px; cursor: pointer;
}
.chip:hover { border-color: var(--line-bright); }
.chip .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.chip.ok .dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.chip.bad .dot { background: var(--bad); }
.chips { display: contents; }

/* ---------- contenu ---------- */
main { max-width: 1200px; margin: 0 auto; padding: 28px 24px 0; position: relative; z-index: 2; }
h1 { font: 800 30px/1 var(--display); letter-spacing: -.03em; margin: 0 0 10px; text-wrap: balance; }
h2 { font: 700 18px/1.2 var(--display); letter-spacing: -.01em; margin: 0 0 14px; }
.lede { margin: 0; color: var(--muted); max-width: 68ch; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.head-actions { display: flex; gap: 8px; flex: none; }

.btn {
  font: 600 14px var(--sans); border-radius: 10px; padding: 9px 16px; cursor: pointer;
  border: 1px solid var(--line); background: var(--sunk); color: var(--ink);
  transition: border-color .15s, color .15s, filter .15s;
}
.btn:hover { border-color: var(--accent-dim); color: var(--accent); }
.btn.primary:hover { color: var(--accent-ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.small { font-size: 12px; padding: 4px 10px; border-radius: 7px; }
.btn:disabled { opacity: .55; cursor: default; filter: none; }

.notice {
  max-width: 1180px; margin: 14px auto 0; padding: 10px 14px; border-radius: 10px;
  background: var(--accent-soft); color: var(--ink); font-size: 14px;
}
main .notice { margin: 0 0 16px; }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }

.onboard {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px 24px; margin-bottom: 24px; box-shadow: var(--shadow);
}
.onboard ol { padding-left: 20px; margin: 12px 0 18px; display: grid; gap: 8px; max-width: 75ch; }
.onboard p { margin: 0; color: var(--muted); max-width: 70ch; }

/* ---------- progression ---------- */
.progress { margin-bottom: 18px; }
.progress-txt { display: flex; gap: 10px; font-size: 13px; margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.track { height: 6px; border-radius: 6px; background: var(--sunk); overflow: hidden; }
.fill { height: 100%; width: 0; background: var(--accent); border-radius: 6px; transition: width .3s ease; }

/* ---------- onglets ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  font: 500 13px var(--sans); padding: 6px 12px; border-radius: 999px; cursor: pointer;
}
.tab .n { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.tab[aria-selected="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.tab[aria-selected="true"] .n { color: var(--accent); }

/* ---------- tableau ---------- */
.table-wrap {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  overflow-x: auto;
}
table.rows { width: 100%; border-collapse: collapse; font-size: 14px; }
.rows th {
  text-align: left; font: 600 11px var(--sans); text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
  background: var(--sunk);
}
.rows td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.rows tr:last-child td { border-bottom: 0; }
.rows tr.selectable { cursor: pointer; }
.rows tr.selectable:hover td { background: var(--sunk); }
.rows .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
/* En-tête qui trie la liste (Lot) : un bouton qui garde l'allure de l'en-tête. */
.th-sort {
  background: none; border: 0; padding: 0; margin: 0; cursor: pointer;
  font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit;
}
.th-sort:hover, [aria-sort="ascending"] > .th-sort, [aria-sort="descending"] > .th-sort { color: var(--accent); }
.th-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.th-sort .arrow { font-size: 9px; }
.c-check { width: 34px; }
.name { font-weight: 550; word-break: break-word; }
.name a { color: inherit; text-decoration: none; }
.name a:hover { color: var(--accent); text-decoration: underline; }
.sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; word-break: break-word; }
.watch-on { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.watch-on select { width: auto; }
.watch-line { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.watch-line .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.watch-line.bad .dot { background: var(--bad); }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.linkish:hover { text-decoration: underline; }
.linkish:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.lib-folders { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.lib-folders li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.lib-src { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; flex: none; }
.lib-path { flex: 1; min-width: 0; word-break: break-all; font-family: var(--mono); font-size: 12.5px; }
#lib-how { margin-top: 12px; }
.maps { display: grid; gap: 6px; margin: 8px 0; }
.maps:empty { display: none; }
.map-row { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 6px; align-items: center; }
.map-row .arrow { color: var(--muted); }
.map-row input { min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.pub-reqs h3 { font-size: 14px; margin: 16px 0 8px; }
@media (max-width: 560px) { .map-row { grid-template-columns: 1fr auto; } .map-row .arrow { display: none; } }
.reqs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.req { font-size: 11.5px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 2px 9px; text-decoration: none; white-space: nowrap; }
.req:hover { text-decoration: underline; }
.req.relay { color: var(--ok); background: var(--ok-soft); }
.req.dead { color: var(--warn); background: var(--warn-soft); }
span.req:hover { text-decoration: none; }
span.req { cursor: help; }
.req.mine { color: var(--muted); background: transparent; border: 1px solid var(--line); }
.copies { font: 600 11px var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; margin-left: 6px; }
/* Le client d'une ligne, quand il y en a plusieurs. */
.ctag { font: 600 11px var(--sans); color: var(--muted); background: var(--sunk); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; margin-left: 6px; white-space: nowrap; vertical-align: 1px; cursor: default; }
.seeds b { font-weight: 650; }
.seeds .rare { color: var(--warn); }
.empty { padding: 28px; text-align: center; color: var(--muted); margin: 0; }
.more { color: var(--muted); font-size: 13px; text-align: center; }

.pill {
  display: inline-block; white-space: nowrap; font: 600 12px var(--sans);
  padding: 2px 9px; border-radius: 999px; background: var(--sunk); color: var(--muted);
}
.pill.add { background: var(--accent-soft); color: var(--accent); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.state { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.mini { width: 90px; height: 4px; border-radius: 4px; background: var(--sunk); overflow: hidden; }
.mini > i { display: block; height: 100%; background: var(--accent); }

/* ---------- barre d'action ---------- */
.actionbar {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 20;
  width: min(880px, calc(100vw - 32px));
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px 12px 18px; box-shadow: var(--shadow);
}
.actionbar .sel { white-space: nowrap; font-variant-numeric: tabular-nums; }
.actionbar .how { margin: 0; color: var(--muted); font-size: 12.5px; flex: 1; }
.actionbar .btn { flex: none; }

/* ---------- historique ---------- */
.history { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.history li { display: grid; grid-template-columns: 130px 140px 1fr; align-items: start; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.history li > .pill { justify-self: start; }
.history li:last-child { border-bottom: 0; }
.history time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; line-height: 22px; }
.history .what { word-break: break-word; line-height: 22px; }
.history .what .sub { line-height: 1.4; }
.history .empty { display: block; }

/* ---------- réglages ---------- */
dialog {
  border: 1px solid var(--line); border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}
dialog::backdrop { background: rgb(8 10 16 / 55%); }
dialog form { padding: 22px 24px; max-height: calc(100vh - 48px); overflow-y: auto; }
fieldset { border: 0; padding: 0; margin: 0 0 18px; }
legend { font: 600 11px var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 8px; padding: 0; }
label { display: block; font-size: 13px; font-weight: 550; margin: 8px 0 4px; }
input[type="text"], input[type="password"], #ssh-set input[type="number"], #f-hashlimit {
  width: 100%; font: 15px var(--sans); color: var(--ink); background: var(--ground);
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px;
}
input[type="text"]:focus, input[type="password"]:focus, #ssh-set input[type="number"]:focus, #f-hashlimit:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); vertical-align: -3px; }
label.check { font-weight: 400; display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
.status { font-size: 13px; margin: 8px 0 0; }
.status.ok { color: var(--ok); }
.status.bad { color: var(--bad); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.detect { display: flex; align-items: flex-end; }
.detected { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.detected li { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; }

/* Les clients torrent : un formulaire seul, ou une carte par client. */
.clients { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.client-card:not(.single) { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--ground); }
.client-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.client-head .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; }
.client-head .dot.ok { background: var(--ok); }
.client-head .dot.bad { background: var(--bad); }
.client-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.client-title b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-title .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-card:not(.single) .client-body { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 2px; }
.client-body select { display: block; }
.sublegend { font: 600 11px var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 18px 0 0; }
.pub-client { display: flex; align-items: center; gap: 8px; margin: 6px 0 4px; flex-wrap: wrap; }
.pub-client select, #lib-client { padding: 5px 8px; font-size: 13px; }
#lib-client-row { margin: 12px 0 0; }
#lib-client-row label, .pub-client label { margin: 0; font-weight: 500; }
input:disabled { opacity: .5; }

/* ---------- apparence ---------- */
.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.swatch {
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer; padding: 0;
  border: 2px solid color-mix(in srgb, var(--c, var(--line)) 60%, var(--ground)); background: var(--c, var(--sunk));
}
.swatch.auto { width: auto; border-radius: 999px; padding: 0 10px; font: 700 11px var(--mono); letter-spacing: .06em; color: var(--muted); border-color: var(--line); }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c, var(--accent)); }
.swatch.auto[aria-checked="true"] { color: var(--ink); border-color: var(--accent); box-shadow: none; }

/* ---------- messages ---------- */
.toasts { position: fixed; top: 64px; right: 16px; z-index: 30; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow); font-size: 14px; }
.toast.bad { border-left-color: var(--bad); }
.toast.ok { border-left-color: var(--ok); }

/* ---------- publier ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 20px; margin-bottom: 16px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { margin: 0; word-break: break-word; }
.card .sub, .small { font-size: 12.5px; }
.link { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > input[type="text"] { flex: 1; min-width: 180px; }
select {
  font: 14px var(--sans); color: var(--ink); background: var(--ground);
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; max-width: 100%;
}
select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

.fs-bar { display: flex; gap: 8px; margin-bottom: 10px; }

/* Mon seed */
.seed-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat-value { font: 700 26px/1.15 var(--display); font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12.5px; color: var(--muted); }
.stat.ok .stat-value { color: var(--ok); }
.stat.bad .stat-value { color: var(--bad); }
.stat.warn .stat-value { color: var(--warn); }
.stat.add .stat-value { color: var(--accent); }
tr.risk-bad td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
tr.risk-warn td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.seed-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.seed-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--ground); }
.seed-names { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); max-height: 260px; overflow: auto; }
.seed-more summary { cursor: pointer; color: var(--accent); font-size: 13.5px; }

/* Ce PC ou la seedbox */
.src-switch { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 9px; background: var(--sunk); }
.src-switch button {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 0; border-radius: 6px;
  background: transparent; color: var(--muted); font: 600 12.5px/1.2 var(--sans); cursor: pointer;
}
.src-switch button:hover { color: var(--ink); }
.src-switch button[aria-checked="true"] { background: var(--raised); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-bright); }
.src-switch .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.src-switch .dot.ok { background: var(--ok); }
.src-switch .dot.bad { background: var(--bad); }
.src-switch .host { font-family: var(--mono); font-weight: 500; font-size: 12px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head .src-switch { margin-left: auto; }

.hostkey { margin: 12px 0 0; padding: 12px 14px; border: 1px solid var(--warn); border-radius: 10px; background: var(--warn-soft); }
.hostkey.bad { border-color: var(--bad); background: var(--bad-soft); }
.hostkey p { margin: 0 0 8px; font-size: 13.5px; }
.hostkey .fp { display: block; font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; color: var(--ink); }
.row-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.two.port { grid-template-columns: 1fr 96px; }
.fs-bar input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 13px; }
.fs-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; max-height: 52vh; overflow-y: auto; }
.fs-list li { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-bottom: 1px solid var(--line); }
.fs-list li:last-child { border-bottom: 0; }
.fs-list li.skip { opacity: .55; }
.fs-list li.empty { color: var(--muted); }
.fs-list li.fs-back { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.fs-ico { width: 18px; height: 14px; flex: none; border-radius: 3px; background: var(--sunk); border: 1px solid var(--line); }
.fs-ico.dir { background: var(--accent-soft); border-color: var(--accent); }
.fs-name { flex: 1; min-width: 0; text-align: left; border: 0; background: none; color: var(--ink); font: 14px var(--sans); cursor: pointer; padding: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-name:hover { color: var(--accent); }
.fs-size { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.facts { display: flex; gap: 22px; flex-wrap: wrap; margin-bottom: 14px; }
.fact { display: flex; flex-direction: column; font-size: 13px; }
.fact b { font-size: 15px; font-variant-numeric: tabular-nums; }
.steps { display: grid; gap: 12px; }
.step { display: flex; gap: 12px; align-items: flex-start; }
.step > .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); margin-top: 6px; flex: none; }
.step.run > .dot { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.step.ok > .dot { background: var(--ok); }
.step.bad > .dot { background: var(--bad); }
.step.bad .sub { color: var(--bad); }
.step-body { flex: 1; min-width: 0; }
.step .sub { color: var(--muted); word-break: break-word; }
.mini.wide { width: 100%; max-width: 420px; margin-top: 6px; }
.map-edit { display: grid; gap: 8px; margin-top: 8px; max-width: 560px; }
.map-edit input { font-family: var(--mono); font-size: 13px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.field > label:first-child { margin-top: 0; }
.span2 { grid-column: 1 / -1; }
.opts { display: flex; gap: 18px; flex-wrap: wrap; }
label.check.inline { margin-top: 0; display: inline-flex; align-items: center; font-weight: 400; }
/* Filtre de « Pas sur V3X » : teams qui interdisent le réupload. */
label.check.small { margin: 0 0 10px; align-items: center; font-size: 13px; color: var(--muted); }
.tokens { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tok { font-size: 12px; background: var(--sunk); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; }
.tok.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tok.warn.block { background: var(--bad-soft); color: var(--bad); }
#name-sugg code { font-family: var(--mono); font-size: 12.5px; background: var(--sunk); padding: 1px 5px; border-radius: 5px; word-break: break-all; }

.tmdb-results { list-style: none; padding: 0; margin: 10px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.tmdb-item { display: flex; gap: 10px; width: 100%; text-align: left; align-items: center; border: 1px solid var(--line); background: var(--ground); color: var(--ink); border-radius: 10px; padding: 6px; cursor: pointer; font: 13px var(--sans); }
.tmdb-item:hover { border-color: var(--accent); }
.tmdb-item img, .tmdb-item .noposter { width: 42px; height: 63px; object-fit: cover; border-radius: 5px; flex: none; background: var(--sunk); display: grid; place-items: center; color: var(--muted); }
.tmdb-meta { display: flex; flex-direction: column; min-width: 0; }
.tmdb-meta b { overflow: hidden; text-overflow: ellipsis; }
.versions { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 4px; }
.versions li { display: flex; gap: 10px; align-items: baseline; padding: 6px 10px; border-radius: 8px; background: var(--sunk); font-size: 13px; }
.versions li a { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.versions li .num { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.versions li .tag { font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); white-space: nowrap; }
.versions li.redo .tag { background: var(--bad-soft); color: var(--bad); }
.tmdb-picked { display: flex; gap: 12px; align-items: center; margin-top: 10px; padding: 8px; border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 10px; }
.tmdb-picked img { width: 46px; height: 69px; object-fit: cover; border-radius: 5px; }
.tmdb-picked a { font-weight: 600; }

/* Musique */
.mb-local { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 2px 0 10px; font-size: 13.5px; }
.mb-results { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.mb-item { display: flex; gap: 12px; width: 100%; text-align: left; align-items: center; border: 1px solid var(--line); background: var(--ground); color: var(--ink); border-radius: 10px; padding: 7px; cursor: pointer; font: 13px var(--sans); }
.mb-item:hover { border-color: var(--accent); }
.mb-item img, .mb-item .noposter, .tmdb-picked .noposter { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; flex: none; background: var(--sunk); display: grid; place-items: center; color: var(--muted); font-size: 20px; }
.tmdb-picked img[src*="coverartarchive"] { width: 64px; height: 64px; }
.mb-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
#mb-state:empty { display: none; }

.editor { margin-top: 18px; }
.editor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.editor-head label { margin: 0; }
.tabs-ed { display: none; gap: 4px; }
.fmt-ed { display: inline-flex; gap: 4px; }
.tab.small { padding: 4px 10px; font-size: 12.5px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border: 1px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--sunk); }
.tool { font: 600 12.5px var(--sans); border: 1px solid transparent; background: none; color: var(--ink); border-radius: 6px; padding: 4px 8px; cursor: pointer; }
.tool:hover { border-color: var(--line); background: var(--surface); }
.tool-b { font-weight: 800; }
.tool-i { font-style: italic; }
.tool-u { text-decoration: underline; }
.tool-s { text-decoration: line-through; }
select.tool { padding: 3px 6px; background: var(--surface); border-color: var(--line); }
input.tool.color { width: 34px; height: 28px; padding: 2px; border-color: var(--line); background: var(--surface); }
.ed-panes { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 0 0 10px 10px; min-height: 420px; }
.ed-panes textarea {
  border: 0; border-right: 1px solid var(--line); border-radius: 0 0 0 10px; resize: vertical; min-height: 420px;
  font: 13px/1.5 var(--mono); padding: 12px; color: var(--ink); background: var(--ground); width: 100%;
}
.ed-panes textarea:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent-soft); }
.preview { padding: 14px 16px; overflow: auto; max-height: 720px; background: var(--surface); border-radius: 0 0 10px 0; min-width: 0; }
.preview img { max-width: 100%; height: auto; }
/* Présentation HTML : rendue comme sur V3X, sur le fond sombre des fiches. */
.preview.html-prev { padding: 0; background: #0e0e13; }
.preview.html-prev iframe { display: block; width: 100%; height: 420px; border: 0; }
details.nfo { margin-top: 14px; }
details.nfo summary { cursor: pointer; font-weight: 600; font-size: 14px; }
#diag-text { width: 100%; min-width: min(560px, 80vw); margin: 4px 0 14px; font: 12px/1.45 var(--mono); padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--ground); color: var(--ink); resize: vertical; }
details.nfo textarea { width: 100%; min-height: 260px; margin-top: 8px; font: 12px/1.4 var(--mono); padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--ground); color: var(--ink); }
#pub-error { margin-top: 14px; }
#pub-done h2 { margin-bottom: 6px; }
#pub-done .row { margin-top: 12px; }
a.btn { text-decoration: none; display: inline-block; }

dialog .confirm { padding: 22px 24px; }
dialog .confirm dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0 0 14px; font-size: 14px; }
dialog .confirm dt { color: var(--muted); }
dialog .confirm dd { margin: 0; word-break: break-word; }

@media (max-width: 999px) {
  .tabs-ed { display: inline-flex; }
  .ed-panes { grid-template-columns: 1fr; }
  .ed-panes textarea { border-right: 0; border-radius: 0 0 10px 10px; }
  .ed-panes .preview { display: none; border-radius: 0 0 10px 10px; }
  .ed-panes.show-prev textarea { display: none; }
  .ed-panes.show-prev .preview { display: block; }
}
@media (max-width: 760px) {
  .grid2 { grid-template-columns: 1fr; }
  .card { padding: 14px; }
}

/* ---------- lot ---------- */
.b-opts { margin-top: 12px; align-items: center; }
.inline-field { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; margin: 0; font-size: 14px; }
.inline-field input { width: 80px; font: 14px var(--sans); color: var(--ink); background: var(--ground); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; }
#b-fs { margin-top: 10px; }
.b-actions { display: flex; gap: 6px; justify-content: flex-end; white-space: nowrap; }
.rows tr.current td { background: var(--accent-soft); }
.rows tr.skipped td { opacity: .55; }
.lot-tags { display: flex; flex-wrap: wrap; gap: 4px; max-width: 240px; }

/* ---------- téléphone et fenêtres étroites ---------- */
@media (max-width: 760px) {
  body { padding-left: 0; padding-top: 0; }
  .rail { position: sticky; top: 0; bottom: auto; width: 100%; height: auto; flex-direction: row; padding: 0 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail-logo { width: auto; height: 52px; border-bottom: 0; padding: 0 10px 0 4px; }
  .rail-nav { flex-direction: row; padding-top: 0; gap: 2px; justify-content: center; }
  .rail-foot { flex-direction: row; padding-top: 0; }
  .rail-item { width: 58px; }
  .rail-label, .ver, .ver-check { display: none; }
  .rail-item[aria-current="page"]::before { display: none; }
  .topbar { position: static; justify-content: center; padding: 8px 12px; height: auto; flex-wrap: wrap; }
  .chip { flex: 1; min-width: 0; }
  main { padding: 20px 16px 0; }
  .head { flex-direction: column; align-items: stretch; }
  .head-actions .btn { flex: 1; }
  .actionbar { flex-wrap: wrap; }
  .actionbar .how { flex-basis: 100%; order: 3; }
  .actionbar .btn { margin-left: auto; }
  table.rows { min-width: 640px; }
  .history li { grid-template-columns: 1fr; gap: 2px; }
  .two { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
/* Filtre texte des listes (quebecman, 21/10/26). */
.list-filter { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.list-filter input[type="text"] { max-width: 440px; font-size: 14px; padding: 7px 10px; }
.tracker-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 10px; }
.tracker-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tracker-chips .chip { padding: 3px 10px; font-size: 12px; gap: 6px; }
.tracker-chips .chip .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.tracker-chips .chip.off { opacity: .55; }
.tracker-chips .chip.off .txt { text-decoration: line-through; }
/* Lot : release sans nom de release, grisée ; « Revoir » reste net (Ekhstaz, 04/11/26). */
.rows tr.noname td:not(:last-child) { opacity: .55; }
/* Cross-seed ▸ Autres : ligne masquée réaffichée (Encrypted_Shards, 04/11/26). */
.rows tr.masked td:not(:last-child) { opacity: .55; }
/* Médiathèque : release ignorée réaffichée (PierrePJ8, 05/11/26). */
.rows tr.ignored td:not(:last-child) { opacity: .55; }
/* Cross-seed : en-têtes Release et Taille cliquables pour trier (bossman74, 12/11/26). */
.th-sort { background: none; border: 0; padding: 0; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.th-sort:hover, .th-sort.on { color: var(--accent); }
.th-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
