/* CRM Farm content — style « verre clair » (cahier des charges, section 13).
   Toutes les couleurs passent par des variables : le thème sombre redéfinit ses propres
   gris (ce n'est pas une inversion) et l'accent choisi dans « Personnaliser » se propage
   partout grâce à color-mix(). */

/* ---------- 1. Couleurs et mesures ---------- */
:root {
  color-scheme: light;
  --bg: #f7f8fb; --surface: #ffffff; --surface-2: #f4f5f9; --thead: #fafafd;
  --border: #e7e9f0; --border-strong: #d6d9e4;
  --text: #15171f; --text-2: #4b5063; --muted: #676c7f; --faint: #8d92a4;
  --accent: #6c5ce7;
  --green: #1f8a52; --green-bg: #e5f5ec; --red: #d2404e; --red-bg: #fdecee;
  --amber: #c77a12; --amber-bg: #fff3df; --blue: #2f6fe0; --blue-bg: #e8f0fd;
  --mint: #0f7a6b; --mint-bg: #dff5ef; --peach: #b4520f; --peach-bg: #feeadb;
  --pink: #a8326e; --pink-bg: #fdeaf3; --teal: #0f6f76; --teal-bg: #e7f6f7;
  --glass: rgba(255, 255, 255, .72); --glass-border: rgba(214, 217, 228, .7);
  --shadow: 0 1px 2px rgba(20, 23, 31, .04), 0 2px 8px rgba(20, 23, 31, .04);
  --shadow-up: 0 4px 10px rgba(20, 23, 31, .06), 0 12px 28px rgba(20, 23, 31, .07);
  --shadow-pop: 0 10px 30px rgba(20, 23, 31, .14), 0 2px 6px rgba(20, 23, 31, .06);
  --wash-opacity: .2;
  --radius-card: 14px; --radius: 10px;
  --pad-card: 20px; --row-pad: 10px; --nav-h: 28px;
  /* Déclinaisons de l'accent : calculées, jamais écrites en dur. */
  --accent-hover: color-mix(in srgb, var(--accent) 84%, black);
  --accent-soft: color-mix(in srgb, var(--accent) 12%, var(--surface));
  --accent-softer: color-mix(in srgb, var(--accent) 6%, var(--surface));
  --accent-text: color-mix(in srgb, var(--accent) 82%, var(--text));
  --accent-ring: color-mix(in srgb, var(--accent) 26%, transparent);
  --accent-light: color-mix(in srgb, var(--accent) 45%, white);
}
/* Thème sombre : ses propres gris bleutés, accent un peu éclairci pour rester lisible. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1015; --surface: #161920; --surface-2: #1d2029; --thead: #1a1d25;
  --border: #272b36; --border-strong: #353a48;
  --text: #e9ebf2; --text-2: #b7bccb; --muted: #959bad; --faint: #737a8e;
  --green: #4cc488; --green-bg: #15301f; --red: #f0707b; --red-bg: #3a1a1f;
  --amber: #f0b25a; --amber-bg: #352813; --blue: #79a6ff; --blue-bg: #17243d;
  --mint: #4fd1bd; --mint-bg: #10302b; --peach: #f39a5c; --peach-bg: #3a2416;
  --pink: #f08cbd; --pink-bg: #3a1a2a; --teal: #5fd0d7; --teal-bg: #102d30;
  --glass: rgba(22, 25, 32, .74); --glass-border: rgba(53, 58, 72, .7);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-up: 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-pop: 0 14px 40px rgba(0, 0, 0, .55);
  --wash-opacity: .12;
  --accent-hover: color-mix(in srgb, var(--accent) 80%, white);
  --accent-soft: color-mix(in srgb, var(--accent) 22%, var(--surface));
  --accent-softer: color-mix(in srgb, var(--accent) 10%, var(--surface));
  --accent-text: color-mix(in srgb, var(--accent) 55%, white);
  --accent-light: color-mix(in srgb, var(--accent) 60%, var(--surface));
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    color-scheme: dark;
    --bg: #0e1015; --surface: #161920; --surface-2: #1d2029; --thead: #1a1d25;
    --border: #272b36; --border-strong: #353a48;
    --text: #e9ebf2; --text-2: #b7bccb; --muted: #959bad; --faint: #737a8e;
    --green: #4cc488; --green-bg: #15301f; --red: #f0707b; --red-bg: #3a1a1f;
    --amber: #f0b25a; --amber-bg: #352813; --blue: #79a6ff; --blue-bg: #17243d;
    --mint: #4fd1bd; --mint-bg: #10302b; --peach: #f39a5c; --peach-bg: #3a2416;
    --pink: #f08cbd; --pink-bg: #3a1a2a; --teal: #5fd0d7; --teal-bg: #102d30;
    --glass: rgba(22, 25, 32, .74); --glass-border: rgba(53, 58, 72, .7);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-up: 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-pop: 0 14px 40px rgba(0, 0, 0, .55);
    --wash-opacity: .12;
    --accent-hover: color-mix(in srgb, var(--accent) 80%, white);
    --accent-soft: color-mix(in srgb, var(--accent) 22%, var(--surface));
    --accent-softer: color-mix(in srgb, var(--accent) 10%, var(--surface));
    --accent-text: color-mix(in srgb, var(--accent) 55%, white);
    --accent-light: color-mix(in srgb, var(--accent) 60%, var(--surface));
  }
}
:root[data-density="dense"] { --pad-card: 14px; --row-pad: 6px; --nav-h: 26px; }

/* ---------- 2. Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.5 Inter, "Inter var", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased;
}
:root[data-density="dense"] body { font-size: 13.5px; }
/* Lavis de couleur fixe en haut de page, fondu vers le bas. */
body::before {
  content: ""; position: fixed; inset: 0 0 auto 0; height: 640px; z-index: 0; pointer-events: none;
  background: linear-gradient(104deg, var(--mint) 0%, var(--accent-light) 50%, var(--peach) 100%);
  opacity: var(--wash-opacity);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, transparent 100%);
}
a { color: var(--accent-text); }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { letter-spacing: -.01em; }
.num, td.num, .kpi-value { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.break { word-break: break-all; }
.pre { white-space: pre-wrap; }
.big { font-size: 20px; font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.warn-text { color: var(--peach); }
.ok-text { color: var(--green); }
.error-text { color: var(--red); max-width: 420px; }
.clamp, .clip { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip { max-width: 360px; }
code, .perm { font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); color: var(--text); border-radius: 5px; padding: 1px 5px; }
.perm { display: inline-block; margin: 1px 0; }
.perm-implied { color: var(--faint); }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ic-sm { width: 14px; height: 14px; }
kbd, .kbd { font: 600 11px/1 Inter, system-ui, sans-serif; color: var(--faint); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px; padding: 3px 6px; background: var(--surface); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- 3. Ossature : la page ne défile pas, menu et zone principale défilent chacun ---------- */
.shell { position: relative; z-index: 1; display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
.sidebar {
  width: 240px; flex: none; display: flex; flex-direction: column; overflow-y: auto; padding: 16px 12px 12px;
  background: var(--glass); border-right: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; padding: 0 8px 14px; letter-spacing: -.01em; }
.brand-name { flex: 1; min-width: 0; }
.brand-center { justify-content: center; padding-bottom: 6px; }
.logo { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; color: #fff; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--mint)));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 2px 6px var(--accent-ring); }
.sidebar .sidebar-close { display: none; }
.shift-pill { display: flex; align-items: center; gap: 8px; margin: 0 4px 6px; padding: 6px 10px; border-radius: 999px; background: var(--green-bg); color: var(--green); font-weight: 600; font-size: 12.5px; text-decoration: none; }
.shift-pill:hover { color: var(--green); filter: brightness(.97); }
.nav { display: block; }
.nav a { display: flex; align-items: center; gap: 9px; height: var(--nav-h); padding: 0 8px 0 9px; margin: 1px 0; border-radius: 8px; color: var(--text-2); text-decoration: none; font-weight: 500; }
.nav a .ic { width: 17px; height: 17px; color: var(--faint); }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav a.active .ic { color: var(--accent); }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-section { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin: 14px 10px 4px; font-variant: all-small-caps; font-size: 12px; }
.nav-badge { font-size: 11px; padding: 0 7px; line-height: 18px; }
.me { position: relative; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.me-btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.me-btn:hover { background: var(--surface-2); }
.me-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.me-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-role { font-size: 12px; color: var(--accent-text); font-weight: 600; }
.me-mail { word-break: break-all; }
.me-avatar { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--accent-text); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); }
.me-avatar-btn { cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; padding: 0; }
.main { flex: 1; min-width: 0; overflow-y: auto; overflow-x: hidden; scroll-padding-top: 72px; }
.page { padding: 22px 32px 40px; max-width: 1240px; }

/* Bandeau collant de 56 px en verre */
.topbar {
  position: sticky; top: 0; z-index: 20; height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 24px 0 32px;
  background: var(--glass); border-bottom: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4);
}
.topbar .menu-btn { display: none; }
.search { position: relative; flex: 1 1 auto; max-width: 440px; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 11px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); color: var(--faint); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.search input[type="search"] { flex: 1; min-width: 0; border: 0; padding: 0; height: 100%; background: transparent; box-shadow: none; }
.search input[type="search"]:focus { box-shadow: none; }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 6px; max-height: 70vh; overflow-y: auto; }
.search-item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; color: var(--text); text-decoration: none; }
.search-item:hover, .search-item.is-on { background: var(--accent-soft); color: var(--text); }
.search-item .si-main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-foot { display: block; padding: 7px 8px 3px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--border); margin-top: 4px; }
.search-empty { padding: 10px 8px; color: var(--muted); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn { position: relative; width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; text-decoration: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.bell-on { color: var(--accent-text); }
.bell-count { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; border: 2px solid var(--surface); box-sizing: content-box; }
.sync-pill { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); font-size: 12.5px; font-weight: 500; text-decoration: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sync-pill:hover { color: var(--text); background: var(--surface-2); }
.sync-pill.is-running { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.top-user { position: relative; }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 6px; }
.dropdown-up { top: auto; bottom: calc(100% + 6px); left: 0; right: 0; }
.dropdown-head { display: flex; flex-direction: column; padding: 6px 8px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.dropdown form { margin: 0; }
.dropdown-item { width: 100%; display: flex; align-items: center; gap: 9px; padding: 7px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.dropdown-item:hover { background: var(--surface-2); color: var(--text); }
.dropdown-item .ic { color: var(--muted); }
.scrim { display: none; }

/* En-tête de page */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head-text { min-width: 0; flex: 1 1 320px; }
.page-head h1 { font-size: 26px; line-height: 1.2; margin: 0 0 4px; font-weight: 700; letter-spacing: -.02em; overflow-wrap: anywhere; }
.page-head h1 .who { gap: 12px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.page-actions:empty { display: none; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent-text); }
.crumb-sep { color: var(--faint); }
.subtitle { color: var(--muted); margin: 0; }

/* ---------- 4. Composants ---------- */
.card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: var(--pad-card); box-shadow: var(--shadow); max-width: 760px; transition: box-shadow .2s ease, transform .2s ease; }
.card:hover { box-shadow: var(--shadow-up); }
.card + .card { margin-top: 16px; }
.card-wide { max-width: none; }
.card h2 { font-size: 15.5px; font-weight: 650; margin: 0 0 12px; }
.card h3 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 0 6px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Pastilles pleines arrondies : texte foncé sur fond pastel */
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 18px; background: var(--surface-2); color: var(--text-2); border: 1px solid transparent; white-space: nowrap; vertical-align: 1px; }
.badge-ok, .badge-exacte { background: var(--green-bg); color: var(--green); }
.badge-off, .badge-grave { background: var(--red-bg); color: var(--red); }
.badge-tout { background: var(--accent-soft); color: var(--accent-text); }
.badge-equipe, .badge-leger { background: var(--blue-bg); color: var(--blue); }
.badge-perso, .badge-warn, .badge-moyen, .badge-vieillissante { background: var(--amber-bg); color: var(--amber); }
.badge-ig { background: var(--pink-bg); color: var(--pink); }
.badge-tt { background: var(--teal-bg); color: var(--teal); }
.badge-plafonnee { background: var(--peach-bg); color: var(--peach); }
.badge-inconnue { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.pill { display: inline-block; border-radius: 999px; padding: 0 8px; font-weight: 600; font-size: 12px; line-height: 20px; }
.pill-up { background: var(--green-bg); color: var(--green); }
.pill-down { background: var(--red-bg); color: var(--red); }
.pill-flat { background: var(--surface-2); color: var(--muted); }
.chip { display: inline-block; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; margin: 2px 0; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); vertical-align: 1px; flex: none; }
.dot-on { background: var(--green); }
.dot-live { background: var(--green); box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 50%, transparent); animation: live 1.8s infinite; }
.sync-pill.is-running .dot-live { background: var(--accent); }
@keyframes live { 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .dot-live { animation: none; } .card, .ring-fg { transition: none; } }

/* Boutons avec reflet interne ; principal en dégradé d'accent */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 15px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; line-height: 1.3; cursor: pointer; text-decoration: none; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 1px 2px rgba(20, 23, 31, .05); white-space: nowrap; }
:root[data-theme="dark"] .btn { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05); }
.btn:hover { background: var(--surface-2); color: var(--text); }
a.btn { text-decoration: none; color: var(--text); }
.btn-primary, a.btn-primary { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 88%, white), var(--accent) 55%, color-mix(in srgb, var(--accent) 88%, black)); border-color: color-mix(in srgb, var(--accent) 80%, black); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 1px 3px var(--accent-ring); }
.btn-primary:hover, a.btn-primary:hover { background: var(--accent-hover); color: #fff; }
:root[data-theme="dark"] .btn-primary:hover { background: color-mix(in srgb, var(--accent) 85%, black); }
.btn-small { padding: 4px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-danger, a.btn-danger { background: var(--red); border-color: var(--red); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22); }
.btn-danger:hover { background: color-mix(in srgb, var(--red) 85%, black); color: #fff; }
.btn-danger-outline, a.btn-danger-outline, table.table a.btn-danger-outline, .card-head a.btn-danger-outline { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, var(--surface)); }
.btn-danger-outline:hover { background: var(--red-bg); color: var(--red); }
.btn-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-shift-start, .btn-shift-end { color: #fff; font-size: 15px; padding: 11px 22px; letter-spacing: .03em; }
.btn-shift-start { background: var(--green); border-color: var(--green); }
.btn-shift-start:hover { background: color-mix(in srgb, var(--green) 85%, black); color: #fff; }
.btn-shift-end { background: var(--red); border-color: var(--red); }
.btn-shift-end:hover { background: color-mix(in srgb, var(--red) 85%, black); color: #fff; }
:root[data-theme="dark"] .btn-shift-start, :root[data-theme="dark"] .btn-shift-end { color: #0e1015; }

/* Sélecteurs segmentés */
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 3px; gap: 2px; flex-wrap: wrap; max-width: 100%; }
.segmented a, .segmented button, .seg-input label { padding: 4px 11px; border-radius: 8px; color: var(--text-2); text-decoration: none; font: inherit; font-weight: 500; border: 0; background: transparent; cursor: pointer; white-space: nowrap; }
.segmented a:hover, .segmented button:hover { color: var(--text); }
.segmented a.on, .segmented button.on, .seg-input label:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(20, 23, 31, .1); font-weight: 600; }
:root[data-theme="dark"] .segmented a.on, :root[data-theme="dark"] .segmented button.on, :root[data-theme="dark"] .seg-input label:has(input:checked) { background: var(--border-strong); }
.seg-input label { display: inline-flex; margin: 0; }
.seg-input input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; margin: 0; }
.segmented .count { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }

/* Champs avec halo d'accent au focus */
label { display: block; font-weight: 500; margin: 12px 0 4px; }
input, select, textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); font: inherit; background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--faint); }
.form-inline select { max-width: 360px; display: block; margin-bottom: 14px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset:disabled { opacity: .55; }
legend { font-weight: 600; padding: 0; margin: 14px 0 6px; }
form .btn-primary, form .btn-danger:not(.btn-small) { margin-top: 16px; }
form.inline { display: inline; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; min-height: 1em; }
label.choice { display: flex; align-items: baseline; gap: 8px; font-weight: 400; margin: 6px 0; flex-wrap: wrap; }
label.choice input { width: auto; flex: none; }
label.choice.is-disabled { color: var(--faint); }
label.confirm { margin-top: 16px; font-weight: 600; }
.choices { display: flex; gap: 4px 20px; flex-wrap: wrap; }
.color-input { width: 64px; height: 38px; padding: 3px; }
select.indent { margin: 0 0 8px 26px; width: calc(100% - 26px); max-width: 420px; }

/* Tableaux : en-têtes en petites capitales, sans lignes verticales */
.table-wrap { overflow-x: auto; margin: 0 calc(-1 * var(--pad-card)); padding: 0 var(--pad-card); }
table.table { border-collapse: collapse; width: 100%; }
table.table th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px; background: var(--thead); border-bottom: 1px solid var(--border); white-space: nowrap; }
table.table th:first-child { border-top-left-radius: 8px; }
table.table th:last-child { border-top-right-radius: 8px; }
table.table td { padding: var(--row-pad) 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.table tbody tr:hover td { background: var(--accent-softer); }
table.table tbody tr:last-child td { border-bottom: 0; }
table.table th.num, table.table td.num { text-align: right; }
table.table a { text-decoration: none; color: var(--text); }
table.table a.btn { color: var(--text); }
table.table a:hover strong { color: var(--accent-text); }
th.sorted { color: var(--accent-text) !important; }
table.kv { border-collapse: collapse; width: 100%; margin-bottom: 12px; }
table.kv th { text-align: left; font-weight: 500; color: var(--text-2); padding: 8px 12px 8px 0; width: 45%; vertical-align: top; }
table.kv td { padding: 8px 0; overflow-wrap: anywhere; }
table.kv tr + tr { border-top: 1px solid var(--border); }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 6px 0; border-bottom: 1px solid var(--border); }
ul.errors { margin: 0; padding-left: 18px; }

