/* ============================================================
   Dashboard DG — Feuille de style principale
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #f4f5f7;
  --bg-card:      #ffffff;
  --sidebar-bg:   #1e2532;
  --sidebar-text: #a8b2c1;
  --sidebar-hover:#2d3748;
  --primary:      #3B8BD4;
  --primary-dark: #2d72b8;
  --success:      #2d7a2d;
  --success-bg:   #eaf3de;
  --warning:      #a06000;
  --warning-bg:   #faeeda;
  --danger:       #c0392b;
  --danger-bg:    #fcebeb;
  --info:         #185FA5;
  --info-bg:      #e6f1fb;
  --text:         #1a1a1a;
  --text-muted:   #6b7280;
  --border:       #e5e7eb;
  --radius:       8px;
  --radius-lg:    12px;
  --shadow:       0 1px 3px rgba(0,0,0,.08);
  --sidebar-w:    220px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ── LAYOUT ─────────────────────────────────────────────── */
.app-wrapper   { display: flex; min-height: 100vh; }
.main-content  { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.content-body  { flex: 1; padding: 20px 24px; overflow-y: auto; }

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-logo {
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.sidebar-logo span { color: #fff; font-weight: 600; font-size: 13px; }
.logo-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; color: #fff;
  flex-shrink: 0;
}
.sidebar-nav { list-style: none; padding: 10px 0; flex: 1; }
.sidebar-nav li a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13px;
  transition: all .15s;
  border-left: 3px solid transparent;
}
.sidebar-nav li a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav li a.active {
  background: var(--sidebar-hover);
  color: #fff;
  font-weight: 500;
  border-left-color: var(--primary);
}
.sidebar-nav li a svg { flex-shrink: 0; }
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.sidebar-user-info { display: flex; align-items: center; gap: 8px; }
.s-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  flex-shrink: 0;
}
.s-name  { font-size: 12px; color: #fff; font-weight: 500; }
.s-role  { font-size: 10px; color: var(--sidebar-text); }

/* ── TOPBAR ──────────────────────────────────────────────── */
.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.page-title  { font-size: 16px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-date  { font-size: 12px; color: var(--text-muted); }
.topbar-user  { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--info-bg); color: var(--info);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
}
.user-name  { font-weight: 500; }
.btn-logout {
  font-size: 12px; color: var(--danger);
  text-decoration: none;
  padding: 3px 8px;
  border: 1px solid var(--danger);
  border-radius: 4px;
  transition: all .15s;
}
.btn-logout:hover { background: var(--danger-bg); }

/* ── FLASH ───────────────────────────────────────────────── */
.flash {
  padding: 10px 24px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.flash-success { background: var(--success-bg); color: var(--success); border-left: 4px solid var(--success); }
.flash-error   { background: var(--danger-bg);  color: var(--danger);  border-left: 4px solid var(--danger); }
.flash-warning { background: var(--warning-bg); color: var(--warning); border-left: 4px solid var(--warning); }
.flash-close   { background: none; border: none; cursor: pointer; font-size: 18px; color: inherit; line-height: 1; }

/* ── CARDS ───────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card:last-child { margin-bottom: 0; }
.card-header {
  padding: 12px 16px;
  font-weight: 600;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.card-body { padding: 16px; }
.p-0  { padding: 0 !important; }
.p-card { padding: 16px; }

/* ── KPI ─────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.kpi-3 { grid-template-columns: repeat(3, 1fr); }
.kpi-4 { grid-template-columns: repeat(4, 1fr); }
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.kpi-label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .3px; }
.kpi-value { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1.1; margin-bottom: 4px; }
.text-danger  { color: var(--danger) !important; }
.text-muted   { color: var(--text-muted); }
.text-center  { text-align: center; }

/* ── BADGES ──────────────────────────────────────────────── */
.badge {
  font-size: 10px; padding: 2px 7px;
  border-radius: 10px; font-weight: 500;
  display: inline-block; white-space: nowrap;
}
.badge-success, .badge-cloture, .badge-executee,
.badge-active,  .badge-valide, .badge-favorable { background: var(--success-bg); color: var(--success); }
.badge-warning, .badge-alerte, .badge-temporaire,
.badge-surveiller, .badge-en_revision            { background: var(--warning-bg); color: var(--warning); }
.badge-danger, .badge-retard, .badge-tendu,
.badge-revoquee                                  { background: var(--danger-bg);  color: var(--danger); }
.badge-info, .badge-planifie, .badge-en_cours,
.badge-brouillon, .badge-non_demarree,
.badge-nouveau, .badge-ouvert                    { background: var(--info-bg);    color: var(--info); }
.badge-secondary, .badge-expiree, .badge-archive,
.badge-tenue, .badge-annulee                     { background: #f1efeb; color: #666; }

/* ── GRIDS ───────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ── TABLES ──────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  padding: 8px 12px; text-align: left;
  font-size: 11px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .3px;
  border-bottom: 1px solid var(--border);
  background: #f9fafb;
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafafa; }
.table tbody tr.row-priority { background: #fffbeb; }
.td-title { font-weight: 500; line-height: 1.3; }
.td-sub   { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── PROGRESS ────────────────────────────────────────────── */
.progress-wrap {
  background: var(--border);
  height: 5px;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 2px;
}
.progress-bar    { height: 100%; border-radius: 3px; transition: width .3s; min-width: 2px; }
.progress-label  { font-size: 10px; color: var(--text-muted); }

/* ── FORMS ───────────────────────────────────────────────── */
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 12px; font-weight: 500; color: var(--text-muted); margin-bottom: 4px; }
.form-control {
  width: 100%; padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px; color: var(--text);
  background: var(--bg-card);
  transition: border-color .15s;
  font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(59,139,212,.15); }
.form-control-sm  { padding: 4px 8px; font-size: 12px; }
textarea.form-control { resize: vertical; }
.form-row  { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 120px; }
.checkbox-group label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.checkbox-group input[type="checkbox"] { width: auto; }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px; font-weight: 500;
  cursor: pointer; border: none;
  text-decoration: none;
  transition: all .15s;
  font-family: inherit;
  gap: 4px;
}
.btn-primary         { background: var(--primary); color: #fff; }
.btn-primary:hover   { background: var(--primary-dark); }
.btn-outline         { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover   { background: var(--bg); }
.btn-success         { background: var(--success); color: #fff; }
.btn-success:hover   { background: #236b23; }
.btn-danger-outline  { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-danger-outline:hover { background: var(--danger-bg); }
.btn-sm  { padding: 4px 10px; font-size: 12px; }
.btn-xs  { padding: 2px 7px; font-size: 11px; border-radius: 4px; }
.btn-block { width: 100%; }

/* ── EVENTS ──────────────────────────────────────────────── */
.event-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.event-item:last-child { border-bottom: none; }
.event-time   { font-size: 11px; color: var(--text-muted); min-width: 38px; padding-top: 2px; flex-shrink: 0; }
.event-dot    { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.event-body   { flex: 1; min-width: 0; }
.event-title  { font-size: 12px; font-weight: 500; }
.event-sub    { font-size: 11px; color: var(--text-muted); }

/* Couleurs catégories */
.dot-reunion_interne { background: #3B8BD4; }
.dot-reunion_externe { background: #D85A30; }
.dot-deplacement     { background: #888780; }
.dot-signature       { background: #1D9E75; }
.dot-autre           { background: #7F77DD; }

/* ── DECISIONS ───────────────────────────────────────────── */
.decision-item { padding: 8px 0; border-bottom: 1px solid var(--border); }
.decision-item:last-child { border-bottom: none; }
.dec-row-head  { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; margin-bottom: 3px; }
.decision-text { font-size: 12px; font-weight: 500; }
.decision-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 5px; }

/* ── ALERTS ──────────────────────────────────────────────── */
.alert-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.alert-item:last-child { border-bottom: none; }
.alert-dot     { width: 6px; height: 6px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.dot-warning   { background: #EF9F27; }
.dot-danger    { background: #E24B4A; }
.alert-banner  {
  background: var(--warning-bg);
  border: 1px solid #f0c040;
  border-left: 4px solid #EF9F27;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--warning);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

/* ── OKR ─────────────────────────────────────────────────── */
.okr-score-big    { display: flex; align-items: center; gap: 16px; padding: 8px 0; }
.score-circle     { width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; flex-shrink: 0; }
.score-green      { background: var(--success-bg); color: var(--success); }
.score-amber      { background: var(--warning-bg); color: var(--warning); }
.score-red        { background: var(--danger-bg);  color: var(--danger); }
.score-label      { font-size: 13px; color: var(--text-muted); }
.score-pill       { font-size: 11px; padding: 3px 8px; border-radius: 6px; font-weight: 500; }

/* ── DOCUMENTS ───────────────────────────────────────────── */
.doc-type-badge   { font-size: 9px; font-weight: 700; padding: 2px 5px; border-radius: 3px; letter-spacing: .3px; }
.doc-pdf          { background: #fde8e8; color: #c0392b; }
.doc-docx, .doc-doc { background: #dbeafe; color: #1e40af; }
.doc-xlsx, .doc-xls { background: #dcfce7; color: #166534; }
.doc-pptx, .doc-ppt { background: #fef3c7; color: #92400e; }
.doc-other        { background: #f1efeb; color: #555; }

.doc-mini {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.doc-mini:last-child { border-bottom: none; }
.doc-mini-type { font-size: 10px; font-weight: 600; color: var(--text-muted); min-width: 30px; }
.doc-mini-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── PAGINATION ──────────────────────────────────────────── */
.pagination {
  display: flex; gap: 4px;
  padding: 12px 16px;
  justify-content: center;
  border-top: 1px solid var(--border);
}
.page-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  text-decoration: none;
  color: var(--text);
  transition: all .15s;
}
.page-btn:hover  { background: var(--bg); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── LOGIN ───────────────────────────────────────────────── */
.login-body    { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #f0f2f5; }
.login-wrapper { width: 100%; max-width: 420px; padding: 24px; }
.login-card    {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 24px rgba(0,0,0,.1);
  padding: 32px;
}
.login-logo    { text-align: center; margin-bottom: 24px; }
.logo-icon-lg  {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: var(--primary);
  color: #fff;
  font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
}
.login-logo h1 { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.login-logo p  { font-size: 13px; color: var(--text-muted); }
.login-hint    { margin-top: 16px; text-align: center; font-size: 12px; color: var(--text-muted); }
.login-hint strong { color: var(--text); }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 1024px) {
  .kpi-grid, .kpi-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .kpi-grid, .kpi-3, .kpi-4 { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .content-body { padding: 14px; }
  .form-row { flex-direction: column; }
}
@media (max-width: 480px) {
  .kpi-grid, .kpi-3, .kpi-4 { grid-template-columns: 1fr; }
  .topbar-date { display: none; }
}
