/* Esmartgestion — shared design tokens (Data-Dense dashboard, emerald brand) */
*, ::before, ::after { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { margin: 0; }

:root {
  --brand-50: #ecfdf5;
  --brand-100: #d1fae5;
  --brand-600: #059669;
  --brand-700: #047857;
  --ink-900: #0f172a;
  --ink-600: #475569;
  --line: #e2e8f0;
  --card-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  --card-shadow-hover: 0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.06);
}

/* Numbers: tabular figures so KPIs and tables don't jitter */
.tnum { font-variant-numeric: tabular-nums; }

/* Cards */
.card {
  background: #fff;
  border: 1px solid #f1f5f9;
  border-radius: 0.75rem;
  box-shadow: var(--card-shadow);
}
.card-hover { transition: box-shadow 200ms ease, transform 200ms ease, border-color 200ms ease; }
.card-hover:hover { box-shadow: var(--card-shadow-hover); }
a.card-hover, button.card-hover { cursor: pointer; }

/* Data tables */
.dtable thead th {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.dtable tbody tr { transition: background-color 150ms ease; }

/* Focus visibility (keyboard navigation) */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--brand-600);
  outline-offset: 2px;
}

/* Skeleton loading */
.skeleton {
  position: relative;
  overflow: hidden;
  background: #f1f5f9;
  border-radius: 0.5rem;
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
::selection { background: #05966920; }

/* Alpine.js : masque les éléments x-cloak avant init (anti-FOUC) */
[x-cloak] { display: none !important; }

/* Notifications toast ventes en direct (pile latérale droite) */
#toast-stack {
  position: fixed;
  top: 4.5rem;
  right: 1rem;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(22rem, calc(100vw - 2rem));
  pointer-events: none;
}
.toast-new {
  pointer-events: auto;
  background: #fff;
  border: 1px solid #f1f5f9;
  border-left: 4px solid #dc2626;
  border-radius: 0.75rem;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.08);
  padding: 0.75rem 0.875rem;
  animation: toast-in 200ms ease-out;
  transition: opacity 200ms ease, transform 200ms ease;
}
.toast-new.toast-leave { opacity: 0; transform: translateX(1rem); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(1rem); }
  to { opacity: 1; transform: translateX(0); }
}
.toast-ic {
  width: 2rem; height: 2rem; flex-shrink: 0;
  background: #fef2f2; color: #dc2626;
  border-radius: 0.5rem;
  display: flex; align-items: center; justify-content: center;
}
.toast-ic svg { width: 1.125rem; height: 1.125rem; }
.toast-title { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: #dc2626; }
.toast-msg { font-size: 0.875rem; font-weight: 600; color: #0f172a; margin-top: 0.125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast-time { font-size: 0.75rem; color: #94a3b8; margin-top: 0.125rem; }
.toast-x {
  flex-shrink: 0; padding: 0.375rem; min-width: 2rem; min-height: 2rem;
  color: #94a3b8; border-radius: 0.5rem; cursor: pointer;
  transition: color 200ms ease, background-color 200ms ease;
}
.toast-x:hover { color: #475569; background: #f1f5f9; }
.toast-x svg { width: 1rem; height: 1rem; }

/* Nouvelles ventes : clignotement rouge (liste en direct du dashboard) */
.flash-new {
  animation: flash-red 1s ease-in-out 6;
  background-color: #fef2f2 !important;
  box-shadow: inset 3px 0 0 #dc2626;
}
.flash-new:hover { background-color: #fee2e2 !important; }
@keyframes flash-red {
  0%, 100% { background-color: #fef2f2; }
  50% { background-color: #fca5a5; }
}

@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
