/* ═══════════════════════════════════════════════
   CUTZ ADMIN — chrome + composants
   Cohérent avec /pro : sidebar slate, topbar blanche,
   accent orange brand, mode light. Sans framework.
═══════════════════════════════════════════════ */

:root {
  --cutz-accent:           #FF6B35;
  --cutz-accent-hover:     #E85D20;
  --cutz-accent-soft:      rgba(255,107,53,0.10);
  --cutz-success:          #10B981;
  --cutz-warning:          #F59E0B;
  --cutz-error:            #EF4444;
  --cutz-info:             #3B82F6;

  --adm-bg:                #F4F5F7;
  --adm-surface:           #FFFFFF;
  --adm-surface-2:         #F9FAFB;
  --adm-border:            #E5E7EB;
  --adm-border-strong:     #D1D5DB;
  --adm-text:              #111827;
  --adm-text-muted:        #6B7280;
  --adm-text-subtle:       #9CA3AF;

  /* Sidebar admin : aubergine profond — différenciation visuelle immédiate
     d'avec le slate-800 du dashboard pro. Power user / panel admin. */
  --adm-sidebar-bg:        #2D1A2E;
  --adm-sidebar-bg-2:      #1E1020;
  --adm-sidebar-text:      #D8C8D9;
  --adm-sidebar-text-active: #FFFFFF;
  --adm-sidebar-hover:     rgba(255,255,255,0.07);
  --adm-sidebar-active-bg: rgba(255,107,53,0.08);

  --adm-radius-sm: 8px;
  --adm-radius-md: 12px;
  --adm-radius-lg: 16px;

  --adm-shadow-1: 0 1px 2px rgba(0,0,0,0.04);
  --adm-shadow-2: 0 4px 12px rgba(0,0,0,0.06);

  --adm-sidebar-w: 248px;
  --adm-topbar-h:  64px;

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, Roboto, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--adm-text);
  background: var(--adm-bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--adm-text); text-decoration: none; }
a:hover { color: var(--cutz-accent); }
button { font-family: inherit; }
code { font-family: var(--font-mono); font-size: 0.92em; padding: 1px 5px; background: var(--adm-surface-2); border: 1px solid var(--adm-border); border-radius: 4px; }

/* ───── LAYOUT ───── */
.adm-app {
  display: grid;
  grid-template-columns: var(--adm-sidebar-w) 1fr;
  grid-template-rows: var(--adm-topbar-h) 1fr;
  grid-template-areas: "sidebar topbar" "sidebar main";
  min-height: 100vh;
}
.adm-sidebar {
  grid-area: sidebar;
  background: var(--adm-sidebar-bg);
  color: var(--adm-sidebar-text);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.adm-topbar {
  grid-area: topbar;
  background: var(--adm-surface);
  border-bottom: 1px solid var(--adm-border);
  display: flex; align-items: center;
  padding: 0 24px; gap: 16px;
  position: sticky; top: 0; z-index: 10;
}
.adm-main {
  grid-area: main;
  padding: 24px 32px 64px;
  max-width: 100%;
}
@media (max-width: 1024px) {
  .adm-app { grid-template-columns: 72px 1fr; }
  .adm-sidebar .nav-label,
  .adm-sidebar .brand-text,
  .adm-sidebar .nav-section-title,
  .adm-sidebar .nav-badge { display: none; }
  .adm-sidebar .nav-item { justify-content: center; padding: 14px 0; }
  .adm-main { padding: 16px; }
}
@media (max-width: 720px) {
  .adm-app { grid-template-columns: 1fr; grid-template-areas: "topbar" "main"; }
  .adm-sidebar { display: none; }
}

/* ───── SIDEBAR ───── */
.brand {
  height: var(--adm-topbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.brand-logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--cutz-accent); color: white;
  display: grid; place-items: center;
  font-weight: 800; font-size: 16px;
}
.brand-text {
  font-weight: 700; letter-spacing: 0.06em;
  font-size: 14px; text-transform: uppercase; color: white;
}
.nav-section-title {
  padding: 16px 20px 8px;
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.40);
  font-weight: 700;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 20px;
  color: var(--adm-sidebar-text);
  font-size: 14px;
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  position: relative;
}
.nav-item:hover { background: var(--adm-sidebar-hover); color: white; }
.nav-item.is-active {
  background: var(--adm-sidebar-active-bg);
  color: var(--adm-sidebar-text-active);
  border-left-color: var(--cutz-accent);
  font-weight: 600;
}
.nav-item .nav-icon {
  width: 20px; height: 20px;
  display: grid; place-items: center; flex-shrink: 0;
}
.nav-item .nav-label { flex: 1; }
.nav-badge {
  background: var(--cutz-accent);
  color: white;
  font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 999px;
  min-width: 20px; text-align: center;
}
.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.04);
  font-size: 12px;
  color: rgba(255,255,255,0.50);
}
.sidebar-footer a { color: rgba(255,255,255,0.7); }
.sidebar-footer a:hover { color: white; }

