/* CD CONNECT extranet — design system (mockups) */

:root {
  --bg: #F7F6F2;
  --surface: #FFFFFF;
  --border: #E8E5DD;
  --border-strong: #D4D0C5;
  --text: #1A1A1A;
  --text-2: #6B6862;
  --text-3: #94918A;
  --primary: #1E3A8A;
  --primary-soft: #E8EDF7;
  --teal: #0F766E;
  --teal-soft: #E0F2EF;
  --amber: #B45309;
  --amber-soft: #FCEFD9;
  --red: #B91C1C;
  --red-soft: #FCE4E4;
  --green: #15803D;
  --green-soft: #DDF2E2;
  --violet: #6D28D9;
  --violet-soft: #EFE6FA;
  --orange: #EA580C;
  --orange-soft: #FFE9DA;
  --brand-orange: #f5a93b;
  --shadow-sm: 0 1px 2px rgba(20, 18, 14, 0.04);
  --shadow-md: 0 4px 16px rgba(20, 18, 14, 0.06);
  --radius: 14px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--text); font-family: 'DM Sans', sans-serif; font-size: 14px; line-height: 1.5; }
h1, h2, h3, h4 { font-family: 'Manrope', sans-serif; font-weight: 700; letter-spacing: -0.01em; }
.mono { font-family: 'JetBrains Mono', monospace; }
a { color: inherit; text-decoration: none; }

/* ---------- LAYOUT ---------- */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }

/* ---------- SIDEBAR ---------- */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 22px 16px 0;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  /* Quand le menu (surtout côté admin) est plus haut que la fenêtre, on scrolle
     à l'intérieur de la sidebar plutôt que de masquer les entrées du bas. */
  overflow-y: auto;
  overscroll-behavior: contain;
}
/* Le pied (avatar + déconnexion) reste visible même quand le menu déborde.
   On absorbe le padding-bottom de la sidebar pour qu'aucun contenu ne se devine
   derrière, et on pose un fond opaque + un dégradé blanc en haut pour adoucir. */
