/* Mobile d'abord (390 px), puis ordinateur. Rien ne dépend du survol. */
:root {
  --bg: #111318; --card: #1b1e25; --line: #2a2f3a; --text: #eef0f4; --muted: #9aa3b2;
  --accent: #e1306c; --ok: #2fbf71; --warn: #f0a020; --bad: #e5484d; --info: #4c8dff;
  --tab-h: 64px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-top: env(safe-area-inset-top);
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
}
h1 { font-size: 22px; margin: 8px 0 16px; }
.muted { color: var(--muted); } .small { font-size: 14px; }
.inline { display: inline; margin: 0; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px max(16px, env(safe-area-inset-right)) 6px max(16px, env(safe-area-inset-left));
}
.brand { font-weight: 700; font-size: 18px; }
.pill { min-height: 44px; padding: 0 16px; border-radius: 22px; border: 0; font: inherit; font-weight: 600; color: #111; }
.pill-ok { background: var(--ok); } .pill-warn { background: var(--warn); }

.banner { padding: 4px 16px 12px; border-bottom: 1px solid var(--line); }
.banner .stat { display: inline-flex; flex-direction: column; margin-right: 18px; }
.banner .stat b { font-size: 20px; } .banner .stat span { font-size: 13px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: 13px; padding: 4px 10px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.chip small { color: var(--muted); }
.chip-ok { border-color: var(--ok); color: var(--ok); } .chip-bad { border-color: var(--bad); color: var(--bad); }
.chip-info { border-color: var(--info); color: var(--info); } .chip-muted { color: var(--muted); }

.page { padding: 12px max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left)); max-width: 900px; margin: 0 auto; }
.empty { background: var(--card); border: 1px dashed var(--line); border-radius: 14px; padding: 20px; }

.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; }
.flash-ok { background: rgba(47,191,113,.15); border: 1px solid var(--ok); }
.flash-error { background: rgba(229,72,77,.15); border: 1px solid var(--bad); }

.btn { display: block; width: 100%; min-height: 48px; border-radius: 12px; border: 0; font: inherit; font-weight: 600; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }

.form fieldset { border: 1px solid var(--line); border-radius: 14px; margin: 0 0 14px; padding: 12px 14px 14px; background: var(--card); }
.form legend { padding: 0 6px; color: var(--muted); font-size: 14px; }
label { display: block; margin: 10px 0 4px; font-size: 15px; }
input[type=text], input[type=password], input[type=number], input[type=time], input[type=date] {
  width: 100%; min-height: 44px; font-size: 16px; /* 16 px : pas de zoom auto de Safari */
  padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
.switch { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.switch input { width: 24px; height: 24px; accent-color: var(--accent); }
.switch.disabled { opacity: .6; }
.actions-bottom {
  position: sticky; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 8px);
  padding-top: 8px;
}
.logout { margin-top: 24px; }

.login { max-width: 360px; margin: 12vh auto 0; }
.login h1 { font-size: 28px; margin-bottom: 2px; }
.login .btn { margin-top: 16px; }

.events { list-style: none; padding: 0; margin: 0; }
.ev { background: var(--card); border-left: 3px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.ev-warning { border-left-color: var(--warn); } .ev-error { border-left-color: var(--bad); }
.ev-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
.ev-kind { font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.ev-msg { margin-top: 2px; word-break: break-word; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; background: #0c0e12; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; min-height: var(--tab-h); display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--muted); text-decoration: none; font-size: 12px; gap: 2px;
}
.tabbar a span { font-size: 20px; }
.tabbar a.on { color: var(--text); }
.tabbar a.disabled { opacity: .35; pointer-events: none; }

@media (min-width: 900px) {
  .tabbar { position: sticky; top: 0; max-width: 900px; margin: 0 auto; border: 0; }
  body { padding-bottom: 0; }
  .actions-bottom { position: static; }
}
