/* ImpressioPro — feuille de style (bleu/gris, moderne, responsive) */

:root {
  --blue-700: #1e3a8a;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-400: #60a5fa;
  --blue-50:  #eff6ff;
  --slate-900:#0f172a;
  --slate-700:#334155;
  --slate-600:#475569;
  --slate-500:#64748b;
  --slate-400:#94a3b8;
  --slate-300:#cbd5e1;
  --slate-200:#e2e8f0;
  --slate-100:#f1f5f9;
  --slate-50: #f8fafc;
  --white:    #ffffff;
  --green:    #16a34a;
  --amber:    #d97706;
  --red:      #dc2626;
  --radius:   12px;
  --shadow:   0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.06);
  --shadow-lg:0 10px 25px rgba(15,23,42,.10);
  --sidebar-w: 248px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--slate-700);
  background: var(--slate-100);
  font-size: 14px;
  line-height: 1.5;
}

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

/* ---------- Barre latérale ---------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--slate-900);
  color: var(--slate-300);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  transition: transform .25s ease;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-logo { font-size: 26px; }
.brand-name { color: #fff; font-weight: 700; font-size: 18px; letter-spacing: .3px; }
.brand-sub  { color: var(--slate-400); font-size: 12px; }

.nav { display: flex; flex-direction: column; gap: 4px; padding: 16px 12px; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 10px;
  color: var(--slate-300); text-decoration: none;
  font-weight: 500; transition: all .15s;
}
.nav-link .ico { width: 18px; text-align: center; opacity: .85; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.active { background: var(--blue-600); color: #fff; }

.sidebar-foot { padding: 16px; border-top: 1px solid rgba(255,255,255,.08); }

.demo-badge {
  display: inline-block;
  background: rgba(59,130,246,.15);
  color: #93c5fd;
  border: 1px solid rgba(59,130,246,.3);
  font-size: 11px; padding: 4px 10px; border-radius: 999px;
}
.demo-badge.sm { background: var(--blue-50); color: var(--blue-600); border-color: var(--slate-200); }

/* ---------- Zone principale ---------- */
.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 64px; background: var(--white);
  border-bottom: 1px solid var(--slate-200);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px; position: sticky; top: 0; z-index: 20;
}
.page-title { font-size: 20px; color: var(--slate-900); font-weight: 700; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--blue-600); color: #fff;
  display: grid; place-items: center; font-weight: 600; font-size: 13px;
}
.burger { display: none; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--slate-700); }

.content { padding: 24px; max-width: 1200px; width: 100%; }

/* ---------- Cartes / composants ---------- */
.card {
  background: var(--white); border: 1px solid var(--slate-200);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }
.card-title { font-size: 15px; font-weight: 700; color: var(--slate-900); margin-bottom: 14px; }

.grid { display: grid; gap: 16px; }
.grid-stats { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: 1.1fr .9fr; }

.stat {
  background: var(--white); border: 1px solid var(--slate-200);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
}
.stat-label { color: var(--slate-500); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--slate-900); margin-top: 6px; }
.stat-hint { font-size: 12px; color: var(--slate-400); margin-top: 4px; }
.stat-icon { float: right; font-size: 22px; opacity: .5; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--slate-200); white-space: nowrap; }
th { color: var(--slate-500); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; font-weight: 700; }
tbody tr:hover { background: var(--slate-50); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- Badges statut ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.st-brouillon { background: var(--slate-100); color: var(--slate-600); }
.st-envoye    { background: #fef3c7; color: #92400e; }
.st-accepte   { background: #dcfce7; color: #166534; }
.st-facture   { background: #dbeafe; color: #1e40af; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--slate-300); background: var(--white); color: var(--slate-700);
  padding: 8px 14px; border-radius: 9px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.btn:hover { background: var(--slate-50); }
.btn-primary { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
.btn-primary:hover { background: var(--blue-700); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Formulaires ---------- */
.form-row { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 140px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--slate-600); }
.field input, .field select {
  padding: 9px 12px; border: 1px solid var(--slate-300); border-radius: 9px;
  font-size: 14px; color: var(--slate-800); background: var(--white); width: 100%;
}
.field input:focus, .field select:focus { outline: 2px solid var(--blue-500); outline-offset: -1px; border-color: var(--blue-500); }

.checks { display: flex; flex-wrap: wrap; gap: 10px; }
.check {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--slate-300); border-radius: 10px; padding: 10px 14px; cursor: pointer;
  transition: all .15s; user-select: none; font-weight: 500;
}
.check:hover { border-color: var(--blue-400); }
.check input { width: 16px; height: 16px; accent-color: var(--blue-600); }
.check.on { border-color: var(--blue-600); background: var(--blue-50); }
.check small { color: var(--slate-500); font-weight: 500; }

/* ---------- Récap devis ---------- */
.recap { position: sticky; top: 88px; }
.recap .line { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--slate-200); font-size: 13.5px; }
.recap .line .lbl { color: var(--slate-600); }
.recap .line .val { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--slate-800); }
.recap .totals { margin-top: 14px; padding-top: 14px; border-top: 2px solid var(--slate-200); }
.recap .total-row { display: flex; justify-content: space-between; padding: 5px 0; }
.recap .total-row.ttc { font-size: 20px; font-weight: 800; color: var(--blue-700); padding-top: 10px; }
.recap .muted { color: var(--slate-400); font-size: 12px; }

/* ---------- Graphique barres ---------- */
.chart { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar { width: 100%; max-width: 42px; background: linear-gradient(180deg, var(--blue-500), var(--blue-600)); border-radius: 6px 6px 0 0; transition: height .4s ease; }
.bar-label { font-size: 11.5px; color: var(--slate-500); }
.bar-val { font-size: 11px; color: var(--slate-400); }

/* ---------- Filtres ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.toolbar input, .toolbar select {
  padding: 8px 12px; border: 1px solid var(--slate-300); border-radius: 9px; font-size: 13.5px; background: #fff;
}
.toolbar .grow { flex: 1; min-width: 180px; }
.spacer { flex: 1; }

.editable { border: 1px solid transparent; border-radius: 6px; padding: 6px 8px; font-size: 13.5px; width: 110px; text-align: right; background: var(--slate-50); font-variant-numeric: tabular-nums; }
.editable:focus { outline: none; border-color: var(--blue-500); background: #fff; }

.section-gap { margin-top: 24px; }
.hint-box { background: var(--blue-50); border: 1px solid #bfdbfe; color: #1e40af; padding: 12px 16px; border-radius: 10px; font-size: 13px; margin-bottom: 18px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--slate-900); color: #fff; padding: 12px 22px; border-radius: 10px;
  box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: all .3s; z-index: 100; font-weight: 500;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .grid-stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .main { margin-left: 0; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .burger { display: block; }
  .demo-badge.sm { display: none; }
}
@media (max-width: 460px) {
  .grid-stats { grid-template-columns: 1fr; }
  .content { padding: 16px; }
}

.overlay { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 30; }
.overlay.show { display: block; }
