:root {
  --sidebar-w: 240px;
  --sidebar-bg: #1b2236;
  --sidebar-fg: #cbd3e1;
  --sidebar-fg-active: #ffffff;
  --sidebar-active-bar: #f0a000;
  --topbar-bg: #ffffff;
  --topbar-border: #e7ebf1;
  --content-bg: #f4f6fa;
  --accent: #c8102e;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
       background: var(--content-bg); color: #1f2430; }

.app-shell { display: flex; min-height: 100vh; }

/* Sidebar ---------------------------------------------------------------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  flex-shrink: 0;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
  padding: 14px 0;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 18px 18px; border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 8px;
}
.brand-logo {
  width: 38px; height: 38px; border-radius: 8px;
  background: var(--accent); color: white;
  display: grid; place-items: center; font-weight: 700; letter-spacing: .5px;
}
.brand-name { color: #fff; font-weight: 600; font-size: 14px; }
.brand-sub  { color: #9aa3b7; font-size: 11px; }

.sidebar .nav-link {
  color: var(--sidebar-fg);
  padding: 9px 18px;
  display: flex; align-items: center; gap: 12px;
  font-size: 13.5px;
  border-left: 3px solid transparent;
  border-radius: 0;
}
.sidebar .nav-link i { width: 18px; font-size: 15px; text-align: center; opacity: .85; }
.sidebar .nav-link:hover { background: rgba(255,255,255,0.04); color: #fff; }
.sidebar .nav-link.active {
  background: rgba(255,255,255,0.06);
  color: var(--sidebar-fg-active);
  border-left-color: var(--sidebar-active-bar);
}

/* Main area -------------------------------------------------------------- */
.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  padding: 10px 20px;
  display: flex; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-weight: 600; font-size: 15px; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.user-chip { font-size: 13px; padding: 4px 10px; background: #f3f4f8; border-radius: 20px; }

.content { padding: 22px 26px; flex: 1; min-width: 0; }

/* Cards & tables --------------------------------------------------------- */
.eb-card {
  background: #fff; border: 1px solid var(--topbar-border);
  border-radius: 10px; padding: 16px 18px; margin-bottom: 18px;
}
.eb-card h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-tile {
  background: #fff; border: 1px solid var(--topbar-border); border-radius: 10px;
  padding: 14px 16px;
}
.stat-tile .label { font-size: 12px; color: #6b7382; text-transform: uppercase; letter-spacing: .5px; }
.stat-tile .value { font-size: 26px; font-weight: 700; margin-top: 6px; }

.table-eb { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table-eb th {
  text-align: left; font-weight: 600; color: #5a6479;
  padding: 10px 12px; border-bottom: 1px solid var(--topbar-border);
  background: #fafbfd; font-size: 12px; text-transform: uppercase; letter-spacing: .3px;
}
.table-eb td { padding: 10px 12px; border-bottom: 1px solid #eff1f5; }
.table-eb tr:hover td { background: #fafbff; }

.tab-bar { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; }
.tab-bar a {
  padding: 6px 12px; border-radius: 18px;
  background: #eef1f6; color: #4a5265; font-size: 12.5px; text-decoration: none;
}
.tab-bar a.active { background: var(--accent); color: #fff; }

.badge-etat { display: inline-block; padding: 3px 9px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.etat-devis{background:#eef1f6;color:#4a5265}
.etat-en_cours,.etat-preparation{background:#fff3cd;color:#8a6d00}
.etat-validee,.etat-livraison{background:#cfe2ff;color:#0a3e8a}
.etat-livree,.etat-facturee{background:#d1e7dd;color:#0a5c36}
.etat-annulee,.etat-supprimee{background:#f8d7da;color:#842029}

.btn-primary-eb { background: var(--accent); border-color: var(--accent); }
.btn-primary-eb:hover { background: #a40b24; border-color: #a40b24; }

.page-header { display:flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.page-header h1 { font-size: 20px; margin: 0; font-weight: 600; }
