:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #d9e2ec;
  --navy: #10243f;
  --accent: #0f766e;
  --green: #15803d;
  --red: #b42318;
  --amber: #b7791f;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; text-decoration: none; }
h1, h2 { margin: 0; }
p { margin: 6px 0 0; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 236px;
  padding: 24px 18px;
  background: var(--navy);
  color: white;
}
.brand { font-size: 20px; font-weight: 800; line-height: 1.1; margin-bottom: 30px; }
.brand span { color: #8ee3d1; }
.sidebar nav { display: grid; gap: 8px; }
.sidebar a { padding: 11px 12px; border-radius: 8px; color: #dbe7f4; }
.sidebar a:hover { background: rgba(255,255,255,.08); }
.session { position: absolute; bottom: 20px; color: #a9b8ca; font-size: 13px; }

.main { margin-left: 236px; padding: 30px; }
.login-main { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card, .panel, .table-panel, .machine-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(16, 36, 63, .06);
}
.login-card { width: min(430px, 100%); padding: 32px; }
.form-stack { display: grid; gap: 16px; margin-top: 22px; }
label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  font: inherit;
  background: white;
}
textarea { min-height: 70px; resize: vertical; margin-top: 8px; }
.primary, .button {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  cursor: pointer;
  display: inline-block;
}
.button { background: #1f3a5b; }
.button.subtle { background: #eef4f8; color: #1f3a5b; border: 1px solid var(--line); padding: 8px 10px; }
.small { padding: 8px 10px; font-size: 13px; }
.muted { color: var(--muted); font-size: 13px; }
.flash, .alert {
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
}
.flash.error, .alert { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}
.page-head h1 { font-size: 30px; letter-spacing: 0; }
.actions, .inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.panel { padding: 18px; margin-bottom: 20px; }
.panel h2 { font-size: 18px; margin-bottom: 12px; }
.inline-form input { min-width: 220px; width: auto; flex: 1; }

.machine-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.machine-card { padding: 18px; display: grid; gap: 14px; }
.card-top { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.machine-card h2 { font-size: 20px; }
.progress { height: 9px; background: #e8eef5; border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); }
.metrics { display: grid; gap: 6px; color: var(--muted); font-size: 14px; }
.empty { padding: 24px; color: var(--muted); }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpis div {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.kpis strong { display: block; font-size: 28px; color: var(--navy); }
.kpis span { color: var(--muted); font-size: 13px; }
.table-panel { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: 14px; }
th { background: #eef4f8; color: #344054; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.status, .status-select { font-weight: 700; }
.status-select.conforme { color: var(--green); }
.status-select.non_conforme { color: var(--red); }
.status-select.non_renseigne { color: var(--amber); }
.status-select.non_applicable { color: #475467; }
.status-global { color: var(--navy); white-space: nowrap; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.compact th, .compact td { font-size: 13px; padding: 9px; }
.reset-form { display: flex; gap: 8px; }
.reset-form input { min-width: 180px; padding: 8px; }

@media (max-width: 900px) {
  .sidebar { position: static; width: auto; }
  .session { position: static; margin-top: 20px; }
  .main { margin-left: 0; padding: 18px; }
  .page-head, .split { display: block; }
  .actions { margin-top: 14px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
