/**
 * EPIM 360 — UI redesign 2026
 * Surcharge visuelle globale (Bootstrap + shell existant).
 * Chargé en dernier dans base.html.
 */

:root {
  /* Sidebar */
  --epim-sidebar-bg:           #0F172A;
  --epim-sidebar-active:       #1E40AF;
  --epim-sidebar-text:         rgba(255, 255, 255, 0.60);
  --epim-sidebar-text-active:  #FFFFFF;
  --epim-sidebar-accent:       #93C5FD;
  --epim-sidebar-divider:      rgba(255, 255, 255, 0.08);
  --epim-sidebar-width:        224px;

  /* Surfaces */
  --epim-surface-page:         #F8FAFC;
  --epim-surface-card:         #FFFFFF;
  --epim-surface-secondary:    #F1F5F9;

  /* Bordures */
  --epim-border:               rgba(15, 23, 42, 0.10);
  --epim-border-strong:        rgba(15, 23, 42, 0.20);

  /* Action principale */
  --epim-blue:                 #1D4ED8;
  --epim-blue-hover:           #1E40AF;
  --epim-blue-light:           #EFF6FF;
  --epim-blue-text:            #1E40AF;

  /* Sémantique */
  --epim-success:              #16A34A;
  --epim-success-bg:           #F0FDF4;
  --epim-warning:              #D97706;
  --epim-warning-bg:           #FFFBEB;
  --epim-danger:               #DC2626;
  --epim-danger-bg:            #FEF2F2;
  --epim-info:                 #0284C7;
  --epim-info-bg:              #F0F9FF;

  /* Accents KPI */
  --epim-accent-blue:          #2563EB;
  --epim-accent-green:         #16A34A;
  --epim-accent-amber:         #D97706;
  --epim-accent-red:           #DC2626;

  /* Typographie */
  --epim-font:                 'Inter', system-ui, sans-serif;
  --epim-radius-sm:            6px;
  --epim-radius-md:            8px;
  --epim-radius-lg:            12px;

  /* Shell legacy compat */
  --navbar-height:             52px;
  --contextual-nav-height:     42px;
  --app-bg:                    var(--epim-surface-page);
  --sidebar-bg:                var(--epim-sidebar-bg);
}

/* ── Base ─────────────────────────────────────────────────── */

html {
  font-size: 16px;
}

body {
  font-family: var(--epim-font);
  font-weight: 400;
  background: var(--epim-surface-page);
  color: #0F172A;
  margin: 0;
}

body.app-authenticated {
  overflow-y: auto;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6,
.fw-bold, .fw-semibold, strong, b {
  font-weight: 500 !important;
}

/* ── Layout global ────────────────────────────────────────── */

.epim-layout {
  display: flex;
  min-height: 100vh;
  align-items: flex-start;
  background: var(--epim-surface-page);
  font-family: var(--epim-font);
}

.epim-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.epim-content,
.app-content.epim-content {
  flex: 1;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--epim-surface-page);
}

/* Sidebar column */
.epim-sidebar-column {
  flex-direction: column;
  width: var(--epim-sidebar-width);
  min-width: var(--epim-sidebar-width);
  max-width: var(--epim-sidebar-width);
  flex: 0 0 var(--epim-sidebar-width);
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--epim-sidebar-bg);
  overflow: hidden;
}

.epim-sidebar-column > .sidebar.app-sidebar-desktop {
  display: flex !important;
  flex-direction: column;
  flex: 1;
  width: 100%;
  min-width: 0;
  max-width: none;
  height: auto;
  position: relative;
  top: 0;
  padding: 0;
  background: transparent;
  overflow: hidden;
}

@media (max-width: 991.98px) {
  .epim-sidebar-column {
    display: none !important;
  }
}

body.sidebar-collapsed .epim-sidebar-column,
html.sidebar-collapsed-boot .epim-sidebar-column {
  width: 72px;
  min-width: 72px;
  max-width: 72px;
  flex-basis: 72px;
}

