/* ===== Console d'administration RappelMoi ===== */
/* Aucune règle « style=... » dans le HTML : la politique de sécurité de la console les interdit. */
:root {
  --navy: #0B1F36;
  --navy-2: #16304F;
  --navy-line: #1E3A5C;
  --brand: #123B70;
  --brand-hover: #0D2D57;
  --brand-soft: #E7EEF7;
  --accent: #12C9AA;
  --bg: #F4F7FB;
  --surface: #FFFFFF;
  --text: #0B1F36;
  --text-2: #34475E;
  --muted: #5B6B80;
  --border: #E2E8F0;
  --border-2: #D5DEEA;
  --row: #EEF2F7;
  --success: #047857; --success-soft: #E6F7F4; --success-text: #0B6B5B;
  --warning: #8A4F05; --warning-soft: #FFF4E0; --warning-dot: #E9A23B;
  --danger: #B91C1C; --danger-soft: #FDECEC; --danger-line: #F3C7C7; --danger-dot: #D9534F;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); }
a:hover { color: var(--brand-hover); }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.pos { color: var(--success); }
.neg { color: var(--danger); }
.warn-text { color: var(--warning); font-weight: 600; }
.danger-text { color: var(--danger); }

/* ---------- Boutons et champs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); color: #fff; }
.btn-ghost { background: var(--surface); border-color: var(--border-2); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: var(--bg); color: var(--text); }
.btn-danger { background: var(--surface); border-color: var(--danger-line); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn-danger-solid { background: var(--danger); color: #fff; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-left { justify-content: flex-start; text-align: left; white-space: normal; padding-top: 10px; padding-bottom: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 13px; font-weight: 600; }
.field .hint { font-weight: 400; color: var(--muted); }
.input { width: 100%; min-height: 44px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--surface); padding: 0 12px; font: inherit; font-size: 15px; color: var(--text); }
textarea.input { padding: 10px 12px; resize: vertical; min-height: 80px; }
.input:focus, .btn:focus-visible, a:focus-visible, .chip:focus-visible, .tab:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent); outline-offset: 1px; }
.code-input { font-family: var(--mono); font-size: 26px; letter-spacing: .4em; text-align: center; }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border-2); border-radius: 10px; padding: 0 12px; min-height: 44px; flex: 1 1 300px; }
.search input { border: 0; outline: 0; flex: 1; font: inherit; font-size: 14px; background: transparent; color: var(--text); min-width: 0; min-height: 42px; }

/* ---------- Pastilles ---------- */
.badge { display: inline-block; font-weight: 600; font-size: 12px; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.b-ok { background: var(--success-soft); color: var(--success-text); }
.b-info { background: var(--brand-soft); color: var(--brand); }
.b-warn { background: var(--warning-soft); color: var(--warning); }
.b-danger { background: var(--danger-soft); color: var(--danger); }
.b-off { background: #F1F4F8; color: var(--text-2); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.dot-warn { background: var(--warning-dot); } .dot-danger { background: var(--danger-dot); } .dot-info { background: var(--brand); }

/* ---------- Page de connexion ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--navy); }
.login-card { width: 100%; max-width: 440px; background: var(--surface); border-radius: 16px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.login-brand .name { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.login-brand .name span { color: #0B7F6C; }
.login-brand .tag { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.login-card h1 { font-size: 22px; margin-bottom: 6px; }
.login-card p.lead { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.qr-box { display: flex; justify-content: center; padding: 12px; background: #fff; border: 1px solid var(--border); border-radius: 12px; margin: 12px 0; }
.qr-box svg { width: 200px; height: 200px; }
.secret { font-family: var(--mono); font-size: 15px; letter-spacing: .08em; background: var(--bg); border-radius: 8px; padding: 10px 12px; word-break: break-all; text-align: center; }
.steps { padding-left: 20px; margin: 0 0 14px; font-size: 14px; color: var(--text-2); display: grid; gap: 4px; }
.notice { font-size: 13px; border-radius: 8px; padding: 10px 12px; margin: 0 0 14px; }
.notice-error { background: var(--danger-soft); color: var(--danger); }
.notice-warn { background: var(--warning-soft); color: var(--warning); }
.notice-info { background: var(--brand-soft); color: var(--brand); }

/* ---------- Coque de la console ---------- */
.shell { min-height: 100vh; display: flex; flex-wrap: wrap; align-items: stretch; }
/* Le menu reste fixe à l'écran : la personne connectée reste visible en bas, même sur une longue page. */
.side { flex: 1 1 248px; max-width: 280px; background: var(--navy); color: #B8C6D9; padding: 22px 16px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; overflow-y: auto; align-self: flex-start; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; color: #fff; text-decoration: none; }
.side .brand b { font-size: 18px; letter-spacing: -0.3px; color: #fff; }
.side .brand b span { color: var(--accent); }
.side .brand small { display: block; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #8FA6C0; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav .group { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #8FA6C0; padding: 14px 12px 6px; }
.nav .group:first-child { padding-top: 0; }
.nav a { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border-radius: 8px; color: #B8C6D9; text-decoration: none; font-size: 14px; font-weight: 500; }
.nav a:hover { background: var(--navy-2); color: #fff; }
.nav a.active { background: var(--navy-2); color: #fff; }
.nav svg, .icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.side-user { margin-top: auto; border-top: 1px solid var(--navy-line); padding: 14px 8px 0; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.side-user b { color: #fff; display: block; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--navy); display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.avatar-soft { background: var(--brand-soft); color: var(--brand); }
.icon-btn { width: 44px; height: 44px; border: 0; background: transparent; color: inherit; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--navy-2); color: #fff; }
.main { flex: 999 1 560px; min-width: 0; padding: 26px 32px 40px; display: flex; flex-direction: column; gap: 18px; }
.env-strip { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border-radius: 10px; font-weight: 600; font-size: 13px; background: var(--warning-soft); color: var(--warning); }
.env-strip.prod { background: var(--danger-soft); color: var(--danger); }
.env-strip .dot { background: currentColor; width: 8px; height: 8px; }

/* ---------- Mise en page ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.page-head .title { flex: 1 1 320px; }
.page-head h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.4px; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.crumb { font-size: 13px; color: var(--muted); }
.crumb a { text-decoration: none; }
.row { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.col-3 { flex: 3 1 560px; min-width: 0; }
.col-2 { flex: 2 1 340px; min-width: 0; }
.col-1 { flex: 1 1 300px; min-width: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.kpi .k { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi .v { font-size: 28px; font-weight: 700; margin-top: 6px; font-family: var(--mono); }
.kpi .v small { font-size: 14px; font-weight: 500; color: var(--muted); }
.kpi .s { font-size: 13px; color: var(--muted); margin-top: 2px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px 10px; }
.card h2, .card-head h2 { font-size: 16px; font-weight: 600; }
.card h2.spaced { margin-bottom: 12px; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.card.danger-zone { border-color: var(--danger-line); }
.danger-zone h2 { color: var(--danger); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.section-label { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 4px 0 8px; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th { text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 10px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; background: #FAFBFD; }
.t td { padding: 12px 16px; border-bottom: 1px solid var(--row); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover { background: #F7FAFD; }
.t tr.selected { background: #EEF4FB; }
.t .strong { font-weight: 600; text-decoration: none; color: var(--text); }
.t .sub { font-size: 13px; color: var(--muted); }
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

/* ---------- Filtres et onglets ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 999px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; background: var(--surface); color: var(--text-2); border: 1px solid var(--border-2); }
.chip[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip .n { font-family: var(--mono); font-size: 12px; opacity: .85; margin-left: 4px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border-2); }
.tab { min-height: 44px; padding: 0 16px; border: 0; background: transparent; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }

/* ---------- Éléments de fiche ---------- */
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 12px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; font-size: 14px; }
.people li { display: flex; align-items: center; gap: 10px; }
.people .grow { flex: 1; min-width: 0; }
.people .grow b { font-weight: 600; }
.people .grow span { display: block; font-size: 12px; color: var(--muted); }
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; font-size: 14px; }
.feed li { display: flex; gap: 12px; }
.feed .when { font-family: var(--mono); font-size: 12px; color: var(--muted); width: 104px; flex: none; padding-top: 2px; }
.note { font-size: 14px; background: #F7FAFD; border-radius: 8px; padding: 10px 12px; }
.note b { font-weight: 600; }
.alert-link { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--row); text-decoration: none; color: var(--text); }
.alert-link:last-child { border-bottom: 0; }
.alert-link .dot { margin-top: 6px; }
.alert-link b { font-weight: 600; }
.alert-link span.t2 { display: block; font-size: 13px; color: var(--muted); }
.big-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; }
.big-head .logo { width: 56px; height: 56px; border-radius: 14px; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 22px; flex: none; }
.big-head .grow { flex: 1 1 300px; }
.big-head h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.4px; }
.suspended-banner { background: var(--danger-soft); color: var(--danger); border-radius: 10px; padding: 12px 16px; font-size: 14px; font-weight: 600; }
.stats-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stats-2 .lbl { font-size: 12px; color: var(--muted); }
.stats-2 .val { font-family: var(--mono); font-size: 20px; font-weight: 600; }

/* ---------- Graphique des envois ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.legend .l-ok { background: var(--brand); } .legend .l-fail { background: var(--danger-dot); }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 200px; margin-top: 16px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 1px; min-width: 3px; }
.bar .ok { background: var(--brand); border-radius: 2px 2px 0 0; }
.bar .fail { background: var(--danger-dot); border-radius: 2px 2px 0 0; }
.axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 8px; font-family: var(--mono); }

/* ---------- Fenêtre modale ---------- */
.overlay { position: fixed; inset: 0; background: rgba(11,31,54,.55); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 16px; width: 100%; max-width: 520px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 18px; }
.modal-head .icon-btn { color: var(--muted); }
.modal-head .icon-btn:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 20px; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); }
.password-box { font-family: var(--mono); font-size: 20px; letter-spacing: .06em; background: var(--bg); border-radius: 10px; padding: 14px; text-align: center; margin: 10px 0; user-select: all; }

/* ---------- Messages éphémères ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: calc(100vw - 32px); }
.toast { background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.error { background: var(--danger); }

@media (max-width: 860px) {
  .side { max-width: none; flex-basis: 100%; padding: 14px 16px; gap: 12px; position: static; height: auto; overflow: visible; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav .group { display: none; }
  .side-user { margin-top: 0; }
  .main { padding: 20px 16px 32px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
}

/* ---------- Réglages des messages ---------- */
.fs { border: 0; padding: 0; margin: 0 0 14px; }
.fs legend { font-size: 13px; font-weight: 600; margin-bottom: 8px; padding: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--brand); }
.check .hint { display: block; font-size: 13px; color: var(--muted); font-weight: 400; }
.form-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-2[hidden] { display: none; }
.sub { font-size: 12px; color: var(--muted); }
.card-head .chips { margin: 0; }
@media (max-width: 560px) { .form-2 { grid-template-columns: 1fr; } }

/* ---------- Formules ---------- */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-bottom: 18px; }
.plan-card { display: flex; flex-direction: column; gap: 6px; }
.plan-card .inline .badge { margin-left: 4px; }
.plan-card > .btn { align-self: flex-start; margin-top: 8px; }
.plan-off { opacity: .7; }
.plan-price { font-family: var(--mono); font-size: 24px; font-weight: 700; }
.plan-price small { font-size: 13px; font-weight: 500; color: var(--muted); }
.stats-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stats-3 .lbl { font-size: 12px; color: var(--muted); }
.stats-3 .val { font-family: var(--mono); font-size: 18px; font-weight: 600; }
.how { padding-left: 18px; margin: 0; display: grid; gap: 6px; color: var(--text-2); }
.feed-pad { padding: 0 20px 12px; }
.feed .sub { display: block; }
.card .inline.spread + .kv { margin-top: 14px; }
#os-extend { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--row); }
