/* Administration — interface moderne */
:root {
  --accent: #f15a29;
  --accent-soft: #fdeee8;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e6e8ec;
  --border-strong: #dcdfe5;
  --text: #1f2430;
  --muted: #8b909a;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.05);
  --shadow: 0 4px 16px rgba(16,24,40,.06);
  --shadow-lg: 0 18px 48px rgba(16,24,40,.10);
  --ring: 0 0 0 3px rgba(241,90,41,.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { letter-spacing: -.01em; }

/* Barre du haut */
.topbar {
  display: flex; align-items: center; gap: 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 0 24px; height: 60px;
  position: sticky; top: 0; z-index: 10;
}
.topbar .brand a { font-weight: 700; color: var(--text); font-size: 16px; letter-spacing: -.02em; }
.mainnav { display: flex; gap: 2px; flex: 1; }
.mainnav a { color: #5b616e; padding: 8px 13px; border-radius: 9px; font-size: 14px; font-weight: 500; transition: background .15s, color .15s; }
.mainnav a:hover { background: #f1f2f4; color: var(--text); text-decoration: none; }
.mainnav a.active { background: var(--accent-soft); color: var(--accent); }
.userbox { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }

.container { max-width: 1040px; margin: 30px auto; padding: 0 22px; }
.page-title { font-size: 24px; font-weight: 700; margin: 0 0 22px; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 14px; }
.muted { color: var(--muted); }

/* Cartes dashboard */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 30px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 22px 18px; text-align: center; box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.card:hover { text-decoration: none; box-shadow: var(--shadow); transform: translateY(-2px); border-color: #d9dce2; }
.card-num { font-size: 32px; font-weight: 700; color: var(--text); letter-spacing: -.02em; }
.card-label { color: var(--muted); font-size: 13px; margin-top: 4px; font-weight: 500; }

/* Panneaux */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow-sm);
}
details.panel > summary {
  cursor: pointer; font-weight: 600; list-style: none; color: var(--accent);
}
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::before { content: "＋ "; font-weight: 700; }
details.panel[open] > summary::before { content: "− "; }

/* Formulaires */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-grid > div { display: flex; flex-direction: column; }
label { font-weight: 600; font-size: 13px; margin: 14px 0 6px; display: block; color: #3a4049; }
label:first-child { margin-top: 0; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=time], input[type=tel], input[type=color], select, textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #b3b7bf; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input:disabled, select:disabled { background: #f3f4f6; color: #9aa0a8; cursor: not-allowed; }
textarea { resize: vertical; min-height: 70px; }
textarea.code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; background: #f7f8fa; color: #444; }
input[type=color] { height: 42px; padding: 4px; cursor: pointer; }
.form-actions { margin-top: 20px; }

/* Boutons */
.btn-primary {
  background: var(--accent); color: #fff; border: 0;
  padding: 11px 20px; border-radius: 10px; font-size: 14px; font-weight: 600;
  font-family: inherit; cursor: pointer; box-shadow: 0 1px 2px rgba(241,90,41,.25);
  transition: filter .15s, transform .05s;
}
.btn-primary:hover { filter: brightness(.96); }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost {
  background: #f1f2f4; color: #41464f; border: 0;
  padding: 8px 13px; border-radius: 9px; font-size: 13px; font-weight: 500;
  font-family: inherit; cursor: pointer; transition: background .15s;
}
.btn-ghost:hover { background: #e7e9ec; text-decoration: none; }
.btn-danger {
  background: #fdeceb; color: #d2402f; border: 0;
  padding: 8px 13px; border-radius: 9px; font-size: 13px; font-weight: 500;
  font-family: inherit; cursor: pointer; transition: background .15s;
}
.btn-danger:hover { background: #f9dad6; }

/* Tableaux */
.table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm);
}
.table th, .table td { text-align: left; padding: 13px 16px; border-bottom: 1px solid #f0f1f3; font-size: 14px; vertical-align: top; }
.table th { background: #fafbfc; color: #6b707a; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #fafbfc; }
.table tr:last-child td { border-bottom: 0; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.src { font-size: 12px; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; background: #f1f2f4; padding: 2px 6px; border-radius: 5px; color: #41464f; }

/* Badges */
.badge { display: inline-block; background: #eef0f3; color: #6b707a; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge-ok { background: #e6f6ec; color: #1f8a4c; }
.badge-off { background: #fdeceb; color: #d2402f; }

/* Alertes */
.alert { padding: 12px 15px; border-radius: 10px; margin-bottom: 18px; font-size: 14px; font-weight: 500; }
.alert-success { background: #e6f6ec; color: #1c7d45; border: 1px solid #bce6cc; }
.alert-error { background: #fdeceb; color: #b3261e; border: 1px solid #f3c2bd; }

/* Onglets */
.tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.tabs a { padding: 9px 16px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); color: #5b616e; font-weight: 500; box-shadow: var(--shadow-sm); }
.tabs a.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.tabs a:hover { text-decoration: none; }

/* Interrupteurs / cases */
.switch input { width: auto; }
.switch-line { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 14px; margin: 16px 0 4px; color: var(--text); }
.switch-line input { width: 16px; height: 16px; accent-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); }

/* Page de connexion */
.login-page {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: radial-gradient(1200px 600px at 50% -10%, #fff 0%, var(--bg) 60%);
}
.login-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 36px; width: 380px; box-shadow: var(--shadow-lg);
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; font-weight: 700; }
.login-card .btn-primary { width: 100%; margin-top: 20px; padding: 13px; }

@media (max-width: 720px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .mainnav { overflow-x: auto; }
  .topbar { gap: 14px; padding: 0 16px; }
}