body.sidebar-collapsed .epim-sidebar-footer,
html.sidebar-collapsed-boot .epim-sidebar-footer {
  display: none !important;
}

/* ── Sidebar ──────────────────────────────────────────────── */

.epim-sidebar,
.sidebar.app-sidebar-desktop {
  background: var(--epim-sidebar-bg);
  color: var(--epim-sidebar-text);
}

.app-sidebar-desktop .sidebar-header {
  padding: 16px 14px 12px;
  margin-bottom: 0;
  border-bottom: 0.5px solid var(--epim-sidebar-divider);
  min-height: auto;
}

.app-sidebar-desktop .sidebar-brand {
  color: #fff;
  font-size: 14px;
  font-weight: 500;
}

.app-sidebar-desktop .sidebar-brand-text,
.app-sidebar-desktop .epim360-brand-fallback {
  font-weight: 500 !important;
  font-size: 14px;
}

.app-sidebar-desktop .sidebar-collapse-btn {
  border: 0.5px solid var(--epim-sidebar-divider);
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--epim-radius-sm);
  width: 28px;
  height: 28px;
}

.app-sidebar-desktop .sidebar-workspace {
  margin: 10px 10px 6px;
  padding: 8px 10px;
  border-radius: var(--epim-radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 0.5px solid var(--epim-sidebar-divider);
}

.app-sidebar-desktop .sidebar-workspace-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.6px;
  text-transform: none;
  color: rgba(255, 255, 255, 0.35);
}

.app-sidebar-desktop .sidebar-workspace-name {
  font-size: 12px;
  font-weight: 500;
}

.app-sidebar-desktop .sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0 8px;
}

.app-sidebar-desktop .sidebar-section-title {
  padding: 14px 14px 4px;
  margin: 0;
  font-size: 10px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.30);
  letter-spacing: 0.8px;
  text-transform: none;
}

.app-sidebar-desktop .nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  margin: 1px 8px;
  border-radius: var(--epim-radius-sm);
  color: var(--epim-sidebar-text);
  font-size: 13px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.app-sidebar-desktop .nav-link:hover {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.90);
}

.app-sidebar-desktop .nav-link.active {
  background: var(--epim-sidebar-active);
  color: var(--epim-sidebar-text-active);
}

.app-sidebar-desktop .nav-link.active i {
  color: var(--epim-sidebar-accent);
}

.app-sidebar-desktop .nav-link i {
  font-size: 16px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.app-sidebar-desktop .nav-link-sub {
  padding-left: 2rem;
  font-size: 12.5px;
}

.app-sidebar-desktop .nav-link-cta {
  font-weight: 500;
  background: rgba(22, 163, 74, 0.12);
  border: 0.5px solid rgba(22, 163, 74, 0.25);
}

.app-sidebar-desktop .nav-link-cta:hover {
  background: rgba(22, 163, 74, 0.20);
}

.app-sidebar-desktop .sidebar-badge {
  margin-left: auto;
  background: var(--epim-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 4px;
}

.epim-sidebar-brand {
  padding: 20px 16px 16px;
  border-bottom: 0.5px solid var(--epim-sidebar-divider);
  flex-shrink: 0;
}

.epim-sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.epim-sidebar-logo-mark {
  width: 34px;
  height: 34px;
  background: #1D4ED8;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  flex-shrink: 0;
}

.epim-sidebar-logo-text {
  color: #fff;
  font-size: 14px;
  font-weight: 500;
}

.epim-sidebar-logo-sub {
  color: rgba(255, 255, 255, 0.35);
  font-size: 10px;
  margin-top: 1px;
}

.epim-sidebar-section {
  padding: 14px 14px 4px;
  font-size: 10px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.30);
  letter-spacing: 0.8px;
}

.epim-sidebar-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  margin: 1px 8px;
  border-radius: var(--epim-radius-sm);
  color: var(--epim-sidebar-text);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.epim-sidebar-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.90);
}

.epim-sidebar-item.active {
  background: var(--epim-sidebar-active);
  color: var(--epim-sidebar-text-active);
}

