/* === SAM · Components === */

/* ---- Icons (feather-ish, 1.5 stroke) ---- */
.icon { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-lg { width: 20px; height: 20px; }
.icon-xl { width: 28px; height: 28px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
  white-space: nowrap;
  letter-spacing: -0.005em;
}
.btn:hover { transform: translateY(-0.5px); }
.btn:active { transform: translateY(0.5px); }
.btn .icon { width: 15px; height: 15px; }

.btn-primary { background: var(--azur); color: #fff; box-shadow: 0 1px 2px rgba(31,120,180,0.25), inset 0 1px 0 rgba(255,255,255,0.15); }
.btn-primary:hover { background: var(--azur-dark); box-shadow: 0 4px 12px -2px rgba(31,120,180,0.4), inset 0 1px 0 rgba(255,255,255,0.15); }

.btn-secondary { background: var(--surface); color: var(--azur); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--azur); background: var(--azur-pale); }

.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #A52E22; }

.btn-gold { background: var(--gold); color: var(--ink); box-shadow: 0 1px 2px rgba(168,126,74,0.25); }
.btn-gold:hover { background: var(--gold-dark); color: #fff; }

.btn-hero { background: #fff; color: var(--azur-deep); box-shadow: 0 8px 24px -8px rgba(0,0,0,0.25); font-weight: 600; }
.btn-hero:hover { background: #fff; box-shadow: 0 12px 32px -8px rgba(0,0,0,0.35); }

.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 14px; }
.btn-icon { width: 36px; padding: 0; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ---- Chips / Badges ---- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  color: var(--text-2);
  letter-spacing: 0;
  white-space: nowrap;
}
.chip-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.chip-success { background: var(--success-soft); color: #1E7E3E; }
.chip-warning { background: var(--warning-soft); color: #8A5A15; }
.chip-danger  { background: var(--danger-soft); color: #8A2A20; }
.chip-info    { background: var(--azur-pale); color: var(--azur-dark); }
.chip-azur    { background: var(--azur); color: #fff; }
.chip-gold    { background: var(--gold-pale); color: var(--gold-dark); }
.chip-ink     { background: var(--ink); color: #fff; }
.chip-outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-2); }

.chip-mono {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border-soft);
  height: 20px;
  padding: 0 7px;
  border-radius: var(--r-sm);
  letter-spacing: 0;
}

/* ---- Card ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--sh-lg); border-color: var(--border-strong); }
.card-pad { padding: 20px; }
.card-pad-lg { padding: 24px; }

/* ---- Input ---- */
.input, .select {
  display: flex;
  align-items: center;
  height: 36px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--text);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
  width: 100%;
}
.input:focus, .select:focus, .input:focus-within {
  outline: none;
  border-color: var(--azur);
  box-shadow: 0 0 0 3px rgba(31,120,180,0.15);
}
.input::placeholder { color: var(--text-3); }

.input.input-search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  width: 240px;
  flex: none;
}
.input.input-search input {
  min-width: 0;
  width: 100%;
}
.input-search .icon { color: var(--text-3); }
.input-search input { border: none; outline: none; background: none; flex: 1; font-size: 13px; color: var(--text); }
.input-search input::placeholder { color: var(--text-3); }

.kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 2px 6px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--text-2);
}

/* ---- Avatar ---- */
.avatar {
  border-radius: 50%;
  background: var(--azur);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
  flex: none;
  position: relative;
  overflow: hidden;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-md { width: 40px; height: 40px; font-size: 13px; }
.avatar-lg { width: 80px; height: 80px; font-size: 22px; }
.avatar-xl { width: 120px; height: 120px; font-size: 32px; }

/* SAM avatar — portrait photographique + bordure doree.
   Le degrade reste comme fond de secours si l'image ne charge pas.

   2026-08-06 : deux regles retirees avec le passage du SVG dessine a la photo.
   - `overflow: visible` : il annulait le `overflow: hidden` de .avatar, donc la
     photo carree debordait du cercle au lieu d'etre detouree.
   - `.avatar-sam::after` : elle dessinait une cravate ROUGE en CSS, heritee de
     l'illustration. Le portrait a sa propre cravate (bleue) — la regle se
     superposait au buste. Ne pas la reintroduire. */
.avatar-sam {
  background: linear-gradient(160deg, #2c3e55 0%, #0F2847 100%);
  border: 2px solid var(--gold);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
}
.avatar-sam img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-user {
  background: linear-gradient(145deg, var(--azur-light), var(--azur-dark));
  color: #fff;
}

/* ---- Progress ---- */
.progress {
  height: 6px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--azur) 0%, #3FB37A 100%);
  border-radius: 999px;
  transition: width 500ms var(--ease);
}
.progress-thin { height: 4px; }

/* ---- Stat pill ---- */
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 32px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-pill);
  font-size: 12px;
  color: var(--text-2);
  box-shadow: var(--sh-sm);
}
.stat-pill strong { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-pill .dot { width: 7px; height: 7px; border-radius: 50%; }

/* ---- KPI card ---- */
.kpi {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--dur) var(--ease);
}
.kpi:hover { box-shadow: var(--sh-md); }
.kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--azur);
  opacity: 0.9;
}
.kpi.kpi-gold::before { background: var(--gold); }
.kpi.kpi-success::before { background: var(--success); }
.kpi.kpi-warning::before { background: var(--warning); }
.kpi-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.kpi-value {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.kpi-value.t-success { color: #1E7E3E; }
.kpi-value.t-warning { color: #8A5A15; }
.kpi-value.t-azur { color: var(--azur); }
.kpi-sub {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
}
.kpi-delta { color: var(--success); font-weight: 500; }
.kpi-delta.neg { color: var(--danger); }

/* ---- Alert ---- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  font-size: 13px;
  border: 1px solid;
}
.alert-warning { background: var(--warning-soft); border-color: #F0D9A8; color: #6E4611; }
.alert-warning .icon { color: var(--warning); margin-top: 2px; }
.alert-info { background: var(--azur-pale); border-color: #C9E1EF; color: var(--azur-dark); }
.alert-info .icon { color: var(--azur); margin-top: 2px; }
.alert-success { background: var(--success-soft); border-color: #C5E5D1; color: #1E5C33; }
.alert-success .icon { color: var(--success); margin-top: 2px; }

/* ---- Table ---- */
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th {
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 10px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--dur-fast) var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }
.table .sha { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-3); }

/* ---- Toast ---- */
.toast {
  position: fixed;
  top: 80px;
  right: 24px;
  min-width: 300px;
  padding: 14px 16px 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--azur);
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  z-index: 2000;
  animation: toastIn 300ms var(--ease);
}
.toast-success { border-left-color: var(--success); }
.toast-danger  { border-left-color: var(--danger); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 40, 71, 0.45);
  backdrop-filter: blur(2px);
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 180ms var(--ease);
}
.modal {
  background: #fff;
  border-radius: var(--r-xl);
  padding: 28px;
  width: 460px;
  max-width: calc(100vw - 40px);
  box-shadow: var(--sh-xl);
  animation: modalIn 220ms var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---- Utility ---- */
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.spacer { flex: 1; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-5 { gap: 20px; } .gap-6 { gap: 24px; } .gap-8 { gap: 32px; }
.text-2 { color: var(--text-2); } .text-3 { color: var(--text-3); }
.mono { font-family: var(--font-mono); }
.display { font-family: var(--font-display); }
.fw-500 { font-weight: 500; } .fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-3);
}
.eyebrow-gold { color: var(--gold-dark); }
.eyebrow-gold::before { content: '—'; margin-right: 8px; color: var(--gold); }
.divider { height: 1px; background: var(--border-soft); }
.v-divider { width: 1px; background: var(--border-soft); align-self: stretch; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
