/* ==========================================================================
   Température du spa — feuille de style
   Palette : chrome sarcelle, eau du spa en orange, extérieur en indigo,
   chauffage en rouge. Thème clair et sombre, mise en page mobile d'abord.
   ========================================================================== */

:root {
  color-scheme: light;

  --bg: #eef2f7;
  --bg-tint-a: rgba(13, 148, 136, 0.10);
  --bg-tint-b: rgba(234, 88, 12, 0.08);

  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --surface-3: #eef2f7;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --text: #0f172a;
  --text-soft: #475569;
  --muted: #64748b;

  --accent: #0f766e;
  --accent-soft: rgba(15, 118, 110, 0.10);
  --accent-contrast: #ffffff;

  --spa: #ea580c;
  --spa-soft: rgba(234, 88, 12, 0.12);
  --out: #4f46e5;
  --out-soft: rgba(79, 70, 229, 0.12);
  --heat: #dc2626;
  --heat-soft: rgba(220, 38, 38, 0.10);
  --cold: #2563eb;

  --grid-line: rgba(15, 23, 42, 0.08);

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 24px -12px rgba(15, 23, 42, 0.18);
  --shadow-lg: 0 24px 60px -24px rgba(15, 23, 42, 0.35);

  --radius: 18px;
  --radius-sm: 12px;
  --radius-pill: 999px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", sans-serif;
  --font-num: "SF Mono", ui-monospace, "Segoe UI", Roboto, sans-serif;
}

:root[data-theme="dark"],
:root[data-theme="auto"] {
  /* valeurs claires conservées ; le bloc media ci-dessous prend le relais */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg: #080c14;
    --bg-tint-a: rgba(45, 212, 191, 0.10);
    --bg-tint-b: rgba(251, 146, 60, 0.08);

    --surface: #111a28;
    --surface-2: #16202f;
    --surface-3: #1d2938;
    --border: #22304a;
    --border-strong: #33445f;

    --text: #e8eef8;
    --text-soft: #b6c2d4;
    --muted: #8798ae;

    --accent: #2dd4bf;
    --accent-soft: rgba(45, 212, 191, 0.14);
    --accent-contrast: #04211f;

    --spa: #fb923c;
    --spa-soft: rgba(251, 146, 60, 0.16);
    --out: #a5b4fc;
    --out-soft: rgba(165, 180, 252, 0.16);
    --heat: #f87171;
    --heat-soft: rgba(248, 113, 113, 0.14);
    --cold: #60a5fa;

    --grid-line: rgba(232, 238, 248, 0.09);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 30px -18px rgba(0, 0, 0, 0.8);
    --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, 0.9);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #080c14;
  --bg-tint-a: rgba(45, 212, 191, 0.10);
  --bg-tint-b: rgba(251, 146, 60, 0.08);

  --surface: #111a28;
  --surface-2: #16202f;
  --surface-3: #1d2938;
  --border: #22304a;
  --border-strong: #33445f;

  --text: #e8eef8;
  --text-soft: #b6c2d4;
  --muted: #8798ae;

  --accent: #2dd4bf;
  --accent-soft: rgba(45, 212, 191, 0.14);
  --accent-contrast: #04211f;

  --spa: #fb923c;
  --spa-soft: rgba(251, 146, 60, 0.16);
  --out: #a5b4fc;
  --out-soft: rgba(165, 180, 252, 0.16);
  --heat: #f87171;
  --heat-soft: rgba(248, 113, 113, 0.14);
  --cold: #60a5fa;

  --grid-line: rgba(232, 238, 248, 0.09);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 30px -18px rgba(0, 0, 0, 0.8);
  --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, 0.9);
}

/* --- Base ---------------------------------------------------------------- */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(1100px 620px at 12% -12%, var(--bg-tint-a), transparent 62%),
    radial-gradient(900px 560px at 92% 4%, var(--bg-tint-b), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }
p { margin: 0; }

a { color: var(--accent); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 10px 16px;
  background: var(--surface);
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 50;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.page {
  width: min(100%, 940px);
  margin: 0 auto;
  padding: 16px 16px calc(32px + env(safe-area-inset-bottom));
}

/* --- Barre supérieure ---------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 2px 18px;
}

.topbar-title { flex: 1; min-width: 0; }

.topbar-title h1 {
  font-size: 1.0625rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-title p {
  font-size: 0.8125rem;
  color: var(--muted);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  flex: none;
}

.brand-mark svg { width: 22px; height: 22px; }

svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-soft);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.icon-button:hover { color: var(--text); background: var(--surface-2); }
.icon-button:active { transform: scale(0.94); }
.icon-button svg { width: 19px; height: 19px; }

#theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] #theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] #theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) #theme-toggle .icon-moon { display: block; }
}

/* --- Cartes -------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card + .card,
main > * + * { margin-top: 14px; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 18px 0;
}

.card-head h2 {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

/* --- Bloc principal : température de l'eau ------------------------------- */

.hero {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 22px 20px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--spa-soft), transparent 55%);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}
.hero[data-state="heating"]::before { opacity: 1; }

