/* ============================================================
   CEErtify Design System
   Palette: Axelia-Énergie (bleu marine #1D385D + vert émeraude #059669)
   Dark/Light mode via data-theme="dark" on <html>
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Light tokens (default) ─────────────────────────────── */
:root {
  --primary: #1D385D;
  --primary-light: #2A4A73;
  --primary-dark: #142842;
  --primary-50: #EEF2F7;
  --primary-100: #D4DCE8;

  --accent: #059669;
  --accent-light: #10B981;
  --accent-dark: #047857;
  --accent-50: #ECFDF5;
  --accent-100: #D1FAE5;

  --gradient-brand: linear-gradient(135deg, #1D385D 0%, #059669 100%);
  --gradient-sidebar: linear-gradient(180deg, #0F172A 0%, #1E293B 100%);

  --bg-page: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F1F5F9;
  --bg-sidebar: #0F172A;
  --bg-sidebar-hover: rgba(255,255,255,0.08);
  --bg-sidebar-active: rgba(255,255,255,0.12);
  --bg-header: #FFFFFF;
  --bg-input: #FFFFFF;
  --bg-overlay: rgba(15,23,42,0.5);

  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --border-input: #CBD5E1;
  --border-focus: #059669;

  --text: #0F172A;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;
  --text-inverse: #FFFFFF;
  --text-sidebar: #94A3B8;
  --text-sidebar-active: #FFFFFF;
  --text-sidebar-section: #475569;

  --score-green: #22C55E;
  --score-green-bg: #F0FDF4;
  --score-green-text: #166534;
  --score-orange: #F59E0B;
  --score-orange-bg: #FFFBEB;
  --score-orange-text: #92400E;
  --score-red: #EF4444;
  --score-red-bg: #FEF2F2;
  --score-red-text: #991B1B;
  --score-grey: #9CA3AF;
  --score-grey-bg: #F3F4F6;
  --score-grey-text: #4B5563;

  --status-blue: #3B82F6;
  --status-blue-bg: #EFF6FF;
  --status-blue-text: #1E40AF;
  --status-purple: #8B5CF6;
  --status-purple-bg: #F5F3FF;
  --status-purple-text: #5B21B6;
  --status-amber: #F59E0B;
  --status-amber-bg: #FFFBEB;
  --status-amber-text: #92400E;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
  --shadow-focus: 0 0 0 3px rgba(5,150,105,0.15);

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 999px;

  --transition: all 0.15s ease;
  --transition-slow: all 0.3s ease;

  --sidebar-width: 260px;
  --header-height: 60px;
}

/* ── Dark tokens ────────────────────────────────────────── */
[data-theme="dark"] {
  --bg-page: #0B1120;
  --bg-card: #152039;
  --bg-card-hover: #1C2A4A;
  --bg-sidebar: #070D1A;
  --bg-header: #0F1729;
  --bg-input: #1A2540;
  --bg-overlay: rgba(0,0,0,0.6);

  --border: #1E3050;
  --border-light: #162544;
  --border-input: #2A4060;

  --text: #E2E8F0;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;

  --primary-50: #1A2A45;
  --primary-100: #1E3050;
  --accent-50: #0D2D22;
  --accent-100: #0F3D2E;

  --score-green-bg: rgba(34,197,94,0.12);
  --score-green-text: #86EFAC;
  --score-orange-bg: rgba(245,158,11,0.12);
  --score-orange-text: #FCD34D;
  --score-red-bg: rgba(239,68,68,0.12);
  --score-red-text: #FCA5A5;
  --score-grey-bg: rgba(156,163,175,0.12);
  --score-grey-text: #D1D5DB;

  --status-blue-bg: rgba(59,130,246,0.12);
  --status-blue-text: #93C5FD;
  --status-purple-bg: rgba(139,92,246,0.12);
  --status-purple-text: #C4B5FD;
  --status-amber-bg: rgba(245,158,11,0.12);
  --status-amber-text: #FCD34D;

  --shadow-card: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.5);
  --shadow-focus: 0 0 0 3px rgba(16,185,129,0.25);
}

/* ── Reset & base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* ── Typography ─────────────────────────────────────────── */
.text-kpi      { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1.2; }
.text-h1       { font-size: 20px; font-weight: 700; color: var(--text); }
.text-h2       { font-size: 16px; font-weight: 700; color: var(--text); }
.text-h3       { font-size: 14px; font-weight: 700; color: var(--text); }
.text-body     { font-size: 13.5px; font-weight: 400; color: var(--text); }
.text-label    { font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.text-small    { font-size: 12px; font-weight: 400; color: var(--text-muted); }
.text-badge    { font-size: 11px; font-weight: 600; }
.text-caption  { font-size: 10px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.text-accent   { color: var(--accent); }
.text-muted    { color: var(--text-muted); }
.text-secondary{ color: var(--text-secondary); }

/* ── Layout: app shell ──────────────────────────────────── */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 40;
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.app-header {
  height: var(--header-height);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  flex-shrink: 0;
  z-index: 30;
}

.app-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
}

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar-logo {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.sidebar-brand-img {
  height: auto;
  width: 80%;
  max-width: 180px;
  object-fit: contain;
  background: white;
  padding: 6px 14px;
  border-radius: var(--radius);
}

.sidebar-logo-icon {
  width: 34px;
  height: 34px;
  background: var(--gradient-brand);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

.sidebar-logo-text {
  color: white;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
}

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

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.sidebar-section {
  margin-top: 20px;
  margin-bottom: 6px;
  padding: 0 20px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-sidebar-section);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  margin: 1px 10px;
  border-radius: var(--radius);
  color: var(--text-sidebar);
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  text-decoration: none;
  position: relative;
}

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

.sidebar-link:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar-active);
}

.sidebar-link.active {
  background: var(--bg-sidebar-active);
  color: var(--text-sidebar-active);
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.sidebar-link .link-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--radius-full);
}