/* Messages flash et états vides */
.flash { padding: 10px 14px; border-radius: var(--radius); margin: 0 0 14px; border: 1px solid transparent; }
.flash-error { background: var(--red-bg); color: var(--red); border-color: color-mix(in srgb, var(--red) 20%, transparent); }
.flash-ok { background: var(--green-bg); color: var(--green); border-color: color-mix(in srgb, var(--green) 20%, transparent); }
.flash-info { background: var(--accent-soft); color: var(--text-2); }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty .ic { width: 28px; height: 28px; color: var(--faint); margin-bottom: 6px; }
.card > p.muted:only-child, .card > h2 + p.muted:last-child { padding: 8px 0; }

/* Divers */
.danger-zone { margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--border-strong); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 16px; }
.perm-group { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 8px; }
.perm-group-title { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: -1px; }
.swatch-lg { width: 18px; height: 18px; border-radius: 6px; vertical-align: 0; }
.account-list { max-height: 220px; overflow-y: auto; margin-bottom: 12px; }
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 8px; }
.filters > div { flex: 1 1 200px; }
.filters label { margin-top: 0; }
.filters-btn { flex: 0 0 auto !important; display: flex; gap: 10px; align-items: center; }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.secret { letter-spacing: .02em; }
details summary { cursor: pointer; margin-bottom: 6px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; vertical-align: middle; flex: none; background: var(--surface-2); border: 1px solid var(--border); }
.avatar-lg { width: 56px; height: 56px; }
.who { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }

/* Connexion */
.page-login .login-wrap { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; box-shadow: var(--shadow-up); }
.login-card h1 { font-size: 22px; text-align: center; margin: 4px 0 16px; }
.login-card .btn { width: 100%; margin-top: 18px; }

/* Personnaliser */
dialog.prefs { width: min(440px, calc(100vw - 32px)); border: 1px solid var(--border); border-radius: 16px; padding: 20px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop); }
dialog.prefs::backdrop { background: rgba(10, 12, 18, .4); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.accent-choices { display: flex; gap: 10px; flex-wrap: wrap; }
.accent-choice { margin: 0; cursor: pointer; }
.accent-choice input { position: absolute; opacity: 0; pointer-events: none; }
.accent-dot { display: block; width: 32px; height: 32px; border-radius: 50%; background: var(--c); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3); border: 3px solid var(--surface); outline: 2px solid transparent; }
.accent-choice input:checked + .accent-dot { outline-color: var(--c); }
.accent-choice input:focus-visible + .accent-dot { outline: 2px dashed var(--text); }

/* ---------- 5. Pages ---------- */
/* Comptes */
.report-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.report-line code { white-space: pre-wrap; word-break: break-all; padding: 6px 10px; flex: 1 1 260px; }
.gen-result { margin-top: 16px; }
.gen-result code { font-size: 14px; padding: 3px 8px; }