.epim-sidebar-item.active i {
  color: var(--epim-sidebar-accent);
}

.epim-sidebar-item i {
  font-size: 16px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.epim-sidebar-badge {
  margin-left: auto;
  background: var(--epim-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.epim-sidebar-badge.warning {
  background: var(--epim-warning);
}

.epim-sidebar-divider {
  height: 0.5px;
  background: var(--epim-sidebar-divider);
  margin: 8px 10px;
}

.epim-sidebar-footer {
  margin-top: auto;
  padding: 12px;
  border-top: 0.5px solid var(--epim-sidebar-divider);
  flex-shrink: 0;
}

.epim-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #1D4ED8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  color: #BFDBFE;
  flex-shrink: 0;
}


/* ── Header / topbar ──────────────────────────────────────── */

.epim-header.top-navbar {
  height: auto;
  min-height: var(--navbar-height);
  background: var(--epim-surface-card);
  border-bottom: 0.5px solid var(--epim-border);
  padding: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  z-index: 1030;
  flex-shrink: 0;
}

.epim-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  height: var(--navbar-height);
  min-height: var(--navbar-height);
}

.epim-header .topbar-left,
.epim-header .topbar-search-zone,
.epim-header .topbar-right {
  align-items: center;
}

.epim-header .topbar-brand {
  border-right: 0.5px solid var(--epim-border);
  padding-right: 12px;
  margin-right: 4px;
}

.epim-header .topbar-brand .epim360-brand-fallback {
  color: #0F172A;
  font-weight: 500;
}

.epim-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #64748B;
  min-width: 0;
}

.epim-breadcrumb i {
  font-size: 14px;
}

.epim-breadcrumb-sep {
  color: #CBD5E1;
  font-size: 12px;
}

.epim-breadcrumb-current {
  font-size: 14px;
  font-weight: 500;
  color: #0F172A;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.epim-header-spacer {
  flex: 1;
}

.epim-header-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 0.5px solid var(--epim-border-strong);
  border-radius: var(--epim-radius-sm);
  font-size: 11.5px;
  color: #475569;
  cursor: pointer;
  background: var(--epim-surface-card);
  white-space: nowrap;
}

.epim-header-pill:hover {
  background: var(--epim-surface-secondary);
}

.epim-header-pill i {
  font-size: 13px;
}

.epim-notif-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--epim-radius-sm);
  color: #475569;
  cursor: pointer;
  position: relative;
  border: 0.5px solid var(--epim-border);
  text-decoration: none;
}

.epim-notif-btn i {
  font-size: 18px;
}

.epim-notif-dot {
  width: 7px;
  height: 7px;
  background: var(--epim-danger);
  border-radius: 50%;
  position: absolute;
  top: 5px;
  right: 5px;
  border: 1.5px solid var(--epim-surface-card);
}

/* Topbar controls — light theme */
.epim-header .topbar-icon-btn {
  color: #475569;
  border: 0.5px solid var(--epim-border);
  border-radius: var(--epim-radius-sm);
  min-width: 34px;
  height: 34px;
}

.epim-header .topbar-icon-btn:hover {
  color: #0F172A;
  background: var(--epim-surface-secondary);
  border-color: var(--epim-border-strong);
}

.epim-header .topbar-user-btn {
  color: #475569;
  border: 0.5px solid var(--epim-border-strong);
  background: var(--epim-surface-card);
  border-radius: var(--epim-radius-sm);
  font-weight: 500;
}

.epim-header .topbar-user-btn::after {
  filter: none;
  opacity: 0.6;
}

.epim-header .topbar-user-btn:hover {
  background: var(--epim-surface-secondary);
  color: #0F172A;
}

.epim-header .topbar-cta-prospect {
  background: var(--epim-blue);
  color: #fff;
  border: none;
  border-radius: var(--epim-radius-sm);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
}

.epim-header .topbar-cta-prospect:hover {
  background: var(--epim-blue-hover);
  color: #fff;
}