.sidebar-bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 16px 8px;
}

.sidebar-logo-img {
  height: 22px;
  width: auto;
  object-fit: contain;
  opacity: 0.85;
  filter: brightness(0) invert(1);
  transition: var(--transition);
}

.sidebar-logo-img:hover { opacity: 1; }

.sidebar-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 16px 4px;
}

.sidebar-action-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: var(--text-sidebar);
  font-size: 15px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  text-decoration: none;
}

.sidebar-action-btn:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar-active);
}

.sidebar-action-btn .notif-dot-sidebar {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  background: var(--score-red);
  border-radius: 50%;
  border: 2px solid var(--bg-sidebar);
}

.sidebar-action-btn.theme-toggle i.fa-sun   { display: none; }
.sidebar-action-btn.theme-toggle i.fa-moon  { display: inline; }
[data-theme="dark"] .sidebar-action-btn.theme-toggle i.fa-sun   { display: inline; }
[data-theme="dark"] .sidebar-action-btn.theme-toggle i.fa-moon  { display: none; }

.sidebar-user {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.sidebar-user:hover { background: var(--bg-sidebar-hover); }

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.sidebar-user-name { color: white; font-size: 13.5px; font-weight: 600; }
.sidebar-user-role { color: var(--text-sidebar); font-size: 11px; }

/* ── Header ─────────────────────────────────────────────── */
.header-left {}
.header-title { font-size: 20px; font-weight: 700; color: var(--text); }
.header-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-org {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card-hover);
  padding: 6px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.header-org i { color: var(--text-muted); font-size: 13px; }

.header-btn {
  position: relative;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 16px;
  transition: var(--transition);
}

.header-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text);
  border-color: var(--border-input);
}

.header-btn .notif-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  background: var(--score-red);
  border-radius: 50%;
  border: 2px solid var(--bg-header);
}

/* theme-toggle in header kept for backwards compat */
.header-btn.theme-toggle i.fa-sun   { display: none; }
.header-btn.theme-toggle i.fa-moon  { display: inline; }
[data-theme="dark"] .header-btn.theme-toggle i.fa-sun   { display: inline; }
[data-theme="dark"] .header-btn.theme-toggle i.fa-moon  { display: none; }

