/* NIZA FOOD — console admin (données réelles depuis l'API) */

:root {
  --niza: #0b4a8b;
  --niza-2: #1463b0;
  --niza-soft: #eaf2fb;
  --surface: #f1f5f9;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --card: #fff;
  --ok: #16a34a;
  --warn: #b45309;
  --warn-soft: #fdf3e3;
  --bad: #b91c1c;
  --bad-soft: #fdecec;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--surface);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }

/* ---------- Login ---------- */
.login-page { display: grid; place-items: center; min-height: 100vh; background: #eef2f8; padding: 24px; }
.login-card {
  width: min(430px, 100%);
  background: #fff; border: 1px solid var(--line); border-radius: 20px;
  padding: 34px 30px; box-shadow: var(--shadow);
}
.login-card .brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 22px; }
.login-card h1 { margin: 0 0 4px; font-size: 21px; text-align: center; }
.login-card .hint { text-align: center; display: block; margin: 0 0 22px; }
.login-card .secure { margin: 18px 0 0; font-size: 11.5px; color: var(--muted); text-align: center; }

.brand-mark {
  width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(145deg, var(--niza-2), var(--niza));
  color: #fff; display: grid; place-items: center;
  font-weight: 800; letter-spacing: .5px; font-size: 15px;
}
.brand-txt strong { display: block; font-size: 16px; letter-spacing: .4px; }
.brand-txt span { display: block; font-size: 11px; color: var(--muted); }

.field { margin-bottom: 15px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: #334155; }
.field input, .field select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 14px; outline: none; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus {
  border-color: var(--niza-2); box-shadow: 0 0 0 3px rgba(20, 99, 176, .12);
}
.field .static { padding: 11px 0; font-size: 13px; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 10px; border: 1px solid transparent;
  padding: 10px 16px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: .15s ease; white-space: nowrap;
}
.btn-primary { background: var(--niza); color: #fff; }
.btn-primary:hover { background: var(--niza-2); }
.btn-block { width: 100%; }

.alert {
  background: var(--bad-soft); border: 1px solid #f3c9c9; color: #8a1c1c;
  border-radius: 11px; padding: 11px 13px; font-size: 13px; margin-bottom: 16px;
}
.hint { font-size: 12px; color: var(--muted); }

/* ---------- Shell ---------- */
.admin-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.side {
  background: #0b1f38; color: #cbd8ea; padding: 18px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.side .brand { color: #fff; padding: 4px 6px 16px; display: flex; gap: 10px; align-items: center; }
.side .brand-txt span { color: #8aa4c4; }
.side .group { font-size: 10.5px; letter-spacing: 1.3px; text-transform: uppercase; color: #6e88a8; padding: 14px 10px 6px; }
.side a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 9px; font-size: 13.5px; font-weight: 500; color: #cbd8ea;
}
.side a:hover { background: rgba(255,255,255,.07); color: #fff; }
.side a.on { background: var(--niza-2); color: #fff; font-weight: 600; }
.side a.side-sub { font-size: 13px; padding-left: 26px; }
.side a.side-sub.on { background: rgba(20, 99, 176, .38); }
.side .em { width: 18px; text-align: center; }
.side .bottom { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.1); }

.admin-main { padding: 22px 26px 40px; min-width: 0; }
.admin-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.admin-top h1 { margin: 0; font-size: 22px; letter-spacing: -.3px; }
.admin-top p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.admin-user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.admin-user b { color: var(--ink); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--niza); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}

.toolbar {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin-bottom: 18px;
}
.toolbar .field { margin: 0; min-width: 220px; }
.toolbar .spacer { flex: 1; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a {
  padding: 10px 14px; font-size: 13.5px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs a.on { color: var(--niza); border-bottom-color: var(--niza); }
.tabs a:hover { color: var(--niza); }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px; }
.kpi .lbl { font-size: 12px; color: var(--muted); }
.kpi .val { font-size: 22px; font-weight: 800; letter-spacing: -.6px; margin-top: 6px; }
.kpi .val small { font-size: 12px; font-weight: 600; color: var(--muted); }

.tbl-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tbl-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tbl-head b { font-size: 14.5px; }
.tbl-head span { font-size: 12px; color: var(--muted); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 16px; border-bottom: 1px solid var(--line); }
th {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); background: #fafcfe; font-weight: 700;
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: #fafcff; }
tfoot td { font-weight: 700; background: #fafcfe; }

.chart { display: flex; align-items: flex-end; gap: 7px; height: 150px; padding: 18px 16px 0; }
.chart .bar {
  flex: 1; background: linear-gradient(180deg, #4f97e0, var(--niza));
  border-radius: 6px 6px 0 0; position: relative; min-height: 3px;
}
.chart .bar span { position: absolute; bottom: -19px; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--muted); }
.chart-legend { padding: 28px 16px 14px; font-size: 11.5px; color: var(--muted); }

.badge { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.ok { background: #e8f7ee; color: var(--ok); }

.two-col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }
.empty { padding: 30px 16px; text-align: center; color: var(--muted); font-size: 13.5px; }

@media (max-width: 1080px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .admin-shell { grid-template-columns: 1fr; }
  .side { flex-direction: row; flex-wrap: wrap; align-items: center; overflow-x: auto; }
  .side .brand { padding: 0 10px 0 0; }
  .side .group, .side .bottom { display: none; }
}

@media (max-width: 640px) {
  .admin-main { padding: 16px 12px 32px; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi .val { font-size: 18px; }
  th, td { padding: 9px 11px; }
}
