/* ============================================================
   iCentral Stats — LiveUp Pharmacies
   Design system inspiré du LGO iCentral
   ============================================================ */

:root {
  --blue-primary: #5C7CFA;
  --blue-primary-dark: #4F6FE5;
  --blue-light: #E8EDFA;
  --blue-pale: #F0F4FB;
  --green-accent: #7CB342;
  --green-accent-dark: #689F38;
  --green-accent-light: #DCEDC8;
  --green-pale: #F1F8E9;
  --orange: #FB923C;
  --red: #EF4444;
  --red-light: #FEE2E2;
  --yellow: #F59E0B;
  --yellow-light: #FEF3C7;

  --bg: #F5F7FA;
  --bg-card: #FFFFFF;
  --border: #E1E5E9;
  --border-light: #F0F2F5;
  --text: #2C3E50;
  --text-muted: #6C757D;
  --text-light: #9CA3AF;

  --sidebar-w: 200px;
  --topbar-h: 50px;
  --filter-h: 180px;
  --radius: 6px;
  --radius-sm: 4px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { border: none; background: none; cursor: pointer; font-family: inherit; }
input, select { font-family: inherit; font-size: inherit; }

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

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  background: white;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 18px 22px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  border-bottom: 1px solid var(--border-light);
  position: relative;
}
.logo-i { color: var(--blue-primary); }
.logo-central { color: var(--blue-primary-dark); }
.logo-dot {
  display: inline-block; width: 8px; height: 8px;
  background: var(--green-accent); border-radius: 50%;
  margin-left: 4px; vertical-align: middle;
  box-shadow: 0 0 0 2px white, 0 0 0 3px var(--green-accent-light);
}

.sidebar-user {
  padding: 14px 22px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border-light);
  font-size: 12px;
  color: var(--text-muted);
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.user-avatar svg { width: 32px; height: 32px; }
.user-name { flex: 1; font-weight: 600; color: var(--text); }
.user-role { font-size: 10px; }

.sidebar-nav { padding: 8px 0; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 22px;
  font-size: 12.5px;
  color: var(--text-muted);
  border-left: 3px solid transparent;
  transition: all 0.15s;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active {
  background: var(--green-pale);
  color: var(--text);
  font-weight: 600;
  border-left-color: var(--green-accent);
}
.nav-item.active .nav-icon { color: var(--green-accent-dark); }
.nav-icon {
  display: inline-flex;
  width: 18px; height: 18px;
  align-items: center; justify-content: center;
  font-size: 14px;
  color: var(--text-light);
  flex-shrink: 0;
}
.nav-icon svg {
  width: 16px; height: 16px;
  stroke-width: 1.8;
}
.nav-item.active .nav-icon { color: var(--green-accent-dark); }
.nav-item:hover .nav-icon { color: var(--text); }
.nav-divider { height: 1px; background: var(--border-light); margin: 8px 22px; }
.nav-item-muted { color: var(--text-light); font-size: 12px; }

/* ============================================================
   MAIN AREA
   ============================================================ */
.main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* ============================================================
   TOPBAR (header bleu)
   ============================================================ */
.topbar {
  height: var(--topbar-h);
  background: linear-gradient(90deg, var(--blue-primary) 0%, var(--blue-primary-dark) 100%);
  color: white;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  position: sticky; top: 0; z-index: 50;
}
.topbar-left {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
}
.breadcrumb-icon { font-size: 16px; }
.breadcrumb-sep { opacity: 0.6; margin: 0 4px; }
#breadcrumb { font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 6px; }
.topbar-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  transition: background 0.15s;
}
.topbar-icon:hover { background: rgba(255,255,255,0.15); }
.topbar-badge {
  position: absolute; top: 4px; right: 4px;
  background: var(--red);
  color: white;
  font-size: 9px; font-weight: 700;
  border-radius: 10px;
  padding: 1px 5px;
  line-height: 1.3;
}

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
  background: var(--blue-pale);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
}
.filter-bar-search {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.filter-bar-search strong {
  color: var(--text);
  font-weight: 600;
  margin-left: 4px;
}
.filter-bar-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}
.filter-bar-row.filter-bar-cards {
  grid-template-columns: repeat(3, 1fr);
}
.filter-select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--text);
  font-size: 12.5px;
  outline: none;
  transition: border-color 0.15s;
}
.filter-select:focus { border-color: var(--blue-primary); }

.filter-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px;
}
.filter-card-title {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}
.radio {
  display: inline-flex; align-items: center; gap: 4px;
  margin-right: 14px;
  cursor: pointer;
  color: var(--text);
}
.radio input { accent-color: var(--blue-primary); }

/* ============================================================
   CONTENT
   ============================================================ */
.content {
  flex: 1;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ============================================================
   CARDS / PANELS
   ============================================================ */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.panel-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, white 0%, #FAFBFC 100%);
}
.panel-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.panel-title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  background: var(--bg);
  border-radius: 5px;
  color: var(--text-muted);
}
.panel-title-icon svg { width: 14px; height: 14px; }
.panel-subtitle {
  font-size: 11px;
  color: var(--text-light);
  font-weight: normal;
  margin-left: 8px;
}
.panel-actions { display: flex; gap: 6px; }
.panel-action {
  font-size: 11px;
  color: var(--text-muted);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: white;
}
.panel-action:hover { background: var(--bg); color: var(--text); }
.panel-body { padding: 14px 16px; }
.panel-body-flush { padding: 0; }

/* ============================================================
   GRID HELPERS
   ============================================================ */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }
.grid-8 { grid-template-columns: repeat(8, 1fr); }
.grid-2-1 { grid-template-columns: 2fr 1fr; }
.grid-1-2 { grid-template-columns: 1fr 2fr; }

@media (max-width: 1280px) {
  .grid-6 { grid-template-columns: repeat(3, 1fr); }
  .grid-8 { grid-template-columns: repeat(4, 1fr); }
}

