/* =========================================================================
   SMS : feuille de style unique
   Thème clair / sombre (préférence système ou choix manuel), sans CDN.
   ========================================================================= */

/* ---------- Jetons de design ---------- */
:root {
  color-scheme: light;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;

  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --surface-3: #eef1f8;
  --border: #e2e6ef;
  --border-strong: #cdd3e1;
  --text: #121a2c;
  --text-2: #4a5470;
  --text-3: #687189;

  --accent: #2d4ee0;
  --accent-hover: #2342c7;
  --accent-soft: #ebefff;
  --accent-text: #2643c9;
  --on-accent: #ffffff;

  --success: #0f7542;
  --success-strong: #13864d;
  --success-soft: #e5f5ec;
  --warning: #9a5b00;
  --warning-strong: #c27400;
  --warning-soft: #fff3dc;
  --danger: #c42b2b;
  --danger-strong: #c42b2b;
  --danger-soft: #fdeceb;
  --info: #1d68a8;
  --info-soft: #e7f1fa;

  --sidebar-bg: #0f1628;
  --sidebar-border: rgba(255, 255, 255, .07);
  --sidebar-text: #b9c1d9;
  --sidebar-muted: #7a84a1;
  --sidebar-hover: rgba(255, 255, 255, .06);
  --sidebar-active: rgba(110, 140, 255, .17);

  --phone-screen: #f1f3f8;
  --phone-bubble: #e3e6ee;
  --phone-text: #121a2c;
  --phone-muted: #7d869d;

  --chart-sent: #3d5ef0;
  --chart-failed: #e5484d;
  --chart-grid: #e7eaf2;

  --shadow-sm: 0 1px 2px rgba(18, 26, 44, .06);
  --shadow: 0 1px 2px rgba(18, 26, 44, .06), 0 4px 12px rgba(18, 26, 44, .05);
  --shadow-lg: 0 24px 48px -16px rgba(18, 26, 44, .32), 0 8px 16px -8px rgba(18, 26, 44, .14);
  --ring: 0 0 0 3px rgba(45, 78, 224, .26);

  --radius-sm: 7px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 22px;
  --sidebar-w: 260px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0f19;
    --surface: #121827;
    --surface-2: #161d2e;
    --surface-3: #1d2539;
    --border: #252f47;
    --border-strong: #34405e;
    --text: #e8ebf4;
    --text-2: #b4bbd0;
    --text-3: #8b94ad;
    --accent: #4d6bf0;
    --accent-hover: #6680f5;
    --accent-soft: rgba(102, 128, 245, .16);
    --accent-text: #a3b4ff;
    --success: #4fd394;
    --success-strong: #1f9d60;
    --success-soft: rgba(79, 211, 148, .13);
    --warning: #f3b648;
    --warning-strong: #c98a14;
    --warning-soft: rgba(243, 182, 72, .13);
    --danger: #ff8080;
    --danger-strong: #d64545;
    --danger-soft: rgba(255, 128, 128, .13);
    --info: #72b8ff;
    --info-soft: rgba(114, 184, 255, .13);
    --sidebar-bg: #080b14;
    --phone-screen: #171e2f;
    --phone-bubble: #283149;
    --phone-text: #e8ebf4;
    --phone-muted: #8b94ad;
    --chart-sent: #6a85ff;
    --chart-failed: #ff6b6f;
    --chart-grid: #232c42;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 4px 14px rgba(0, 0, 0, .25);
    --shadow-lg: 0 24px 52px -16px rgba(0, 0, 0, .7), 0 8px 16px -8px rgba(0, 0, 0, .5);
    --ring: 0 0 0 3px rgba(102, 128, 245, .36);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0f19;
  --surface: #121827;
  --surface-2: #161d2e;
  --surface-3: #1d2539;
  --border: #252f47;
  --border-strong: #34405e;
  --text: #e8ebf4;
  --text-2: #b4bbd0;
  --text-3: #8b94ad;
  --accent: #4d6bf0;
  --accent-hover: #6680f5;
  --accent-soft: rgba(102, 128, 245, .16);
  --accent-text: #a3b4ff;
  --success: #4fd394;
  --success-strong: #1f9d60;
  --success-soft: rgba(79, 211, 148, .13);
  --warning: #f3b648;
  --warning-strong: #c98a14;
  --warning-soft: rgba(243, 182, 72, .13);
  --danger: #ff8080;
  --danger-strong: #d64545;
  --danger-soft: rgba(255, 128, 128, .13);
  --info: #72b8ff;
  --info-soft: rgba(114, 184, 255, .13);
  --sidebar-bg: #080b14;
  --phone-screen: #171e2f;
  --phone-bubble: #283149;
  --phone-text: #e8ebf4;
  --phone-muted: #8b94ad;
  --chart-sent: #6a85ff;
  --chart-failed: #ff6b6f;
  --chart-grid: #232c42;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 4px 14px rgba(0, 0, 0, .25);
  --shadow-lg: 0 24px 52px -16px rgba(0, 0, 0, .7), 0 8px 16px -8px rgba(0, 0, 0, .5);
  --ring: 0 0 0 3px rgba(102, 128, 245, .36);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { margin: 0; color: var(--text); line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.65rem; font-weight: 700; letter-spacing: -.025em; }
h2 { font-size: 1.04rem; font-weight: 650; }
h3 { font-size: .95rem; font-weight: 650; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
strong, b { font-weight: 650; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  display: inline-block;
  flex: none;
  width: 1.15em;
  height: 1.15em;
  vertical-align: -.2em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.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;
}
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 200;
  padding: 10px 14px; border-radius: var(--radius); background: var(--accent); color: var(--on-accent); font-weight: 600;
}
.skip-link:focus { top: 12px; text-decoration: none; }

.muted { color: var(--text-3); }
.nowrap { white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.mt-0 { margin-top: 0 !important; }

/* ---------- Structure ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.main { min-width: 0; display: flex; flex-direction: column; }
.content { flex: 1; width: 100%; max-width: 1260px; margin: 0 auto; padding: 34px 40px 48px; outline: none; }
.app-footer {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  max-width: 1260px; width: 100%; margin: 0 auto; padding: 18px 40px 26px;
  color: var(--text-3); font-size: .8rem;
}
.app-footer a { color: var(--text-3); }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
  padding: 18px 14px 14px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  scrollbar-width: thin;
}
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 22px; }
.sidebar .sidebar-close { display: none; }
.sidebar .icon-btn { color: var(--sidebar-text); }
.sidebar .icon-btn:hover { background: var(--sidebar-hover); color: #fff; }

.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); font-weight: 750; letter-spacing: -.015em; font-size: 1.04rem; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 34px; flex: none; border-radius: 9px; }
.brand-name { font-size: 1.12rem; letter-spacing: .02em; }
.brand-accent { color: var(--accent-text); }
.sidebar .brand, .brand-light { color: #fff; }
.sidebar .brand-accent, .brand-light .brand-accent { color: #a9b9ff; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  padding: 16px 12px 7px; font-size: .68rem; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--sidebar-muted);
}
.nav-label:first-child { padding-top: 0; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 12px; border: 0; border-radius: 9px; background: none;
  color: var(--sidebar-text); font-size: .9rem; font-weight: 550; text-align: left; cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-item .icon { width: 19px; height: 19px; opacity: .85; }
.nav-item:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.nav-item.is-active { background: var(--sidebar-active); color: #fff; box-shadow: inset 3px 0 0 #7d97ff; }
.nav-item.is-active .icon { opacity: 1; color: #a9b9ff; }
.nav-badge {
  margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px;
  background: #f3b648; color: #2a1a00; font-size: .72rem; font-weight: 750; text-align: center;
}
.nav-external { margin-left: auto; width: 14px !important; height: 14px !important; opacity: .5 !important; }

.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--sidebar-border); display: flex; flex-direction: column; gap: 2px; }
.theme-toggle .icon-sun, .theme-toggle .label-light { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun, :root[data-theme="dark"] .theme-toggle .label-light { display: inline-block; }
:root[data-theme="dark"] .theme-toggle .icon-moon, :root[data-theme="dark"] .theme-toggle .label-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun, :root:not([data-theme="light"]) .theme-toggle .label-light { display: inline-block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon, :root:not([data-theme="light"]) .theme-toggle .label-dark { display: none; }
}

.user-card { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 12px 6px 2px 8px; border-top: 1px solid var(--sidebar-border); }
.user-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.user-name { color: #fff; font-weight: 650; font-size: .87rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { color: var(--sidebar-muted); font-size: .75rem; }
.user-card form { margin: 0; }

.avatar {
  width: 36px; height: 36px; flex: none; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-text);
  font-size: .78rem; font-weight: 750; letter-spacing: .02em;
}
.sidebar .avatar { background: rgba(125, 151, 255, .2); color: #d3dcff; }
.avatar-sm { width: 32px; height: 32px; font-size: .72rem; }

.topbar { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 1023px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 60; width: min(86vw, 300px);
    transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg);
  }
  .sidebar:target, .nav-open .sidebar { transform: none; }
  .sidebar .sidebar-close { display: inline-grid; }
  .sidebar-backdrop {
    display: block; position: fixed; inset: 0; z-index: 55;
    background: rgba(6, 9, 18, .55); opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .sidebar:target ~ .sidebar-backdrop, .nav-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  .topbar {
    position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 8px;
    height: 58px; padding: 0 12px; background: var(--surface); border-bottom: 1px solid var(--border);
  }
  .topbar .brand { font-size: .98rem; }
  .topbar .brand-mark { width: 28px; height: 28px; }
  .content { padding: 22px 16px 40px; }
  .app-footer { padding: 14px 16px 22px; }
}

/* ---------- En-tête de page ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 26px; }
.page-title { min-width: 0; }
.eyebrow { margin-bottom: 6px; color: var(--accent-text); font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.subtitle { margin-top: 6px; color: var(--text-2); }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Grilles ---------- */
.stack { display: flex; flex-direction: column; gap: 20px; }
.section-gap { margin-bottom: 22px; }
.grid { display: grid; gap: 20px; }
.grid-kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 24px; align-items: start; }
.section { margin-top: 20px; }
@media (max-width: 1180px) { .grid-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1240px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .split > .split-aside { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); align-items: start; }
  .split > .split-aside > .card:first-child { grid-row: span 2; }
}
@media (max-width: 560px) { .grid-kpi { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Cartes ---------- */
.card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 22px 0; }
.card-head p { margin-top: 3px; color: var(--text-3); font-size: .84rem; }
.card-head .link { font-size: .85rem; font-weight: 600; white-space: nowrap; }
.card-body { padding: 18px 22px 22px; }
.card-body.flush { padding: 14px 0 0; }
.card-foot {
  padding: 14px 22px; border-top: 1px solid var(--border);
  background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ---------- Indicateurs ---------- */
.kpi { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 12px; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--text-2); font-size: .85rem; font-weight: 600; }
.kpi-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.kpi-icon .icon { width: 18px; height: 18px; }
.kpi-icon.is-success { background: var(--success-soft); color: var(--success); }
.kpi-icon.is-warning { background: var(--warning-soft); color: var(--warning); }
.kpi-icon.is-danger { background: var(--danger-soft); color: var(--danger); }
.kpi-value { font-size: 1.9rem; font-weight: 750; letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: .95rem; font-weight: 600; color: var(--text-3); letter-spacing: 0; }
.kpi-sub { color: var(--text-3); font-size: .8rem; }
.delta { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.delta.is-up { background: var(--success-soft); color: var(--success); }
.delta.is-down { background: var(--danger-soft); color: var(--danger); }
.delta.is-flat { background: var(--surface-3); color: var(--text-2); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--radius);
  font-size: .9rem; font-weight: 650; line-height: 1; white-space: nowrap;
  cursor: pointer; user-select: none;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 1px 2px rgba(18, 26, 44, .18), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--surface-3); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--danger-strong); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-success { background: var(--success-strong); color: #fff; }
.btn-success:hover { filter: brightness(1.08); }
.btn-soft-success { background: var(--success-soft); color: var(--success); }
.btn-soft-success:hover { filter: brightness(.97); }
.btn-soft-danger { background: var(--danger-soft); color: var(--danger); }
.btn-soft-danger:hover { filter: brightness(.97); }
.btn-sm { height: 32px; padding: 0 11px; border-radius: 8px; font-size: .82rem; gap: 6px; }
.btn-sm .icon { width: 15px; height: 15px; }
.btn-lg { height: 48px; padding: 0 22px; border-radius: 12px; font-size: .98rem; }
.btn-block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: spin .7s linear infinite;
}

