/* ==========================================================================
   Vigie — Design system « control-room »
   Volontairement distinct d'ELOGE : clair par défaut, violet + cyan,
   pas de glass morphism, cartes nettes, chiffres en monospace.
   ========================================================================== */

:root {
  --primary: #7c3aed;
  --primary-600: #6d28d9;
  --primary-700: #5b21b6;
  --primary-soft: #f3effe;
  --primary-ring: rgba(124, 58, 237, 0.18);

  --live: #06b6d4;
  --ok: #16a34a;
  --warn: #f59e0b;
  --danger: #ef4444;

  --bg: #f4f4f5;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --text: #18181b;
  --muted: #71717a;
  --muted-2: #a1a1aa;

  --shadow-sm: 0 1px 2px rgba(24, 24, 27, 0.06);
  --shadow: 0 4px 16px rgba(24, 24, 27, 0.08);
  --shadow-lg: 0 12px 40px rgba(24, 24, 27, 0.16);

  --radius: 14px;
  --radius-sm: 9px;
  --sidebar-w: 244px;

  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --primary: #a78bfa;
  --primary-600: #8b5cf6;
  --primary-700: #7c3aed;
  --primary-soft: #1c1630;
  --primary-ring: rgba(167, 139, 250, 0.22);

  --bg: #0a0a0f;
  --surface: #15151f;
  --surface-2: #1b1b28;
  --border: #27273a;
  --border-strong: #35354d;
  --text: #ededf2;
  --muted: #9494a8;
  --muted-2: #6b6b80;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
/* Taille par défaut des icônes inline (surchargée par les sélecteurs de contexte) */
svg { width: 1em; height: 1em; flex: none; vertical-align: -0.15em; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.02em; font-weight: 650; }
.mono { font-family: var(--mono); }
.hidden { display: none !important; }

/* ---------- Utilitaires ---------- */
.label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}
.muted { color: var(--muted); }
.row { display: flex; align-items: center; gap: 12px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.spacer { flex: 1; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  font-weight: 550; font-size: 13.5px;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn svg { width: 16px; height: 16px; }
.btn-primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 1px 3px var(--primary-ring);
}
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); color: #fff; }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: transparent; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Cartes ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }
.card-hover { transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s; }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); cursor: pointer; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.badge-warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); border-color: color-mix(in srgb, var(--warn) 28%, transparent); }
.badge-danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); border-color: color-mix(in srgb, var(--danger) 26%, transparent); }
.badge-primary { color: var(--primary); background: var(--primary-soft); border-color: var(--primary-ring); }
.badge-info { color: var(--live); background: color-mix(in srgb, var(--live) 12%, transparent); border-color: color-mix(in srgb, var(--live) 26%, transparent); }

/* ---------- Point live pulsant ---------- */
.pulse { position: relative; width: 9px; height: 9px; border-radius: 50%; background: var(--live); flex: none; }
.pulse::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: var(--live); animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse { 0% { transform: scale(1); opacity: 0.7; } 100% { transform: scale(3.2); opacity: 0; } }
.pulse-off { background: var(--muted-2); }
.pulse-off::after { display: none; }
.pulse-ok { background: var(--ok); }
.pulse-ok::after { background: var(--ok); }

/* ==========================================================================
   Layout applicatif
   ========================================================================== */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--live));
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 17px;
  box-shadow: 0 4px 12px var(--primary-ring);
}
.brand-name { font-weight: 750; font-size: 17px; letter-spacing: -0.03em; }
.brand-name span { color: var(--primary); }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 550; font-size: 13.5px;
  transition: background 0.12s, color 0.12s;
}
.nav-item svg { width: 18px; height: 18px; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); }
.nav-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.nav-sep { height: 1px; background: var(--border); margin: 10px 4px; }
.nav-foot { margin-top: auto; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 62px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; gap: 14px; padding: 0 24px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-size: 17px; }
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 7px 12px; min-width: 240px;
}
.search svg { width: 16px; height: 16px; color: var(--muted); }
.search input { border: none; background: none; outline: none; color: var(--text); font-size: 13.5px; width: 100%; }
.icon-btn {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  display: grid; place-items: center; color: var(--muted); position: relative;
}
.icon-btn:hover { color: var(--primary); border-color: var(--primary); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .nav-badge { position: absolute; top: -6px; right: -6px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-700));
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px;
}