/* ============================================================
   KPI CARDS
   ============================================================ */
.kpi {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}
.kpi:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.kpi.kpi-clickable { cursor: pointer; position: relative; }
.kpi.kpi-clickable::after {
  content: '⤢';
  position: absolute;
  top: 8px; right: 10px;
  font-size: 11px;
  color: var(--text-light);
  opacity: 0;
  transition: opacity 0.15s;
}
.kpi.kpi-clickable:hover::after { opacity: 1; color: var(--blue-primary); }
.kpi::before {
  content: ''; position: absolute;
  top: 0; left: 0; width: 3px; height: 100%;
  background: var(--blue-primary);
}
.kpi.kpi-green::before { background: var(--green-accent); }
.kpi.kpi-orange::before { background: var(--orange); }
.kpi.kpi-red::before { background: var(--red); }
.kpi.kpi-purple::before { background: #8B5CF6; }
.kpi-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}
.kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}
.kpi-unit { font-size: 14px; color: var(--text-muted); font-weight: 500; margin-left: 2px; }
.kpi-delta {
  font-size: 11.5px;
  margin-top: 4px;
  font-weight: 600;
  display: inline-flex; align-items: center; gap: 3px;
}
.kpi-delta.up { color: var(--green-accent-dark); }
.kpi-delta.down { color: var(--red); }
.kpi-delta.neutral { color: var(--text-muted); }
.kpi-spark-wrap {
  position: relative;
  height: 36px;
  margin-top: 8px;
  width: 100%;
}
.kpi-spark-wrap canvas {
  position: absolute !important;
  top: 0; left: 0;
  width: 100% !important;
  height: 100% !important;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.table thead th {
  background: var(--blue-light);
  color: var(--text);
  font-weight: 600;
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky; top: 0;
}
.table tbody td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}
.table tbody tr:hover td { background: var(--bg); }
.table tbody tr.row-highlight td { background: var(--yellow-light); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .total td {
  font-weight: 700;
  background: var(--bg);
  border-top: 2px solid var(--border);
}
.table .col-label { font-weight: 500; color: var(--text); }
.table-mini {
  font-size: 12px;
}
.table-mini thead th { padding: 6px 10px; font-size: 11px; }
.table-mini tbody td { padding: 5px 10px; }

/* badges */
.badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 11px;
  background: var(--bg);
  color: var(--text-muted);
}
.badge-green { background: var(--green-accent-light); color: var(--green-accent-dark); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-blue { background: var(--blue-light); color: var(--blue-primary-dark); }
.badge-orange { background: #FED7AA; color: #C2410C; }
.badge-yellow { background: var(--yellow-light); color: #92400E; }

/* tabs */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  padding: 0 4px;
  gap: 0;
}
.tab {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--green-accent-dark);
  border-bottom-color: var(--green-accent);
  font-weight: 600;
}

/* alert list */
.alert-list { display: flex; flex-direction: column; }
.alert-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s;
}
.alert-item:last-child { border-bottom: none; }
.alert-item:hover { background: var(--bg); }
.alert-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
}
.alert-dot.red { background: var(--red); box-shadow: 0 0 0 3px var(--red-light); }
.alert-dot.orange { background: var(--orange); box-shadow: 0 0 0 3px #FED7AA; }
.alert-dot.green { background: var(--green-accent); box-shadow: 0 0 0 3px var(--green-accent-light); }
.alert-dot.blue { background: var(--blue-primary); box-shadow: 0 0 0 3px var(--blue-light); }
.alert-text { flex: 1; }
.alert-action {
  font-size: 11px; color: var(--blue-primary);
  font-weight: 600;
}

/* button */
.btn {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  transition: all 0.15s;
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--blue-primary); color: white; border-color: var(--blue-primary); }
.btn-primary:hover { background: var(--blue-primary-dark); }
.btn-success { background: var(--green-accent); color: white; border-color: var(--green-accent); }
.btn-success:hover { background: var(--green-accent-dark); }
.btn-sm { padding: 3px 8px; font-size: 11px; }
.btn-icon { padding: 4px 7px; }

/* progress bar */
.bar {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.bar-fill {
  height: 100%;
  background: var(--blue-primary);
  border-radius: 3px;
  transition: width 0.4s;
}
.bar-fill.green { background: var(--green-accent); }
.bar-fill.red { background: var(--red); }
.bar-fill.orange { background: var(--orange); }

/* progress with label */
.bar-row {
  display: grid;
  grid-template-columns: 1fr 60px 60px;
  gap: 10px;
  align-items: center;
  padding: 6px 0;
  font-size: 12px;
}
.bar-row .bar-label { color: var(--text); }
.bar-row .bar-track { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.bar-row .bar-track > div { height: 100%; border-radius: 3px; }
.bar-row .bar-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-muted); }

/* mini stat */
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border-light);
  font-size: 12.5px;
}
.stat-row:last-child { border-bottom: none; }
.stat-row .label { color: var(--text-muted); }
.stat-row .value { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

/* heatmap (CSS grid based) */
.heatmap {
  display: grid;
  grid-template-columns: 50px repeat(24, 1fr);
  gap: 1px;
  font-size: 10px;
}
.heatmap-h {
  text-align: center;
  color: var(--text-muted);
  font-size: 9px;
  padding: 2px 0;
}
.heatmap-day {
  text-align: right;
  color: var(--text-muted);
  font-size: 10px;
  padding: 4px 6px 0 0;
}
.heatmap-cell {
  height: 16px;
  border-radius: 2px;
  background: var(--bg);
  position: relative;
  cursor: pointer;
}
.heatmap-cell:hover {
  outline: 2px solid var(--blue-primary);
  outline-offset: 1px;
  z-index: 2;
}

/* legend */
.legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11px;
  color: var(--text-muted);
}
.legend-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  border-top: 1px solid var(--border);
  background: white;
  padding: 10px 24px;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

/* ============================================================
   PAGE TITLE
   ============================================================ */