/* ───── TOPBAR ───── */
.topbar-title { font-size: 16px; font-weight: 600; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.env-pill {
  font-size: 11px; font-family: var(--font-mono);
  color: var(--adm-text-muted);
  padding: 4px 10px;
  background: var(--adm-surface-2);
  border: 1px solid var(--adm-border);
  border-radius: 999px;
}
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--adm-border);
  background: white;
}
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--cutz-accent);
  color: white; font-weight: 700;
  display: grid; place-items: center;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-chip-name { font-size: 13px; font-weight: 500; }

/* ───── PAGE HEADER ───── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; gap: 16px; flex-wrap: wrap;
}
.page-header h1 { font-size: 22px; margin: 0 0 4px; font-weight: 700; }
.page-header .page-sub { font-size: 13px; color: var(--adm-text-muted); margin: 0; }

/* ───── CARDS ───── */
.card {
  background: var(--adm-surface);
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius-md);
  padding: 20px;
  box-shadow: var(--adm-shadow-1);
}
.card.no-pad { padding: 0; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px;
}
.card-title { font-size: 15px; font-weight: 600; margin: 0; }
.card-sub { font-size: 12px; color: var(--adm-text-muted); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-2of3 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
@media (max-width: 1024px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-2of3 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ───── KPI ───── */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 540px)  { .kpi-grid { grid-template-columns: 1fr; } }

.kpi {
  background: white;
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius-md);
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 6px;
}
.kpi-label {
  font-size: 12px; color: var(--adm-text-muted);
  font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.04em;
}
.kpi-value { font-size: 26px; font-weight: 800; line-height: 1.1; }
.kpi-delta { font-size: 12px; color: var(--cutz-success); font-weight: 600; }
.kpi-delta.is-down { color: var(--cutz-error); }
.kpi-delta.is-flat { color: var(--adm-text-muted); }
.kpi.is-warn .kpi-value { color: var(--cutz-warning); }
.kpi.is-danger .kpi-value { color: var(--cutz-error); }

/* ───── BUTTONS ───── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border-radius: var(--adm-radius-sm);
  border: 1px solid var(--adm-border);
  background: white;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
  color: var(--adm-text);
  text-decoration: none;
}
.btn:hover { background: var(--adm-surface-2); }
.btn-primary {
  background: var(--cutz-accent); color: white;
  border-color: var(--cutz-accent); font-weight: 600;
}
.btn-primary:hover { background: var(--cutz-accent-hover); border-color: var(--cutz-accent-hover); color: white; }
.btn-success {
  background: var(--cutz-success); color: white;
  border-color: var(--cutz-success); font-weight: 600;
}
.btn-success:hover { background: #0E9F70; }
.btn-danger {
  color: var(--cutz-error); border-color: var(--adm-border);
}
.btn-danger:hover { background: rgba(239,68,68,0.08); border-color: var(--cutz-error); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--adm-surface-2); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 22px; font-size: 14px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ───── FORM ───── */
.form-row { margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 768px) { .form-grid { grid-template-columns: 1fr; } }
.label {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--adm-text); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.input, .select, .textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--adm-border-strong);
  border-radius: var(--adm-radius-sm);
  background: white;
  font: inherit;
  color: var(--adm-text);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--cutz-accent);
  box-shadow: 0 0 0 3px var(--cutz-accent-soft);
}
.textarea { min-height: 96px; resize: vertical; }
.help { font-size: 12px; color: var(--adm-text-muted); margin-top: 6px; }

/* ───── BADGE ───── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-neutral  { background: var(--adm-surface-2); color: var(--adm-text-muted); border: 1px solid var(--adm-border); }
.badge-pending  { background: rgba(245,158,11,0.12);  color: #92400E; }
.badge-success  { background: rgba(16,185,129,0.12);  color: #065F46; }
.badge-info     { background: rgba(59,130,246,0.12);  color: #1E3A8A; }
.badge-danger   { background: rgba(239,68,68,0.10);   color: #991B1B; }
.badge-orange   { background: rgba(255,107,53,0.10);  color: #9A3412; }
.badge-purple   { background: rgba(124,58,237,0.10);  color: #5B21B6; }

/* ───── TABLE ───── */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--adm-text-muted);
  border-bottom: 1px solid var(--adm-border);
  background: var(--adm-surface-2);
  white-space: nowrap;
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--adm-border);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--adm-surface-2); }
.table-card {
  background: white;
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius-md);
  overflow: hidden;
}
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { white-space: nowrap; }
.table .actions .btn { margin-left: 4px; }

/* ───── EMPTY STATE ───── */
.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--adm-text-muted);
}
.empty .empty-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.5; }
.empty .empty-title { font-size: 15px; font-weight: 600; color: var(--adm-text); margin-bottom: 4px; }