/* ── Breadcrumb ─────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.breadcrumb a { color: var(--text-muted); transition: var(--transition); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { font-size: 10px; }
.breadcrumb .current { color: var(--text-secondary); font-weight: 500; }

/* ── Card ───────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.card-hover:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-input);
}

.card-p { padding: 20px; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title { font-size: 14px; font-weight: 700; color: var(--text); }
.card-link  { font-size: 12px; font-weight: 500; color: var(--accent); transition: var(--transition); }
.card-link:hover { color: var(--accent-dark); text-decoration: underline; }

/* ── Badge ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-green  { background: var(--score-green-bg); color: var(--score-green-text); }
.badge-orange { background: var(--score-orange-bg); color: var(--score-orange-text); }
.badge-red    { background: var(--score-red-bg); color: var(--score-red-text); }
.badge-grey   { background: var(--score-grey-bg); color: var(--score-grey-text); }
.badge-blue   { background: var(--status-blue-bg); color: var(--status-blue-text); }
.badge-purple { background: var(--status-purple-bg); color: var(--status-purple-text); }
.badge-amber  { background: var(--status-amber-bg); color: var(--status-amber-text); }

.badge-solid-green  { background: var(--score-green); color: white; }
.badge-solid-accent { background: var(--accent); color: white; }
.badge-solid-primary{ background: var(--primary); color: white; }

/* ── Score dot ──────────────────────────────────────────── */
.score-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.score-dot-green  { background: var(--score-green); }
.score-dot-orange { background: var(--score-orange); }
.score-dot-red    { background: var(--score-red); }
.score-dot-grey   { background: var(--score-grey); }

/* ── KPI card ───────────────────────────────────────────── */
.kpi-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  padding: 20px;
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.kpi-label { font-size: 12px; font-weight: 500; color: var(--text-secondary); }

.kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.kpi-value { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1.2; }
.kpi-sub   { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

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

/* ── Data table ─────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  position: sticky;
  top: 0;
  background: var(--bg-card);
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  z-index: 2;
}

.data-table tbody tr {
  transition: var(--transition);
}

.data-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.data-table tbody td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.data-table .row-link {
  cursor: pointer;
}

.data-table .col-actions {
  text-align: right;
  white-space: nowrap;
}

.action-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.action-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-50);
}

.action-btn-danger:hover {
  border-color: var(--score-red);
  color: var(--score-red);
  background: var(--score-red-bg);
}

/* ── Filter chips ───────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.filter-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.filter-chip .count {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.8;
}

/* ── Pagination ─────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.pagination-pages {
  display: flex;
  gap: 4px;
}

.pagination-pages button {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
}

.pagination-pages button:hover { border-color: var(--accent); color: var(--accent); }
.pagination-pages button.active { background: var(--accent); border-color: var(--accent); color: white; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover { background: var(--accent-dark); }

.btn-secondary {
  background: var(--primary);
  color: white;
}
.btn-secondary:hover { background: var(--primary-dark); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}
.btn-ghost:hover { background: var(--bg-card-hover); color: var(--text); }

.btn-danger {
  background: var(--score-red);
  color: white;
}
.btn-danger:hover { background: #DC2626; }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 10px 24px; font-size: 14px; }

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 14px;
  transition: var(--transition);
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent); }

/* ── Form inputs ────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-input);
  background: var(--bg-input);
  color: var(--text);
  font-size: 13.5px;
  transition: var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}

.form-input::placeholder { color: var(--text-muted); }

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394A3B8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

/* ── Tabs ───────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 0;
  margin-bottom: 20px;
}

.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.tab:hover { color: var(--text); }

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.tab .tab-count {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: var(--bg-card-hover);
  color: var(--text-muted);
}

.tab.active .tab-count {
  background: var(--accent-50);
  color: var(--accent);
}

/* ── Alert item ─────────────────────────────────────────── */
.alert-item {
  padding: 12px 16px;
  border-left: 3px solid;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--bg-card);
  margin-bottom: 8px;
  transition: var(--transition);
}