.page-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 4px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border-light);
}
.page-title h1 {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  padding-bottom: 2px;
}
.page-title-meta {
  font-size: 11px;
  color: var(--text-light);
}

/* ============================================================
   CHATBOT
   ============================================================ */
.chat-btn {
  position: fixed;
  bottom: 24px; right: 24px;
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-primary) 0%, var(--blue-primary-dark) 100%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(92, 124, 250, 0.4);
  z-index: 80;
  transition: transform 0.2s, box-shadow 0.2s;
}
.chat-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 28px rgba(92, 124, 250, 0.5);
}
.chat-btn-pulse {
  position: absolute;
  top: -2px; right: -2px;
  width: 14px; height: 14px;
  background: var(--green-accent);
  border-radius: 50%;
  border: 2px solid white;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(124,179,66,0.6); }
  70% { box-shadow: 0 0 0 8px rgba(124,179,66,0); }
  100% { box-shadow: 0 0 0 0 rgba(124,179,66,0); }
}

.chat-window {
  position: fixed;
  bottom: 100px; right: 24px;
  width: 420px; max-height: 600px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.18);
  display: none;
  flex-direction: column;
  z-index: 90;
  overflow: hidden;
  animation: slide-up 0.25s ease;
}
.chat-window.open { display: flex; }
@keyframes slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-header {
  background: linear-gradient(135deg, var(--blue-primary) 0%, var(--blue-primary-dark) 100%);
  padding: 14px 18px;
  color: white;
  position: relative;
}
.chat-header-title {
  font-size: 14px;
  font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.chat-header-dot {
  display: inline-block; width: 8px; height: 8px;
  background: var(--green-accent);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.4);
  animation: pulse-green 2s infinite;
}
@keyframes pulse-green {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.chat-header-subtitle {
  font-size: 11px;
  opacity: 0.85;
  margin-top: 2px;
}
.chat-close {
  position: absolute;
  top: 12px; right: 12px;
  color: white;
  font-size: 14px;
  opacity: 0.7;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
}
.chat-close:hover { opacity: 1; background: rgba(255,255,255,0.15); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg);
  min-height: 280px;
  max-height: 380px;
}
.chat-msg {
  max-width: 85%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
}
.chat-msg.user {
  background: var(--blue-primary);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 3px;
}
.chat-msg.bot {
  background: white;
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 3px;
  border: 1px solid var(--border-light);
}
.chat-msg .chip {
  display: inline-block;
  background: var(--blue-light);
  color: var(--blue-primary-dark);
  padding: 2px 7px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  margin-right: 4px;
  margin-bottom: 2px;
}
.chat-msg .mini-chart {
  margin-top: 8px;
  padding: 8px;
  background: var(--bg);
  border-radius: 6px;
}

.chat-suggestions {
  padding: 8px 14px 0;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  background: var(--bg);
  border-top: 1px solid var(--border-light);
}
.chat-suggestion {
  font-size: 11px;
  padding: 5px 9px;
  border-radius: 12px;
  background: white;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.chat-suggestion:hover {
  background: var(--blue-light);
  color: var(--blue-primary-dark);
  border-color: var(--blue-primary);
}

.chat-input-wrap {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  background: white;
  border-top: 1px solid var(--border);
  gap: 6px;
}
.chat-mic, .chat-send {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.chat-mic { background: var(--blue-light); }
.chat-mic:hover { background: var(--blue-pale); }
.chat-mic.recording { background: var(--red); animation: pulse-red 1s infinite; }
.chat-mic.recording svg path { fill: white; }
@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}
.chat-send { background: var(--blue-primary); }
.chat-send:hover { background: var(--blue-primary-dark); }

.chat-input-wrap input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 8px 14px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.chat-input-wrap input:focus { border-color: var(--blue-primary); }

/* ============================================================
   UTILITIES
   ============================================================ */
.muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-tiny { font-size: 11px; }
.text-strong { font-weight: 600; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-sm { gap: 6px; }
.gap-md { gap: 12px; }
.mt-sm { margin-top: 6px; }
.mt-md { margin-top: 12px; }
.mt-lg { margin-top: 18px; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
.fade-in { animation: fade-in 0.25s; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ============================================================
   MODAL SYSTEM (expand panel on click)
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay.open { display: flex; animation: fade-in 0.2s; }
.modal {
  background: white;
  border-radius: 10px;
  max-width: 95vw;
  max-height: 92vh;
  width: 1200px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,0.30);
  animation: slide-up 0.25s ease;
}
.modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, white 0%, #FAFBFC 100%);
}
.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.modal-subtitle {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 2px;
}
.modal-actions { display: flex; gap: 6px; }
.modal-close {
  font-size: 18px;
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body {
  padding: 18px 22px;
  overflow-y: auto;
  flex: 1;
}

.panel-expand {
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 9px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: white;
  display: inline-flex; align-items: center; gap: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.panel-expand:hover {
  background: var(--blue-light);
  color: var(--blue-primary-dark);
  border-color: var(--blue-primary);
}
.panel.clickable { cursor: pointer; transition: box-shadow 0.15s, transform 0.15s; }
.panel.clickable:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.panel.clickable .panel-header { cursor: pointer; }
.panel.clickable .panel-body { cursor: pointer; }
.panel.clickable .panel-body button,
.panel.clickable .panel-body a,
.panel.clickable .panel-body input,
.panel.clickable .panel-body select { cursor: pointer; }
.panel-expand-hint {
  font-size: 10px;
  color: var(--text-light);
  margin-left: 6px;
  font-weight: normal;
}
.panel.clickable:hover .panel-expand-hint { color: var(--blue-primary); }

/* ============================================================
   GAUGE (score santé)
   ============================================================ */
.gauge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
}
.gauge {
  position: relative;
  width: 220px;
  height: 130px;
  overflow: hidden;
}
.gauge-svg { width: 220px; height: 130px; }
.gauge-value {
  position: absolute;
  bottom: 6px; left: 0; right: 0;
  text-align: center;
  font-size: 36px;
  font-weight: 700;
  color: var(--text);
}
.gauge-label {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================================
   ACTION ITEMS (today)
   ============================================================ */
.action-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  align-items: center;
  cursor: pointer;
  transition: background 0.15s;
}
.action-item:last-child { border-bottom: none; }
.action-item:hover { background: var(--bg); }
.action-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--blue-light);
  color: var(--blue-primary-dark);
  font-size: 12px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.action-num.priority { background: var(--red-light); color: var(--red); }
.action-num.med { background: #FED7AA; color: #C2410C; }
.action-num.low { background: var(--green-accent-light); color: var(--green-accent-dark); }
.action-content { flex: 1; }
.action-title { font-size: 13px; font-weight: 600; color: var(--text); }
.action-desc { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.action-meta {
  font-size: 10.5px;
  color: var(--text-light);
  text-align: right;
  white-space: nowrap;
}
.action-impact {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--green-accent-light);
  color: var(--green-accent-dark);
  margin-top: 2px;
  display: inline-block;
}

/* ============================================================
   TREND PILLS (what's hot)
   ============================================================ */
.trend-list { display: flex; flex-direction: column; gap: 6px; }
.trend-row {
  display: grid;
  grid-template-columns: 24px 1fr 80px 60px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 12px;
  gap: 10px;
}
.trend-row:hover { background: var(--bg); }
.trend-rank {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 11px;
}
.trend-name { color: var(--text); font-weight: 500; }
.trend-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: 11px; }
.trend-delta { text-align: right; font-weight: 600; font-size: 11px; }
.trend-delta.up { color: var(--green-accent-dark); }
.trend-delta.down { color: var(--red); }

/* ============================================================
   COMPARE COCKPIT (side-by-side)
   ============================================================ */
.compare-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 0;
}
.compare-half { text-align: center; flex: 1; }
.compare-num { font-size: 26px; font-weight: 700; }
.compare-label { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; margin-top: 2px; }
.compare-vs {
  font-size: 14px;
  color: var(--text-light);
  font-weight: 600;
  padding: 0 8px;
}

/* ============================================================
   MINI HEATMAP (week view)
   ============================================================ */
.mini-cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  padding: 8px 0;
}
.mini-day {
  border-radius: 4px;
  padding: 8px 6px;
  text-align: center;
  background: var(--bg);
  font-size: 11px;
  cursor: pointer;
  transition: transform 0.15s;
}
.mini-day:hover { transform: translateY(-1px); }
.mini-day-name { color: var(--text-muted); font-size: 10px; text-transform: uppercase; }
.mini-day-val { font-size: 13px; font-weight: 700; color: var(--text); margin-top: 2px; }
.mini-day-meta { font-size: 9.5px; color: var(--text-light); margin-top: 2px; }