.epim-header .topbar-search-group {
  border: 0.5px solid var(--epim-border-strong);
  border-radius: var(--epim-radius-sm);
  background: var(--epim-surface-card);
  overflow: hidden;
}

.epim-header .topbar-search-group .form-control,
.epim-header .topbar-search-group .input-group-text {
  border: none;
  background: transparent;
  font-size: 12.5px;
  box-shadow: none;
}

.epim-header .topbar-search-group:focus-within {
  border-color: var(--epim-blue);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.08);
}

/* Domain tabs row */
.epim-header .epim-domain-subnav {
  display: flex;
  background: var(--epim-surface-card);
  border-top: 0.5px solid var(--epim-border);
  padding: 0 20px;
  overflow-x: auto;
  scrollbar-width: none;
}

.epim-header .epim-domain-subnav::-webkit-scrollbar {
  display: none;
}

.epim-header .topbar-domain-nav {
  width: 100%;
  margin-left: 0;
}

.epim-header .topbar-domain-link {
  height: auto;
  padding: 10px 14px;
  font-size: 12.5px;
  color: #64748B;
  border-bottom: 2px solid transparent;
  font-weight: 400;
}

.epim-header .topbar-domain-link:hover {
  color: #0F172A;
  background: transparent;
  border-bottom-color: var(--epim-border-strong);
}

.epim-header .topbar-domain-link.active {
  color: var(--epim-blue);
  border-bottom-color: var(--epim-blue);
  font-weight: 500;
  background: transparent;
}

.epim-header .topbar-domain-link.active i,
.epim-header .topbar-domain-link.active .topbar-domain-icon {
  color: var(--epim-blue);
  opacity: 1;
}

/* ── Subnav / contextual tabs ─────────────────────────────── */

.epim-subnav,
.topbar-contextual {
  display: flex;
  background: var(--epim-surface-card);
  border-bottom: 0.5px solid var(--epim-border);
  padding: 0 20px;
  flex-shrink: 0;
  overflow-x: auto;
  position: static;
  top: auto;
  z-index: 1020;
}

.epim-tab,
.topbar-contextual-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  font-size: 12.5px;
  color: #64748B;
  cursor: pointer;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s;
  height: auto;
  font-weight: 400;
}

.epim-tab:hover,
.topbar-contextual-link:hover {
  color: #0F172A;
  border-bottom-color: var(--epim-border-strong);
}

.epim-tab.active,
.topbar-contextual-link.active {
  color: var(--epim-blue);
  border-bottom-color: var(--epim-blue);
  font-weight: 500;
}

.epim-tab i,
.topbar-contextual-link i {
  font-size: 14px;
}

.epim-tab-badge,
.topbar-contextual-badge {
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 4px;
}

.epim-tab-badge.info,
.topbar-contextual-badge {
  background: var(--epim-blue-light);
  color: var(--epim-blue-text);
}

.epim-tab-badge.warn {
  background: var(--epim-warning-bg);
  color: #92400E;
}

.epim-tab-badge.danger {
  background: var(--epim-danger-bg);
  color: #991B1B;
}

.epim-tab-badge.success {
  background: var(--epim-success-bg);
  color: #166534;
}

.topbar-contextual-nav {
  height: auto;
  min-height: var(--contextual-nav-height);
}

/* ── Buttons ──────────────────────────────────────────────── */

.epim-btn-primary,
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--epim-blue);
  color: #fff;
  border: none;
  border-radius: var(--epim-radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: none !important;
}

.epim-btn-primary:hover,
.btn-primary:hover {
  background: var(--epim-blue-hover);
  color: #fff;
}

.epim-btn-ghost,
.btn-outline-secondary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--epim-surface-secondary);
  color: #0F172A;
  border: 0.5px solid var(--epim-border-strong);
  border-radius: var(--epim-radius-sm);
  font-size: 12px;
  font-weight: 500;
  box-shadow: none !important;
}

.epim-btn-ghost:hover,
.btn-outline-secondary:hover,
.btn-secondary:hover {
  background: #E2E8F0;
  color: #0F172A;
}