.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; padding: 0; border: 0; border-radius: 9px;
  background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.icon-btn .icon { width: 19px; height: 19px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Formulaires ---------- */
.form-stack { display: flex; flex-direction: column; gap: 20px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.label { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: .86rem; font-weight: 650; color: var(--text); }
.label .optional, .label .aside { font-weight: 500; font-size: .8rem; color: var(--text-3); }
.label a { font-weight: 600; font-size: .8rem; }
.input, .select, .textarea {
  width: 100%; min-width: 0;
  padding: 10px 13px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font-size: .95rem;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input, .select { height: 42px; }
.select {
  appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b94ad' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 16px;
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); opacity: .85; }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-2); color: var(--text-3); cursor: not-allowed; }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--danger); }
.input.is-invalid:focus, .textarea.is-invalid:focus { box-shadow: 0 0 0 3px var(--danger-soft); }
.hint { color: var(--text-3); font-size: .8rem; }
.field-error { display: flex; align-items: center; gap: 6px; color: var(--danger); font-size: .82rem; font-weight: 550; }
.field-error .icon { width: 15px; height: 15px; }
.input-wrap { position: relative; }
.input-wrap > .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-3); pointer-events: none; }
.input-wrap > .input { padding-left: 40px; }
.input-wrap.has-action > .input { padding-right: 46px; }
.input-action { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.input-action .icon-eye-off { display: none; }
.input-action[aria-pressed="true"] .icon-eye { display: none; }
.input-action[aria-pressed="true"] .icon-eye-off { display: inline-block; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 640px) { .form-row { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Badges, puces ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 9px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-2);
  font-size: .75rem; font-weight: 650; white-space: nowrap;
}
.badge .icon { width: 13px; height: 13px; stroke-width: 2.6; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 9px; border-radius: 7px;
  background: var(--surface-3); border: 1px solid var(--border);
  color: var(--text); font-size: .8rem; font-weight: 550; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.chip .icon { width: 13px; height: 13px; }
.chip-sender { font-family: var(--mono); font-size: .74rem; font-weight: 650; letter-spacing: .02em; color: var(--accent-text); background: var(--accent-soft); border-color: transparent; }
.chip.is-invalid { background: var(--danger-soft); color: var(--danger); border-color: transparent; cursor: help; }
.chip.is-more { background: transparent; border-style: dashed; color: var(--text-3); }
button.chip { cursor: pointer; }
button.chip:hover { border-color: var(--accent); }

/* ---------- Alertes ---------- */
.flash-stack { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.alert {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 14px 13px 16px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: .9rem;
}
.alert > .icon { width: 20px; height: 20px; margin-top: 1px; }
.alert-body { flex: 1; min-width: 0; }
.alert-title { font-weight: 700; }
.alert-title + .alert-text { margin-top: 2px; }
.alert-text { color: var(--text-2); }
.alert-text p + p, .alert-text p + ul, .alert-text ul + p { margin-top: 6px; }
.alert-text ul { padding-left: 18px; }
.alert-text strong { color: var(--text); }
.alert-close { width: 30px; height: 30px; margin: -4px -4px -4px 0; }
.alert-success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 22%, transparent); }
.alert-success > .icon, .alert-success .alert-title { color: var(--success); }
.alert-danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 22%, transparent); }
.alert-danger > .icon, .alert-danger .alert-title { color: var(--danger); }
.alert-warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 25%, transparent); }
.alert-warning > .icon, .alert-warning .alert-title { color: var(--warning); }
.alert-info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 22%, transparent); }
.alert-info > .icon, .alert-info .alert-title { color: var(--info); }
.alert .btn-row { margin-top: 10px; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .875rem; }
.table th {
  padding: 10px 16px; text-align: left; white-space: nowrap;
  background: var(--surface-2); color: var(--text-3);
  font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.table th:first-child, .table td:first-child { padding-left: 22px; }
.table th:last-child, .table td:last-child { padding-right: 22px; }
.table td { padding: 13px 16px; vertical-align: middle; border-bottom: 1px solid var(--border); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.cell-main { display: block; color: var(--text); font-weight: 600; }
.cell-sub { display: block; color: var(--text-3); font-size: .8rem; }
.cell-error { margin-top: 4px; max-width: 220px; white-space: normal; }
.cell-user { display: flex; align-items: center; gap: 11px; min-width: 0; }
.cell-user > div { min-width: 0; }
.cell-message { min-width: 220px; max-width: 420px; }
.message-toggle {
  display: block; width: 100%; padding: 0; border: 0; background: none;
  text-align: left; color: var(--text-2); cursor: pointer; font-size: .86rem; line-height: 1.45;
}
.message-clamp { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.message-toggle[aria-expanded="true"] .message-clamp { display: block; -webkit-line-clamp: unset; line-clamp: unset; }
.message-toggle:hover { color: var(--text); }

/* Historique : lignes compactes (destinataire · date / message / expéditeur · statut) sous 1320 px */
.history-table .c-status { min-width: 120px; }
.history-table .c-account { white-space: nowrap; color: var(--text-2); }
@media (max-width: 1320px) {
  .history-table thead { display: none; }
  .history-table, .history-table tbody { display: block; width: 100%; }
  .history-table tbody tr {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "recipient recipient date" "message message message" "sender account status";
    align-items: center; gap: 8px 12px; padding: 14px 22px; border-bottom: 1px solid var(--border);
  }
  .history-table tbody tr:last-child { border-bottom: 0; }
  .history-table td, .history-table td:first-child, .history-table td:last-child { display: block; padding: 0; border: 0; }
  .history-table tbody tr:hover { background: var(--surface-2); }
  .history-table tbody tr:hover td { background: none; }
  .history-table .c-recipient { grid-area: recipient; }
  .history-table .c-date { grid-area: date; text-align: right; }
  .history-table .c-date .cell-main, .history-table .c-date .cell-sub { display: inline; font-size: .8rem; color: var(--text-3); font-weight: 550; }
  .history-table .c-message { grid-area: message; min-width: 0; max-width: none; }
  .history-table .c-sender { grid-area: sender; }
  .history-table .c-account { grid-area: account; min-width: 0; color: var(--text-3); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .history-table .c-status { grid-area: status; text-align: right; min-width: 0; }
  .history-table .c-status .cell-error { margin-left: auto; }
  .history-table .c-recipient .cell-main, .history-table .c-recipient .cell-sub { display: inline; }
  .history-table .c-recipient .cell-sub { margin-left: 8px; }
}

/* ---------- Onglets, filtres, pagination ---------- */
.tabs { display: flex; gap: 2px; padding: 0 14px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 13px 10px 11px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  color: var(--text-2); font-size: .88rem; font-weight: 650; white-space: nowrap;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.is-active { color: var(--accent-text); border-bottom-color: var(--accent); }
.tab .count { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: .72rem; text-align: center; }
.tab.is-active .count { background: var(--accent-soft); color: var(--accent-text); }
.tab .count.is-attention { background: var(--warning-soft); color: var(--warning); }

.filters { display: grid; grid-template-columns: minmax(220px, 2.2fr) repeat(4, minmax(120px, 1fr)) auto; gap: 12px; align-items: end; }
.filters.is-admin { grid-template-columns: minmax(180px, 1.6fr) repeat(3, minmax(110px, 1fr)) repeat(2, minmax(134px, 1fr)) auto; }
.filters .field { gap: 6px; }
.filters .label { font-size: .78rem; color: var(--text-2); }
.filter-actions { display: flex; gap: 8px; }
@media (max-width: 1320px) {
  .filters, .filters.is-admin { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters .field-search { grid-column: 1 / -1; }
}
/* Historique admin avec le filtre « Groupe » : un champ de plus */
.filters.is-admin.has-groups { grid-template-columns: minmax(170px, 1.5fr) repeat(4, minmax(104px, 1fr)) repeat(2, minmax(130px, 1fr)) auto; }
@media (max-width: 1600px) {
  .filters.is-admin.has-groups { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .filters.is-admin.has-groups .field-search { grid-column: 1 / -1; }
}
@media (max-width: 1100px) { .filters.is-admin.has-groups { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .filters, .filters.is-admin, .filters.is-admin.has-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-actions { grid-column: 1 / -1; }
  .history-table tbody tr {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "recipient date" "message message" "sender status" "account status";
    padding: 14px 16px;
  }
  .history-table .c-status { align-self: start; }
  .history-table .c-status .cell-error { max-width: 150px; }
  .page-actions { width: 100%; }
}
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 22px; }
.toolbar .search { position: relative; flex: 1; max-width: 340px; min-width: 200px; }
.result-meta { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; color: var(--text-3); font-size: .84rem; }
.result-meta strong { color: var(--text); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 22px; border-top: 1px solid var(--border); color: var(--text-3); font-size: .84rem; }
.pager-links { display: flex; gap: 4px; align-items: center; }
.pager-links a, .pager-links span {
  min-width: 34px; height: 34px; padding: 0 9px; border-radius: 8px;
  display: inline-grid; place-items: center; color: var(--text-2); font-weight: 650;
}
.pager-links a:hover { background: var(--surface-3); text-decoration: none; }
.pager-links .is-current { background: var(--accent); color: var(--on-accent); }
.pager-links .is-disabled { opacity: .35; }
.pager-links .pager-gap { min-width: 20px; padding: 0; }
.pager-links .icon { width: 16px; height: 16px; }

/* ---------- États vides ---------- */
.empty { padding: 52px 24px; text-align: center; color: var(--text-3); }
.empty-icon { width: 54px; height: 54px; margin: 0 auto 16px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-3); }
.empty-icon .icon { width: 24px; height: 24px; }
.empty h3 { color: var(--text); margin-bottom: 4px; font-size: 1rem; }
.empty p { max-width: 42ch; margin: 0 auto; }
.empty-action { margin-top: 18px; }

/* ---------- Listes compactes ---------- */
.list { list-style: none; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 22px; border-top: 1px solid var(--border); }
.list-item:first-child { border-top: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { display: block; color: var(--text); font-weight: 600; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .meta { display: block; color: var(--text-3); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-dot { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; }
.status-dot .icon { width: 15px; height: 15px; stroke-width: 2.4; }
.status-dot.is-sent { background: var(--success-soft); color: var(--success); }
.status-dot.is-failed { background: var(--danger-soft); color: var(--danger); }

/* ---------- Graphiques ---------- */
.chart-box { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; margin: 6px 0 0; }
.chart-y { position: relative; width: 34px; height: 210px; color: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-y span { position: absolute; right: 0; transform: translateY(-50%); line-height: 1; white-space: nowrap; }
.chart-y .y4 { top: 0; }
.chart-y .y3 { top: 25%; }
.chart-y .y2 { top: 50%; }
.chart-y .y1 { top: 75%; }
.chart-y .y0 { top: 100%; }
.chart-plot { min-width: 0; }
.chart { display: block; width: 100%; height: 210px; overflow: visible; }
.chart-x { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); margin-top: 8px; color: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-x span { justify-self: center; white-space: nowrap; }
.chart-grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart-grid.is-base { stroke: var(--border-strong); }
.chart-hit { fill: transparent; }
.chart-col:hover .chart-hit { fill: var(--surface-3); }
.bar-sent { fill: var(--chart-sent); }
.bar-failed { fill: var(--chart-failed); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--text-2); font-size: .8rem; font-weight: 550; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend .is-sent { background: var(--chart-sent); }
.legend .is-failed { background: var(--chart-failed); }
.meter-svg { display: block; width: 100%; height: 6px; }
.meter-track { fill: var(--surface-3); }
.meter-fill { fill: var(--accent); }
.meter-fill.is-success { fill: var(--success-strong); }
.meter-fill.is-danger { fill: var(--chart-failed); }
.meter-fill.is-warning { fill: var(--warning-strong); }
.bar-cell { min-width: 140px; }
.bar-cell .meter-svg { margin-top: 6px; }

/* ---------- Composition du SMS ---------- */
.composer .card-body { display: flex; flex-direction: column; gap: 24px; }
.step { display: flex; flex-direction: column; gap: 10px; }
.step-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.step-title { display: flex; align-items: center; gap: 10px; font-size: .92rem; font-weight: 700; }
.step-num {
  width: 24px; height: 24px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-text); font-size: .76rem; font-weight: 800;
}
.sender-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.sender-option { position: relative; }
.sender-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sender-option span {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface);
  font-family: var(--mono); font-size: .84rem; font-weight: 700; letter-spacing: .02em; cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.sender-option span::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border-strong); flex: none;
  transition: border-color .15s, border-width .15s;
}
.sender-option span:hover { border-color: var(--accent); }
.sender-option input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent); }
.sender-option input:checked + span::before { border-color: var(--accent); border-width: 4px; }
.sender-option input:focus-visible + span { box-shadow: var(--ring); }
.sender-fixed { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sender-fixed .chip-sender { height: 34px; padding: 0 13px; font-size: .84rem; }

.counter-row { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; font-size: .8rem; color: var(--text-3); }
.counter-row .count { font-variant-numeric: tabular-nums; font-weight: 650; color: var(--text-2); }
.counter-row .count.is-over { color: var(--danger); }
.meter { height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; width: 0; height: 100%; border-radius: 4px; background: var(--accent); transition: width .15s ease, background .15s; }
.meter.is-warning > span { background: var(--warning-strong); }
.meter.is-over > span { background: var(--danger-strong); }
.encoding-alert .chips { margin-top: 8px; }
.encoding-alert .chip { font-family: var(--mono); background: var(--surface); }

.send-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px 20px; flex-wrap: wrap;
  padding: 16px 22px; border-top: 1px solid var(--border);
  background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.cost { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cost strong { font-size: .95rem; }
.cost span { color: var(--text-3); font-size: .8rem; }
.composer.is-disabled .card-body { opacity: .55; pointer-events: none; }

/* Aperçu téléphone */
.phone {
  width: 100%; max-width: 290px; margin: 0 auto; padding: 11px;
  border-radius: 40px; background: #0c111e;
  box-shadow: var(--shadow-lg), inset 0 0 0 2px #262f46;
}
.phone-screen { display: flex; flex-direction: column; min-height: 400px; border-radius: 30px; overflow: hidden; background: var(--phone-screen); }
.phone-notch { width: 92px; height: 22px; margin: 9px auto 0; border-radius: 12px; background: #0c111e; }
.phone-head { padding: 12px 14px 12px; text-align: center; border-bottom: 1px solid color-mix(in srgb, var(--phone-muted) 18%, transparent); }
.phone-avatar {
  width: 42px; height: 42px; margin: 0 auto 5px; border-radius: 50%;
  display: grid; place-items: center; background: linear-gradient(160deg, #a5afc6, #7f89a3); color: #fff;
}
.phone-avatar .icon { width: 20px; height: 20px; }
.phone-sender { color: var(--phone-text); font-size: .8rem; font-weight: 700; letter-spacing: .02em; }
.phone-body { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 14px 12px 16px; }
.phone-meta { color: var(--phone-muted); font-size: .68rem; text-align: center; margin-bottom: 4px; }
.bubble {
  align-self: flex-start; max-width: 88%;
  padding: 9px 13px; border-radius: 18px 18px 18px 6px;
  background: var(--phone-bubble); color: var(--phone-text);
  font-size: .86rem; line-height: 1.42; white-space: pre-wrap; overflow-wrap: anywhere;
}
.bubble.is-empty { color: var(--phone-muted); font-style: italic; }
.phone-foot { padding: 0 14px 14px; color: var(--phone-muted); font-size: .7rem; text-align: center; }

.mini-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mini-stat { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.mini-stat .value { display: block; font-size: 1.35rem; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.mini-stat .label-sm { color: var(--text-3); font-size: .78rem; font-weight: 600; }

/* Résultat d'envoi */
.result-card { overflow: hidden; }
.result-head { display: flex; align-items: center; gap: 14px; padding: 18px 22px; }
.result-icon { width: 44px; height: 44px; border-radius: 14px; flex: none; display: grid; place-items: center; }
.result-icon .icon { width: 22px; height: 22px; stroke-width: 2.2; }
.result-icon.is-success { background: var(--success-soft); color: var(--success); }
.result-icon.is-warning { background: var(--warning-soft); color: var(--warning); }
.result-icon.is-danger { background: var(--danger-soft); color: var(--danger); }
.result-head h2 { font-size: 1.05rem; }
.result-head p { color: var(--text-3); font-size: .85rem; margin-top: 2px; }
.result-head .icon-btn { margin-left: auto; }
.result-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--border); }
.result-stats > div { padding: 12px 22px; border-left: 1px solid var(--border); }
.result-stats > div:first-child { border-left: 0; }
.result-stats .value { display: block; font-size: 1.25rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.result-stats .label-sm { color: var(--text-3); font-size: .78rem; font-weight: 600; }
.result-details { border-top: 1px solid var(--border); padding: 14px 22px 18px; display: flex; flex-direction: column; gap: 14px; }
.result-details h3 { font-size: .84rem; margin-bottom: 8px; }
@media (max-width: 640px) {
  .result-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .result-stats > div:nth-child(3) { border-left: 0; }
  .result-stats > div:nth-child(n+3) { border-top: 1px solid var(--border); }
}

details.disclosure > summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--accent-text); font-weight: 650; font-size: .85rem; list-style: none; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary .icon { width: 16px; height: 16px; transition: transform .15s; }
details.disclosure[open] > summary .icon { transform: rotate(180deg); }
details.disclosure > div { margin-top: 10px; }

/* Superposition pendant l'envoi */
.sending-overlay { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 16px; background: rgba(6, 9, 18, .62); backdrop-filter: blur(3px); }
.sending-box { width: min(380px, 100%); padding: 30px 28px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-lg); text-align: center; }
.sending-box h2 { font-size: 1.1rem; }
.sending-box p { margin-top: 6px; color: var(--text-2); font-size: .9rem; }
.spinner { width: 42px; height: 42px; margin: 0 auto 18px; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Administration ---------- */
.attention-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.attention-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); }
.attention-row .grow { flex: 1; min-width: 160px; }
.attention-row form { margin: 0; }

.rank { list-style: none; }
.rank li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 11px 22px; border-top: 1px solid var(--border); align-items: center; }
.rank li:first-child { border-top: 0; }
.rank .meter-svg { grid-column: 1 / -1; }
.rank .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rank .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: .88rem; }
.rank .num { font-weight: 700; font-variant-numeric: tabular-nums; font-size: .88rem; }

.menu { position: relative; display: inline-block; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 230px;
  padding: 6px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); text-align: left;
}
.menu-pop form { margin: 0; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px;
  border: 0; border-radius: 8px; background: none; color: var(--text); font-size: .86rem; font-weight: 550;
  text-align: left; cursor: pointer;
}
.menu-item .icon { width: 17px; height: 17px; color: var(--text-3); }
.menu-item:hover { background: var(--surface-3); text-decoration: none; }
.menu-item.is-danger, .menu-item.is-danger .icon { color: var(--danger); }
.menu-sep { height: 1px; margin: 5px 4px; background: var(--border); }

.users-table .cell-main .badge { margin-left: 6px; vertical-align: 1px; height: 20px; padding: 0 7px; font-size: .7rem; }
.users-table .c-status .cell-sub { margin-top: 5px; }
.users-table .c-actions .btn-row { justify-content: flex-end; flex-wrap: nowrap; }
@media (max-width: 1320px) {
  .users-table thead { display: none; }
  .users-table, .users-table tbody { display: block; width: 100%; }
  .users-table tbody tr {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "user user actions" "status senders activity";
    align-items: center; gap: 12px 22px; padding: 16px 22px; border-bottom: 1px solid var(--border);
  }
  .users-table tbody tr:last-child { border-bottom: 0; }
  .users-table td, .users-table td:first-child, .users-table td:last-child { display: block; padding: 0; border: 0; }
  .users-table tbody tr:hover { background: var(--surface-2); }
  .users-table tbody tr:hover td { background: none; }
  .users-table .c-user { grid-area: user; }
  .users-table .c-actions { grid-area: actions; }
  .users-table .c-status { grid-area: status; padding-left: 47px; }
  .users-table .c-senders { grid-area: senders; }
  .users-table .c-activity { grid-area: activity; text-align: right; }
}
@media (max-width: 640px) {
  .users-table tbody tr { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "user actions" "status status" "senders senders" "activity activity"; padding: 14px 16px; }
  .users-table .c-status { padding-left: 0; }
  .users-table .c-activity { text-align: left; }
  .users-table .c-actions .btn-row { flex-wrap: wrap; }
}
.sender-cell { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sender-cell .icon-btn { width: 28px; height: 28px; }
.sender-cell .icon-btn .icon { width: 15px; height: 15px; }

/* Boîtes de dialogue */
dialog.modal {
  width: min(480px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border); border-radius: 18px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
dialog.modal::backdrop { background: rgba(6, 9, 18, .55); backdrop-filter: blur(2px); }
.modal-inner { margin: 0; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 22px 24px 0; }
.modal-icon { width: 38px; height: 38px; border-radius: 12px; flex: none; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.modal-icon.is-danger { background: var(--danger-soft); color: var(--danger); }
.modal-icon .icon { width: 19px; height: 19px; }
.modal-head h2 { font-size: 1.08rem; }
.modal-body { padding: 14px 24px 4px; color: var(--text-2); font-size: .92rem; }
.modal-body .field { margin-top: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 20px 24px 22px; flex-wrap: wrap; }

/* Notifications éphémères */
.toast-zone { position: fixed; right: 20px; bottom: 20px; z-index: 150; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.toast {
  display: flex; align-items: center; gap: 14px; max-width: min(420px, calc(100vw - 40px));
  padding: 12px 12px 12px 16px; border-radius: 12px; background: #141c2f; color: #eef1fa;
  box-shadow: var(--shadow-lg); font-size: .87rem; animation: toast-in .2s ease-out;
}
.toast button { border: 0; background: none; color: #a9b9ff; font-weight: 700; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.toast button:hover { background: rgba(255, 255, 255, .08); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Connexion / inscription ---------- */
.auth-body { background: var(--surface); }
.auth { display: grid; grid-template-columns: minmax(440px, 1fr) minmax(0, 1.05fr); min-height: 100vh; }
.auth-aside {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 40px;
  padding: 40px 52px 48px; color: #e7ebff;
  background:
    radial-gradient(900px 520px at -10% -15%, rgba(77, 107, 240, .55), transparent 60%),
    radial-gradient(700px 480px at 115% 105%, rgba(19, 179, 138, .35), transparent 55%),
    #0d1426;
}
.auth-aside::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, .9), transparent 70%);
}
.auth-aside > * { position: relative; z-index: 1; }
.auth-pitch { margin-top: 8vh; }
.auth-pitch h2 { max-width: 15ch; color: #fff; font-size: clamp(1.8rem, 2.6vw, 2.35rem); font-weight: 750; line-height: 1.12; letter-spacing: -.03em; }
.auth-pitch > p { max-width: 42ch; margin-top: 14px; color: #b8c2e6; font-size: 1rem; }
.auth-points { list-style: none; margin-top: 22px; display: flex; flex-direction: column; gap: 10px; color: #dfe5ff; font-size: .92rem; }
.auth-points li { display: flex; align-items: center; gap: 10px; }
.auth-points .icon { width: 18px; height: 18px; padding: 3px; border-radius: 50%; background: rgba(79, 211, 148, .18); color: #6fe0a9; stroke-width: 2.6; box-sizing: content-box; }
.auth-visual { margin-top: auto; display: flex; flex-direction: column; gap: 12px; max-width: 420px; }
.notif {
  display: flex; gap: 12px; padding: 13px 15px; border-radius: 16px;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12);
  backdrop-filter: blur(10px); color: #e9edff; font-size: .84rem; line-height: 1.4;
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .5);
}
.notif:nth-child(2) { margin-left: 28px; opacity: .85; }
.notif:nth-child(3) { margin-left: 56px; opacity: .65; }
.notif-icon { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; background: #3ccf7d; color: #fff; }
.notif-icon .icon { width: 18px; height: 18px; }
.notif-top { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 2px; font-size: .78rem; }
.notif-top strong { font-family: var(--mono); letter-spacing: .03em; color: #fff; }
.notif-top span { color: #9aa6cc; }

.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 48px 24px 28px; background: var(--surface); }
.auth-card { width: 100%; max-width: 400px; }
.auth-brand-mobile { display: none; margin-bottom: 30px; }
.auth-head { margin-bottom: 26px; }
.auth-head h1 { font-size: 1.75rem; }
.auth-head p { margin-top: 8px; color: var(--text-2); }
.auth-card .flash-stack, .auth-card .alert { margin-bottom: 20px; }
.auth-switch { margin-top: 24px; text-align: center; color: var(--text-2); font-size: .9rem; }
.forgot-link { align-self: flex-end; font-size: .82rem; font-weight: 600; }
.auth-legal { color: var(--text-3); font-size: .8rem; }
.auth-legal a { color: var(--text-3); text-decoration: underline; }
.success-panel { text-align: center; }
.success-panel .result-icon { margin: 0 auto 16px; width: 56px; height: 56px; border-radius: 18px; }
.success-panel .result-icon .icon { width: 28px; height: 28px; }
.success-panel h1 { font-size: 1.5rem; }
.success-panel p { margin-top: 10px; color: var(--text-2); }
.success-panel .btn { margin-top: 24px; }
@media (max-width: 960px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { display: none; }
  .auth-brand-mobile { display: inline-flex; }
  .auth-main { justify-content: flex-start; padding-top: 40px; }
}

/* ---------- Pages d'erreur ---------- */
.error-page { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.error-box { max-width: 460px; text-align: center; }
.error-box h1 { margin: 8px 0 10px; }
.error-box p { color: var(--text-2); }
.error-box .btn { margin-top: 22px; }
.error-code { font-size: 4rem; font-weight: 800; letter-spacing: -.04em; color: var(--accent-text); line-height: 1; }

/* ---------- Divers ---------- */
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; }
.profile-grid dt { color: var(--text-3); font-size: .78rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.profile-grid dd { margin: 4px 0 0; font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 640px) { .profile-grid { grid-template-columns: minmax(0, 1fr); } }
.kbd { font-family: var(--mono); font-size: .8em; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border-strong); background: var(--surface-2); }
.secret-box { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px dashed var(--border-strong); font-family: var(--mono); font-size: 1rem; font-weight: 700; letter-spacing: .04em; }

/* =========================================================================
   Envoi de masse
   ========================================================================= */
.segmented { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); max-width: 100%; overflow-x: auto; }
.segment { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 9px; color: var(--text-2); font-size: .88rem; font-weight: 650; white-space: nowrap; }
.segment .icon { width: 17px; height: 17px; }
.segment:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.segment.is-active { background: var(--accent-soft); color: var(--accent-text); }
.segment .count { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: .72rem; text-align: center; }
.segment.is-active .count { background: var(--surface); color: var(--accent-text); }

mark.var { padding: 0 4px; border-radius: 5px; background: var(--accent-soft); color: var(--accent-text); font-family: var(--mono); font-size: .88em; font-weight: 650; }

.onboarding { max-width: 620px; margin: 0 auto; padding: 44px 24px; text-align: center; }
.onboarding .empty-icon { margin-bottom: 16px; background: var(--accent-soft); color: var(--accent-text); }
.onboarding h2 { font-size: 1.25rem; }
.onboarding > p { margin-top: 8px; color: var(--text-2); }
.steps-list { margin: 22px 0 24px; padding: 0; list-style: none; counter-reset: step; text-align: left; display: flex; flex-direction: column; gap: 10px; }
.steps-list li { position: relative; padding: 12px 14px 12px 50px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: .9rem; counter-increment: step; }
.steps-list li::before { content: counter(step); position: absolute; left: 14px; top: 11px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font-size: .78rem; font-weight: 800; }
.steps-list strong { color: var(--text); }
.onboarding .btn-row { justify-content: center; }

/* 360 px minimum : les trois boutons du pied de carte tiennent sur une ligne (sinon ils passent à la ligne) */
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 18px; }
.preset-card { display: flex; flex-direction: column; gap: 12px; padding: 18px 18px 16px; }
.preset-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.preset-title { min-width: 0; }
.preset-title h2 { font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preset-title h2 a { color: var(--text); }
.preset-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.preset-message { flex: 1; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: var(--text-2); font-size: .88rem; line-height: 1.5; white-space: pre-line; }
.preset-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.preset-foot-actions { display: flex; gap: 8px; margin-left: auto; }
.preset-new { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 200px; border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); color: var(--text-2); font-weight: 650; }
.preset-new .empty-icon { margin: 0; }
.preset-new:hover { border-color: var(--accent); color: var(--accent-text); text-decoration: none; background: var(--accent-soft); }
.job-row .meter-svg { margin-top: 6px; max-width: 360px; }

/* =========================================================================
   Administration : expéditeurs et groupes d'expéditeurs
   ========================================================================= */
.period-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }
.period-custom { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 6px; border-radius: 12px; border: 1px solid transparent; }
.period-custom.is-active { border-color: var(--accent); background: var(--accent-soft); }
.period-custom .input-sm { width: auto; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; margin-bottom: 14px; }
.block-head h2 { font-size: 1.05rem; }
.block-head p { color: var(--text-3); font-size: .85rem; }
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 18px; }
.group-card { display: flex; flex-direction: column; gap: 14px; padding: 18px; }
.group-card.is-ungrouped { background: var(--surface-2); box-shadow: none; border-style: dashed; }
.group-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.group-title { min-width: 0; }
.group-title h3 { font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.group-figures .value { display: block; font-size: 1.3rem; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.group-figures > div:first-child .value { font-size: 1.6rem; color: var(--accent-text); }
.group-figures .label-sm { color: var(--text-3); font-size: .76rem; font-weight: 600; }
.group-share { display: flex; flex-direction: column; gap: 6px; }
.group-new { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 220px; border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); background: none; color: var(--text-2); font: inherit; font-weight: 650; cursor: pointer; }
.group-new .empty-icon { margin: 0; }
.group-new:hover { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.group-new:focus-visible { outline: none; box-shadow: var(--ring); }

.senders-table .c-sender .badge { margin-left: 6px; }
.senders-table .c-groups .chips { gap: 4px; }
.senders-table .c-share { min-width: 120px; }
.senders-table .c-accounts, .senders-table .c-last { color: var(--text-2); }
.senders-table .c-last { white-space: nowrap; }
@media (max-width: 900px) {
  .senders-table thead { display: none; }
  .senders-table, .senders-table tbody { display: block; width: 100%; }
  .senders-table tbody tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-areas: "sender sender sent" "groups groups groups" "failed credits last" "share share share" "accounts accounts accounts"; gap: 10px 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
  .senders-table td, .senders-table td:first-child, .senders-table td:last-child { display: block; padding: 0; border: 0; text-align: left; }
  .senders-table tbody tr:hover td { background: none; }
  .senders-table .num { text-align: left; }
  .senders-table .c-sender { grid-area: sender; }
  .senders-table .c-sent { grid-area: sent; text-align: right; font-size: 1.1rem; }
  .senders-table .c-groups { grid-area: groups; }
  .senders-table .c-groups.is-empty { display: none; }
  .senders-table .c-failed { grid-area: failed; }
  .senders-table .c-credits { grid-area: credits; }
  .senders-table .c-last { grid-area: last; white-space: normal; }
  .senders-table .c-share { grid-area: share; min-width: 0; }
  .senders-table .c-accounts { grid-area: accounts; }
  .senders-table td[data-label]::before { content: attr(data-label); display: block; color: var(--text-3); font-size: .7rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
}

.group-senders { border: 0; padding: 0; margin: 0; min-width: 0; }
.group-senders legend { margin-bottom: 8px; padding: 0; }
.group-senders [data-group-filter] { margin-bottom: 8px; }
.sender-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); gap: 6px; max-height: 260px; overflow-y: auto; padding: 2px; }
.sender-check { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.sender-check:hover { border-color: var(--border-strong); }
.sender-check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.sender-check input { flex: none; width: 16px; height: 16px; accent-color: var(--accent); }
.sender-check .cell-sub { margin-left: auto; font-size: .76rem; white-space: nowrap; }
.sender-check[hidden] { display: none; }

/* Champ destinataires : jetons + suggestions de l'annuaire */
.recipient-field { position: relative; }
.token-box {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 50px; padding: 7px 8px;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); cursor: text;
  transition: border-color .15s, box-shadow .15s;
}
.token-box:hover { border-color: var(--text-3); }
.token-box:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.token-box.is-invalid { border-color: var(--danger); }
.tokens { display: contents; }
.token {
  display: inline-flex; align-items: center; gap: 7px; max-width: 100%; height: 32px; padding: 0 3px 0 10px;
  border-radius: 8px; background: var(--accent-soft); color: var(--text); font-size: .85rem;
}
.token.is-unknown { background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--border-strong); }
.token-label { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.token-sub { color: var(--text-3); font-size: .76rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.token-remove { display: inline-grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--text-3); cursor: pointer; font-size: 1.05rem; line-height: 1; }
.token-remove:hover { background: color-mix(in srgb, var(--text) 10%, transparent); color: var(--text); }
.token-more { height: 32px; padding: 0 12px; border: 1px dashed var(--border-strong); border-radius: 8px; background: none; color: var(--text-2); font-weight: 650; font-size: .82rem; cursor: pointer; }
.token-more:hover { border-color: var(--accent); color: var(--accent-text); }
.token-input { flex: 1; min-width: 200px; height: 32px; padding: 0 6px; border: 0; outline: 0; background: transparent; color: var(--text); font-size: .95rem; }
.token-input::placeholder { color: var(--text-3); }
.suggestions {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 25; max-height: 330px; overflow-y: auto;
  margin: 0; padding: 6px; list-style: none; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-lg);
}
.suggestion { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; cursor: pointer; }
.suggestion:hover, .suggestion.is-active { background: var(--surface-3); }
.suggestion .grow { flex: 1; min-width: 0; }
.suggestion .title { display: block; font-weight: 650; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggestion .meta { display: block; color: var(--text-3); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggestion .kbd, .suggestion .badge { flex: none; }
.suggestion mark { padding: 0 1px; border-radius: 3px; background: var(--accent-soft); color: var(--accent-text); font-weight: 700; }
.suggestion.is-empty { color: var(--text-3); cursor: default; font-size: .88rem; }
.suggestion.is-empty:hover { background: none; }
.suggestion .avatar { background: var(--accent-soft); }
.suggestion .avatar.is-new { background: var(--success-soft); color: var(--success); }
.recipients-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px 14px; flex-wrap: wrap; }

.preview-for { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.tips { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.tips li { display: flex; gap: 10px; color: var(--text-2); font-size: .86rem; }
.tips .icon { margin-top: 2px; color: var(--accent-text); }

/* Boîtes de dialogue de l'annuaire */
dialog.modal-lg { width: min(660px, calc(100vw - 32px)); }
.contact-rows { display: flex; flex-direction: column; gap: 10px; max-height: 46vh; overflow-y: auto; margin-top: 14px; padding: 2px; }
.contact-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1.2fr); gap: 8px; align-items: center; }
.contact-row .chip { justify-content: center; height: 42px; font-size: .86rem; }
.contact-row .input { height: 42px; }
@media (max-width: 640px) {
  .contact-row { grid-template-columns: minmax(0, 1fr); padding-bottom: 10px; border-bottom: 1px solid var(--border); }
  .contact-row .chip { justify-content: flex-start; height: 30px; }
}
.picker-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0 8px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .86rem; font-weight: 650; color: var(--text); cursor: pointer; }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
.picker-list { list-style: none; max-height: 46vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; }
.picker-item label { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--border); cursor: pointer; }
.picker-item:first-child label { border-top: 0; }
.picker-item label:hover { background: var(--surface-2); }
.picker-item .grow { flex: 1; min-width: 0; }
.picker-item .title { display: block; font-weight: 650; font-size: .9rem; color: var(--text); }
.picker-item .meta { display: block; color: var(--text-3); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-item.is-added label { cursor: default; opacity: .6; }
.picker-empty { padding: 26px 16px; text-align: center; color: var(--text-3); font-size: .88rem; }

/* Lancement et suivi */
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; margin: 0; }
.summary-grid dt { color: var(--text-3); font-size: .76rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.summary-grid dd { margin: 4px 0 0; font-weight: 650; font-size: 1.02rem; }
.summary-grid dd .muted { font-size: .82rem; font-weight: 500; }
.section-title { margin-bottom: 10px; color: var(--text-2); font-size: .78rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.samples { list-style: none; display: flex; flex-direction: column; gap: 14px; }
.sample-bubble { display: block; max-width: 100%; margin-top: 6px; }
.recipient-list { max-height: 520px; overflow-y: auto; }
.recipient-list .avatar { background: var(--surface-3); color: var(--text-2); }
.job-card .result-head p { margin-top: 2px; }
.job-badge { margin-left: auto; }
.result-icon.is-accent { background: var(--accent-soft); color: var(--accent-text); }
.job-body { display: flex; flex-direction: column; gap: 14px; padding: 0 22px 20px; }
.job-stats { border: 1px solid var(--border); border-radius: 12px; }
.job-note:empty { display: none; }
progress.progress { width: 100%; height: 12px; border: 0; border-radius: 999px; overflow: hidden; background: var(--surface-3); appearance: none; -webkit-appearance: none; }
progress.progress::-webkit-progress-bar { background: var(--surface-3); border-radius: 999px; }
progress.progress::-webkit-progress-value { background: linear-gradient(90deg, var(--accent), var(--chart-sent)); border-radius: 999px; transition: width .3s ease; }
progress.progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }

/* Annuaire */
.contact-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .8fr) minmax(0, 1.3fr) auto; gap: 12px; align-items: end; }
.contact-form .field { gap: 6px; }
.contact-form-error { grid-column: 1 / -1; }
@media (max-width: 900px) { .contact-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } .contact-form .field-wide { grid-column: 1 / -1; } }
@media (max-width: 560px) { .contact-form { grid-template-columns: minmax(0, 1fr); } }
.contacts-table .c-actions .btn-row { justify-content: flex-end; flex-wrap: nowrap; gap: 2px; }
.contacts-table .c-actions form { margin: 0; }
@media (max-width: 760px) {
  .contacts-table thead { display: none; }
  .contacts-table, .contacts-table tbody { display: block; width: 100%; }
  .contacts-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name actions" "phone usage"; gap: 6px 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .contacts-table td, .contacts-table td:first-child, .contacts-table td:last-child { display: block; padding: 0; border: 0; }
  .contacts-table tbody tr:hover td { background: none; }
  .contacts-table .c-name { grid-area: name; }
  .contacts-table .c-actions { grid-area: actions; }
  .contacts-table .c-phone { grid-area: phone; padding-left: 43px; color: var(--text-2); }
  .contacts-table .c-usage { grid-area: usage; text-align: right; font-size: .82rem; }
}

/* =========================================================================
   Envois programmés
   ========================================================================= */
.choice-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 640px) { .choice-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice span {
  display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 6px 12px; line-height: 1.25;
  border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface);
  font-size: .87rem; font-weight: 650; cursor: pointer; transition: border-color .15s, background .15s, color .15s;
}
.choice span .icon { width: 17px; height: 17px; color: var(--text-3); }
.choice span:hover { border-color: var(--accent); }
.choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent); }
.choice input:checked + span .icon { color: var(--accent-text); }
.choice input:focus-visible + span { box-shadow: var(--ring); }