/* ============================================================
   HERO KPI CARDS (refondues V2.0 — Stripe/Linear style)
   Fond blanc + bordure-top 4px + chiffre noir 48px
   ============================================================ */
.hero-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 4px;
}
.hero-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 24px;
  position: relative;
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-height: 200px;
  display: flex;
  flex-direction: column;
}
.hero-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: rgba(92,124,250,0.25); }
.hero-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 4px;
  background: var(--blue-primary);
}
.hero-card.hero-money::before    { background: var(--green-accent); }
.hero-card.hero-stock::before    { background: var(--orange); }
.hero-card.hero-patient::before  { background: var(--orange); } /* opportunité, pas alerte */
.hero-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: rgba(92, 124, 250, 0.1);
}
.hero-card.hero-money .hero-icon { background: rgba(124, 179, 66, 0.12); color: var(--green-accent-dark); }
.hero-card.hero-stock .hero-icon { background: rgba(251, 146, 60, 0.12); color: #C2410C; }
.hero-card.hero-patient .hero-icon { background: rgba(251, 146, 60, 0.12); color: #C2410C; }
.hero-icon svg { width: 20px; height: 20px; stroke-width: 1.8; }
.icon-sm { display: inline-flex; vertical-align: middle; width: 14px; height: 14px; stroke-width: 1.8; }
.icon-md { display: inline-flex; vertical-align: middle; width: 18px; height: 18px; stroke-width: 1.7; }
.hero-label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 6px;
}
.hero-value {
  font-size: 44px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -1.2px;
  line-height: 1;
  margin-top: 2px;
}
.hero-delta {
  font-size: 12.5px;
  font-weight: 600;
  margin-top: 8px;
}
.hero-delta.up { color: var(--green-accent-dark); }
.hero-delta.down { color: var(--red); }
.hero-delta.neutral { color: var(--text-muted); }
.hero-meta {
  margin-top: auto;
  padding-top: 12px;
  font-size: 11.5px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
  line-height: 1.5;
}
.hero-meta strong { color: var(--text); font-weight: 600; }
.hero-action {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--blue-primary);
}
.hero-card:hover .hero-action { color: var(--blue-primary-dark); }
.hero-card:hover .hero-action::after { content: ' →'; }
.hero-card .hero-action::after { content: ''; transition: content 0.15s; }

/* ============================================================
   Tooltip help — petit rond avec "?" dedans
   ============================================================ */
.kpi-why {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--blue-primary);
  background: var(--blue-light);
  border-radius: 50%;
  cursor: help;
  transition: all 0.15s;
  vertical-align: middle;
  border: 1px solid transparent;
  user-select: none;
}
.kpi-why::before { content: '?'; line-height: 1; }
.kpi-why:hover {
  background: var(--blue-primary);
  color: white;
  transform: scale(1.1);
}
.kpi-why.unseen {
  background: var(--blue-primary);
  color: white;
  animation: pulse-green 2s infinite;
}

/* ============================================================
   ACTION SUGGESTION sous le score (Q2)
   ============================================================ */
