/* Back-office 7 Galaxy — design sobre, clair, professionnel */
:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #1a1d21;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #C8482C;        /* orange 7 Galaxy / écosystème poêles */
  --brand-ink: #a23a23;
  --ok: #15803d;
  --warn: #b45309;
  --danger: #b91c1c;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
}

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

a { color: var(--brand-ink); }

/* ─── Header ─────────────────────────────────────────── */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand { display: flex; align-items: center; gap: 9px; font-weight: 700;
  letter-spacing: -0.02em; font-size: 17px; color: var(--ink); text-decoration: none; }
.topbar .brand-logo { height: 32px; width: auto; }
.topbar .brand span { color: var(--muted); font-weight: 600; }
.topbar nav { display: flex; gap: 8px; align-items: center; }
.topbar nav a {
  padding: 8px 12px; border-radius: 8px; text-decoration: none;
  color: var(--ink); font-weight: 500;
}
.topbar nav a:hover { background: var(--bg); }
.topbar nav a.active { background: var(--bg); color: var(--brand-ink); }
.topbar .user { color: var(--muted); font-size: 13px; margin-right: 8px; }

/* ─── Layout ─────────────────────────────────────────── */
.wrap { max-width: 1080px; margin: 0 auto; padding: 32px 24px; }
.page-title { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 4px; }
.page-sub { color: var(--muted); margin: 0 0 24px; }

/* ─── Cartes ─────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px; margin-bottom: 20px;
}

/* ─── Stats ──────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 16px; margin-bottom: 24px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; }

/* ─── Formulaires ───────────────────────────────────── */
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 15px; font-family: inherit; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
.field { margin-bottom: 16px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ─── Boutons ────────────────────────────────────────── */
.btn {
  display: inline-block; padding: 10px 18px; border-radius: 8px; border: 1px solid transparent;
  font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none; text-align: center;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ─── Tables ─────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr:hover td { background: #fafafa; }

/* ─── Badges statut ──────────────────────────────────── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.encaisser { background: #fef3c7; color: var(--warn); }
.badge.acompte   { background: #dbeafe; color: #1d4ed8; }
.badge.solde     { background: #dcfce7; color: var(--ok); }
.badge.annule    { background: #fee2e2; color: var(--danger); }

/* Badges de production (pipeline) */
.badge.p-nouveau    { background: #f1f5f9; color: #475569; }
.badge.p-brief      { background: #dbeafe; color: #1d4ed8; }
.badge.p-creation   { background: #fef3c7; color: var(--warn); }
.badge.p-validation { background: #ede9fe; color: #6d28d9; }
.badge.p-enligne    { background: #dcfce7; color: var(--ok); }

/* ─── Alertes ────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fee2e2; color: var(--danger); }
.alert-ok { background: #dcfce7; color: var(--ok); }

/* ─── Login ──────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { font-size: 22px; margin: 0 0 4px; }
.login-card .muted { color: var(--muted); margin: 0 0 24px; font-size: 14px; }

.muted { color: var(--muted); }
.text-right { text-align: right; }
footer.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 24px; }
footer.foot a { color: var(--muted); }
