/* Styles de la page, servis à part sous /assets/ : la politique de sécurité refuse les balises de style dans les pages. */
  :root {
    --bg: #f7f7f5; --surface: #ffffff; --ink: #1d1d1b; --ink-2: #5c5c57; --muted: #6e6e69;
    --line: #e4e4df; --input-border: #8c8c86; --bar: #2f6fb3; --bar-hover: #1f4f86; --err: #b3261e; --up: #1b7a3d; --down: #b3261e; --note: #a35f00;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --bg: #151514; --surface: #1f1f1d; --ink: #ededea; --ink-2: #b4b4ae; --muted: #8f8f89;
      --line: #33332f; --input-border: #6b6b66; --bar: #6ea3dc; --bar-hover: #9cc2ea; --err: #f2b8b5; --up: #7fd19b; --down: #f2b8b5; --note: #f0b44c;
    }
  }
  /* Thème choisi dans la page (bouton Thème), quel que soit le réglage du système. */
  :root[data-theme="dark"] {
    --bg: #151514; --surface: #1f1f1d; --ink: #ededea; --ink-2: #b4b4ae; --muted: #8f8f89;
    --line: #33332f; --input-border: #6b6b66; --bar: #6ea3dc; --bar-hover: #9cc2ea; --err: #f2b8b5; --up: #7fd19b; --down: #f2b8b5; --note: #f0b44c;
  }
  :root { color-scheme: light dark; } :root[data-theme="light"] { color-scheme: light; } :root[data-theme="dark"] { color-scheme: dark; }
  * { box-sizing: border-box; }
  body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
  main { max-width: 1640px; margin: 0 auto; padding: 24px clamp(16px, 2.5vw, 40px) 48px; }
  /* Grand écran : les blocs d'un onglet côte à côte (liste et formulaire d'ajout, par exemple). */
  @media screen and (min-width: 1280px) {
    [role="tabpanel"]:not([hidden]) { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(540px, 100%), 1fr)); gap: 16px; align-items: start; }
    [role="tabpanel"] > .card + .card { margin-top: 0; }
  }
  :focus-visible { outline: 2px solid var(--bar); outline-offset: 2px; }
  a { color: var(--bar); }
  .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
  .brand { font-weight: 650; color: var(--ink-2); }
  h1 { font-size: 20px; margin: 0 0 16px; }
  h2, h3 { font-size: 14px; margin: 0 0 12px; color: var(--ink-2); font-weight: 600; }
  h3 { color: var(--ink); }
  textarea.notice { display: block; width: 100%; min-height: 22em; resize: vertical; font: inherit; font-size: 14px; line-height: 1.5; padding: 10px 12px; border: 1px solid var(--input-border); border-radius: 6px; background: var(--bg); color: var(--ink); margin: 8px 0; }
  select, input, button { font: inherit; padding: 6px 10px; border: 1px solid var(--input-border); border-radius: 6px; background: var(--surface); color: var(--ink); }
  button { cursor: pointer; }
  button:disabled { cursor: default; opacity: .6; }
  button.danger { border-color: var(--err); color: var(--err); }
  ul.setup { list-style: none; margin: 0; padding: 0; }
  ul.setup li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 4px 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); }
  ul.setup .mark { font-size: 18px; line-height: 1.3; text-align: center; }
  ul.setup .mark.ok { color: var(--up); } ul.setup .mark.todo { color: var(--note); }
  ul.setup b { font-weight: 600; }
  ul.setup .gdesc { overflow-wrap: anywhere; }
  ul.setup .tag { margin-left: 6px; }
  ol.wizard { margin: 0; padding-left: 20px; display: grid; gap: 12px; }
  #wz-goals label { display: flex; gap: 8px; align-items: baseline; margin: 4px 0; }
  ul.setup pre.snippet { grid-column: 2 / -1; margin: 6px 0 0; }
  a.btn { display: inline-flex; align-items: center; padding: 6px 10px; border: 1px solid var(--input-border); border-radius: 6px; background: var(--surface); color: var(--ink); text-decoration: none; }
  a.btn:hover { border-color: var(--bar); }
  .card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; min-width: 0; overflow-x: auto; }
  .card + .card { margin-top: 12px; }
  table { position: relative; width: 100%; border-collapse: collapse; font-size: 14px; }
  th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
  th { color: var(--muted); font-weight: 500; font-size: 12px; }
  td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
  td.t { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  td.w { overflow-wrap: anywhere; min-width: 8em; }
  td.act { width: 1%; white-space: nowrap; text-align: right; }
  td.act button + button { margin-left: 4px; }
  .empty { color: var(--muted); font-size: 13px; }
  .hint { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
  .err { color: var(--err); }
  .ok { color: var(--up); }
  .down { color: var(--down); }
  .msg { font-size: 13px; margin: 8px 0 0; }
  .msg:empty { display: none; }
  .gdesc { display: block; color: var(--muted); font-size: 12px; }
  .gdesc.err { color: var(--err); overflow-wrap: anywhere; white-space: normal; }
  .tag { display: inline-block; padding: 1px 6px; border-radius: 4px; background: var(--bg); border: 1px solid var(--line); font-size: 12px; }
  .warn { border-left: 3px solid var(--note); padding: 6px 10px; background: var(--bg); border-radius: 0 6px 6px 0; font-size: 13px; margin: 0 0 12px; }
  .warn:empty { display: none; }
  .star, .ndel { border: 0; background: none; padding: 0 4px; color: var(--muted); font-size: 15px; line-height: 1; }
  .star:hover, .ndel:hover { color: var(--bar); }
  .star.armed, button.armed { color: var(--err); border: 1px solid var(--err); border-radius: 6px; padding: 2px 8px; font-size: 13px; }
  ul.cmds { margin: 4px 0 8px; padding-left: 18px; font-size: 14px; }
  ul.cmds li { margin: 3px 0; }
  pre.snippet { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 12px; overflow-x: auto; white-space: pre; margin: 6px 0; }
  .newlink { margin-top: 14px; padding: 12px; border: 1px solid var(--bar); border-radius: 8px; }
  .newlink label { font-size: 13px; color: var(--ink-2); }
  .copyrow { display: flex; gap: 8px; margin-top: 6px; }
  .copyrow input { flex: 1; min-width: 0; font-family: ui-monospace, monospace; font-size: 13px; }
  .goal-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; align-items: end; }
  .goal-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); }
  .goal-form input, .goal-form select { width: 100%; }
  .goal-form [hidden] { display: none; }
  .goal-form label.inline { flex-direction: row; align-items: center; gap: 6px; }
  .goal-form input[type="checkbox"] { width: auto; }
  .goal-form .full { grid-column: 1 / -1; }
  .sites-pick { border: 1px solid var(--input-border); border-radius: 6px; padding: 6px 10px; font-size: 13px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 4px 12px; }
  .sites-pick label { flex-direction: row; align-items: center; gap: 4px; }
  .sites-pick input { width: auto; }
  details.fold > summary { cursor: pointer; color: var(--ink-2); font-size: 14px; font-weight: 600; }
  details.fold[open] > summary { margin-bottom: 12px; }
  code { font-size: 13px; }

  /* Onglets (motif WAI-ARIA) : retour à la ligne sur petit écran, jamais de défilement horizontal de la page. */
  [role="tablist"] { display: flex; flex-wrap: wrap; gap: 2px 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
  [role="tab"] { border: 0; border-bottom: 2px solid transparent; border-radius: 6px 6px 0 0; background: none; color: var(--ink-2); padding: 8px 12px; margin-bottom: -1px; }
  [role="tab"]:hover { color: var(--ink); background: var(--surface); }
  [role="tab"][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--bar); font-weight: 600; }
  [role="tabpanel"]:focus-visible { outline-offset: 4px; }

  /* Étapes du guide Telegram. */
  .step { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
  .step:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
  .step h3 .num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--bar); color: var(--surface); font-size: 12px; margin-right: 6px; }
  .step ol, .step ul.how { margin: 0 0 12px; padding-left: 20px; color: var(--ink-2); font-size: 14px; }
  .step li + li { margin-top: 2px; }
  .step.off > :not(h3):not(.hint) { display: none; }
  ul.chats { list-style: none; padding: 0; margin: 0 0 12px; }
  ul.chats li { display: flex; gap: 8px; align-items: baseline; padding: 4px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
  ul.chats .txt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
  .pick { border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; margin: 12px 0 0; }
  .pick legend { font-size: 13px; color: var(--ink-2); padding: 0 4px; }
  .pick label { display: flex; gap: 8px; align-items: baseline; padding: 4px 0; font-size: 14px; }
  .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  /* Petits écrans : chaque alerte devient une fiche (libellé de colonne devant chaque valeur). */
  @media (max-width: 640px) {
    table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    table.stack tr { display: block; border-bottom: 1px solid var(--line); padding: 6px 0; }
    table.stack td { display: flex; gap: 8px; border: 0; padding: 2px 0; }
    table.stack td[data-l]::before { content: attr(data-l); color: var(--muted); font-size: 12px; min-width: 6.5em; flex-shrink: 0; padding-top: 2px; }
    table.stack td > :first-child { min-width: 0; }
    table.stack td.n { text-align: left; }
    table.stack td.act { width: auto; text-align: left; padding-top: 6px; flex-wrap: wrap; }
    table.stack td.act button + button { margin-left: 0; }
  }
  #smtp-test { grid-template-columns: minmax(180px, 320px) auto; justify-content: start; }
  @media (max-width: 480px) { #smtp-test { grid-template-columns: 1fr; } }
  #login { max-width: 360px; }
  #login input { width: 100%; margin: 8px 0; }
  /* Écrans tactiles : cibles d'au moins 44 px. */
  @media (pointer: coarse) {
    select, input:not([type="checkbox"]), button, a.btn, .sites-pick label, .pick label { min-height: 44px; }
    .star, .ndel { min-width: 44px; }
    summary { padding-block: 12px; }
  }