.hero-main { flex: 1; min-width: 0; position: relative; }

.hero-reading {
  display: flex;
  align-items: baseline;
  gap: 4px;
  color: var(--text);
}

.hero-value {
  font-size: clamp(3.25rem, 15vw, 4.5rem);
  font-weight: 250;
  line-height: 1;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}

.hero-unit {
  font-size: clamp(1.25rem, 5vw, 1.75rem);
  font-weight: 400;
  color: var(--muted);
}

.hero-label {
  margin-top: 6px;
  font-size: 0.875rem;
  color: var(--muted);
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.hero-gauge { flex: none; width: 148px; max-width: 42%; }
.hero-gauge svg { width: 100%; height: auto; overflow: visible; }

.gauge-track { stroke: var(--surface-3); stroke-width: 9; }
.gauge-fill {
  stroke: var(--spa);
  stroke-width: 9;
  transition: stroke-dashoffset 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.gauge-goal { stroke: var(--accent); stroke-width: 2.5; }
.gauge-caption {
  fill: var(--muted);
  stroke: none;
  font-size: 7px;
  font-family: var(--font);
  text-anchor: middle;
}
.gauge-caption-value {
  fill: var(--text-soft);
  font-size: 9px;
  font-weight: 600;
}

@media (max-width: 380px) {
  .hero-gauge { display: none; }
}

/* --- Pastilles d'état ---------------------------------------------------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px 5px 9px;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--text-soft);
  white-space: nowrap;
}

.pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.pill-heat { background: var(--heat-soft); color: var(--heat); }
.pill-heat .dot { animation: pulse 1.8s ease-in-out infinite; }
.pill-idle { background: var(--accent-soft); color: var(--accent); }
.pill-off { background: var(--surface-3); color: var(--muted); }
.pill-stale { background: var(--heat-soft); color: var(--heat); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.72); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

.trend {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.trend svg { width: 15px; height: 15px; }
.trend-up { color: var(--heat); }
.trend-down { color: var(--cold); }

/* --- Grille de statistiques ---------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

@media (min-width: 620px) {
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.stat {
  padding: 14px 15px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat-label svg { width: 14px; height: 14px; flex: none; }

.stat-value {
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.stat-value.is-off { color: var(--muted); font-weight: 400; }

.stat-hint {
  font-size: 0.75rem;
  color: var(--muted);
}

.stat.is-active { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }

/* --- Cartes cliquables --------------------------------------------------- */

a.stat {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
a.stat:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow), 0 0 0 3px var(--accent-soft);
}
a.stat:active { transform: translateY(0) scale(0.985); }

/* Chevron : sur un écran tactile, c'est le seul indice que la carte s'ouvre. */
.stat-chevron {
  margin-left: auto;
  opacity: 0.5;
  transition: opacity 0.15s, transform 0.15s;
}
a.stat:hover .stat-chevron { opacity: 1; transform: translateX(2px); }

/* Le libellé des cartes non cliquables garde le même alignement. */
.stat-label { min-height: 18px; }

/* --- Graphique ----------------------------------------------------------- */

.chart-card { padding-bottom: 14px; }

.chart-wrap {
  position: relative;
  margin: 14px 8px 0;
  height: 260px;
  touch-action: pan-y;
}

@media (min-width: 620px) { .chart-wrap { height: 320px; } }

.chart-wrap canvas { display: block; width: 100%; height: 100%; }

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 0.875rem;
  color: var(--muted);
}

.chart-tip {
  position: absolute;
  z-index: 3;
  min-width: 132px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 0.8125rem;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -12px);
  transition: opacity 0.12s;
}
.chart-tip[data-visible="1"] { opacity: 1; }
.chart-tip .tip-time { color: var(--muted); font-size: 0.75rem; margin-bottom: 5px; }
.chart-tip .tip-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-variant-numeric: tabular-nums;
}
.chart-tip .tip-row + .tip-row { margin-top: 2px; }
.chart-tip .tip-swatch { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.chart-tip .tip-value { margin-left: auto; font-weight: 600; }

.legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 18px 0;
  font-size: 0.8125rem;
  color: var(--muted);
}
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: currentColor;
  display: inline-block;
}
.legend .lg-spa { color: var(--spa); }
.legend .lg-out { color: var(--out); }
.legend .lg-heat i { height: 10px; width: 10px; border-radius: 3px; }
.legend .lg-heat { color: var(--heat); }