.epim-btn-danger,
.btn-outline-danger,
.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--epim-danger-bg);
  color: #991B1B;
  border: 0.5px solid #FECACA;
  border-radius: var(--epim-radius-sm);
  font-size: 12px;
  font-weight: 500;
  box-shadow: none !important;
}

.epim-btn-danger:hover,
.btn-outline-danger:hover {
  background: #FEE2E2;
  color: #991B1B;
}

.epim-btn-sm,
.btn-sm {
  padding: 4px 10px;
  font-size: 11.5px;
}

.btn-success {
  background: var(--epim-success);
  border: none;
  font-weight: 500;
  box-shadow: none !important;
}

.btn-link {
  font-weight: 500;
  text-decoration: none;
}

/* ── KPI cards ────────────────────────────────────────────── */

.epim-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.epim-kpi-card {
  background: var(--epim-surface-card);
  border: 0.5px solid var(--epim-border);
  border-radius: var(--epim-radius-md);
  border-left: 3px solid var(--accent, var(--epim-accent-blue));
  padding: 12px 14px;
  box-shadow: none !important;
  min-height: auto;
}

a.epim-kpi-card:hover {
  border-color: var(--epim-border-strong);
  box-shadow: none !important;
}

.epim-kpi-card__label,
.epim-kpi-label {
  font-size: 11px;
  color: #64748B;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 4px;
  font-weight: 500;
}

.epim-kpi-card__value,
.epim-kpi-value {
  font-size: 22px;
  font-weight: 500;
  color: #0F172A;
  line-height: 1.2;
}

.epim-kpi-card__subtitle,
.epim-kpi-meta {
  font-size: 11px;
  color: #94A3B8;
  margin-top: 3px;
}

.epim-kpi-meta .up,
.epim-kpi-card__trend--up {
  color: var(--epim-success);
}

.epim-kpi-meta .down,
.epim-kpi-card__trend--down {
  color: var(--epim-danger);
}

/* ── Cards ────────────────────────────────────────────────── */

.epim-card,
.card {
  background: var(--epim-surface-card);
  border: 0.5px solid var(--epim-border);
  border-radius: var(--epim-radius-md);
  overflow: hidden;
  box-shadow: none !important;
}

.epim-card-header,
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--epim-border);
  background: var(--epim-surface-card);
  font-weight: 500;
}

.epim-card-title {
  font-size: 13px;
  font-weight: 500;
  color: #0F172A;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
}

.epim-card-title i {
  font-size: 15px;
  color: #64748B;
}

.epim-card-body,
.card-body {
  padding: 14px 16px;
}

.epim-card-link {
  font-size: 12px;
  color: var(--epim-blue);
  display: flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  font-weight: 500;
}

.epim-table-card {
  background: var(--epim-surface-card);
  border: 0.5px solid var(--epim-border);
  border-radius: var(--epim-radius-md);
  overflow: hidden;
  box-shadow: none !important;
}

.epim-table-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--epim-border);
}

.epim-table-card__title {
  font-size: 13px;
  font-weight: 500;
  margin: 0;
}

/* ── Tables ───────────────────────────────────────────────── */

.epim-table-wrap,
.table-responsive {
  background: var(--epim-surface-card);
  border: 0.5px solid var(--epim-border);
  border-radius: var(--epim-radius-md);
  overflow: hidden;
}

.epim-table,
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  margin-bottom: 0;
}

.epim-table thead th,
.table thead th {
  background: var(--epim-surface-secondary);
  padding: 9px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  color: #64748B;
  border-bottom: 0.5px solid var(--epim-border);
  white-space: nowrap;
}

.epim-table tbody td,
.table tbody td,
.table tbody th {
  padding: 9px 14px;
  border-bottom: 0.5px solid var(--epim-border);
  color: #0F172A;
  vertical-align: middle;
}

.epim-table tbody tr:last-child td,
.table tbody tr:last-child td {
  border-bottom: none;
}