.alert-item:hover { background: var(--bg-card-hover); }
.alert-red    { border-left-color: var(--score-red); }
.alert-orange { border-left-color: var(--score-orange); }
.alert-amber  { border-left-color: var(--status-amber); }
.alert-blue   { border-left-color: var(--status-blue); }

/* ── Timeline ───────────────────────────────────────────── */
.timeline { position: relative; padding-left: 24px; }

.timeline::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 20px;
  padding-left: 20px;
}

.timeline-dot {
  position: absolute;
  left: -19px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--bg-page);
}

.timeline-dot-green  { background: var(--accent); }
.timeline-dot-blue   { background: var(--status-blue); }
.timeline-dot-orange { background: var(--score-orange); }
.timeline-dot-red    { background: var(--score-red); }
.timeline-dot-grey   { background: var(--score-grey); }
.timeline-dot-purple { background: var(--status-purple); }

/* ── Message bubbles ────────────────────────────────────── */
.msg {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 13.5px;
  line-height: 1.6;
  margin-bottom: 12px;
}

.msg-user {
  background: var(--accent);
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.msg-bot {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  margin-right: auto;
  border-bottom-left-radius: 4px;
}

.msg-partner {
  background: var(--status-blue-bg);
  color: var(--text);
  margin-right: auto;
  border-bottom-left-radius: 4px;
}

.msg-source {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-card-hover);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

/* ── Progress bar ───────────────────────────────────────── */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border-light);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.progress-green  { background: var(--score-green); }
.progress-orange { background: var(--score-orange); }
.progress-red    { background: var(--score-red); }
.progress-grey   { background: var(--score-grey); }
.progress-blue   { background: var(--status-blue); }
.progress-purple { background: var(--status-purple); }
.progress-accent { background: var(--accent); }
.progress-slate  { background: var(--text-muted); }

/* ── Document card ──────────────────────────────────────── */
.doc-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: var(--transition);
}

.doc-card:hover { border-color: var(--border-input); box-shadow: var(--shadow-sm); }

.doc-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.doc-icon-pdf  { background: #FEE2E2; color: #DC2626; }
.doc-icon-img  { background: #E0F2FE; color: #0284C7; }
.doc-icon-csv  { background: var(--accent-50); color: var(--accent); }
.doc-icon-doc  { background: #EEF2FF; color: #4F46E5; }

.doc-info { flex: 1; min-width: 0; }
.doc-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── Upload zone ────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  transition: var(--transition);
  cursor: pointer;
}

.upload-zone:hover {
  border-color: var(--accent);
  background: var(--accent-50);
  color: var(--accent);
}

.upload-zone i { font-size: 32px; margin-bottom: 8px; }

/* ── Empty state ────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-state i { font-size: 48px; color: var(--text-muted); margin-bottom: 16px; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 13px; color: var(--text-secondary); margin-bottom: 20px; max-width: 360px; }

/* ── Activity item ──────────────────────────────────────── */
.activity-item {
  display: flex;
  gap: 12px;
  padding: 8px 0;
}

.activity-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}

.activity-text { font-size: 13px; color: var(--text-secondary); }
.activity-text strong { color: var(--text); font-weight: 600; }
.activity-text .ref { color: var(--accent); font-weight: 500; }
.activity-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── Notification item ──────────────────────────────────── */
.notif-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
  cursor: pointer;
}

.notif-item:hover { background: var(--bg-card-hover); }
.notif-item.unread { background: var(--accent-50); }
.notif-item.unread .notif-title { font-weight: 600; }

.notif-dot-unread {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 6px;
}