/* --- Sélecteurs (puces) -------------------------------------------------- */

.chips {
  display: flex;
  width: max-content;
  max-width: 100%;
  gap: 4px;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  overflow-x: auto;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"],
.chip.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* --- Boutons ------------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-contrast);
  font: inherit;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.15s, transform 0.15s;
}
.button:hover { filter: brightness(1.08); }
.button:active { transform: scale(0.98); }
.button[disabled] { opacity: 0.55; cursor: default; transform: none; }

.button-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-soft);
}
.button-ghost:hover { background: var(--surface-2); filter: none; }

.button svg { width: 17px; height: 17px; }

/* --- Réglage des consignes ----------------------------------------------- */

.setting + .setting {
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.setting-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.setting-head h3 { font-size: 1rem; }
.setting-head .setting-when { font-size: 0.8125rem; color: var(--muted); }

.setting-readout {
  display: flex;
  align-items: baseline;
  gap: 3px;
  font-variant-numeric: tabular-nums;
}
.setting-readout .value {
  font-size: 2.25rem;
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1;
}
.setting-readout .unit { font-size: 1rem; color: var(--muted); }
.setting-readout.is-off .value { font-size: 1.5rem; font-weight: 500; color: var(--muted); }
.setting-readout.is-off .unit { display: none; }

.stepper {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
}

.stepper input[type="range"] {
  flex: 1;
  min-width: 0;
  appearance: none;
  height: 26px;
  background: transparent;
  cursor: pointer;
  margin: 0;
}
/* --fill est posé par app.js : la portion parcourue prend la couleur d'accent. */
.stepper input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right,
    var(--accent) 0 var(--fill, 0%), var(--surface-3) var(--fill, 0%) 100%);
}
.stepper input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right,
    var(--accent) 0 var(--fill, 0%), var(--surface-3) var(--fill, 0%) 100%);
}
.stepper input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -9px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
  box-shadow: var(--shadow);
}
.stepper input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
  box-shadow: var(--shadow);
}

.step-button {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.25rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.step-button:hover { background: var(--surface-3); }
.step-button:active { transform: scale(0.92); }
.step-button svg { width: 18px; height: 18px; stroke-width: 2.4; }

.setting-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 22px;
}
.setting-actions .button { flex: 1; }