.epim-table tbody tr:hover td,
.table-hover tbody tr:hover td,
.table tbody tr:hover td {
  background: var(--epim-surface-secondary);
}

.epim-table td.muted,
.text-muted {
  color: #64748B !important;
  font-size: 12px;
}

.epim-table td.amount {
  font-weight: 500;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.epim-table td.center {
  text-align: center;
}

.epim-table .col-name {
  font-weight: 500;
}

.epim-table-footer {
  padding: 10px 14px;
  font-size: 12px;
  color: #64748B;
  border-top: 0.5px solid var(--epim-border);
  background: var(--epim-surface-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
  background: transparent;
}

/* ── Badges ───────────────────────────────────────────────── */

.epim-badge,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: none;
}

.epim-badge.success,
.bg-success,
.badge.bg-success {
  background: var(--epim-success-bg) !important;
  color: #166534 !important;
}

.epim-badge.warning,
.bg-warning {
  background: var(--epim-warning-bg) !important;
  color: #92400E !important;
}

.epim-badge.danger,
.bg-danger {
  background: var(--epim-danger-bg) !important;
  color: #991B1B !important;
}

.epim-badge.info,
.bg-info {
  background: var(--epim-info-bg) !important;
  color: #0C4A6E !important;
}

.epim-badge.blue {
  background: var(--epim-blue-light);
  color: var(--epim-blue-text);
}

.epim-badge.neutral,
.bg-secondary {
  background: var(--epim-surface-secondary) !important;
  color: #475569 !important;
}

.epim-badge.orange {
  background: #FFF7ED;
  color: #9A3412;
}

/* ── Forms ────────────────────────────────────────────────── */

.epim-form-card {
  background: var(--epim-surface-card);
  border: 0.5px solid var(--epim-border);
  border-radius: var(--epim-radius-md);
  padding: 18px 20px;
}

.epim-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.epim-form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

.epim-form-grid-1 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.epim-field,
.form-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.epim-field label,
.form-label {
  font-size: 11px;
  font-weight: 500;
  color: #475569;
  margin-bottom: 4px;
}

.epim-field input,
.epim-field select,
.epim-field textarea,
.form-control,
.form-select {
  padding: 7px 10px;
  border: 0.5px solid var(--epim-border-strong);
  border-radius: var(--epim-radius-sm);
  font-size: 12.5px;
  color: #0F172A;
  background: var(--epim-surface-card);
  font-family: var(--epim-font);
  transition: border-color 0.15s;
  box-shadow: none !important;
}

.epim-field input:focus,
.epim-field select:focus,
.epim-field textarea:focus,
.form-control:focus,
.form-select:focus {
  outline: none;
  border-color: var(--epim-blue);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.08) !important;
}

.epim-field .hint,
.form-text {
  font-size: 11px;
  color: #94A3B8;
}

.epim-field .error,
.invalid-feedback {
  font-size: 11px;
  color: var(--epim-danger);
}

.epim-form-section {
  font-size: 12px;
  font-weight: 500;
  color: #0F172A;
  margin: 18px 0 12px;
  padding-bottom: 8px;
  border-bottom: 0.5px solid var(--epim-border);
}

.epim-form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 0.5px solid var(--epim-border);
}

.epim-filter-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--epim-surface-card);
  border: 0.5px solid var(--epim-border);
  border-radius: var(--epim-radius-md);
  padding: 14px 16px;
}

.epim-filter-row .epim-field {
  min-width: 140px;
  flex: 1;
}

.epim-filter-actions {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}

.input-group-text {
  border: 0.5px solid var(--epim-border-strong);
  background: var(--epim-surface-secondary);
  font-size: 12px;
}

/* ── Funnel ───────────────────────────────────────────────── */

.epim-funnel,
.epim-funnel-flow {
  display: flex;
  align-items: stretch;
  border: 0.5px solid var(--epim-border);
  border-radius: var(--epim-radius-md);
  overflow: hidden;
  background: var(--epim-border);
  gap: 0.5px;
}