/* ───── FLASH ───── */
.flash {
  padding: 12px 16px;
  border-radius: var(--adm-radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
  border: 1px solid transparent;
}
.flash-success { background: rgba(16,185,129,0.08); color: #065F46; border-color: rgba(16,185,129,0.2); }
.flash-error   { background: rgba(239,68,68,0.08); color: #991B1B; border-color: rgba(239,68,68,0.2); }
.flash-info    { background: rgba(59,130,246,0.08); color: #1E3A8A; border-color: rgba(59,130,246,0.2); }
.flash-warn    { background: rgba(245,158,11,0.08); color: #92400E; border-color: rgba(245,158,11,0.2); }

/* ───── TABS ───── */
.tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--adm-border);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.tab {
  padding: 10px 18px;
  font-size: 13px; font-weight: 500;
  color: var(--adm-text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
}
.tab:hover { color: var(--adm-text); }
.tab.is-active {
  color: var(--cutz-accent);
  border-bottom-color: var(--cutz-accent);
  font-weight: 600;
}
.tab-count {
  display: inline-block;
  margin-left: 6px;
  background: var(--adm-surface-2);
  padding: 1px 7px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
  border: 1px solid var(--adm-border);
}

/* ───── FILTER BAR ───── */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-bottom: 16px; align-items: center;
}
.filter-bar .input,
.filter-bar .select { width: auto; min-width: 200px; }
.filter-bar .filter-spacer { flex: 1; }

/* ───── PAGINATION ───── */
.pagination {
  display: flex; gap: 6px; justify-content: center;
  margin-top: 20px; align-items: center;
  font-size: 13px;
}
.pagination .page-info { color: var(--adm-text-muted); margin: 0 12px; }
.pagination a, .pagination span.page-current {
  padding: 6px 12px;
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius-sm);
  background: white;
}
.pagination span.page-current {
  background: var(--cutz-accent); color: white;
  border-color: var(--cutz-accent); font-weight: 600;
}
.pagination .disabled { opacity: 0.4; pointer-events: none; }

/* ───── MINI BAR CHART (CSS-only) ───── */
.bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 140px; padding-top: 16px; }
.bar-chart .bar {
  flex: 1;
  background: var(--cutz-accent-soft);
  border-radius: 4px 4px 0 0;
  position: relative;
  transition: background 0.12s;
}
.bar-chart .bar:hover { background: var(--cutz-accent); }
.bar-chart .bar::after {
  content: attr(data-value);
  position: absolute; top: -16px; left: 50%;
  transform: translateX(-50%);
  font-size: 10px; color: var(--adm-text-muted);
  white-space: nowrap;
  opacity: 0; transition: opacity 0.12s;
}
.bar-chart .bar:hover::after { opacity: 1; }
.bar-chart-axis {
  display: flex; gap: 4px;
  font-size: 10px; color: var(--adm-text-subtle);
  margin-top: 6px;
}
.bar-chart-axis span { flex: 1; text-align: center; }

/* ───── MINI LINE / SPARK ───── */
.spark { display: block; width: 100%; height: 50px; }
.spark path { fill: none; stroke: var(--cutz-accent); stroke-width: 2; }
.spark .area { fill: var(--cutz-accent-soft); stroke: none; }

/* ───── FUNNEL ───── */
.funnel { display: flex; flex-direction: column; gap: 8px; }
.funnel-step {
  background: white;
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius-sm);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center; gap: 12px;
  position: relative;
  overflow: hidden;
}
.funnel-step::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--cutz-accent-soft);
  width: var(--w, 100%);
  z-index: 0;
}
.funnel-step > * { position: relative; z-index: 1; }
.funnel-step .funnel-label { font-weight: 600; font-size: 13px; }
.funnel-step .funnel-value { font-size: 18px; font-weight: 800; }
.funnel-step .funnel-rate { font-size: 12px; color: var(--adm-text-muted); }

/* ───── LOGIN ───── */
.login-body {
  background: var(--adm-bg);
  display: grid; place-items: center;
  min-height: 100vh; padding: 24px;
}
.login-card {
  background: white;
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius-lg);
  padding: 32px;
  width: 100%; max-width: 380px;
  box-shadow: var(--adm-shadow-2);
}
.login-card h1 { margin: 16px 0 4px; font-size: 22px; }
.login-card .muted { color: var(--adm-text-muted); font-size: 13px; margin: 0 0 20px; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.login-brand .brand-text { color: var(--adm-text); }

/* ───── UTILS ───── */
.muted { color: var(--adm-text-muted); }
.tiny { font-size: 11px; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-success { color: var(--cutz-success); }
.text-warning { color: var(--cutz-warning); }
.text-danger  { color: var(--cutz-error); }
.text-mono { font-family: var(--font-mono); }
.no-wrap { white-space: nowrap; }

/* ───── MAP ───── */
.map-container {
  height: 540px;
  border-radius: var(--adm-radius-md);
  overflow: hidden;
  border: 1px solid var(--adm-border);
}