.content { padding: 26px 28px 60px; max-width: 1440px; width: 100%; }
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 24px; }
.page-head p { color: var(--muted); margin: 4px 0 0; }

/* ---------- Grilles de stats ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat { padding: 16px 18px; }
.stat .label { display: flex; align-items: center; gap: 6px; }
.stat .value { font-family: var(--mono); font-size: 30px; font-weight: 680; letter-spacing: -0.03em; margin-top: 8px; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat-accent-live .value { color: var(--live); }
.stat-accent-danger .value { color: var(--danger); }
.stat-accent-warn .value { color: var(--warn); }

/* ---------- Cartes de sites ---------- */
.sites-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.site-card { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.site-fav { width: 34px; height: 34px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); object-fit: contain; }
.site-title { font-weight: 640; font-size: 15px; }
.site-url { font-size: 12px; color: var(--muted); word-break: break-all; }
.site-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.site-card.pinned { border-color: rgba(245, 158, 11, .45); box-shadow: 0 0 0 1px rgba(245, 158, 11, .25); }
.star-btn { color: var(--muted-2); }
.star-btn.on { color: #f59e0b; }
.star-btn.on svg { fill: #f59e0b; }
.tag-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); cursor: pointer; }
.tag-chip:hover { border-color: var(--primary); color: var(--primary); }
.tag-chip svg { width: 12px; height: 12px; }
.sites-grid.compact { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.sites-grid.compact .site-card { padding: 13px; gap: 9px; }
.sites-grid.compact .site-metrics { display: none; }
.sites-grid.compact .tag-chip { display: none; }
#site-status.subtabs { margin: 0; border: 0; }

/* Espace client */
.client-app { min-height: 100vh; background: var(--bg); }
.client-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
.client-main { max-width: 860px; margin: 0 auto; padding: 26px 20px 60px; }
.req-list { display: flex; flex-direction: column; gap: 12px; }
.req-row { padding: 15px 16px; display: flex; flex-direction: column; gap: 10px; }
.thread { display: flex; flex-direction: column; gap: 10px; max-height: 44vh; overflow-y: auto; padding: 4px 2px; }
.tmsg { max-width: 85%; padding: 9px 12px; border-radius: 12px; font-size: 13.5px; }
.tmsg-head { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.tmsg-body { white-space: pre-wrap; word-break: break-word; }
.tmsg.mine { align-self: flex-end; background: var(--primary-soft); border: 1px solid var(--primary-ring); }
.tmsg.team { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); }
.file-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 5px 6px 5px 10px; max-width: 100%; }
.file-chip a { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--text); font-size: 12.5px; min-width: 0; }
.file-chip a:hover { color: var(--primary); }
.file-chip .fc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.file-chip .fc-size { color: var(--muted); font-size: 11px; white-space: nowrap; }
.fc-del { border: none; background: none; color: var(--muted-2); cursor: pointer; padding: 2px; display: inline-flex; border-radius: 5px; }
.fc-del:hover { color: var(--danger); background: var(--surface); }
.fc-del svg { width: 13px; height: 13px; }
.file-chip.is-img { padding: 3px; }
.file-chip.is-img a { flex-direction: column; gap: 2px; align-items: center; }
.fc-img { width: 84px; height: 84px; object-fit: cover; border-radius: 6px; display: block; }
.file-chip.is-img .fc-size { font-size: 10px; }
.unread-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); margin-right: 7px; vertical-align: middle; }
.req-row.unread { border-color: rgba(124, 58, 237, .4); box-shadow: -3px 0 0 0 var(--primary) inset; }
.tmsg.internal { align-self: stretch; max-width: 100%; background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 10px, transparent 10px, transparent 20px), var(--surface); border: 1px dashed var(--warn); }
.tmsg.internal .tmsg-head { color: var(--warn); }
.pres-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted-2); display: inline-block; flex: none; }
.pres-dot.on { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .22); }
button.avatar { border: 0; font: inherit; cursor: pointer; }
button.avatar:hover { filter: brightness(1.08); }
.metric .m-val { font-family: var(--mono); font-size: 18px; font-weight: 640; }
.metric .m-lab { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

/* ---------- Anneau de santé ---------- */
.ring { --p: 100; --c: var(--ok); width: 44px; height: 44px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--border) 0);
  display: grid; place-items: center; position: relative; }