/* Espace VA, shifts, reports */
.shift-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.shift-start { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.shift-start > div { flex: 1 1 280px; max-width: 460px; }
.shift-start label:first-child { margin-top: 0; }
.entry-row { display: grid; grid-template-columns: 2fr 1.3fr 1.3fr .8fr 1.1fr; gap: 0 12px; }
.entry-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.entry-actions .btn-primary { margin-top: 0; }
pre.report { white-space: pre-wrap; word-break: break-all; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 6px; font: 12.5px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; max-height: 420px; overflow-y: auto; }
.day-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.day-pick { display: flex; gap: 8px; align-items: center; }
.day-pick input { width: auto; padding: 5px 10px; }

/* Relevés et statistiques */
.stat-filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.inline-select select { width: auto; max-width: 100%; padding: 6px 10px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; overflow: hidden; transition: box-shadow .2s; container-type: inline-size; }
.kpi:hover { box-shadow: var(--shadow-up); }
.kpis-compact .kpi { box-shadow: none; background: var(--surface-2); }
.kpi-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
/* Le chiffre rétrécit avec la carte : un total à 11 chiffres (10 000 comptes) tient sans être coupé. */
.kpi-value { font-size: 24px; font-size: clamp(15px, 11.5cqi, 24px); font-weight: 700; letter-spacing: -.02em; margin: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi-foot { font-size: 12.5px; color: var(--text-2); }
.kpi-spark { display: block; width: 100%; height: 34px; margin: 4px 0 2px; }
.kpi-spark path.sp-line { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.kpi-spark path.sp-area { fill: var(--accent-soft); stroke: none; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.dash-grid .card { max-width: none; margin: 0; }
.dash-grid .card + .card { margin-top: 0; }
.dash-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.dash-row .card { max-width: none; margin: 0; }
.dash-row .card + .card { margin-top: 0; }
.dash-page .card-wide + .card-wide { margin-top: 16px; }
.chart-head { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.chart-box { position: relative; min-height: 180px; }
svg.chart { width: 100%; height: 220px; display: block; overflow: visible; }
.chart-area { fill: var(--accent-soft); }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.chart-avg { stroke: var(--faint); stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.chart-dot { fill: var(--surface); stroke: var(--accent); stroke-width: 1.5; }
.chart-last { fill: var(--accent); }
.chart-label { font-size: 10px; fill: var(--muted); }
.chart-bubble { font-size: 11px; font-weight: 700; fill: var(--accent-text); }
/* Graphiques dessinés en JavaScript */
svg.jchart { width: 100%; display: block; overflow: visible; font-family: inherit; }
.jc-grid { stroke: var(--border); stroke-width: 1; shape-rendering: crispEdges; }
.jc-axis { font-size: 10.5px; fill: var(--faint); font-variant-numeric: tabular-nums; }
.jc-val { font-size: 10px; font-weight: 600; fill: var(--text-2); font-variant-numeric: tabular-nums; }
.jc-avg { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; }
.jc-avg-label { font-size: 10px; fill: var(--muted); }
.jc-line { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.jc-area { stroke: none; }
.jc-bar { fill: var(--accent); opacity: .85; }
.jc-bar:hover { opacity: 1; }
.jc-bar-neg { fill: var(--red); }
.jc-dot { fill: var(--surface); stroke: var(--accent); stroke-width: 1.6; }
.jc-hit { fill: transparent; cursor: crosshair; }
.jc-last { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.jc-bubble rect { fill: var(--accent); }
.jc-bubble text { font-size: 11px; font-weight: 700; fill: #fff; font-variant-numeric: tabular-nums; }
.jc-cursor { stroke: var(--border-strong); stroke-width: 1; }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--text); color: var(--surface); font-size: 12px; padding: 5px 9px; border-radius: 8px; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); box-shadow: var(--shadow-pop); font-variant-numeric: tabular-nums; }
.chart-tip[hidden] { display: none; }
ul.bars { list-style: none; margin: 0; padding: 0; }
ul.bars li { margin-bottom: 12px; }
.bar-label { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.bar-label > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 4px; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-light), var(--accent)); border-radius: 999px; }
.rank-n { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 700; margin-right: 6px; }
.quick-filter input { width: 220px; max-width: 100%; padding: 6px 10px; }
.entry-when { max-width: 360px; margin-bottom: 12px; }
.entry-when label { margin-top: 0; }
.table-entry td { vertical-align: middle; }
.num-input { width: 110px; padding: 6px 8px; text-align: right; font-variant-numeric: tabular-nums; }
tr.row-error td { background: var(--red-bg); }

/* Synchronisation */
.sync-top { display: grid; gap: 16px; align-items: start; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); margin-bottom: 16px; }
.sync-top .card { margin: 0; max-width: none; }
.sync-top .card + .card { margin-top: 0; }
.sync-ring-row { display: flex; gap: 18px; align-items: center; margin: 6px 0 10px; }
.ring { flex: 0 0 auto; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring-bg { stroke: var(--surface-2); }
.ring-fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.ring-text { transform: rotate(90deg); transform-origin: 50px 50px; font-size: 17px; font-weight: 600; fill: var(--text); font-variant-numeric: tabular-nums; }
.sync-facts { min-width: 0; flex: 1 1 auto; }
.sync-facts > div { overflow-wrap: anywhere; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.actions .btn-primary { margin-top: 0; }
.estimate-live { margin: 14px 0; padding: 10px 14px; border-radius: var(--radius); background: var(--accent-soft); }
.key-form { margin-bottom: 14px; }
.key-form input { margin-bottom: 8px; }
.dash-sync .sync-ring-row { flex-direction: row; align-items: center; }

/* Fiabilité, alertes */
ul.anomalies { margin: 0; padding: 0; list-style: none; }
ul.anomalies li + li { margin-top: 4px; }
.notif { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.notif:last-child { border-bottom: 0; }
.notif-unread .notif-title { font-weight: 700; }
.notif-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.notif-meta { white-space: nowrap; text-align: right; }
.group-title { display: flex; align-items: center; gap: 10px; margin: 18px 0 6px; font-size: 15px; }
.group-more { margin: 6px 0 14px; }
.cmp-diff { color: var(--peach); font-weight: 600; }
.seuils { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.seuils > div { flex: 0 1 180px; }
.seuils label { margin-top: 0; }
.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-list li { padding: 8px 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.alert-list li:last-child { border-bottom: 0; }
.alert-list li > span:first-child { min-width: 0; overflow-wrap: anywhere; }

/* ---------- Numéros SMS (étape 9) ---------- */
.sms-rent { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.sms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.sms-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 14px 16px; min-width: 0; }
.sms-card.sms-closed { opacity: .75; }
.sms-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.sms-timer { margin-left: auto; }
.sms-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 8px; }
.sms-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.sms-number { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: .01em; overflow-wrap: anywhere; }
.sms-code { font: 700 28px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; color: var(--accent-text); overflow-wrap: anywhere; }
.sms-code.sms-wait { font-family: inherit; font-size: 15px; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.sms-actions { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; margin-top: 12px; }
.sms-actions form { margin: 0; }
.sms-settings .btn-primary { margin-top: 14px; }
.inline-form { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; margin: 6px 0; }
.inline-form input, .inline-form select { width: auto; flex: 0 1 280px; min-width: 0; }
.head-links { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.guided-step h2 { display: flex; align-items: center; gap: 10px; }
.step-num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-size: 13px; font-weight: 700; flex: 0 0 auto; }
.entry-row-3 { grid-template-columns: 2fr .8fr 1.2fr; }

/* ---------- 6. Écrans plus petits ---------- */
/* ---------- Contenu : bibliothèque, aperçus, envois vers les iPhones ---------- */
.contenu-tabs { margin-bottom: 14px; }
.phone-line { display: flex; align-items: center; gap: 10px; padding: 12px var(--pad-card); }
.phone-line > span:not(.badge) { flex: 1 1 0; min-width: 0; }
.phone-line .ic { color: var(--accent-text); flex: none; }
.add-post > summary { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; cursor: pointer; list-style: none; }
.add-post > summary::-webkit-details-marker { display: none; }
.add-post > summary h2 { margin: 0; }
.add-post > summary h2::before { content: "+"; display: inline-block; width: 1.1em; color: var(--accent-text); font-weight: 700; }
.add-post[open] > summary h2::before { content: "–"; }
.add-post[open] > summary { margin-bottom: 12px; }
.link-label { display: inline; margin: 0; font-weight: 500; color: var(--accent-text); text-decoration: underline; cursor: pointer; }
.upload-form { margin: 0; }
.upload-form .inline-form { flex-wrap: wrap; }
.upload-progress { margin: 10px 0; max-width: 520px; }
.contenu-search { flex-wrap: nowrap; }
.contenu-search input { min-width: 0; }
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-top: 8px; }
.post-card { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; background: var(--surface); color: var(--text); text-decoration: none; transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease; }
.post-card:hover { box-shadow: var(--shadow-up); transform: translateY(-1px); border-color: var(--accent-ring); }
.post-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.post-thumb { position: relative; display: block; aspect-ratio: 1 / 1; background: var(--surface-2); }
.post-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-count { position: absolute; right: 8px; top: 8px; background: var(--glass); border: 1px solid var(--glass-border); color: var(--text); border-radius: 999px; padding: 0 8px; font-size: 12px; font-weight: 600; line-height: 20px; backdrop-filter: blur(6px); }
.post-play { position: absolute; left: 50%; top: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%; background: var(--glass); border: 1px solid var(--glass-border); backdrop-filter: blur(6px); }
.post-play::after { content: ""; position: absolute; left: 15px; top: 11px; border-style: solid; border-width: 8px 0 8px 12px; border-color: transparent transparent transparent var(--text); }
.post-body { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px 12px; min-width: 0; }
.post-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.post-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.send-card { border-color: var(--accent-ring); background: linear-gradient(180deg, var(--accent-softer), var(--surface)); }
.send-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.send-actions form { margin: 0; max-width: 100%; }
.send-actions .btn, .envoi-actions .btn { white-space: normal; max-width: 100%; text-align: center; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.media-item { margin: 0; min-width: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.media-item video, .media-photo img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--surface-2); }
.media-item video { object-fit: contain; background: var(--surface-2); }
.media-photo { display: block; }
.media-item figcaption { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; min-width: 0; }
.media-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 13px; }
.bar-lg { height: 12px; }
.envoi-card .bar-label { margin-top: 4px; }
.envoi-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.envoi-actions form { margin: 0; }
.manual-steps { margin-top: 14px; }
.manual-steps ol { margin: 6px 0 0; padding-left: 20px; }
.manual-steps li + li { margin-top: 3px; }

@media (max-width: 1250px) { .sync-top { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid, .dash-row { grid-template-columns: minmax(0, 1fr); }
  .entry-row, .entry-row-3 { grid-template-columns: 1fr 1fr; }
  .entry-wide { grid-column: 1 / -1; }
}
/* Sous 820 px : menu hors champ ouvert par un bouton, voile derrière. */
@media (max-width: 820px) {
  .sidebar { position: fixed; z-index: 60; top: 0; bottom: 0; left: 0; width: min(280px, 86vw); transform: translateX(-105%); transition: transform .22s ease; background: var(--surface); box-shadow: var(--shadow-pop); }
  .menu-open .sidebar { transform: none; }
  .sidebar .sidebar-close { display: grid; width: 32px; height: 32px; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(10, 12, 18, .42); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .menu-open .scrim { opacity: 1; pointer-events: auto; }
  .topbar .menu-btn { display: grid; }
  .topbar { padding: 0 12px; gap: 8px; }
  .search { max-width: none; }
  .kbd { display: none; }
  .sync-pill #sync-pill-text { display: none; }
  .sync-pill { width: 36px; height: 36px; padding: 0; justify-content: center; }
  .sync-pill .dot { width: 10px; height: 10px; }
  .page { padding: 16px 16px 32px; }
  .page-head h1 { font-size: 22px; }
  .card { padding: 16px; --pad-card: 16px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .sync-ring-row { flex-direction: column; align-items: flex-start; }
  table.kv th { width: 40%; }
  .clamp, .clip { max-width: 200px; }
  .quick-filter input { width: 100%; }
  .head-actions { width: 100%; }
}
@media (max-width: 560px) {
  .entry-row, .entry-row-3 { grid-template-columns: 1fr; }
  .sms-grid { grid-template-columns: minmax(0, 1fr); }
  .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .sms-timer { margin-left: 0; width: 100%; }
  .inline-form input, .inline-form select { flex: 1 1 100%; }
  .kpis { gap: 10px; }
  .kpi { padding: 12px; }
  .kpi-value { font-size: 20px; font-size: clamp(14px, 11.5cqi, 20px); }
  .top-user { display: none; }
  table.kv, table.kv tbody, table.kv tr, table.kv th, table.kv td { display: block; width: 100%; }
  table.kv th { padding: 8px 0 0; color: var(--muted); font-size: 12px; }
  table.kv td { padding: 2px 0 8px; }
  .notif { flex-wrap: wrap; }
  .notif-meta { text-align: left; }
  .alert-list li { flex-wrap: wrap; }
}
@media print { .sidebar, .topbar, body::before { display: none; } .shell { height: auto; overflow: visible; } .main { overflow: visible; } }
.dash-single { margin-bottom: 16px; }
.dash-single .card { max-width: none; }
.filters-menu { position: relative; }
.filters-pop { width: 260px; padding: 4px 14px 14px; }
.filters-pop label { margin-top: 10px; }
.filters-pop .actions .btn-primary { margin-top: 0; }
tr.is-filtered { display: none; }
.bell .ic { width: 19px; height: 19px; }
.card-side { align-self: start; }
