:root {
  --navy: #0F172A;
  --navy-soft: #1E293B;
  --ink: #0F172A;
  --muted: #64748B;
  --muted-2: #94A3B8;
  --white: #FFFFFF;
  --bg: #F1F5F9;
  --bg-soft: #F8FAFC;
  --surface: #FFFFFF;
  --border: #E2E8F0;
  --border-soft: #F1F5F9;
  --accent: #2563EB;
  --accent-soft: #DBEAFE;
  --accent-hover: #1D4ED8;
  --red: #EF4444;
  --red-soft: #FEE2E2;
  --green: #10B981;
  --green-soft: #D1FAE5;
  --orange: #F59E0B;
  --orange-soft: #FEF3C7;
  --teal: #14B8A6;
  --blue: #3B82F6;
  --blue-soft: #DBEAFE;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --shadow: 0 8px 30px rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.1);
  --font: 'Plus Jakarta Sans', 'Manrope', system-ui, sans-serif;
  --sidebar-w: 272px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; transition: color 0.15s var(--ease); }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; }

/* ========== CRM SHELL ========== */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  padding: 1.5rem 1rem 1.25rem;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.75rem 1.75rem;
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.sidebar-brand .logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(145deg, #10B981, #059669);
  color: #fff;
  display: inline-grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 800;
  margin-right: 0.55rem;
  box-shadow: 0 6px 14px rgba(16, 185, 129, 0.35);
}
.sidebar-brand span { color: var(--accent); }
.sidebar nav { flex: 1; overflow-y: auto; }
.nav-section {
  padding: 1.1rem 0.85rem 0.45rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  margin-bottom: 2px;
  color: var(--muted);
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.92rem;
  transition: all 0.18s var(--ease);
  border: none;
}
.nav-link .nav-ico {
  width: 20px; height: 20px;
  opacity: 0.7;
  flex-shrink: 0;
}
.nav-link:hover {
  background: var(--bg-soft);
  color: var(--ink);
}
.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.nav-link.active .nav-ico { opacity: 1; }
.sidebar-foot {
  padding: 1rem 0.75rem 0.25rem;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  background:
    radial-gradient(ellipse 80% 50% at 100% -20%, rgba(37, 99, 235, 0.06), transparent),
    var(--bg);
}
.topbar {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  padding: 1.1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin: 0;
}
.topbar-sub {
  font-size: 0.875rem;
  color: var(--muted);
  margin-top: 0.15rem;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.55rem 1rem;
  min-width: 240px;
  color: var(--muted);
}
.search-box input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  color: var(--ink);
  font-size: 0.9rem;
}
.page { padding: 1.75rem 2rem 3.5rem; }