.notif-title { font-size: 13px; color: var(--text); }
.notif-desc  { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.notif-time  { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ── Kanban ─────────────────────────────────────────────── */
.kanban {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
}

.kanban-col {
  min-width: 260px;
  max-width: 300px;
  flex-shrink: 0;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 12px;
  font-weight: 600;
}

.kanban-col-body {
  background: var(--bg-card-hover);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 8px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.kanban-card:hover { box-shadow: var(--shadow-md); }

/* ── Steps / stepper ────────────────────────────────────── */
.stepper {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 32px;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  position: relative;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid var(--border);
  color: var(--text-muted);
  background: var(--bg-card);
}

.step.active .step-num {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.step.active { color: var(--accent); font-weight: 600; }

.step.done .step-num {
  background: var(--accent-100);
  border-color: var(--accent);
  color: var(--accent);
}

.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  min-width: 24px;
}

.step-line.done { background: var(--accent); }

/* ── Search spotlight ───────────────────────────────────── */
.search-spotlight {
  max-width: 640px;
  margin: 80px auto;
}

.search-spotlight-input {
  width: 100%;
  padding: 16px 20px 16px 52px;
  font-size: 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  color: var(--text);
  outline: none;
  transition: var(--transition);
}

.search-spotlight-input:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
}

.search-group-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 16px 0 8px;
}

.search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}

.search-result:hover { background: var(--bg-card-hover); }

/* ── Checklist ──────────────────────────────────────────── */
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}

.check-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
  margin-top: 1px;
}

.check-ok      { background: var(--score-green-bg); color: var(--score-green); }
.check-ko      { background: var(--score-red-bg); color: var(--score-red); }
.check-warning { background: var(--score-orange-bg); color: var(--score-orange); }
.check-pending { background: var(--score-grey-bg); color: var(--score-grey); border: 1px dashed var(--score-grey); }

/* ── Confidence indicator ───────────────────────────────── */
.confidence {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-card-hover);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* ── Utility classes ────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-5 { gap: 20px; }
.gap-6 { gap: 24px; }
.w-full { width: 100%; }
.flex-1 { flex: 1; min-width: 0; }
.flex-shrink-0 { flex-shrink: 0; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-top: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.ml-auto { margin-left: auto; }
.p-4 { padding: 16px; }
.p-5 { padding: 20px; }
.hidden { display: none; }
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg-overlay);
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-lg { max-width: 720px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 16px; font-weight: 700; color: var(--text); }

.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.modal-close:hover { background: var(--bg-card-hover); color: var(--text); }

.modal-body { padding: 24px; }
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ── Toggle switch ─────────────────────────────────────── */
.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-input);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 1279px) {
  .app-sidebar {
    width: 64px;
    overflow: visible;
  }
  .sidebar-logo-text,
  .sidebar-section,
  .sidebar-link span,
  .sidebar-link .link-badge,
  .sidebar-user-name,
  .sidebar-user-role { display: none; }
  .sidebar-brand-img { height: 22px; }
  .sidebar-link { justify-content: center; padding: 10px; margin: 2px 6px; }
  .sidebar-link i { width: auto; }
  .sidebar-logo { justify-content: center; padding: 16px; }
  .sidebar-user { justify-content: center; padding: 8px 12px; }
  .sidebar-actions { padding: 8px 6px 0; gap: 2px; }
  .sidebar-action-btn { width: 32px; height: 32px; font-size: 13px; }
  .sidebar-logos { gap: 6px; padding: 8px 6px 4px; }
  .sidebar-logo-img { height: 14px; }
  .stat-grid-5 { grid-template-columns: repeat(3, 1fr); }
  .app-content { padding: 24px; }
}

@media (max-width: 1023px) {
  .app-sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    transition: var(--transition-slow);
    z-index: 50;
  }
  .app-sidebar.open { left: 0; }
  .sidebar-logo-text,
  .sidebar-section,
  .sidebar-link span,
  .sidebar-link .link-badge,
  .sidebar-user-name,
  .sidebar-user-role { display: unset; }
  .sidebar-link { justify-content: flex-start; padding: 9px 16px; margin: 1px 10px; }
  .sidebar-logo { justify-content: flex-start; padding: 20px; }
  .sidebar-user { justify-content: flex-start; padding: 16px 20px; }
  .stat-grid-5 { grid-template-columns: repeat(2, 1fr); }
  .stat-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .app-content { padding: 20px; }
}

@media (max-width: 640px) {
  .stat-grid-5, .stat-grid-4, .stat-grid-3, .stat-grid-2 { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .app-content { padding: 16px; }
  .app-header { padding: 0 16px; }
}
