/* HOMSLO CONTROL — mobile d'abord, thème sombre.
   Aucun style en ligne : la protection du navigateur (CSP) les interdit. */
:root {
  --bg: #0a0f1c;
  --bg2: #0f1b33;
  --card: rgba(255, 255, 255, 0.045);
  --line: rgba(255, 255, 255, 0.1);
  --text: #eaf0fb;
  --muted: #94a3bd;
  --accent: #5eead4;
  --accent2: #22c55e;
  --danger: #f87171;
  --warn: #fbbf24;
  --radius: 18px;
  --tab-h: 68px;
}
* { box-sizing: border-box; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--text);
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(94, 234, 212, 0.14), transparent 60%),
    radial-gradient(700px 420px at -10% 10%, rgba(34, 197, 94, 0.1), transparent 55%),
    var(--bg);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, p { margin: 0; }
h1 { font-size: 1.55rem; line-height: 1.2; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; display: block; }
.noscript { padding: 24px; }

/* Écrans plein cadre (connexion, code) */
.screen {
  max-width: 440px;
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: rise 0.4s ease both;
}
.brand { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 6vh; }
.brand-logo { border-radius: 20px; box-shadow: 0 10px 40px rgba(94, 234, 212, 0.18); }
.foot { text-align: center; font-size: 0.9rem; }

/* Cartes et formulaires */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.stack { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 0.85rem; color: var(--muted); }
input {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 14px;
  font: inherit; /* 16 px : évite le zoom automatique sur iPhone */
}
input:focus-visible, .btn:focus-visible, .tab:focus-visible, .link:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
input.code { text-align: center; font-size: 1.9rem; letter-spacing: 0.35em; padding-left: 0.35em; font-variant-numeric: tabular-nums; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 20px;
  border: 0;
  border-radius: 14px;
  color: #04130f;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}
.btn:active { transform: scale(0.98); }
.btn[disabled] { filter: grayscale(0.6) brightness(0.8); cursor: progress; }
.btn.ghost { color: var(--text); background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); }
.btn.danger { color: #fff; background: rgba(248, 113, 113, 0.16); border: 1px solid rgba(248, 113, 113, 0.5); }
.link { align-self: center; min-height: 44px; padding: 0 12px; color: var(--muted); background: none; border: 0; font: inherit; text-decoration: underline; cursor: pointer; }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Messages */
.error { color: var(--danger); font-size: 0.95rem; }
.error[hidden] { display: none; }
.notice { padding: 12px 14px; border-radius: 14px; background: rgba(94, 234, 212, 0.1); border: 1px solid rgba(94, 234, 212, 0.3); }
.warn { color: var(--warn); font-size: 0.92rem; }

/* Double authentification */
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.secret { padding: 14px; text-align: center; border-radius: 14px; border: 1px dashed var(--line); background: rgba(0, 0, 0, 0.25); overflow-wrap: anywhere; }
.secret code { font: 600 1.15rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.06em; }
.qr summary { cursor: pointer; color: var(--muted); min-height: 44px; display: flex; align-items: center; }
.qr img { display: block; margin: 8px auto 0; background: #fff; padding: 10px; border-radius: 12px; }
hr { width: 100%; border: 0; border-top: 1px solid var(--line); margin: 2px 0; }

/* Application connectée */
.shell { min-height: 100vh; min-height: 100dvh; }
.page {
  max-width: 560px;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px calc(var(--tab-h) + 28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: rise 0.4s ease both;
}
.top { display: flex; align-items: center; gap: 12px; }
.top > div { flex: 1; min-width: 0; }
.top-logo { border-radius: 12px; }
.pill { padding: 4px 12px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; border: 1px solid var(--line); }
.pill.ok { color: var(--accent); border-color: rgba(94, 234, 212, 0.4); background: rgba(94, 234, 212, 0.08); }
.pill.warn { color: var(--warn); border-color: rgba(251, 191, 36, 0.4); background: rgba(251, 191, 36, 0.08); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); }
.kpi-label { font-size: 0.8rem; color: var(--muted); }
.kpi-value { font-size: 1.9rem; font-weight: 700; color: var(--muted); }
.kpi-sub { font-size: 0.78rem; color: var(--muted); }
.row { display: flex; align-items: center; gap: 10px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--accent2); box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18); }
.devices { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.device { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); }
.device > div { min-width: 0; display: flex; flex-direction: column; }
.device strong { overflow-wrap: anywhere; font-weight: 600; }

/* Barre de navigation basse (pouce) */
.tabbar {
  position: fixed;
  inset: auto 0 0 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(10, 15, 28, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1;
  max-width: 220px;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 14px;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}
.tab.on { color: var(--accent); background: rgba(94, 234, 212, 0.08); }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
@media (min-width: 700px) {
  .page { padding-top: 40px; }
}
