:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --green: #22c55e;
  --orange: #f59e0b;
  --red: #ef4444;
  --radius: 16px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 18px 16px env(safe-area-inset-bottom, 14px);
  gap: 16px;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
.hero {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.65rem;
  color: var(--muted);
  margin-bottom: 4px;
}

h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.btn {
  width: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--muted);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1.5rem;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.btn:active {
  background: rgba(255,255,255,0.1);
  color: var(--text);
}

/* ── Main ── */
main {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-height: 0;
}

/* ── Bandeau fermeture ── */
.banner {
  background: rgba(239, 68, 68, 0.12);
  border-left: 4px solid var(--red);
  color: #fecaca;
  padding: 14px 16px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.banner[hidden] { display: none; }

.banner strong { font-size: 0.95rem; }

.banner-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.banner-line {
  font-size: 0.82rem;
  opacity: 0.9;
  line-height: 1.4;
}

/* ── Carte statut ── */
.status-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-pill {
  width: 6px;
  height: 44px;
  border-radius: 3px;
  flex-shrink: 0;
  background: var(--green);
}

.status-body { flex: 1; min-width: 0; }

h2 {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.status-body p {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.35;
}

/* ── Débit + tendance ── */
.flow-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 18px 10px;
}

.flow-row h3 {
  margin: 0;
}

.flow-values {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.flow-main {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.flow-number {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

.flow-unit {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
}

.flow-trend {
  font-size: 1.1rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
}

/* Tendance couleurs */
.trend-up {
  color: #f87171;
  background: rgba(239, 68, 68, 0.12);
}
.trend-down {
  color: #4ade80;
  background: rgba(34, 197, 94, 0.12);
}
.trend-stable {
  color: var(--muted);
  background: rgba(148, 163, 184, 0.1);
}

.flow-threshold {
  font-size: 0.72rem;
  color: var(--muted);
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 8px;
}

/* ── Prévisions ── */
.forecast {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

h3 {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.forecast-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.forecast-card {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.forecast-card .hours {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.forecast-card .value {
  font-size: 1.2rem;
  font-weight: 700;
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  width: fit-content;
}

.tag.green {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
}

.tag.orange {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
}

.tag.red {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
}

/* ── Méta ── */
.meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 8px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
}

.meta .sep { opacity: 0.3; }

.meta a {
  color: #60a5fa;
  text-decoration: none;
}

/* ── Footer ── */
.footer {
  max-width: 800px;
  width: 100%;
  margin: 10px auto;
  display: flex;
  justify-content: center;
  color: var(--muted);
  font-size: 0.7rem;
  flex-shrink: 0;
}

.footer .heart {
  display: inline-block;
  animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.footer a {
  color: #60a5fa;
  text-decoration: none;
}

/* ── Desktop ── */
@media (min-width: 601px) {
  body { padding: 40px 24px; gap: 24px; overflow: auto; height: auto; min-height: 100dvh; }

  h1 { font-size: 2.2rem; }
  h2 { font-size: 1.6rem; }
  .eyebrow { font-size: 0.75rem; }

  .btn { width: 56px; font-size: 1.7rem; }

  main { gap: 20px; }

  .status-card { padding: 24px; gap: 20px; border-radius: 20px; }
  .status-pill { width: 8px; height: 56px; border-radius: 4px; }
  .status-body p { font-size: 1rem; }

  .flow-row { padding: 24px; border-radius: 20px; gap: 12px; }
  .flow-number { font-size: 3rem; }
  .flow-unit { font-size: 1.1rem; }
  .flow-trend { font-size: 1.2rem; }
  .flow-threshold { font-size: 0.85rem; }

  .forecast { padding: 24px; border-radius: 20px; gap: 16px; }
  h3 { font-size: 0.85rem; }
  .forecast-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; }
  .forecast-card { padding: 18px; border-radius: 14px; gap: 8px; }
  .forecast-card .hours { font-size: 0.8rem; }
  .forecast-card .value { font-size: 1.4rem; }
  .tag { font-size: 0.7rem; padding: 4px 12px; }

  .banner { padding: 16px 20px; border-radius: 20px; }
  .banner strong { font-size: 1.05rem; }
  .banner span { font-size: 0.95rem; }

  .meta { font-size: 0.85rem; }
  .footer { font-size: 0.85rem; }
}