.epim-funnel-step,
.epim-funnel-stage {
  flex: 1;
  background: var(--epim-surface-card);
  padding: 14px 12px;
  text-align: center;
  position: relative;
}

.epim-funnel-step::after {
  content: "›";
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  color: #CBD5E1;
  font-size: 18px;
  z-index: 1;
}

.epim-funnel-step:last-child::after {
  display: none;
}

.epim-funnel-num,
.epim-funnel-stage__count {
  font-size: 22px;
  font-weight: 500;
  color: #0F172A;
}

.epim-funnel-label,
.epim-funnel-stage__label {
  font-size: 11px;
  color: #64748B;
  margin-top: 2px;
}

.epim-funnel-rate,
.epim-funnel-arrow__rate {
  display: inline-block;
  margin-top: 5px;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
}

.epim-funnel-rate.blue {
  background: var(--epim-blue-light);
  color: var(--epim-blue-text);
}

.epim-funnel-rate.green {
  background: var(--epim-success-bg);
  color: #166534;
}

.epim-funnel-rate.amber {
  background: var(--epim-warning-bg);
  color: #92400E;
}

.epim-funnel-rate.red {
  background: var(--epim-danger-bg);
  color: #991B1B;
}

/* ── Alerts ───────────────────────────────────────────────── */

.epim-alert,
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--epim-radius-md);
  border: 0.5px solid;
  font-size: 12.5px;
  box-shadow: none !important;
}

.epim-alert.danger,
.alert-danger {
  background: var(--epim-danger-bg);
  border-color: #FECACA;
  color: #7F1D1D;
}

.epim-alert.warning,
.alert-warning {
  background: var(--epim-warning-bg);
  border-color: #FDE68A;
  color: #78350F;
}

.epim-alert.info,
.alert-info {
  background: var(--epim-info-bg);
  border-color: #BAE6FD;
  color: #0C4A6E;
}

.epim-alert.success,
.alert-success {
  background: var(--epim-success-bg);
  border-color: #BBF7D0;
  color: #166534;
}

.epim-alert i {
  font-size: 16px;
  flex-shrink: 0;
}

.epim-alert-body {
  flex: 1;
}

.epim-alert-count {
  background: var(--epim-danger);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}

.epim-alert-count.warning {
  background: var(--epim-warning);
}

.epim-alert-item {
  border: 0.5px solid var(--epim-border);
  border-radius: var(--epim-radius-md);
  box-shadow: none !important;
}

.epim-priority-list {
  display: flex;
  flex-direction: column;
}

.epim-priority-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 0.5px solid var(--epim-border);
  font-size: 12.5px;
}

.epim-priority-item:last-child {
  border-bottom: none;
}

.epim-priority-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #334155;
}

.epim-priority-label i {
  font-size: 15px;
  color: #64748B;
}