/* ========== CARDS ========== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(226, 232, 240, 0.9);
  padding: 1.35rem 1.5rem;
}
.card-flush { padding: 0; overflow: hidden; }
.panel {
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(226, 232, 240, 0.7);
  padding: 1.75rem;
}

/* ========== KPI ========== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.kpi-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.35rem 1.4rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(226, 232, 240, 0.9);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.kpi-card::after {
  content: '';
  position: absolute;
  inset: auto -20% -40% auto;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124,58,237,0.08), transparent 70%);
  pointer-events: none;
}
.kpi-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.55rem;
}
.kpi-value {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.04em;
  line-height: 1.1;
}
.kpi-sub {
  font-size: 0.75rem;
  color: var(--muted-2);
  margin-top: 0.4rem;
  font-weight: 500;
}
.kpi-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 1.05rem;
  margin-bottom: 0.85rem;
}
.kpi-icon.violet { background: var(--accent-soft); color: var(--accent); }
.kpi-icon.green { background: var(--green-soft); color: #059669; }
.kpi-icon.orange { background: var(--orange-soft); color: #D97706; }
.kpi-icon.red { background: var(--red-soft); color: #DC2626; }
.kpi-icon.blue { background: var(--blue-soft); color: #2563EB; }

/* KPI panel 2x2 (maquette premium) */
.kpi-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  background: var(--white);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.kpi-panel .kpi-cell {
  padding: 1.5rem 1.6rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.kpi-panel .kpi-cell:nth-child(2n) { border-right: none; }
.kpi-panel .kpi-cell:nth-last-child(-n+2) { border-bottom: none; }

/* Category bars */
.cat-bars { display: flex; flex-direction: column; gap: 1.1rem; }
.cat-bar-row { display: grid; grid-template-columns: 110px 1fr 80px; gap: 0.85rem; align-items: center; }
.cat-bar-row .name { font-size: 0.88rem; font-weight: 600; color: var(--muted); }
.cat-bar-row .amt { font-size: 0.88rem; font-weight: 700; text-align: right; color: var(--ink); }
.cat-bar-track {
  height: 10px;
  background: var(--bg);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.cat-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, #334155, #0F172A);
  transition: width 0.5s var(--ease);
}
.cat-bar-fill.soft { background: #94A3B8; }
.cat-bar-fill.soft2 { background: #CBD5E1; }

/* ========== BADGES ========== */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.28rem 0.7rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.badge-gray { background: #F1F5F9; color: #64748B; }
.badge-orange { background: var(--orange-soft); color: #B45309; }
.badge-blue { background: var(--blue-soft); color: #1D4ED8; }
.badge-green { background: var(--green-soft); color: #047857; }
.badge-teal { background: #CCFBF1; color: #0F766E; }
.badge-red { background: var(--red-soft); color: #B91C1C; }
.badge-violet { background: var(--accent-soft); color: var(--accent); }
.badge-dot::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  padding: 0.65rem 1.2rem;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  transition: all 0.18s var(--ease);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, #2563EB, #1D4ED8);
  color: #fff;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.28);
}
.btn-primary:hover {
  filter: brightness(1.05);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.35);
}
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-soft); color: #fff; }
.btn-ghost {
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-soft); }
.btn-success { background: var(--green); color: #fff; }
.btn-warning { background: var(--orange); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; border-radius: 9px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }

/* ========== FORMS ========== */
.form-group { margin-bottom: 1.05rem; }
.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.form-control {
  width: 100%;
  padding: 0.72rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus {
  outline: none;
  border-color: #A78BFA;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.12);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ========== TABLES ========== */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td {
  padding: 1rem 1.15rem;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
}
table.data th {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--bg-soft);
}
table.data tbody tr { transition: background 0.15s; }
table.data tr:hover td { background: #FAFBFF; }
table.data tr:last-child td { border-bottom: none; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #7C3AED, #6366F1);
  color: #fff;
  display: inline-grid; place-items: center;
  font-weight: 700; font-size: 0.8rem;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25);
}
.user-cell { display: flex; align-items: center; gap: 0.85rem; }
.user-cell .meta { display: flex; flex-direction: column; }
.user-cell .meta small { color: var(--muted-2); font-size: 0.78rem; }

/* ========== ALERTS ========== */
.alert {
  padding: 0.9rem 1.15rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid transparent;
}
.alert-success { background: var(--green-soft); color: #065F46; border-color: #A7F3D0; }
.alert-error { background: var(--red-soft); color: #991B1B; border-color: #FECACA; }
.alert-warning { background: var(--orange-soft); color: #92400E; border-color: #FDE68A; }

/* ========== PROGRESS ========== */
.progress {
  height: 8px; background: var(--bg); border-radius: var(--radius-pill); overflow: hidden;
}
.progress > span {
  display: block; height: 100%; border-radius: var(--radius-pill);
  background: linear-gradient(90deg, #10B981, #34D399);
  transition: width 0.4s var(--ease);
}
.progress.orange > span { background: linear-gradient(90deg, #F59E0B, #FBBF24); }
.progress.red > span { background: linear-gradient(90deg, #EF4444, #F87171); }

/* ========== NOTE CARDS CRM ========== */
.note-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.85rem;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}
.note-card:hover { box-shadow: var(--shadow); }
.note-card-header {
  display: flex; align-items: center; gap: 1rem;
  padding: 1.05rem 1.2rem;
  cursor: pointer;
}
.note-thumb {
  width: 56px; height: 56px; border-radius: 12px;
  object-fit: cover; background: var(--bg); flex-shrink: 0;
}
.note-card-body {
  display: none;
  padding: 0 1.2rem 1.25rem;
  border-top: 1px solid var(--border);
}
.note-card.open .note-card-body { display: block; padding-top: 1.1rem; }
.ocr-compare {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.35rem;
}
.ocr-image {
  border-radius: 14px; overflow: hidden;
  background: linear-gradient(160deg, #1E1B4B, #0F172A);
  min-height: 200px;
  display: grid; place-items: center;
}
.ocr-image img { max-height: 360px; cursor: zoom-in; }
.actions-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }

/* ========== AUTH ========== */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse 60% 50% at 20% 20%, rgba(37, 99, 235, 0.22), transparent),
    radial-gradient(ellipse 50% 40% at 90% 80%, rgba(14, 165, 233, 0.12), transparent),
    linear-gradient(160deg, #0F172A 0%, #1E293B 50%, #0F172A 100%);
  padding: 1.5rem;
}
.auth-card {
  width: 100%; max-width: 440px;
  background: #fff;
  border-radius: 24px;
  padding: 2.25rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid #E2E8F0;
}
.auth-card h1 {
  margin: 0 0 0.25rem;
  color: var(--ink);
  font-size: 1.75rem;
  letter-spacing: -0.03em;
}
.auth-card .brand-accent { color: var(--accent); }
.auth-card p.sub { color: var(--muted); margin: 0 0 1.75rem; }
.auth-logo {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #7C3AED, #4F46E5);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 800;
  margin-bottom: 1.25rem;
  box-shadow: 0 10px 24px rgba(124, 58, 237, 0.35);
}

/* ========== PWA ========== */
.pwa-body-root { background: #F8FAFC; }
.pwa-shell {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  background: #F8FAFC;
  padding-bottom: 92px;
  position: relative;
}
.pwa-top {
  padding: 1.1rem 1.15rem 0.35rem;
  background: #F8FAFC;
}
.pwa-top-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}
.pwa-back {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--border);
  display: grid; place-items: center;
  color: var(--ink);
  flex-shrink: 0;
  margin-top: 0.1rem;
}
.pwa-top h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.pwa-top p {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.pwa-header {
  background: #fff;
  color: var(--ink);
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}
.pwa-header h1 { margin: 0; font-size: 1.35rem; letter-spacing: -0.03em; color: var(--ink); }
.pwa-header p { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.88rem; opacity: 1; }
.pwa-body { padding: 0.85rem 1.1rem 2rem; }

.seg {
  display: flex;
  gap: 0.3rem;
  padding: 0.3rem;
  background: #EEF2FF;
  border-radius: 14px;
  margin-bottom: 1rem;
}
.seg a {
  flex: 1;
  text-align: center;
  padding: 0.65rem 0.4rem;
  border-radius: 11px;
  font-weight: 700;
  font-size: 0.86rem;
  color: #64748B;
}
.seg a.is-on {
  background: #fff;
  color: #6D28D9;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.sheet {
  background: #fff;
  border-radius: 20px;
  padding: 1.35rem 1.2rem 1.4rem;
  border: 1px solid #E8ECF1;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
}
.sheet-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.sheet-desc {
  margin: 0.4rem 0 1.2rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

.pick-row {
  display: flex;
  gap: 0.65rem;
}
.pick {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 100px;
  padding: 0.9rem 0.5rem;
  border-radius: 16px;
  border: 1px solid #E8ECF1;
  background: #F8FAFC;
  color: #0F172A;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.pick svg { color: #7C3AED; }
.pick:hover, .pick:focus {
  border-color: #C4B5FD;
  background: #F5F3FF;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.1);
  outline: none;
}

.pick-preview {
  margin-top: 0.85rem;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0F172A;
}
.pick-preview img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  display: block;
}
.pick-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.8rem;
  background: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
}
.pick-preview-bar button {
  border: none;
  background: transparent;
  color: #7C3AED;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

.cta {
  width: 100%;
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border: none;
  border-radius: 14px;
  background: #7C3AED;
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(124, 58, 237, 0.25);
}
.cta:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}
.cta:not(:disabled):hover { background: #6D28D9; }
.btn-sec {
  flex: 1;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
}
.actions { display: flex; gap: 0.6rem; margin-top: 1rem; }
.actions .cta { margin-top: 0; flex: 1.4; }

.field { display: block; margin-bottom: 0.9rem; }
.field > span {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: #A78BFA;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}
.field-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; }
.hint { color: var(--muted); font-size: 0.78rem; }
.meta-row { margin-bottom: 0.85rem; }
.chip {
  display: inline-flex;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.chip-ok { background: #D1FAE5; color: #047857; }
.chip-warn { background: #FEF3C7; color: #B45309; }
.check {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.88rem; font-weight: 600; margin: 0.5rem 0 0.75rem;
}

.toast {
  border-radius: 12px;
  padding: 0.75rem 0.95rem;
  font-size: 0.86rem;
  font-weight: 600;
  margin-bottom: 0.85rem;
}
.toast-ok { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.toast-warn { background: #FFF7ED; color: #9A3412; border: 1px solid #FDBA74; }
.toast-fixed {
  margin: 0.75rem 1.1rem 0;
  transition: opacity 0.25s;
  position: relative;
  z-index: 40;
}

.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 430px;
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(16px);
  border-top: 1px solid #EEF2F7;
  display: flex; justify-content: space-around;
  padding: 0.45rem 0 calc(0.45rem + env(safe-area-inset-bottom));
  z-index: 50;
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center;
  font-size: 0.68rem; font-weight: 700; color: #94A3B8; gap: 0.15rem;
  padding: 0.4rem 0.9rem;
  border-radius: 12px;
}
.bottom-nav a.active {
  color: #7C3AED;
  background: transparent;
}
.fab {
  position: fixed;
  bottom: 96px; right: max(1.1rem, calc(50% - 215px + 1.1rem));
  width: 56px; height: 56px; border-radius: 50%;
  background: #7C3AED;
  color: #fff;
  border: none; font-size: 1.7rem; font-weight: 300;
  box-shadow: 0 10px 24px rgba(124, 58, 237, 0.35);
  cursor: pointer; z-index: 55;
  display: grid; place-items: center;
}
.pending-banner {
  background: #FFF7ED;
  border: 1px solid #FED7AA;
  border-radius: 14px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  color: #9A3412;
  font-weight: 600;
  font-size: 0.88rem;
}
.pwa-install { display: none !important; }

.mode-tabs, .scan-hero, .upload-choice, .upload-choice-btn, .upload-preview { /* legacy kept minimal */ }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.15rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.15rem; }
.section-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 1rem;
  letter-spacing: -0.02em;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.15rem;
  gap: 1rem;
}
.filters {
  display: flex; flex-wrap: wrap; gap: 0.75rem;
  margin-bottom: 1.25rem; align-items: end;
}
.timeline { border-left: 2px solid var(--border); padding-left: 1rem; margin-top: 0.75rem; }
.timeline-item { position: relative; padding-bottom: 0.85rem; font-size: 0.85rem; }
.timeline-item::before {
  content: ''; position: absolute; left: -1.35rem; top: 0.35rem;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.month-nav { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.month-nav .label { font-weight: 800; font-size: 1.2rem; color: var(--ink); letter-spacing: -0.02em; }
.cloture-bar {
  position: sticky; bottom: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 1.1rem 2rem;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.06);
  gap: 1rem; flex-wrap: wrap;
}
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  display: none; place-items: center; z-index: 100; padding: 1rem;
}
.modal-backdrop.open { display: grid; }
.modal {
  background: #fff; border-radius: 20px; padding: 1.75rem;
  width: 100%; max-width: 480px; max-height: 90vh; overflow: auto;
  box-shadow: var(--shadow-lg);
}
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,0.9);
  display: none; place-items: center; z-index: 200; padding: 1rem;
}
.lightbox.open { display: grid; }
.lightbox img { max-width: 95vw; max-height: 90vh; border-radius: 8px; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.page-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.page-header p {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .ocr-compare { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.25s var(--ease); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .form-row, .grid-2 { grid-template-columns: 1fr; }
  .page { padding: 1.15rem; }
  .cat-bar-row { grid-template-columns: 80px 1fr 70px; }
}

/* ===== Super Admin Dashboard (maquette premium) ===== */
.sa-dash { display: flex; flex-direction: column; gap: 1.15rem; }
.sa-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.sa-kpi {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem 1rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(226,232,240,0.8);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 168px;
}
.sa-kpi-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sa-kpi-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.sa-kpi-value {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--ink);
}
.sa-kpi-sub { font-size: 0.78rem; color: var(--muted-2); margin-top: -0.2rem; }
.sa-kpi-foot {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: auto;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border-soft);
}
.sa-kpi-ico {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
}
.sa-kpi-ico--violet { background: var(--accent-soft); color: var(--accent); }
.sa-kpi-ico--teal { background: #CCFBF1; color: #0F766E; }
.sa-kpi-ico--orange { background: var(--orange-soft); color: #B45309; }
.sa-kpi-split { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.sa-donut-wrap { width: 64px; height: 64px; flex-shrink: 0; }
.sa-kpi canvas { width: 100% !important; max-height: 48px; }
.sa-kpi-legend {
  display: flex; flex-wrap: wrap; gap: 0.45rem 0.75rem;
  font-size: 0.68rem; color: var(--muted); margin-top: auto;
}
.sa-kpi-legend i {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  margin-right: 0.25rem; vertical-align: middle;
}

.sa-mod-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.85rem;
}
.sa-mod {
  position: relative;
  display: flex; flex-direction: column; gap: 0.35rem;
  padding: 1.1rem 1rem 0.95rem;
  border-radius: 14px;
  color: #fff !important;
  text-decoration: none !important;
  min-height: 148px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(15,23,42,0.18);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.sa-mod:hover { transform: translateY(-3px); box-shadow: 0 16px 36px rgba(15,23,42,0.22); color: #fff !important; }
.sa-mod strong { font-size: 0.92rem; font-weight: 700; letter-spacing: -0.01em; }
.sa-mod p { margin: 0; font-size: 0.72rem; opacity: 0.78; line-height: 1.35; flex: 1; }
.sa-mod-ico {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(255,255,255,0.14);
  display: grid; place-items: center; margin-bottom: 0.25rem;
}
.sa-mod-badge {
  position: absolute; top: 0.65rem; right: 0.65rem;
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.06em;
  padding: 0.2rem 0.45rem; border-radius: 6px;
  background: rgba(255,255,255,0.2); backdrop-filter: blur(4px);
}
.sa-mod-cta {
  font-size: 0.72rem; font-weight: 700; opacity: 0.9; margin-top: 0.35rem;
}
.sa-mod--violet { background: linear-gradient(145deg, #6D28D9 0%, #4C1D95 100%); }
.sa-mod--teal { background: linear-gradient(145deg, #0D9488 0%, #115E59 100%); }
.sa-mod--indigo { background: linear-gradient(145deg, #4338CA 0%, #1E1B4B 100%); }
.sa-mod--blue { background: linear-gradient(145deg, #2563EB 0%, #1E3A8A 100%); }
.sa-mod--rose { background: linear-gradient(145deg, #E11D48 0%, #881337 100%); }

.sa-charts-row {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  gap: 1rem;
}
.sa-panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(226,232,240,0.8);
}
.sa-panel-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 0.85rem;
}
.sa-panel-head h3 {
  margin: 0; font-size: 0.95rem; font-weight: 700; letter-spacing: -0.01em;
}
.sa-panel-head a { font-size: 0.78rem; font-weight: 600; }
.sa-chip {
  font-size: 0.68rem; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); padding: 0.2rem 0.55rem; border-radius: 999px;
}
.sa-cat-layout { display: flex; gap: 1rem; align-items: center; }
.sa-cat-chart { width: 140px; height: 140px; flex-shrink: 0; }
.sa-cat-legend { list-style: none; margin: 0; padding: 0; flex: 1; }
.sa-cat-legend li {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.35rem 0; font-size: 0.8rem;
  border-bottom: 1px solid var(--border-soft);
}
.sa-cat-legend .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.sa-cat-legend .name { flex: 1; color: var(--muted); }
.sa-cat-legend strong { font-size: 0.8rem; }

.sa-bottom-row {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 1rem;
}
.sa-feed { display: flex; flex-direction: column; gap: 0.15rem; max-height: 420px; overflow-y: auto; }
.sa-feed-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.7rem 0.15rem;
  border-bottom: 1px solid var(--border-soft);
}
.sa-feed-av { width: 36px; height: 36px; font-size: 0.72rem; flex-shrink: 0; }
.sa-feed-body { flex: 1; min-width: 0; }
.sa-feed-title {
  display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap;
  font-size: 0.86rem;
}
.sa-feed-meta {
  font-size: 0.75rem; color: var(--muted);
  display: flex; justify-content: space-between; gap: 0.5rem; margin-top: 0.15rem;
}
.sa-feed-amt { font-weight: 700; color: var(--ink); }
.sa-feed-thumb {
  width: 44px; height: 44px; border-radius: 10px; object-fit: cover;
  background: var(--bg); flex-shrink: 0; border: 1px solid var(--border);
}
.sa-feed-thumb--empty {
  display: grid; place-items: center; color: var(--muted-2);
}

.sa-insights { display: flex; flex-direction: column; gap: 0.85rem; }
.sa-bulb {
  width: 32px; height: 32px; border-radius: 10px;
  background: #FEF3C7; color: #B45309;
  display: grid; place-items: center;
}
.sa-insight-alert {
  background: #FEF2F2; border: 1px solid #FECACA; border-radius: 12px;
  padding: 0.85rem 1rem; color: #991B1B;
}
.sa-insight-alert p { margin: 0.35rem 0 0; font-size: 0.82rem; opacity: 0.85; }
.sa-insight-ok {
  background: #ECFDF5; border: 1px solid #A7F3D0; border-radius: 12px;
  padding: 0.85rem 1rem; color: #065F46;
}
.sa-insight-ok p { margin: 0.35rem 0 0; font-size: 0.82rem; }
.sa-insight-list { list-style: none; margin: 0; padding: 0; }
.sa-insight-list li {
  font-size: 0.8rem; padding: 0.45rem 0;
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap;
}
.sa-insight-cta { width: 100%; justify-content: center; margin-top: auto; }
.sa-quick-links {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem;
}
.sa-quick-links a {
  font-size: 0.78rem; font-weight: 600; text-align: center;
  padding: 0.55rem; border-radius: 10px;
  background: var(--bg-soft); color: var(--ink);
  border: 1px solid var(--border);
}
.sa-quick-links a:hover { background: var(--accent-soft); color: var(--accent); }

@media (max-width: 1200px) {
  .sa-kpi-row { grid-template-columns: 1fr 1fr; }
  .sa-mod-row { grid-template-columns: 1fr 1fr 1fr; }
  .sa-charts-row { grid-template-columns: 1fr; }
  .sa-bottom-row { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .sa-kpi-row, .sa-mod-row { grid-template-columns: 1fr; }
}
/* ===== Density + paliers + Super Admin pro ===== */
:root {
  --sidebar-w: 248px;
  --radius: 12px;
  --radius-sm: 8px;
  --accent: #2563EB;
  --accent-soft: #DBEAFE;
  --accent-hover: #1D4ED8;
}
.page--dense { padding: 1rem 1.25rem 1.5rem; }
.topbar--compact { padding: 0.85rem 1.25rem; }
.topbar--compact .topbar-title { font-size: 1.15rem; }
.brand-ctx {
  font-size: 0.65rem; font-weight: 700; color: var(--ctx, var(--accent));
  letter-spacing: 0.02em; margin-top: 0.1rem; max-width: 140px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-ctx--groupe { color: #7C3AED; }
.brand-ctx--admin { color: #0F172A; }
.nav-pill-ctx {
  margin: 0.35rem 0.75rem 0.75rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: color-mix(in srgb, var(--ctx, #2563EB) 12%, white);
  border: 1px solid color-mix(in srgb, var(--ctx, #2563EB) 28%, transparent);
}
.nav-pill-ctx span { display:block; font-size:0.62rem; font-weight:700; text-transform:uppercase; letter-spacing:0.06em; color:var(--muted); }
.nav-pill-ctx strong { font-size:0.82rem; color:var(--ink); }
.nav-link--exit { color: #B91C1C !important; font-weight: 700; }
.nav-soc { display:flex; align-items:center; gap:0.5rem; }
.nav-soc-dot { width:8px; height:8px; border-radius:50%; flex-shrink:0; }
.nav-switch { padding: 0 0.75rem 0.5rem; }
.nav-switch select {
  width:100%; font-size:0.78rem; padding:0.4rem 0.5rem;
  border-radius:8px; border:1px solid var(--border); background:#fff;
}
.sidebar-brand .logo-mark {
  background: linear-gradient(145deg, #2563EB, #1D4ED8) !important;
  box-shadow: 0 6px 14px rgba(37,99,235,0.35) !important;
}
.nav-link { padding: 0.45rem 0.85rem; font-size: 0.84rem; }
.nav-section { padding-top: 0.85rem; }

.sa-dash--pro { gap: 0.85rem; }
.sa-metric-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.65rem;
}
.sa-metric {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 0.9rem;
  box-shadow: none;
  min-height: 0;
  display: flex; flex-direction: column; gap: 0.2rem;
}
.sa-metric--alert { border-color: #FDBA74; background: #FFFBEB; }
.sa-metric-ico { font-size: 0.95rem; opacity: 0.85; }
.sa-metric-num {
  font-size: 1.35rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1;
}
.sa-metric-num--sm { font-size: 1.05rem; }
.sa-metric-label { font-size: 0.72rem; font-weight: 600; color: var(--muted); }
.sa-metric-hint { font-size: 0.65rem; color: var(--muted-2); margin-top: auto; }
.sa-metric-link { font-size: 0.7rem; font-weight: 700; margin-top: auto; color: var(--accent); }

.sa-actions-row { display:flex; flex-wrap:wrap; gap:0.45rem; }
.sa-mod-chips { display:flex; flex-wrap:wrap; gap:0.45rem; }
.sa-chip-mod {
  display:flex; align-items:baseline; gap:0.4rem;
  padding: 0.4rem 0.7rem; border-radius: 999px;
  border: 1px solid var(--border); background:#fff;
  font-size: 0.75rem; color: var(--ink) !important; text-decoration:none !important;
}
.sa-chip-mod strong { font-size: 0.75rem; }
.sa-chip-mod span { color: var(--muted); }
.sa-chip-mod em { font-style:normal; font-weight:700; font-size:0.65rem; }
.sa-chip-mod.is-on { border-color:#BBF7D0; background:#F0FDF4; }
.sa-chip-mod.is-on em { color:#15803D; }
.sa-chip-mod.is-off { opacity:0.7; }
.sa-chip-mod.is-off em { color:#94A3B8; }

.sa-charts-row--compact {
  grid-template-columns: 1fr 1.2fr !important;
  gap: 0.75rem !important;
}
.sa-chart-box { height: 140px; }
.sa-cat-chart { width: 110px !important; height: 110px !important; }
.sa-bottom-row--compact { grid-template-columns: 1.5fr 0.9fr !important; gap: 0.75rem !important; }
.sa-panel { padding: 0.9rem 1rem !important; }
.sa-panel-head h3 { font-size: 0.85rem !important; }
.sa-feed-item { padding: 0.5rem 0.1rem !important; }
.sa-feed { max-height: 280px !important; }
.sa-kpi, .sa-mod-row { display: none !important; } /* hide old bulky widgets if cached HTML */

.kpi-grid { gap: 0.65rem; }
.kpi-card { padding: 0.9rem 1rem; }
.kpi-value { font-size: 1.25rem; }
.card { padding: 1rem; border-radius: 12px; box-shadow: none; border: 1px solid var(--border); }

@media (max-width: 1200px) {
  .sa-metric-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
  .sa-metric-grid { grid-template-columns: repeat(2, 1fr); }
  .sa-charts-row--compact, .sa-bottom-row--compact { grid-template-columns: 1fr !important; }
}

/* ===== GROUPE / MULTI-SOCIETES v8 ===== */
.nav-back {
  display: block;
  margin: 0 0.5rem 0.65rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted) !important;
  border-radius: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}
.nav-back:hover { color: var(--accent) !important; background: var(--accent-soft); }
.nav-soc-banner {
  margin: 0 0.5rem 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border-left: 3px solid;
}
.nav-soc-banner strong { display:block; font-size:0.82rem; color:var(--ink); }
.nav-soc-banner small { font-size:0.65rem; color:var(--muted); text-transform:uppercase; letter-spacing:0.04em; }
.nav-empty { padding: 0.4rem 0.85rem; font-size: 0.75rem; color: var(--muted-2); }
.nav-soc-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sidebar--pro { padding: 1.1rem 0.65rem 1rem; }
.sidebar--pro .sidebar-brand { padding: 0 0.55rem 1.1rem; }
.sidebar--pro nav { overflow-y: auto; flex: 1; }

.grp-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  padding: 1.35rem 1.5rem;
  border-radius: 16px;
  background:
    radial-gradient(ellipse 80% 120% at 100% 0%, rgba(37,99,235,0.18), transparent 55%),
    linear-gradient(135deg, #0F172A 0%, #1E293B 55%, #0F172A 100%);
  color: #fff;
  box-shadow: 0 16px 40px rgba(15,23,42,0.18);
}
.grp-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #93C5FD;
}
.grp-hero h2 {
  margin: 0 0 0.35rem;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.grp-hero p {
  margin: 0;
  font-size: 0.88rem;
  color: #94A3B8;
  max-width: 36rem;
}
.grp-hero .btn-primary {
  background: #2563EB;
  border-color: #2563EB;
  box-shadow: 0 8px 20px rgba(37,99,235,0.4);
}

.grp-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.grp-kpi {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.95rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.grp-kpi span {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.grp-kpi strong {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.grp-kpi.is-warn {
  background: #FFFBEB;
  border-color: #FCD34D;
}
.grp-kpi.is-warn strong { color: #B45309; }

.grp-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.grp-card {
  --soc: #2563EB;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
  box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
.grp-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(15,23,42,0.1);
  border-color: color-mix(in srgb, var(--soc) 35%, var(--border));
}
.grp-card-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 1rem 1.05rem 0.85rem;
  border-bottom: 1px solid var(--border-soft);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--soc) 10%, white), white 70%);
}
.grp-card-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 16px color-mix(in srgb, var(--soc) 40%, transparent);
}
.grp-card-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.grp-card-head p {
  margin: 0.15rem 0 0;
  font-size: 0.72rem;
  color: var(--muted);
}
.grp-status {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.grp-status--vert { background: #D1FAE5; color: #047857; }
.grp-status--orange { background: #FEF3C7; color: #B45309; }
.grp-status--rouge { background: #FEE2E2; color: #B91C1C; }

.grp-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  padding: 0.95rem 1.05rem;
}
.grp-card-stats > div {
  background: var(--bg-soft);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
}
.grp-card-stats span {
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.grp-card-stats strong {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.grp-card-foot {
  margin-top: auto;
  padding: 0.85rem 1.05rem 1.05rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  border-top: 1px solid var(--border-soft);
}
.grp-card-foot .btn-primary {
  background: var(--soc);
  border-color: var(--soc);
  flex: 1;
  min-width: 140px;
  justify-content: center;
}
.grp-card-foot .btn-primary:hover {
  filter: brightness(0.92);
}

.grp-chart-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.sa-soc-portal {
  margin: 0.25rem 0 1.1rem;
  padding: 1.1rem 1.2rem;
  border-radius: 16px;
  background:
    radial-gradient(ellipse 70% 100% at 0% 0%, rgba(37,99,235,0.12), transparent 50%),
    #fff;
  border: 1px solid var(--border);
}
.sa-soc-portal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
  flex-wrap: wrap;
}
.sa-soc-portal-head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}
.sa-soc-portal-head p {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.sa-soc-portal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
.sa-soc-tile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0.95rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--ink) !important;
  text-decoration: none !important;
  transition: transform 0.15s var(--ease), border-color 0.15s, box-shadow 0.15s;
}
.sa-soc-tile:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--soc, #2563EB) 40%, var(--border));
  box-shadow: 0 10px 24px rgba(15,23,42,0.08);
  background: #fff;
}
.sa-soc-tile-mark {
  width: 36px; height: 36px; border-radius: 10px;
  color: #fff; font-weight: 800; font-size: 0.95rem;
  display: grid; place-items: center; flex-shrink: 0;
}
.sa-soc-tile strong { display:block; font-size:0.88rem; }
.sa-soc-tile small { color: var(--muted); font-size: 0.7rem; }

body.ctx-groupe .main-content {
  background:
    radial-gradient(ellipse 50% 40% at 100% 0%, rgba(37,99,235,0.06), transparent 50%),
    var(--bg);
}

@media (max-width: 1100px) {
  .grp-grid, .sa-soc-portal-grid { grid-template-columns: 1fr 1fr; }
  .grp-kpis { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .grp-grid, .sa-soc-portal-grid, .grp-kpis { grid-template-columns: 1fr; }
  .grp-hero { padding: 1.1rem; }
}

/* ===== PATRON VISU COMPTABLE ===== */
.pat-hero {
  display:flex; justify-content:space-between; align-items:flex-end; gap:1rem; flex-wrap:wrap;
  margin-bottom:1.15rem; padding:1.25rem 1.4rem; border-radius:16px;
  background:
    radial-gradient(ellipse 70% 120% at 100% 0%, color-mix(in srgb, var(--soc,#0EA5E9) 28%, transparent), transparent 55%),
    linear-gradient(135deg, #0F172A, #1E293B);
  color:#fff;
}
.pat-eyebrow { margin:0 0 0.3rem; font-size:0.65rem; font-weight:700; letter-spacing:0.12em; text-transform:uppercase; color:#7DD3FC; }
.pat-hero h2 { margin:0 0 0.3rem; font-size:1.45rem; font-weight:800; letter-spacing:-0.03em; }
.pat-hero p { margin:0; font-size:0.85rem; color:#94A3B8; max-width:28rem; }
.pat-filters { display:flex; gap:0.65rem; flex-wrap:wrap; }
.pat-filters label { display:flex; flex-direction:column; gap:0.25rem; font-size:0.65rem; font-weight:700; text-transform:uppercase; letter-spacing:0.04em; color:#94A3B8; }
.pat-filters select {
  min-width:140px; padding:0.45rem 0.65rem; border-radius:8px;
  border:1px solid rgba(255,255,255,0.15); background:rgba(15,23,42,0.55); color:#fff; font-size:0.85rem;
}
.pat-kpis { display:grid; grid-template-columns:repeat(4,1fr); gap:0.75rem; margin-bottom:1.1rem; }
.pat-kpi {
  background:#fff; border:1px solid var(--border); border-radius:14px; padding:0.95rem 1.05rem;
  display:flex; flex-direction:column; gap:0.2rem;
}
.pat-kpi span { font-size:0.68rem; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:0.04em; }
.pat-kpi strong { font-size:1.3rem; font-weight:800; letter-spacing:-0.03em; }
.pat-kpi small { font-size:0.72rem; color:var(--muted-2); }
.pat-kpi--accent { border-color:#BAE6FD; background:linear-gradient(180deg,#F0F9FF,#fff); }
.pat-kpi--accent strong { color:#0369A1; }
.pat-grid { display:grid; grid-template-columns:1fr 1fr; gap:0.85rem; margin-bottom:0.85rem; }
.pat-panel { background:#fff; border:1px solid var(--border); border-radius:14px; padding:1rem; }
.pat-empty { margin:0.5rem 0; font-size:0.85rem; color:var(--muted); }
.pat-cats { list-style:none; margin:0; padding:0; }
.pat-cats li { display:flex; align-items:center; gap:0.55rem; padding:0.45rem 0; border-bottom:1px solid var(--border-soft); font-size:0.85rem; }
.pat-cats li:last-child { border-bottom:0; }
.pat-cats .dot { width:8px; height:8px; border-radius:50%; flex-shrink:0; }
.pat-cats .name { flex:1; color:var(--ink); }
.pat-cats strong { font-weight:800; }
body.ctx-patron .main-content {
  background: radial-gradient(ellipse 50% 40% at 100% 0%, rgba(14,165,233,0.07), transparent 50%), var(--bg);
}
@media (max-width: 900px) {
  .pat-kpis, .pat-grid { grid-template-columns:1fr 1fr; }
}
@media (max-width: 640px) {
  .pat-kpis, .pat-grid { grid-template-columns:1fr; }
}

/* ===== Brand logo sidebar ===== */
.sidebar-brand--logo {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0.15rem 0.45rem 1.2rem !important;
  text-decoration: none !important;
  gap: 0;
}
.sidebar-brand--logo:hover { opacity: 0.92; }
.brand-logo {
  display: block;
  width: 100%;
  max-width: 220px;
  height: auto;
  max-height: 88px;
  object-fit: contain;
  object-position: left center;
}
.brand-logo--icon {
  width: 84px;
  height: 84px;
  max-width: 84px;
  max-height: 84px;
  object-fit: contain;
}
.sidebar--pro .sidebar-brand--logo { padding-left: 0.4rem !important; padding-right: 0.4rem !important; }
.auth-logo-img {
  display: block;
  margin: 0 auto 0.75rem;
  width: min(280px, 85%);
  height: auto;
  max-height: 96px;
  object-fit: contain;
}
