/* Planificateur de diffusion — feuille de style */
:root {
  --ground: #F4F5F7;
  --panel: #FFFFFF;
  --line: #DDE1E6;
  --line-strong: #C9CFD8;
  --ink: #15181C;
  --ink-2: #2F3640;
  --muted: #4F5763;
  --accent: #1F4FC4;
  --accent-dark: #163A92;
  --accent-soft: #E8EEFB;
  --ok: #0B5E50;
  --ok-soft: #E3F2EE;
  --warn: #8A4200;
  --warn-soft: #FFF4E5;
  --danger: #A12D20;
  --danger-soft: #FCECEA;
  --radius: 12px;
  --font: 'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 12px; }
h1 { font-size: 24px; font-weight: 600; }
.h3, h3 { font-size: 16px; font-weight: 600; }
p { margin: 0 0 12px; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.pre-line { white-space: pre-line; }
.big { font-size: 20px; letter-spacing: 0.04em; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; z-index: 10; background: #fff; padding: 8px 12px; border-radius: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Barre du haut */
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; padding: 12px 24px; background: var(--ink); color: #fff; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 600; font-size: 16px; }
.brand:hover { color: #fff; }
.mainnav { display: flex; flex-wrap: wrap; gap: 4px; }
.mainnav a { color: #D5DAE1; text-decoration: none; padding: 8px 12px; border-radius: 8px; font-size: 14px; }
.mainnav a:hover { background: #23282F; color: #fff; }
.usermenu { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.avatar-link { display: inline-flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-size: 14px; }
.avatar-link:hover { color: #fff; text-decoration: underline; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #3A414B; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; }

.page { max-width: 1200px; margin: 0 auto; padding: 24px; }
.footer { max-width: 1200px; margin: 0 auto; padding: 8px 24px 32px; color: var(--muted); font-size: 12px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head h1 { margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 8px; }

/* Cartes et grilles */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card.narrow { max-width: 520px; }
.card.medium { max-width: 720px; }
.card.empty { text-align: center; padding: 40px 20px; }
.card.placeholder { border-style: dashed; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .card { margin-top: 16px; }
.stack { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.actions-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 0; }
.sep { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid transparent; font: inherit; font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { background: #EEF1F5; color: var(--ink); }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: transparent; }
.btn-danger-ghost:hover { background: var(--danger-soft); color: var(--danger); }
.btn-dark { background: transparent; color: #fff; border-color: #3A414B; }
.btn-dark:hover { background: #23282F; }
.btn-small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* Formulaires */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0; border: 0; padding: 0; min-width: 0; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
label, legend { font-size: 14px; font-weight: 500; color: var(--ink-2); }
legend { padding: 0; margin-bottom: 6px; }
label.inline { display: flex; align-items: center; gap: 8px; font-weight: 400; color: var(--ink); min-height: 32px; }
label.inline.is-covered { color: var(--muted); }
.radio-row { display: flex; flex-wrap: wrap; gap: 4px 24px; }
input[type=text], input[type=email], input[type=password], input[type=time], input[type=search], select {
  width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--ink); font: inherit; font-size: 15px;
}
input.mono { font-family: var(--mono); font-size: 14px; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.code-input { font-family: var(--mono); font-size: 22px !important; letter-spacing: 0.2em; text-align: center; }
.hint { margin: 0; font-size: 13px; color: var(--muted); }
.mask-preview { margin: 0; font-size: 13px; color: var(--accent-dark); font-family: var(--mono); }
.mask-preview:empty { display: none; }

/* Alertes */
.alert { border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; font-size: 14px; border: 1px solid transparent; }
.alert p:last-child, .alert ul:last-child { margin-bottom: 0; }
.alert ul { margin: 4px 0 0; padding-left: 20px; }
.alert-success { background: var(--ok-soft); color: var(--ok); border-color: #BFE0D7; }
.alert-info { background: var(--accent-soft); color: var(--accent-dark); border-color: #C8D6F3; }
.alert-warning { background: var(--warn-soft); color: var(--warn); border-color: #F3D2A8; }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: #F2C4BE; }
.temp-password .big { margin: 6px 0; color: var(--ink); }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge-emission { background: var(--accent-soft); color: var(--accent-dark); }
.badge-chronique { background: #EFE8FB; color: #5A2FA8; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-muted { background: #EEF0F3; color: var(--muted); }

/* Tableaux */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid #EEF0F3; vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }

/* Arborescence */
.tree-card .radio-name { font-size: 18px; margin: 0; }
.zone-name { margin: 0; color: var(--ink-2); }
.tree-card > .zone-name { margin-top: 16px; margin-bottom: 4px; }
.row-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.row-actions form { margin: 0; }
.zone-block { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.content-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.content-link { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--ink); background: #FAFBFC; }
.content-link:hover { border-color: #BFCBE6; background: #F7F9FE; color: var(--ink); }
.content-link.is-inactive { opacity: 0.7; }
.content-title { font-weight: 600; }
.content-meta { width: 100%; font-size: 12.5px; color: var(--muted); }

/* Propriétés */
.props { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0 0 12px; font-size: 14px; }
.props dt { color: var(--muted); }
.props dd { margin: 0; overflow-wrap: anywhere; }
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }

/* Droits */
.perm-tree fieldset.perm-radio { border: 1px solid var(--line); border-radius: 10px; padding: 8px 16px 12px; margin: 0; }
.perm-zone { margin-left: 26px; padding: 4px 0; }
.perm-contents { margin-left: 26px; display: flex; flex-wrap: wrap; gap: 0 20px; }

/* Journal */
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; }

/* Écrans de connexion */
.auth-body { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; }
.auth-wrap { width: 100%; max-width: 480px; padding: 48px 16px; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 600; font-size: 17px; margin-bottom: 20px; }
.auth-card { padding: 28px; }
.auth-title { font-size: 22px; }
.checklist { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check-icon { width: 22px; height: 22px; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.checklist .ok .check-icon { background: var(--ok-soft); color: var(--ok); }
.checklist .ko .check-icon { background: var(--danger-soft); color: var(--danger); }
.steps { margin: 0 0 12px; padding-left: 20px; font-size: 14px; }
.steps li { margin-bottom: 6px; }
.qr { width: 220px; height: 220px; margin: 0 auto 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.qr svg { width: 100%; height: 100%; display: block; }
.secret-details { margin-bottom: 16px; font-size: 14px; }
.secret-details summary { cursor: pointer; color: var(--accent); }
.secret { font-size: 16px; letter-spacing: 0.06em; background: var(--ground); padding: 10px 12px; border-radius: 8px; margin: 8px 0; overflow-wrap: anywhere; }
.recovery-codes { list-style: none; padding: 16px; margin: 0 0 16px; background: var(--ground); border-radius: 10px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 16px; font-size: 16px; }

@media (max-width: 640px) {
  .page { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .usermenu { margin-left: 0; }
  .auth-card { padding: 20px; }
}

@media print {
  .topbar, .footer, .actions-row, .alert { display: none; }
  body { background: #fff; }
  .card { border: 0; }
}

/* Couleurs de zone (palette fixe, texte blanc lisible sur chaque teinte) */
.zc-bleu { --zc: #1F4FC4; --zc-soft: #E8EEFB; }
.zc-vert { --zc: #0F7A67; --zc-soft: #E3F2EE; }
.zc-orange { --zc: #B04F08; --zc-soft: #FDEEDC; }
.zc-violet { --zc: #6B3FC0; --zc-soft: #EFE8FB; }
.zc-rose { --zc: #B8326F; --zc-soft: #FBE7F0; }
.zc-rouge { --zc: #B23A2E; --zc-soft: #FBE9E7; }
.zc-cyan { --zc: #0E7490; --zc-soft: #E0F2F7; }
.zc-olive { --zc: #5E6B12; --zc-soft: #EEF2D9; }
.zc-brun { --zc: #85532A; --zc-soft: #F3E9DF; }
.zc-ardoise { --zc: #4F5763; --zc-soft: #ECEEF1; }
.zc-marine { --zc: #1E3A8A; --zc-soft: #E3E8F6; }
.zc-emeraude { --zc: #047857; --zc-soft: #DFF3EA; }
.zc-moutarde { --zc: #7F6200; --zc-soft: #F6EFD6; }
.zc-prune { --zc: #7E2A7A; --zc-soft: #F5E6F4; }
.zc-magenta { --zc: #A21CAF; --zc-soft: #F7E4F9; }
.zc-bordeaux { --zc: #8B1E3F; --zc-soft: #F6E3E9; }
.zc-indigo { --zc: #4338CA; --zc-soft: #E7E6FA; }
.zc-sapin { --zc: #1F5135; --zc-soft: #E2EEE6; }
.zc-chocolat { --zc: #5C3A21; --zc-soft: #EFE6DE; }
.zc-anthracite { --zc: #2B2F36; --zc-soft: #E6E7E9; }

.zone-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; background: var(--zc); color: #fff; font-size: 13px; font-weight: 600; line-height: 1.4; white-space: nowrap; }
.zone-chip::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #fff; opacity: 0.85; }
h3.zone-name .zone-chip { font-size: 14px; }
.zone-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--zc); flex: none; }
.zone-block[class*="zc-"] { border-top: 0; margin-top: 18px; padding: 14px 16px; border-radius: 10px; background: var(--zc-soft); }
.zone-block[class*="zc-"] .table { background: #fff; border-radius: 8px; }
.content-link[class*="zc-"] { border-top: 4px solid var(--zc); }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 8px; border: 0; padding: 0; margin: 0; }
.swatch { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px 0 8px; border: 1px solid var(--line-strong); border-radius: 999px; background: #fff; cursor: pointer; font-size: 14px; font-weight: 400; color: var(--ink); }
.swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch .zone-dot { width: 22px; height: 22px; }
.swatch:has(input:checked) { border-color: var(--zc); box-shadow: 0 0 0 2px var(--zc); font-weight: 600; }
.swatch:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* État de l'agent dans l'en-tête */
.agent-pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; font-size: 13px; border: 1px solid #3A414B; color: #E6E9ED; }
.agent-dot { width: 8px; height: 8px; border-radius: 50%; background: #8B939E; }
.agent-ok { background: #1F2D29; border-color: #2E5A4F; }
.agent-ok .agent-dot { background: #3CCB9F; }
.agent-backup { background: #2D2A1F; border-color: #5A4F2E; }
.agent-backup .agent-dot { background: #E8B54A; }
.agent-offline { background: #3A1F1F; border-color: #6B3434; }
.agent-offline .agent-dot { background: #F07A6E; }
.badge-info { background: var(--accent-soft); color: var(--accent-dark); }

/* Stock */
.stock-tree { display: flex; flex-direction: column; gap: 6px; }
.stock-folder { border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; }
.stock-folder > summary { cursor: pointer; padding: 10px 0; font-weight: 600; font-size: 14px; }
.stock-files { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; }
.stock-files li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 7px 0; border-top: 1px solid #EEF0F3; }
.file-name { font-size: 13px; overflow-wrap: anywhere; }