.form-note {
  margin-top: 14px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.save-state {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.2s;
}
.save-state[data-visible="1"] { opacity: 1; }

/* .js est posé par le script inline de l'entête : sans JavaScript, les
   éléments « js-only » restent cachés et les « no-js-only » s'affichent. */
.js-only { display: none; }
.js .js-only { display: revert; }
.js .no-js-only { display: none; }

/* --- Tableau de consommation --------------------------------------------- */

.table-wrap { overflow-x: auto; padding: 4px 4px 0; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}

table.data th,
table.data td {
  padding: 11px 14px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

table.data th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

table.data th:first-child,
table.data td:first-child { text-align: left; }

table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: var(--surface-2); }

table.data tfoot td,
table.data tfoot th {
  border-top: 1px solid var(--border-strong);
  border-bottom: 0;
  font-weight: 600;
  background: var(--surface-2);
}

/* Assez spécifique pour battre l'alignement à droite des cellules chiffrées. */
table.data th.bar-cell,
table.data td.bar-cell { width: 34%; min-width: 90px; text-align: left; }
.bar {
  display: block;
  height: 7px;
  border-radius: 4px;
  background: var(--spa);
  opacity: 0.75;
  min-width: 2px;
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* --- Page météo ---------------------------------------------------------- */

.wx { width: 22px; height: 22px; }
.wx-mid { width: 26px; height: 26px; }
.wx-big { width: 100%; height: auto; }

.wx-sun { color: #f59e0b; }
.wx-moon { color: #94a3b8; }
.wx-cloud { color: var(--muted); }
.wx-rain { color: #38bdf8; }
.wx-storm { color: #a78bfa; }
.wx-snow { color: #7dd3fc; }
.wx-mist { color: var(--muted); }

.wx-hero { align-items: center; }
.wx-hero-icon { flex: none; width: 94px; max-width: 30%; }
@media (max-width: 380px) { .wx-hero-icon { display: none; } }

/* Prochaines heures : bande défilante horizontalement sur téléphone. */
.wx-hours {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 14px 14px 16px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}

.wx-hour {
  flex: none;
  width: 74px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 12px 4px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  scroll-snap-align: start;
}

.wx-hour-time { font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.wx-hour-temp { font-size: 1.0625rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.wx-hour-rain {
  font-size: 0.6875rem;
  color: var(--out);
  font-variant-numeric: tabular-nums;
}
.wx-hour-rain.is-dry { color: var(--muted); opacity: 0.5; }

/* Cinq jours : nom, icône, puis la plage min–max sur une échelle commune. */
.wx-days { padding: 6px 16px 16px; }

.wx-day {
  display: grid;
  grid-template-columns: minmax(66px, 1fr) 30px minmax(34px, auto) 30px minmax(60px, 1.6fr) 30px;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
}
.wx-day + .wx-day { border-top: 1px solid var(--border); }

.wx-day-name {
  font-size: 0.9375rem;
  font-weight: 500;
  text-transform: capitalize;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wx-day-icon { display: grid; place-items: center; }

.wx-day-rain {
  font-size: 0.6875rem;
  color: var(--out);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.wx-day-rain.is-dry { color: transparent; }

.wx-day-low,
.wx-day-high {
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.wx-day-low { color: var(--muted); }
.wx-day-high { font-weight: 600; }

.wx-day-track {
  position: relative;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-3);
}
.wx-day-range {
  position: absolute;
  top: 0;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--out), var(--spa));
}

@media (max-width: 420px) {
  .wx-day { grid-template-columns: minmax(58px, 1fr) 26px 28px minmax(44px, 1.2fr) 28px; gap: 6px; }
  .wx-day-rain { display: none; }
}

/* --- Bandeaux ------------------------------------------------------------ */

.banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  border: 1px solid transparent;
}
.banner svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.banner-warn { background: var(--heat-soft); border-color: var(--heat-soft); color: var(--heat); }
.banner-ok { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent); }

/* Confirmation qui s'efface d'elle-même après quelques secondes. */
.banner-dismiss { transition: opacity 0.4s, transform 0.4s; }
.banner-dismiss.is-gone { opacity: 0; transform: translateY(-6px); }
[hidden] { display: none !important; }

/* --- Pied de page -------------------------------------------------------- */

.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding: 0 4px;
  font-size: 0.8125rem;
  color: var(--muted);
}
.foot a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--border-strong); }
.foot a:hover { color: var(--text); }

.updating { opacity: 0.5; transition: opacity 0.2s; }

/* --- Administration et page du propriétaire ----------------------------- */

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
  padding: 12px 18px;
  margin-bottom: 14px;
  font-size: 0.9375rem;
}
.admin-nav a { color: var(--accent); text-decoration: none; font-weight: 600; }
.admin-nav a:hover { text-decoration: underline; }
.admin-nav .inline-form { margin-left: auto; }

.inline-form { display: inline; margin: 0; }

.link-button {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--text-soft);
  cursor: pointer;
  text-decoration: underline;
}

.card-body { padding: 4px 18px 18px; }

.muted { color: var(--muted); font-size: 0.8125rem; }

table.data-left th,
table.data-left td { text-align: left; white-space: normal; vertical-align: top; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 0.8125rem; font-weight: 600; color: var(--text-soft); }
.field input,
.field select,
.field textarea {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  width: 100%;
  max-width: 28rem;
  box-sizing: border-box;
}
.field-row { display: flex; flex-wrap: wrap; gap: 0 16px; }
.field-row .field { flex: 1 1 10rem; }

.button-danger { background: var(--heat); }

/* Le bouton de saison du propriétaire : gros, impossible à manquer, et un
   seul par page. */
.button-big {
  width: 100%;
  padding: 20px 22px;
  font-size: 1.125rem;
  border-radius: 16px;
}

.big-text { font-size: 1.25rem; line-height: 1.55; }
.big-text .muted { font-size: 1rem; }

/* Les explications de la page du propriétaire : lisibles sans lunettes. */
.note-large { font-size: 1rem; color: var(--text-soft); }
.big-text strong { font-weight: 700; }

.secret-link {
  display: block;
  padding: 12px;
  border: 1px dashed var(--accent);
  border-radius: 10px;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875rem;
  background: var(--accent-soft);
}

pre.raw {
  margin: 0;
  padding: 12px;
  overflow-x: auto;
  font-size: 0.8125rem;
  background: var(--surface-2);
  border-radius: 10px;
}