.sidebar-footer {
  position: sticky; bottom: 0;
  background: var(--surface);
  padding-bottom: 22px;
  box-shadow: 0 -16px 16px -12px var(--surface);
}
.brand {
  display: flex; flex-direction: column; gap: 6px;
  padding: 4px 8px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.brand-logo-img { height: 34px; width: auto; max-width: 100%; display: block; }
.brand-sub {
  font-size: 11px; color: var(--text-3);
  letter-spacing: 0.08em; text-transform: uppercase;
  font-family: 'Manrope', sans-serif; font-weight: 600;
  padding-left: 2px;
}
.brand-sub.admin { color: var(--primary); }

.nav-label {
  font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em;
  padding: 16px 8px 8px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; margin: 1px 0;
  border-radius: 8px; color: var(--text-2); font-weight: 500;
  cursor: pointer; transition: all 0.15s;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item .icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item .badge {
  margin-left: auto; font-size: 10px; font-weight: 700;
  background: var(--red); color: white; padding: 1px 6px; border-radius: 8px;
}
.nav-item .badge.muted { background: var(--bg); color: var(--text-3); border: 1px solid var(--border); }

.sidebar-footer {
  margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #C2A36A, #8E703E);
  color: white; display: grid; place-items: center;
  font-family: 'Manrope', sans-serif; font-weight: 700; font-size: 13px;
}
.avatar.admin { background: linear-gradient(135deg, var(--primary), #2456C7); }
.user-info { line-height: 1.2; }
.user-name { font-weight: 600; font-size: 13px; }
.user-role { font-size: 11px; color: var(--text-3); }

/* ---------- TOPBAR ---------- */
.main { padding: 0; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 32px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.site-selector {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-weight: 600; cursor: pointer; transition: border-color 0.15s;
  min-width: 280px;
}
.site-selector:hover { border-color: var(--border-strong); }
.site-selector .label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 500; }
.site-selector .name { font-size: 14px; }
.site-selector .count { color: var(--text-3); font-weight: 500; }
.site-selector .chevron { margin-left: auto; color: var(--text-3); }

.search-box {
  flex: 1; max-width: 480px;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.search-box input {
  flex: 1; border: 0; background: transparent; outline: none;
  font: 400 14px 'DM Sans'; color: var(--text);
}
.search-box .kbd {
  font: 600 11px 'JetBrains Mono'; color: var(--text-3);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 4px; padding: 2px 6px;
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
  display: grid; place-items: center; cursor: pointer; position: relative;
  color: var(--text-2);
}
.icon-btn:hover { background: var(--bg); }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; background: var(--red); border-radius: 50%; border: 2px solid var(--surface); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  font: 600 13px 'DM Sans'; cursor: pointer;
  transition: all 0.15s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: #16306E; }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { border-color: var(--border-strong); }

/* ---------- CONTENT ---------- */
.content { padding: 32px 32px 48px; max-width: 1400px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 28px; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.page-subtitle { color: var(--text-2); margin-top: 4px; font-size: 14px; }

.period-tabs { display: inline-flex; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 3px; gap: 2px; }
.period-tabs button,
.period-tabs a {
  padding: 6px 14px; background: transparent; border: 0;
  font-family: 'DM Sans'; font-size: 13px; color: var(--text-2);
  font-weight: 500; cursor: pointer; border-radius: 6px;
  text-decoration: none; white-space: nowrap; line-height: 1.4;
}
.period-tabs a:hover { background: var(--bg); color: var(--text); }
.period-tabs button.active,
.period-tabs a.active { background: var(--bg); color: var(--text); font-weight: 600; }

/* ---------- KPI GRID ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  transition: border-color 0.15s, transform 0.15s;
  cursor: pointer; position: relative; overflow: hidden;
}
.kpi:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.kpi-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.kpi-label { font-size: 12px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.kpi-icon { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; }
.kpi-icon.blue { background: var(--primary-soft); color: var(--primary); }
.kpi-icon.teal { background: var(--teal-soft); color: var(--teal); }
.kpi-icon.green { background: var(--green-soft); color: var(--green); }
.kpi-icon.amber { background: var(--amber-soft); color: var(--amber); }
.kpi-icon.red { background: var(--red-soft); color: var(--red); }
.kpi-value { font-family: 'Manrope'; font-size: 32px; font-weight: 800; letter-spacing: -0.025em; line-height: 1; }
.kpi-value .unit { font-size: 14px; color: var(--text-3); font-weight: 500; margin-left: 4px; }
.kpi-trend { font-size: 12px; margin-top: 8px; display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.kpi-trend .pct.up { color: var(--green); font-weight: 600; }
.kpi-trend .pct.down { color: var(--red); font-weight: 600; }
.kpi-trend .pct.warn { color: var(--amber); font-weight: 600; }

/* progress (data conso) */
.progress { height: 6px; background: var(--bg); border-radius: 99px; margin-top: 12px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; }
.progress-fill.amber { background: var(--amber); }
.progress-fill.teal { background: var(--teal); }
.progress-fill.red { background: var(--red); }
.progress-fill.green { background: var(--green); }
.progress-info { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); margin-top: 6px; font-weight: 500; }

/* ---------- CARDS / TWO COL ---------- */
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 24px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
  margin-bottom: 24px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 700; }
.card-link { font-size: 12px; color: var(--primary); font-weight: 600; cursor: pointer; }

/* ---------- TABLE ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead th {
  text-align: left;
  font: 600 11px 'DM Sans'; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-3); padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.tbl tbody td { padding: 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr:hover { background: var(--bg); cursor: pointer; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl-num { font-family: 'JetBrains Mono'; font-weight: 600; }

/* ---------- PILLS / DOTS ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 99px;
  font: 600 11px 'DM Sans';
}
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.gray { background: var(--bg); color: var(--text-2); border: 1px solid var(--border); }
.pill.blue { background: var(--primary-soft); color: var(--primary); }

.status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; }
.status-dot.up { background: var(--green); }
.status-dot.warn { background: var(--amber); }
.status-dot.down { background: var(--red); }

/* ---------- ALERTS ---------- */
.alert { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.alert:last-child { border-bottom: 0; padding-bottom: 0; }
.alert:first-child { padding-top: 0; }
.alert-icon { width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0; display: grid; place-items: center; }
.alert-icon.red { background: var(--red-soft); color: var(--red); }
.alert-icon.amber { background: var(--amber-soft); color: var(--amber); }
.alert-icon.blue { background: var(--primary-soft); color: var(--primary); }
.alert-content { flex: 1; }
.alert-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.alert-desc { color: var(--text-2); font-size: 13px; line-height: 1.4; }
.alert-time { color: var(--text-3); font-size: 11px; margin-top: 4px; font-family: 'JetBrains Mono'; font-weight: 500; }

/* ---------- ACTIVITY ---------- */
.activity-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.activity-row:last-child { border-bottom: 0; padding-bottom: 0; }
.activity-row:first-child { padding-top: 0; }
.activity-arrow {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  flex-shrink: 0; background: var(--bg);
}
.activity-arrow.in { color: var(--green); }
.activity-arrow.out { color: var(--primary); }
.activity-arrow.miss { color: var(--red); }
.activity-info { flex: 1; min-width: 0; }
.activity-num { font-family: 'JetBrains Mono'; font-weight: 600; font-size: 13px; }
.activity-from { font-size: 12px; color: var(--text-2); margin-top: 1px; }
.activity-meta { text-align: right; font-size: 11px; color: var(--text-3); font-family: 'JetBrains Mono'; font-weight: 500; line-height: 1.5; }

/* ---------- SITES ---------- */
.sites-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.site {
  border: 1px solid var(--border); border-radius: 12px; padding: 16px;
  transition: all 0.15s; cursor: pointer; background: var(--bg);
}
.site:hover { border-color: var(--primary); background: var(--surface); }
.site-clickable {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; color: inherit;
}
.site-clickable .site-name { flex: 1; min-width: 0; }
.site-clickable .site-arrow {
  font: 700 22px/1 'Manrope'; color: var(--text-3);
  transition: transform 0.15s, color 0.15s;
}
.site-clickable:hover .site-arrow { color: var(--primary); transform: translateX(2px); }
.site-name { font-weight: 700; font-size: 14px; margin-bottom: 2px; }
.site-addr { font-size: 12px; color: var(--text-2); margin-bottom: 12px; }
.site-stats { display: flex; gap: 14px; }
.site-stat { display: flex; flex-direction: column; gap: 2px; }
.site-stat .num { font-family: 'JetBrains Mono'; font-weight: 700; font-size: 16px; }
.site-stat .lbl { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.site-status { display: flex; align-items: center; font-size: 11px; color: var(--text-2); margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); font-weight: 500; }

/* ---------- CHART ---------- */
.chart-area { height: 180px; margin-top: 8px; position: relative; }
.chart-svg { width: 100%; height: 100%; overflow: visible; }
.chart-grid line { stroke: var(--border); stroke-dasharray: 2 4; }
.chart-line { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart-fill { fill: var(--primary-soft); opacity: 0.5; }
.chart-dot { fill: var(--surface); stroke: var(--primary); stroke-width: 2.5; }
.chart-label { font-size: 10px; fill: var(--text-3); font-family: 'JetBrains Mono'; font-weight: 500; }

/* ---------- MOCK BANNER ---------- */
.mock-banner {
  background: #FEF8E0; border: 1px dashed #D4A82C;
  color: #6B5414; padding: 10px 16px; font-size: 12px;
  text-align: center; font-weight: 500;
}
.mock-banner a { color: #6B5414; border-bottom: 1px solid #D4A82C; padding-bottom: 1px; }

/* ---------- RESPONSIVE ---------- */
/* Hamburger / drawer (visible < 900px) */
.sidebar-toggle {
  display: none;
  position: fixed; top: 12px; left: 12px; z-index: 1001;
  width: 40px; height: 40px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; padding: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  align-items: center; justify-content: center;
}
.sidebar-toggle:hover { border-color: var(--border-strong); }
.sidebar-scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.42); z-index: 999; }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .sites-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; width: 260px;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }
  body.sidebar-open .sidebar { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.2); }
  body.sidebar-open .sidebar-scrim { display: block; }
  .sidebar-toggle { display: inline-flex; }

  /* Topbar : laisser la place au bouton burger à gauche */
  .topbar { padding: 12px 16px 12px 64px; flex-wrap: wrap; gap: 10px; }
  .topbar .site-selector { min-width: 0; flex: 1; }
  .topbar .search-box { max-width: none; flex-basis: 100%; }

  /* Tables : scroll horizontal si une table déborde son conteneur */
  .card { padding: 14px; }
  .card { overflow-x: auto; }
  .tbl, .data-table { min-width: 600px; }   /* force le scroll horizontal en mobile */

  /* Contenu plus dense */
  .content { padding: 12px 14px !important; }
  .page-title { font-size: 22px; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* ---------- FORMS ---------- */
.form-group { margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-row .form-group { margin-bottom: 0; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea.form-input { resize: vertical; min-height: 80px; font-family: 'DM Sans', sans-serif; }
input[type="file"].form-input { padding: 8px; }

/* ---------- TICKETING ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.cat-card {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 18px 12px; border: 1.5px solid var(--border); border-radius: 10px; cursor: pointer;
  background: var(--surface); transition: all 0.15s; text-align: center;
}
.cat-card:hover { border-color: var(--border-strong); }
.cat-card.selected { border-color: var(--primary); background: var(--primary-soft); }
.cat-card input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.cat-card-icon { color: var(--text-2); }
.cat-card.selected .cat-card-icon { color: var(--primary); }
.cat-card-label { font-size: 13px; font-weight: 600; color: var(--text); }

/* Badges statut ticket */
.ticket-badge {
  display: inline-block; padding: 3px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
}
.ticket-badge.open           { background: #DBEAFE; color: #1E40AF; }
.ticket-badge.in_progress    { background: #FEF3C7; color: #92400E; }
.ticket-badge.waiting_client { background: #EDE9FE; color: #5B21B6; }
.ticket-badge.resolved       { background: #D1FAE5; color: #065F46; }
.ticket-badge.closed         { background: var(--bg); color: var(--text-3); border: 1px solid var(--border); }
.ticket-badge.priority-high   { background: #FFEDD5; color: #9A3412; }
.ticket-badge.priority-urgent { background: #FEE2E2; color: #991B1B; }

/* Fil de discussion */
.thread { display: flex; flex-direction: column; gap: 14px; margin-bottom: 24px; }
.msg {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 18px; max-width: 85%;
}
.msg-mine { align-self: flex-end; background: var(--primary-soft); border-color: #C5D2EC; }
.msg-them { align-self: flex-start; }
.msg-internal { align-self: flex-start; background: #FEF3C7; border-color: #FCD34D; }
.msg-head { display: flex; justify-content: space-between; margin-bottom: 8px; }
.msg-author { display: flex; gap: 10px; align-items: center; }
.msg-name { font-size: 13px; font-weight: 600; }
.msg-time { font-size: 11px; color: var(--text-3); }
.msg-body { font-size: 14px; line-height: 1.55; color: var(--text); word-wrap: break-word; }
.msg-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.att {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  font-size: 12px; color: var(--text); text-decoration: none;
}
.att:hover { border-color: var(--primary); color: var(--primary); }
.att-size { color: var(--text-3); font-family: 'JetBrains Mono'; font-size: 11px; }
.avatar.small { width: 28px; height: 28px; font-size: 11px; }

.reply-form, .ticket-form { padding: 24px; }
.ticket-form .form-group { margin-bottom: 20px; }

/* ─────────── Services CD CONNECT (bandeau commercial dashboard client) ─────────── */
.services-card { margin-bottom: 24px; }
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.service {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 18px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s, transform 0.15s, background 0.15s, box-shadow 0.15s;
}
.service:hover { transform: translateY(-1px); }

/* Tons pastel par service — utilisés à la fois inactif (très léger) et actif (un cran plus saturé).
   Palette cohérente : 4 tons FROIDS (bleu, teal, vert, violet) pour les 4 services du bandeau commercial. */
.service.tone-blue   { background: #EEF2FB; border-color: #DCE4F4; }
.service.tone-teal   { background: #E6F5F2; border-color: #CDEAE3; }
.service.tone-green  { background: #EAF3EA; border-color: #D2E5D2; }
.service.tone-violet { background: #F2ECFA; border-color: #DDD0EE; }

.service.tone-blue.active   { background: #DCE6FA; border-color: #B7C8EE; box-shadow: inset 0 0 0 1px #B7C8EE; }
.service.tone-teal.active   { background: #C9EAE2; border-color: #A4D6CC; box-shadow: inset 0 0 0 1px #A4D6CC; }
.service.tone-green.active  { background: #D5EAD5; border-color: #ADD2AD; box-shadow: inset 0 0 0 1px #ADD2AD; }
.service.tone-violet.active { background: #E1D2F5; border-color: #C1AFDF; box-shadow: inset 0 0 0 1px #C1AFDF; }
.service-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center;
  margin-bottom: 4px;
}
.service-icon.blue   { background: var(--primary-soft); color: var(--primary); }
.service-icon.teal   { background: var(--teal-soft);    color: var(--teal); }
.service-icon.green  { background: var(--green-soft);   color: var(--green); }
.service-icon.violet { background: var(--violet-soft);  color: var(--violet); }
.service-name { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
.service-desc { font-size: 12px; color: var(--text-2); line-height: 1.45; min-height: 34px; }
.service-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.service-meta { font-size: 11px; color: var(--text-3); font-weight: 500; }
.service-cta {
  margin-top: auto; padding-top: 4px;
  font-size: 12px; font-weight: 600; color: var(--primary);
  text-decoration: none;
}
.service-cta.muted { color: var(--text-3); }
.service-cta:hover { text-decoration: underline; }

/* Services non souscrits : présentation "marketing" — texte plus grand, accroche
   commerciale, CTA bouton plus visible. */
.service:not(.active) .service-name { font-size: 18px; }
.service:not(.active) .service-desc { font-size: 14px; line-height: 1.5; color: var(--text); font-weight: 500; min-height: 0; }
.service:not(.active) .service-pitch { font-size: 13px; font-weight: 500; color: var(--text-2); margin-top: 6px; line-height: 1.5; }
.service:not(.active) .service-cta.discover {
  display: inline-block; padding: 8px 14px; border-radius: 8px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  font-size: 13px; font-weight: 700; text-decoration: none;
}
.service.tone-blue:not(.active)   .service-cta.discover { background: var(--primary); color: white; border-color: transparent; }
.service.tone-teal:not(.active)   .service-cta.discover { background: var(--teal,   #0F766E); color: white; border-color: transparent; }
.service.tone-green:not(.active)  .service-cta.discover { background: var(--green,  #16a34a); color: white; border-color: transparent; }
.service.tone-violet:not(.active) .service-cta.discover { background: var(--violet, #6D28D9); color: white; border-color: transparent; }
.service:not(.active) .service-cta.discover:hover { filter: brightness(1.08); text-decoration: none; }

/* Ventilation à l'intérieur d'un KPI (ex. mobiles par opérateur, liens par techno) */
.kpi-breakdown {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-2);
}
.kpi-breakdown-row { display: flex; align-items: baseline; gap: 8px; }
.kpi-breakdown-count {
  display: inline-block;
  min-width: 24px;
  font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  font-weight: 700;
  color: var(--text);
}
.kpi-breakdown-label { color: var(--text-2); }

/* ─────────── Carte Alertes ─────────── */
.alerts-card.all-clear {
  background: linear-gradient(135deg, #ECFDF5 0%, #F0FDF4 100%);
  border-color: #BBF7D0;
}
.alerts-empty {
  display: flex; align-items: center; gap: 18px;
  padding: 8px 4px;
}
.alerts-empty-icon {
  width: 56px; height: 56px; flex-shrink: 0;
  display: grid; place-items: center;
  background: #DCFCE7; color: #16A34A;
  border-radius: 12px;
}
.alerts-empty-text { display: flex; flex-direction: column; gap: 2px; }
.alerts-empty-text strong { font-size: 15px; font-weight: 700; color: #14532D; }
.alerts-empty-text span   { font-size: 13px; color: #166534; }
.alerts-recap {
  list-style: none; margin: 12px 0 0 0; padding: 12px 14px;
  background: rgba(255,255,255,0.5); border: 1px solid rgba(20,83,45,0.12); border-radius: 8px;
  display: flex; flex-direction: column; gap: 6px;
  font-size: 13px; color: #14532D;
}
.alerts-recap li { display: flex; gap: 8px; align-items: baseline; }
.alerts-recap .ok { color: #16a34a; font-weight: 800; font-size: 14px; flex-shrink: 0; }

.alerts-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.alert-row {
  display: flex; gap: 12px; align-items: center;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 8px;
}
.alert-row.severity-warning  { border-left-color: var(--amber); background: #FFFBEB; }
.alert-row.severity-critical { border-left-color: var(--red);   background: #FEF2F2; }
.alert-icon { flex-shrink: 0; }
.alert-row.severity-warning  .alert-icon { color: var(--amber); }
.alert-row.severity-critical .alert-icon { color: var(--red); }
.alert-body { flex: 1; min-width: 0; }
.alert-title  { font-size: 13px; font-weight: 700; color: var(--text); }
.alert-detail { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.alert-action {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 10px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--primary); font-size: 12px; font-weight: 600;
  text-decoration: none;
}
.alert-action:hover { background: var(--primary-soft); border-color: var(--primary); }

/* Lignes de tableau "data élevée" / "data épuisée" (utilisé sur Mobiles) */
tr.warn td { background: rgba(180, 83, 9, 0.08); }   /* amber pastel */
tr.crit td { background: rgba(185, 28, 28, 0.10); }  /* red pastel */

/* ---------- NOTIFICATIONS (cloche + panneau + toast) ---------- */
.notif-wrap { position: relative; }
.notif-wrap .icon-btn { position: relative; }
.notif-dot {
    position: absolute; top: 4px; right: 4px;
    min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 99px;
    background: var(--red); color: white;
    font: 700 10px/16px 'DM Sans';
    text-align: center;
    border: 2px solid var(--surface);
}
.notif-panel {
    position: absolute; top: calc(100% + 8px); right: 0;
    width: 380px; max-width: calc(100vw - 24px);
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 12px 28px rgba(0,0,0,0.12);
    z-index: 100;
}
.notif-panel-header {
    padding: 12px 16px; border-bottom: 1px solid var(--border);
    font: 700 14px 'Manrope'; color: var(--text);
}
.notif-panel-body { max-height: 70vh; overflow-y: auto; }
.notif-empty { padding: 24px; text-align: center; color: var(--text-3); font-size: 13px; }
.notif-item {
    padding: 12px 16px; border-bottom: 1px solid var(--border);
    border-left: 3px solid transparent;
}
.notif-item:last-child { border-bottom: 0; }
.notif-item.unread { background: rgba(31, 71, 160, 0.04); }
.notif-item.severity-info     { border-left-color: var(--primary); }
.notif-item.severity-success  { border-left-color: var(--green, #16a34a); }
.notif-item.severity-warning  { border-left-color: var(--amber, #B45309); }
.notif-item.severity-critical { border-left-color: var(--red, #B91C1C); }
.notif-title { font-weight: 700; font-size: 13px; color: var(--text); }
.notif-badge-new {
    display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 99px;
    background: var(--red-soft); color: var(--red); font-size: 10px; font-weight: 700;
}
.notif-body  { margin-top: 4px; font-size: 13px; color: var(--text-2); line-height: 1.45; white-space: pre-wrap; }
.notif-meta  { margin-top: 6px; font-size: 11px; color: var(--text-3); }

.notif-toast {
    position: fixed; top: 16px; right: 16px; z-index: 1100;
    width: 340px; max-width: calc(100vw - 32px);
    background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--primary);
    border-radius: 10px; padding: 14px 16px;
    box-shadow: 0 16px 32px rgba(0,0,0,0.16);
    cursor: pointer;
    animation: notif-slidein 0.25s ease-out both;
}
.notif-toast.severity-info     { border-left-color: var(--primary); }
.notif-toast.severity-success  { border-left-color: var(--green, #16a34a); }
.notif-toast.severity-warning  { border-left-color: var(--amber, #B45309); }
.notif-toast.severity-critical { border-left-color: var(--red, #B91C1C); }
.notif-toast-title { font-weight: 700; font-size: 14px; color: var(--text); }
.notif-toast-body  { margin-top: 4px; font-size: 13px; color: var(--text-2); line-height: 1.45; white-space: pre-wrap;
                     overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
.notif-toast.fade-out { opacity: 0; transform: translateX(20px); transition: all 0.4s ease; }
@keyframes notif-slidein {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}




/* ---------- IMPERSONATE BAR ---------- */
/* Bandeau orange persistant en haut quand un admin se fait passer pour un client.
   On reserve la hauteur pour ne pas masquer le contenu (translation des grilles). */
body.is-impersonating { padding-top: 38px; }
.impersonate-bar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 10000;
    height: 38px; display: flex; align-items: center; gap: 12px;
    padding: 0 16px;
    background: linear-gradient(90deg, var(--orange) 0%, #C2410C 100%);
    color: white; font: 600 13px/1 'Manrope';
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}
.impersonate-icon { display: inline-flex; opacity: 0.95; }
.impersonate-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.impersonate-text strong { font-weight: 700; }
.impersonate-exit {
    flex-shrink: 0; padding: 5px 12px; border-radius: 999px;
    background: rgba(255,255,255,0.18); color: white;
    font: 700 12px/1 'Manrope'; text-decoration: none;
    transition: background 0.15s;
}
.impersonate-exit:hover { background: rgba(255,255,255,0.30); text-decoration: none; }

/* ---------- BOUTON Se connecter comme ---------- */
.btn-impersonate {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 10px; border-radius: 8px;
    background: var(--orange-soft); color: #9A3412;
    font: 600 12px/1 'Manrope';
    text-decoration: none; border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}
.btn-impersonate:hover { background: #FFD3B5; border-color: var(--orange); text-decoration: none; }