.score-action-hint {
  margin-top: 12px;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(124,179,66,0.08) 0%, rgba(92,124,250,0.05) 100%);
  border-left: 3px solid var(--green-accent);
  border-radius: 4px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
}
.score-action-hint:hover { background: linear-gradient(180deg, rgba(124,179,66,0.14) 0%, rgba(92,124,250,0.08) 100%); }
.score-action-hint .hint-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--green-accent-dark);
  font-weight: 700;
  margin-bottom: 2px;
}
.score-action-hint .hint-action {
  font-weight: 600;
  color: var(--text);
}
.score-action-hint .hint-impact {
  display: inline-block;
  margin-left: 4px;
  font-weight: 700;
  color: var(--green-accent-dark);
}
.score-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 4px;
}
.score-meta strong { color: var(--text); }

/* Profile selector (5 profils) */
.score-profile-row {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 4px 6px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.score-profile-select {
  flex: 1; font-size: 12px; padding: 4px 6px;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--bg); color: var(--text); cursor: pointer;
}
.score-profile-select:hover { border-color: var(--accent, #5C7CFA); }

/* Plafond risque banner */
.score-cap {
  display: flex; align-items: center; gap: 6px;
  margin: 8px 4px 0; padding: 6px 8px;
  background: rgba(239, 68, 68, 0.08);
  border-left: 3px solid #EF4444;
  border-radius: 3px;
  font-size: 11px; color: #B91C1C;
}
.score-cap .cap-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #EF4444; animation: pulseDot 2s infinite;
}
.score-cap .cap-raw { color: var(--text-muted); margin-left: auto; font-size: 10px; }
.cap-info {
  margin-top: 12px; padding: 8px 10px;
  background: rgba(239, 68, 68, 0.06);
  border-left: 3px solid #EF4444;
  border-radius: 3px;
  font-size: 12px; color: #991B1B;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Sous-scores avec barre + poids */
.score-subscores {
  margin-top: 12px; width: 100%;
  display: flex; flex-direction: column; gap: 6px;
  padding: 8px 4px 0;
  border-top: 1px solid var(--border);
}
.subscore-row {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  align-items: center;
  gap: 8px; font-size: 11px;
}
.subscore-label { display: flex; align-items: center; gap: 5px; color: var(--text); }
.subscore-bar {
  height: 6px; background: #E1E5E9;
  border-radius: 3px; overflow: hidden;
}
.subscore-fill { display: block; height: 100%; border-radius: 3px; transition: width .4s ease; }
.subscore-val { font-size: 11px; }
.subscore-val .subscore-w { color: var(--text-muted); margin-left: 3px; font-weight: 400; }

/* ============================================================
   ROI LEDGER (transversal cockpit)
   ============================================================ */
.roi-led-summary {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px; padding: 12px 4px 16px;
  border-bottom: 1px solid var(--border-light);
}
.roi-led-stat {
  background: var(--bg); border-radius: 6px;
  padding: 10px 12px; text-align: center;
  border: 1px solid var(--border-light);
}
.roi-led-stat.highlight {
  background: linear-gradient(180deg, rgba(124,179,66,0.08), rgba(124,179,66,0.02));
  border-color: rgba(124,179,66,0.35);
}
.roi-led-stat-val { font-size: 18px; font-weight: 700; color: var(--text); }
.roi-led-stat-lbl { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.roi-led-sources {
  padding: 14px 4px;
  display: flex; flex-direction: column; gap: 8px;
  border-bottom: 1px solid var(--border-light);
}
.roi-led-source-row {
  display: grid;
  grid-template-columns: 12px 130px 1fr 130px 50px;
  align-items: center; gap: 8px;
  font-size: 12px;
}
.roi-led-source-name { color: var(--text); font-weight: 600; }
.roi-led-source-bar {
  height: 6px; background: #E1E5E9; border-radius: 3px; overflow: hidden;
}
.roi-led-source-fill { display: block; height: 100%; border-radius: 3px; transition: width .4s ease; }
.roi-led-source-val { text-align: right; color: var(--text-muted); font-size: 11px; }
.roi-led-source-pct { text-align: right; }

.roi-led-table { margin-top: 8px; }
.roi-led-table td { vertical-align: middle; }
.roi-led-badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px;
}
.roi-led-detecte { background: rgba(92,124,250,0.15); color: #4263EB; }
.roi-led-valide  { background: rgba(245,158,11,0.18); color: #B45309; }
.roi-led-realise { background: rgba(124,179,66,0.18); color: #4F7A18; }
.roi-led-rejete  { background: rgba(156,163,175,0.18); color: #6B7280; }
.roi-led-perdu   { background: rgba(239,68,68,0.15);   color: #B91C1C; }

.badge-purple { background: rgba(139,92,246,0.15); color: #6D28D9; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }

/* ============================================================
   BRIEFING : hiérarchie 1+2 (Q1)
   ============================================================ */
.briefing-action.hero-priority {
  background: rgba(255,255,255,0.20);
  border: 2px solid rgba(255,255,255,0.45);
  padding: 16px 18px;
  position: relative;
}
.briefing-action.hero-priority::before {
  content: 'PRIORITÉ N°1';
  position: absolute;
  top: -10px;
  left: 14px;
  background: white;
  color: var(--blue-primary-dark);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
  padding: 2px 8px;
  border-radius: 3px;
}
.briefing-action.hero-priority .briefing-num {
  width: 36px; height: 36px;
  font-size: 16px;
  background: var(--green-accent);
  color: white;
}
.briefing-action.hero-priority .briefing-text { font-size: 14.5px; }
.briefing-action.hero-priority .briefing-impact { font-size: 12px; padding: 5px 12px; }
.briefing-more-link {
  display: block;
  text-align: center;
  margin-top: 12px;
  font-size: 12px;
  color: rgba(255,255,255,0.85);
  font-weight: 500;
  cursor: pointer;
}
.briefing-more-link:hover { color: white; text-decoration: underline; }

/* ============================================================
   ROI TRIPLET — Détecté / Validé / Réalisé (Q14)
   ============================================================ */
.roi-triplet {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 12px 0;
}
.roi-tier {
  text-align: center;
  padding: 14px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: white;
}
.roi-tier-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  margin-bottom: 4px;
}
.roi-tier-value {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
}
.roi-tier-meta {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 4px;
}
.roi-tier.detected { border-top: 3px solid var(--blue-primary); }
.roi-tier.detected .roi-tier-label { color: var(--blue-primary-dark); }
.roi-tier.detected .roi-tier-value { color: var(--blue-primary-dark); }
.roi-tier.validated { border-top: 3px solid var(--orange); }
.roi-tier.validated .roi-tier-label { color: #C2410C; }
.roi-tier.validated .roi-tier-value { color: #C2410C; }
.roi-tier.realized { border-top: 3px solid var(--green-accent); background: var(--green-pale); }
.roi-tier.realized .roi-tier-label { color: var(--green-accent-dark); }
.roi-tier.realized .roi-tier-value { color: var(--green-accent-dark); }

.roi-summary-line {
  display: flex;
  justify-content: space-around;
  align-items: baseline;
  padding: 12px 0;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
}
.roi-summary-line .num { font-weight: 700; color: var(--text); font-size: 15px; }

/* ============================================================
   "MES VICTOIRES" + "ACTIONS QUI ONT MARCHÉ AILLEURS" (Q4)
   ============================================================ */
.my-wins {
  background: linear-gradient(135deg, #DCEDC8 0%, #F1F8E9 100%);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.my-wins-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--green-accent-dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.my-wins-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.my-win {
  background: white;
  padding: 10px 12px;
  border-radius: 6px;
  border-left: 3px solid var(--green-accent);
  font-size: 11.5px;
}
.my-win-num {
  font-size: 18px;
  font-weight: 800;
  color: var(--green-accent-dark);
  line-height: 1;
}
.my-win-label {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.actions-elsewhere-item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.15s;
}
.actions-elsewhere-item:last-child { border-bottom: none; }
.actions-elsewhere-item:hover { background: var(--bg); }
.actions-elsewhere-icon { font-size: 18px; opacity: 0.85; }
.actions-elsewhere-text { font-size: 12.5px; line-height: 1.4; }
.actions-elsewhere-text strong { color: var(--text); }
.actions-elsewhere-meta {
  display: flex; flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 10.5px;
  color: var(--text-muted);
}
.actions-elsewhere-cta {
  font-size: 11px;
  color: var(--blue-primary);
  font-weight: 600;
  white-space: nowrap;
}
.actions-elsewhere-item:hover .actions-elsewhere-cta { text-decoration: underline; }

/* ============================================================
   CHIPS chatbot question-first (Q10) — 6 max
   ============================================================ */
.chat-suggestion-rich {
  font-size: 11.5px;
  padding: 8px 12px;
  border-radius: 14px;
  background: white;
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-suggestion-rich:hover {
  background: var(--blue-light);
  color: var(--blue-primary-dark);
  border-color: var(--blue-primary);
}
.chat-suggestion-rich .icon { font-size: 13px; }

/* ============================================================
   BOTTOM NAV mobile (PWA, Q13/Q15)
   ============================================================ */
.bottom-nav { display: none; }
@media (max-width: 768px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: white;
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 100;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
  }
  .bottom-nav-item {
    flex: 1;
    text-align: center;
    padding: 8px 0 6px;
    font-size: 10px;
    color: var(--text-muted);
    cursor: pointer;
  }
  .bottom-nav-item.active { color: var(--blue-primary); border-top: 2px solid var(--blue-primary); }
  .bottom-nav-icon { font-size: 18px; display: block; margin-bottom: 2px; }
  .main { padding-bottom: 60px; }
  .hero-grid, .grid-2, .grid-3, .grid-4, .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
  .hero-value { font-size: 36px; }
}

/* ============================================================
   COMMITMENT DATE PICKER (Q7 — Passage prévu)
   ============================================================ */
.commitment-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 250;
}
.commitment-box {
  background: white;
  border-radius: 8px;
  padding: 20px;
  width: 360px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.2);
}
.commitment-box h3 { font-size: 14px; margin-bottom: 12px; }
.commitment-box input[type=date] {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 12px;
}
.commitment-box .actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ============================================================
   REFUSAL MODAL (Q6 — motif refus stock dormant)
   ============================================================ */
.refusal-modal-box textarea {
  width: 100%;
  min-height: 80px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 12.5px;
  resize: vertical;
  margin-bottom: 12px;
}
.refusal-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.refusal-reason-chip {
  padding: 4px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.15s;
}
.refusal-reason-chip:hover, .refusal-reason-chip.active {
  background: var(--blue-light);
  color: var(--blue-primary-dark);
  border-color: var(--blue-primary);
}

/* ============================================================
   BRIEFING DU JOUR (3 actions prioritaires)
   ============================================================ */
.briefing {
  background: linear-gradient(135deg, #4F6FE5 0%, #5C7CFA 50%, #7CB342 100%);
  border-radius: 10px;
  padding: 18px 22px;
  color: white;
  position: relative;
  overflow: hidden;
}
.briefing::after {
  content: '';
  position: absolute;
  bottom: -50px; right: -50px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
}
.briefing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.briefing-title {
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.briefing-listen {
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.briefing-listen:hover { background: rgba(255,255,255,0.28); }
.briefing-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  z-index: 2;
}
.briefing-action {
  display: grid;
  grid-template-columns: 32px 1fr auto auto;
  gap: 12px;
  align-items: center;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(2px);
  padding: 12px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
}
.briefing-action:hover {
  background: rgba(255,255,255,0.20);
  border-color: rgba(255,255,255,0.3);
  transform: translateX(2px);
}
.briefing-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  color: var(--blue-primary-dark);
  font-size: 13px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.briefing-text { font-size: 13.5px; font-weight: 500; }
.briefing-text strong { font-weight: 700; }
.briefing-impact {
  background: rgba(124, 179, 66, 0.95);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  white-space: nowrap;
}
.briefing-go {
  background: white;
  color: var(--blue-primary-dark);
  font-weight: 700;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================================
   FRESHNESS BADGE
   ============================================================ */
.freshness-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  background: var(--green-accent-light);
  color: var(--green-accent-dark);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.freshness-dot {
  width: 6px; height: 6px;
  background: var(--green-accent);
  border-radius: 50%;
  animation: pulse-green 2s infinite;
}

/* ============================================================
   KPI INFO TOOLTIP (icône ⓘ "comment c'est calculé")
   ============================================================ */
.kpi-info {
  display: inline-block;
  margin-left: 4px;
  width: 14px; height: 14px;
  font-size: 10px;
  background: var(--bg);
  color: var(--text-muted);
  border-radius: 50%;
  text-align: center;
  line-height: 14px;
  cursor: help;
  transition: all 0.15s;
  vertical-align: middle;
  font-weight: 700;
}
.kpi-info:hover { background: var(--blue-primary); color: white; }
.kpi-info-popover {
  position: absolute;
  background: var(--text);
  color: white;
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 11.5px;
  line-height: 1.5;
  max-width: 320px;
  z-index: 100;
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
  white-space: normal;
}
.kpi-info-popover strong { color: white; font-weight: 700; }
.kpi-info-popover .formula {
  display: block;
  margin-top: 6px;
  padding: 6px 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 10.5px;
}

/* ============================================================
   COMMAND PALETTE (Cmd+K, style Linear)
   ============================================================ */
.cmdp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  z-index: 300;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}
.cmdp-overlay.open { display: flex; animation: fade-in 0.15s; }
.cmdp {
  background: white;
  border-radius: 12px;
  width: 640px;
  max-width: 90vw;
  max-height: 70vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.30);
  animation: slide-up 0.18s ease;
}
.cmdp-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.cmdp-search input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  background: transparent;
  color: var(--text);
}
.cmdp-search input::placeholder { color: var(--text-light); }
.cmdp-results {
  overflow-y: auto;
  max-height: 50vh;
  padding: 8px 0;
}
.cmdp-section-title {
  padding: 8px 18px 4px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  font-weight: 700;
}
.cmdp-item {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 18px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.cmdp-item.active, .cmdp-item:hover { background: var(--blue-light); }
.cmdp-item-icon {
  width: 24px; height: 24px;
  background: var(--bg);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
}
.cmdp-item-name { font-weight: 500; }
.cmdp-item-meta { font-size: 11px; color: var(--text-light); }
.cmdp-kbd {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 5px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-family: ui-monospace, monospace;
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
}
.cmdp-footer {
  padding: 8px 16px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--text-light);
}
.cmdp-empty {
  padding: 30px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12.5px;
}

/* ============================================================
   WALL OF WINS
   ============================================================ */
.wow-list {
  display: flex;
  flex-direction: column;
}
.wow-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 12.5px;
}
.wow-item:last-child { border-bottom: none; }
.wow-emoji { font-size: 18px; flex-shrink: 0; }
.wow-text { flex: 1; }
.wow-text strong { color: var(--green-accent-dark); }
.wow-time { font-size: 10.5px; color: var(--text-light); }

/* ============================================================
   ROI / SAVINGS METER
   ============================================================ */
.roi-meter {
  text-align: center;
  padding: 14px 0;
}
.roi-big {
  font-size: 38px;
  font-weight: 800;
  color: var(--green-accent-dark);
  letter-spacing: -0.5px;
}
.roi-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-top: 2px;
}
.roi-breakdown {
  margin-top: 16px;
  text-align: left;
}
.roi-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 12px;
  border-bottom: 1px dashed var(--border-light);
}
.roi-line:last-child { border-bottom: none; }

/* ============================================================
   ALERT FEEDBACK (👍/👎)
   ============================================================ */
.alert-feedback {
  display: inline-flex;
  gap: 4px;
  margin-left: 8px;
}
.alert-feedback button {
  width: 20px; height: 20px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  opacity: 0.5;
  transition: all 0.15s;
}
.alert-feedback button:hover {
  opacity: 1;
  background: var(--bg);
  border-color: var(--border);
}
.alert-feedback button.active {
  opacity: 1;
  background: var(--blue-light);
  border-color: var(--blue-primary);
}

/* ============================================================
   FILTER BANNER (cross-filtering active)
   ============================================================ */
.filter-banner {
  background: linear-gradient(90deg, #FEF3C7 0%, #FED7AA 100%);
  border-bottom: 1px solid #F59E0B;
  padding: 8px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: #92400E;
}
.filter-banner-icon { font-size: 14px; }
.filter-banner-text { font-weight: 600; }
.filter-chip {
  display: inline-block;
  background: white;
  color: #92400E;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #F59E0B;
  margin-right: 5px;
}
.filter-chip-close {
  margin-left: 4px;
  cursor: pointer;
  font-weight: 700;
  color: #C2410C;
}

/* ============================================================
   BOOKMARK MENU
   ============================================================ */
.bookmark-menu {
  position: absolute;
  top: 60px;
  right: 24px;
  width: 360px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.15);
  border: 1px solid var(--border);
  z-index: 100;
  overflow: hidden;
}
.bookmark-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.bookmark-list {
  max-height: 320px;
  overflow-y: auto;
}
.bookmark-item {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12.5px;
  transition: background 0.15s;
}
.bookmark-item:hover { background: var(--bg); }
.bookmark-item:last-child { border-bottom: none; }
.bookmark-item-icon {
  width: 22px; height: 22px;
  background: var(--blue-light);
  color: var(--blue-primary-dark);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  flex-shrink: 0;
}
.bookmark-item-content { flex: 1; }
.bookmark-item-name { font-weight: 600; color: var(--text); }
.bookmark-item-meta { font-size: 11px; color: var(--text-muted); }
.bookmark-item-delete {
  color: var(--red);
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.bookmark-item:hover .bookmark-item-delete { opacity: 1; }
.bookmark-empty {
  padding: 20px 16px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 13px;
  z-index: 250;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  animation: slide-up 0.3s ease;
}
.toast-success { background: var(--green-accent-dark); }
.toast-error { background: var(--red); }

/* ============================================================
   WORKFLOW STATUS (stock dormant + patients chroniques)
   ============================================================ */
.workflow-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.workflow-status::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
}
.workflow-status.proposed { background: var(--blue-light); color: var(--blue-primary-dark); }
.workflow-status.proposed::before { background: var(--blue-primary); animation: pulse-green 2s infinite; }
.workflow-status.accepted { background: #FED7AA; color: #C2410C; }
.workflow-status.accepted::before { background: var(--orange); }
.workflow-status.executing { background: var(--yellow-light); color: #92400E; }
.workflow-status.executing::before { background: var(--yellow); animation: pulse-green 1s infinite; }
.workflow-status.sold { background: var(--green-accent-light); color: var(--green-accent-dark); }
.workflow-status.sold::before { background: var(--green-accent); }

.workflow-status.pending { background: var(--red-light); color: var(--red); }
.workflow-status.pending::before { background: var(--red); animation: pulse-red 1s infinite; }
.workflow-status.contacted { background: var(--blue-light); color: var(--blue-primary-dark); }
.workflow-status.contacted::before { background: var(--blue-primary); }
.workflow-status.returned { background: var(--green-accent-light); color: var(--green-accent-dark); }
.workflow-status.returned::before { background: var(--green-accent); }
.workflow-status.lost { background: var(--bg); color: var(--text-muted); }
.workflow-status.lost::before { background: var(--text-light); }

.workflow-step-bar {
  display: flex;
  gap: 2px;
  margin-top: 4px;
}
.workflow-step-bar > div {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--border-light);
}
.workflow-step-bar > div.done { background: var(--green-accent); }
.workflow-step-bar > div.current { background: var(--blue-primary); animation: pulse-green 2s infinite; }

/* ============================================================
   CHECKLIST ACTIVATION (1er login)
   ============================================================ */
.activation-overlay {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 360px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.15);
  z-index: 70;
  overflow: hidden;
  animation: slide-up 0.3s ease;
}
.activation-overlay.collapsed .activation-body { display: none; }
.activation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(90deg, var(--blue-primary) 0%, var(--green-accent) 100%);
  color: white;
  cursor: pointer;
}
.activation-title {
  font-size: 13px;
  font-weight: 700;
}
.activation-progress {
  font-size: 11px;
  background: rgba(255,255,255,0.25);
  padding: 2px 8px;
  border-radius: 12px;
}
.activation-toggle { font-size: 14px; }
.activation-body { padding: 4px 0; }
.activation-step {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  font-size: 12.5px;
  transition: background 0.15s;
}
.activation-step:last-child { border-bottom: none; }
.activation-step:hover { background: var(--bg); }
.activation-step.done { color: var(--text-muted); }
.activation-step.done .activation-step-name { text-decoration: line-through; }
.activation-step-icon {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}
.activation-step.done .activation-step-icon {
  background: var(--green-accent);
  border-color: var(--green-accent);
  color: white;
}
.activation-step.current .activation-step-icon {
  background: var(--blue-primary);
  border-color: var(--blue-primary);
  color: white;
  animation: pulse-green 2s infinite;
}
.activation-step-name { font-weight: 600; color: var(--text); }
.activation-step.done .activation-step-name { font-weight: 500; }
.activation-step-desc { font-size: 11px; color: var(--text-muted); }
.activation-step-go {
  font-size: 11px;
  color: var(--blue-primary);
  font-weight: 600;
}
.activation-step.done .activation-step-go { display: none; }

/* ============================================================
   PERCENTILE (benchmark vs comparables)
   ============================================================ */
.percentile-row {
  display: grid;
  grid-template-columns: 130px 1fr 60px;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  font-size: 12px;
}
.percentile-label { color: var(--text); font-weight: 500; }
.percentile-track {
  position: relative;
  height: 24px;
  background: linear-gradient(90deg, #FEE2E2 0%, #FED7AA 25%, #FEF3C7 50%, #DCEDC8 75%, var(--green-accent-light) 100%);
  border-radius: 12px;
  overflow: hidden;
}
.percentile-mark {
  position: absolute;
  top: 0;
  width: 4px;
  height: 100%;
  background: var(--text);
  transform: translateX(-2px);
}
.percentile-mark::after {
  content: 'vous';
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  background: var(--text);
  color: white;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 700;
  white-space: nowrap;
}
.percentile-p50, .percentile-p90 {
  position: absolute;
  top: 0;
  width: 1px;
  height: 100%;
  background: rgba(0,0,0,0.15);
}
.percentile-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--text-muted);
}
.percentile-value strong { color: var(--text); font-size: 13px; }

/* ============================================================
   COPY LINK BUTTON (modals)
   ============================================================ */
.modal-actions .btn {
  font-size: 11px;
  padding: 4px 10px;
}
.copied-flash {
  background: var(--green-accent) !important;
  color: white !important;
  border-color: var(--green-accent) !important;
}

/* ============================================================
   ROI CALCULATOR
   ============================================================ */
.roi-calc-input {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.roi-calc-input label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  font-weight: 600;
}
.roi-calc-input input[type=range] { accent-color: var(--blue-primary); }
.roi-calc-input .value { font-size: 16px; font-weight: 700; color: var(--text); }

/* loading dots */
.dot-typing {
  display: inline-flex; gap: 3px; padding: 4px 0;
}
.dot-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-light);
  animation: dot-bounce 1.2s infinite;
}
.dot-typing span:nth-child(2) { animation-delay: 0.15s; }
.dot-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}