.day-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.day input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.day span {
  display: inline-grid; place-items: center; width: 52px; height: 40px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface); font-size: .85rem; font-weight: 650; cursor: pointer;
}
.day span:hover { border-color: var(--accent); }
.day input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.day input:focus-visible + span { box-shadow: var(--ring); }

.inline-field { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--text-2); font-size: .9rem; }
.input-sm { width: 96px; height: 38px; }
.select-sm { width: auto; min-width: 90px; height: 38px; }
.end-options { display: flex; flex-direction: column; gap: 10px; }
.radio-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .9rem; color: var(--text); cursor: pointer; }
.radio-line input[type="radio"] { width: 17px; height: 17px; accent-color: var(--accent); }
.radio-line .input { width: auto; }
.radio-line input[type="date"].input { width: 170px; }

.upcoming { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.upcoming li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: .88rem; }
.upcoming li .icon { color: var(--text-3); }
.upcoming li.is-next { border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: var(--accent-soft); color: var(--accent-text); font-weight: 650; }
.upcoming li.is-next .icon { color: var(--accent-text); }
.upcoming li.muted { background: none; border-style: dashed; }

.schedule-list { display: flex; flex-direction: column; gap: 16px; }
.schedule-card { overflow: hidden; scroll-margin-top: 80px; }
.schedule-card:target, .schedule-card.is-highlight { box-shadow: var(--ring), var(--shadow); }
.schedule-main { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(200px, auto); gap: 16px 18px; padding: 18px 22px; }
.schedule-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.schedule-card.is-paused .schedule-icon { background: var(--warning-soft); color: var(--warning); }
.schedule-card.is-done .schedule-icon { background: var(--surface-3); color: var(--text-3); }
.schedule-icon .icon { width: 21px; height: 21px; }
.schedule-text { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.schedule-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.schedule-title h2 { font-size: 1.02rem; }
.schedule-rule { color: var(--text); font-weight: 600; font-size: .9rem; }
.schedule-next { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); align-self: start; }
.schedule-next .label-sm { color: var(--text-3); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.schedule-next strong { font-size: 1rem; }
.schedule-alert { padding: 0 22px 14px; }
.schedule-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; padding: 12px 22px; border-top: 1px solid var(--border); background: var(--surface-2); }
.schedule-foot form { margin: 0; }
@media (max-width: 900px) {
  .schedule-main { grid-template-columns: auto minmax(0, 1fr); }
  .schedule-next { grid-column: 1 / -1; }
}
.preset-schedule { display: inline-flex; align-items: center; gap: 7px; font-size: .82rem; font-weight: 650; color: var(--accent-text); }
.preset-schedule .icon { width: 15px; height: 15px; }
.badge-neutral { background: var(--surface-3); color: var(--text-2); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