.epim-priority-tag {
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

.epim-priority-tag.traiter {
  background: var(--epim-warning-bg);
  color: #92400E;
}

.epim-priority-tag.surveiller {
  background: var(--epim-info-bg);
  color: #0C4A6E;
}

.epim-priority-tag.critique {
  background: var(--epim-danger-bg);
  color: #991B1B;
}

/* ── Progress ─────────────────────────────────────────────── */

.epim-progress-wrap,
.progress {
  height: 6px;
  background: var(--epim-surface-secondary);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: none !important;
}

.epim-progress-bar,
.progress-bar {
  height: 100%;
  border-radius: 3px;
  background: var(--epim-blue);
  transition: width 0.3s ease;
}

.epim-progress-bar.green,
.progress-bar.bg-success {
  background: var(--epim-success);
}

.epim-progress-bar.amber,
.progress-bar.bg-warning {
  background: var(--epim-warning);
}

.epim-progress-bar.red,
.progress-bar.bg-danger {
  background: var(--epim-danger);
}

/* ── Grilles ──────────────────────────────────────────────── */

.epim-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.epim-three-col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

.epim-col-wide {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
}

.epim-col-sidebar {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 14px;
}

@media (max-width: 960px) {
  .epim-two-col,
  .epim-three-col,
  .epim-col-wide,
  .epim-col-sidebar {
    grid-template-columns: 1fr;
  }
}

/* ── Page headers (design system legacy) ──────────────────── */

.epim-page-header__greeting {
  font-size: 1.35rem;
  font-weight: 500;
  color: #0F172A;
  margin-bottom: 0.25rem;
}

.epim-page-header__context,
.epim-page-header__period {
  font-size: 12.5px;
  color: #64748B;
}

.epim-section {
  margin-bottom: 0;
}

/* ── Modals & dropdowns ───────────────────────────────────── */

.modal-content {
  border: 0.5px solid var(--epim-border);
  border-radius: var(--epim-radius-lg);
  box-shadow: none !important;
}

.modal-header,
.modal-footer {
  border-color: var(--epim-border);
}

.dropdown-menu {
  border: 0.5px solid var(--epim-border);
  border-radius: var(--epim-radius-md);
  box-shadow: none !important;
  font-size: 12.5px;
}

.dropdown-item {
  font-size: 12.5px;
  font-weight: 400;
}

.dropdown-item:active {
  background: var(--epim-blue-light);
  color: var(--epim-blue-text);
}

.dropdown-header {
  font-size: 11px;
  font-weight: 500;
}

/* ── Pagination ───────────────────────────────────────────── */

.pagination .page-link {
  font-size: 12px;
  font-weight: 500;
  border: 0.5px solid var(--epim-border);
  color: #475569;
  box-shadow: none;
}

.pagination .page-item.active .page-link {
  background: var(--epim-blue);
  border-color: var(--epim-blue);
}

/* ── Nav tabs (Bootstrap) ───────────────────────────────────── */

.nav-tabs {
  border-bottom: 0.5px solid var(--epim-border);
}

.nav-tabs .nav-link {
  font-size: 12.5px;
  font-weight: 400;
  color: #64748B;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 14px;
}

.nav-tabs .nav-link.active {
  color: var(--epim-blue);
  border-bottom-color: var(--epim-blue);
  font-weight: 500;
  background: transparent;
}

/* ── Login / unauthenticated ──────────────────────────────── */

body:not(.app-authenticated) main.container {
  max-width: 960px;
}

/* ── Mobile offcanvas ─────────────────────────────────────── */

.offcanvas {
  border-right: 0.5px solid var(--epim-border);
}

.offcanvas .sidebar {
  background: var(--epim-sidebar-bg);
  color: var(--epim-sidebar-text);
}

.offcanvas-header {
  border-bottom: 0.5px solid var(--epim-border);
}

/* ── App launcher ─────────────────────────────────────────── */

#appLauncherModal .modal-body {
  background: var(--epim-surface-page);
}

/* ── List groups (search dropdown) ────────────────────────── */

.list-group-item {
  font-size: 12.5px;
  border-color: var(--epim-border);
}

#globalSearchDropdown {
  border: 0.5px solid var(--epim-border) !important;
  border-radius: var(--epim-radius-md);
  overflow: hidden;
}

/* ── Accordion (legacy sidebar mobile) ────────────────────── */

.accordion-button {
  font-weight: 500;
  box-shadow: none !important;
}

/* ── Utilities ─────────────────────────────────────────────── */

.small, small {
  font-size: 11px !important;
}

.text-uppercase {
  text-transform: none !important;
  letter-spacing: normal !important;
}

.shadow, .shadow-sm, .shadow-lg {
  box-shadow: none !important;
}

/* ── Sidebar macro domains (desktop) ──────────────────────── */

.sidebar-macro-nav .sidebar-domain-item {
  list-style: none;
}

.sidebar-macro-nav .nav-link-domain {
  font-weight: 500;
}

.app-sidebar-desktop .nav-link-domain.active {
  background: var(--epim-sidebar-active);
  color: var(--epim-sidebar-text-active);
}

.app-sidebar-desktop .nav-link-domain.active i {
  color: var(--epim-sidebar-accent);
}