.ring::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--surface); }
.ring span { position: relative; font-family: var(--mono); font-size: 12.5px; font-weight: 700; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); }
table.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--border); }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover, table.tbl tr:hover { background: var(--surface-2); }

/* ---------- Barres (top pages / referrers) ---------- */
.barlist { display: flex; flex-direction: column; gap: 8px; }
.barrow { position: relative; padding: 8px 12px; border-radius: 8px; overflow: hidden; font-size: 13px; }
.barrow .fill { position: absolute; inset: 0; background: var(--primary-soft); border-radius: 8px; z-index: 0; }
.barrow .lbl, .barrow .cnt { position: relative; z-index: 1; }
.barrow .lbl { display: inline-block; max-width: 86%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.barrow .cnt { float: right; font-family: var(--mono); font-weight: 640; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.input, textarea.input, select.input {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-size: 14px; outline: none; transition: border-color 0.12s, box-shadow 0.12s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
textarea.input { resize: vertical; min-height: 72px; }
.color-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 7px; cursor: pointer; border: 2px solid transparent; }
.swatch.sel { border-color: var(--text); }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(9, 9, 15, 0.5); backdrop-filter: blur(3px); z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 480px; max-height: 90vh; overflow: auto; }
.modal-lg { max-width: 720px; }
.modal-head { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Code / snippet ---------- */
.code {
  background: #0d0d16; color: #e2e2f0; border-radius: var(--radius-sm);
  padding: 14px 16px; font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
  overflow-x: auto; white-space: pre; position: relative; border: 1px solid #23233a;
}
.code .tok-tag { color: #ff7ac6; }
.code .tok-attr { color: #7ee3ff; }
.code .tok-str { color: #b6f09c; }

/* ---------- Toast ---------- */
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 12px 16px; font-size: 13.5px; min-width: 240px; animation: slidein 0.2s ease; }
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--danger); }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } }

/* ---------- Alertes ---------- */
.alert-item { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.alert-item:last-child { border-bottom: none; }
.alert-item.unread { background: var(--primary-soft); }
.alert-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.alert-ico svg { width: 16px; height: 16px; }
.a-info { background: color-mix(in srgb, var(--live) 15%, transparent); color: var(--live); }
.a-warning { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.a-critical { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1200px 600px at 20% -10%, var(--primary-soft), transparent),
              radial-gradient(1000px 500px at 90% 110%, color-mix(in srgb, var(--live) 14%, transparent), transparent),
              var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-brand { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 24px; }
.auth-tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: var(--radius-sm); margin-bottom: 20px; }
.auth-tab { flex: 1; text-align: center; padding: 9px; border-radius: 7px; font-weight: 600; font-size: 13.5px; color: var(--muted); }
.auth-tab.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.ms-btn { width: 100%; justify-content: center; font-weight: 600; padding: 11px; }
.ms-logo { width: 18px; height: 18px; }
.auth-sep { display: flex; align-items: center; text-align: center; color: var(--muted); font-size: 12px; margin: 16px 0; gap: 10px; }
.auth-sep::before, .auth-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty svg { width: 46px; height: 46px; opacity: 0.4; margin-bottom: 12px; }

/* ---------- Sous-onglets ---------- */
.subtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.subtab { padding: 10px 14px; font-weight: 550; font-size: 13.5px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.subtab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- Espace Commercial ---------- */
.mode-switch { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 14px; }
.mode-opt { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 6px; border: none; background: transparent; border-radius: 7px; font-weight: 600; font-size: 12.5px; color: var(--muted); }
.mode-opt.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.mode-opt svg { width: 15px; height: 15px; }

.pbar { height: 7px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin: 8px 0 6px; }
.pbar-fill { height: 100%; border-radius: 999px; transition: width 0.3s; }

.pipeline-bar { display: flex; gap: 4px; height: 34px; border-radius: 8px; overflow: hidden; }
.pipeline-seg { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 600; min-width: 44px; padding: 0 8px; white-space: nowrap; overflow: hidden; }
.pipeline-seg span { overflow: hidden; text-overflow: ellipsis; }

.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(238px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.kcol { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; }
.kcol-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 10px; font-weight: 650; font-size: 13px; }
.kcount { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; font-size: 11px; color: var(--muted); }
.kcol-body { display: flex; flex-direction: column; gap: 10px; }
.kempty { text-align: center; color: var(--muted-2); padding: 16px; font-size: 12px; }
.dot-stage { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.chk { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }
.proj-card { padding: 13px; display: flex; flex-direction: column; gap: 8px; }
.kcard-wrap { position: relative; }
.kcard-wrap[draggable="true"] { cursor: grab; }
.kcard-wrap.dragging { opacity: .5; }
.stage-move { margin-top: 6px; padding: 6px 8px; font-size: 12px; }
.kcol-body { min-height: 44px; border-radius: 10px; transition: background .12s, outline-color .12s; }
.drop-hot { outline: 2px dashed var(--primary); outline-offset: 2px; background: var(--primary-ring); }

/* Zone « En production » sous le kanban */
.prod-zone { margin-top: 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; transition: background .12s; }
.prod-list { display: flex; flex-direction: column; gap: 8px; }
.prod-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; cursor: grab; }
.prod-line.dragging { opacity: .5; }
.prod-line:active { cursor: grabbing; }
.prod-logo { width: 22px; height: 22px; border-radius: 5px; object-fit: contain; flex: none; background: var(--surface-2); }
.prod-name { font-weight: 600; color: var(--text); text-decoration: none; }
.prod-name:hover { text-decoration: underline; color: var(--primary); }
.prod-client { font-size: 12.5px; }
.prod-since { margin-left: auto; font-size: 12.5px; color: var(--ok); white-space: nowrap; }
.prod-line select.prod-sel { flex: 0 0 auto; width: auto; min-width: 92px; padding: 4px 6px; font-size: 12px; margin: 0; }
.prod-name { flex: 0 1 auto; min-width: 80px; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prod-client { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.task-check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-strong); background: transparent; flex: none; cursor: pointer; position: relative; padding: 0; }
.task-check.doing { border-color: var(--warn); background: conic-gradient(var(--warn) 55%, transparent 0); }
.task-check.done { border-color: var(--ok); background: var(--ok); }
.task-check.done::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 700; }

.range { width: 100%; accent-color: var(--primary); }

/* Conteneur de graphique à hauteur fixe (évite que Chart.js grandisse à l'infini) */
.chart-box { position: relative; width: 100%; height: 280px; }
.chart-box canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -260px; z-index: 50; transition: left 0.2s; box-shadow: var(--shadow-lg); }
  .sidebar.open { left: 0; }
  .menu-toggle { display: grid !important; }
  .content { padding: 18px 16px 50px; }
}
.menu-toggle { display: none; }

/* ---------- Palette de commandes (Cmd/Ctrl+K) ---------- */
.palette { width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.palette-input svg { width: 18px; height: 18px; color: var(--muted); }
.palette-input input { flex: 1; border: none; outline: none; background: none; color: var(--text); font-size: 15px; }
.palette-list { max-height: 60vh; overflow-y: auto; padding: 6px; }
.palette-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.palette-item svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.palette-item.sel { background: var(--primary-soft); color: var(--primary); }
.palette-item.sel svg { color: var(--primary); }
.pi-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pi-hint { font-size: 11.5px; color: var(--muted-2); }
.palette-empty { padding: 20px; text-align: center; }
.kbd { font: 600 11px var(--mono); background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; color: var(--muted); }

/* Corps d'un message de formulaire (rendu type e-mail, toujours sur fond clair) */
.mail-body { background: #fff; color: #18181b; border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; overflow-x: auto; }
.mail-body * { max-width: 100%; }

/* ---------- Impression / PDF ---------- */
@media print {
  .sidebar, .topbar, .toasts, .modal-backdrop, [data-action="print"], [data-action="export-csv"], [data-action="new-site"], [data-action="new-project"], .btn-primary { display: none !important; }
  .app { grid-template-columns: 1fr !important; }
  .content { max-width: none !important; padding: 0 !important; }
  body { background: #fff !important; }
  .card { break-inside: avoid; box-shadow: none !important; border-color: #ccc !important; }
}
