@font-face {
  font-family: "Birthstone Bounce";
  src: url("fonts/BirthstoneBounce-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem;
}
body {
  line-height: 1.5;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}
header h1 {
  font-family: "Birthstone Bounce", cursive;
  font-size: 2rem;
  font-weight: 400;
}
.header-meta-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  align-items: center;
  /* margin-bottom: 0.5rem;
  min-height: 2rem;
  width: fit-content; */
}
.meta-info {
  display: contents;
  font-size: 0.85rem;
  color: var(--muted);
}
.meta-info .value {
  color: var(--text);
  font-weight: 500;
}

h1.wavy span {
  display: inline-block;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  will-change: transform;
  backface-visibility: hidden;
}
h1.wavy span.wave {
  animation: wavy 0.6s ease-in-out;
}
@keyframes wavy {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

/* Alerts */
.alerts {
  margin-bottom: 1.5rem;
}
.alerts-header {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--yellow);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.5rem 1.2rem;
}
.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  border-left: 4px solid;
}
.alert-warning {
  background: rgba(255, 167, 38, 0.1);
  border-color: var(--yellow);
}
.alert-info {
  background: rgba(66, 165, 245, 0.1);
  border-color: var(--blue);
}

/* Bannière données source limitées (Hub'Eau en retard) */
.alert-source-warning {
  background: rgba(66, 165, 245, 0.1);
  border-color: var(--blue);
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  line-height: 1.5;
}

/* Icône ℹ alignée avec le début du texte */
.alert-source-warning .source-warning-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  color: var(--blue);
  margin-top: 0.1rem;
}

/* Titre en couleur accent bleu, séparé du corps par un léger espacement */
.alert-source-warning .source-warning-body strong {
  display: block;
  color: var(--blue);
  margin-bottom: 0.3rem;
}

/* Corps du texte légèrement atténué pour hiérarchie titre/corps */
.alert-source-warning .source-warning-body {
  color: var(--text);
  font-size: 0.88rem;
}

/* Network wrap + collapsible (mobile) */
.network-wrap {
  position: relative;
  margin-bottom: 1rem;
}

/* Groupe toggle + bookmark : caché sur desktop, visible sur mobile */
.network-controls {
  display: none;
}

.network-toggle {
  display: none;
}

/* Network diagram */
.network-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0.25rem;
  overflow-x: auto;
  padding: 1rem 0;
  max-width: fit-content;
  margin: 0 auto;
}
.net-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 70px;
  cursor: pointer;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  transition: background 0.2s;
  gap: 0.15rem;
}
.net-node:hover {
  background: rgba(79, 195, 247, 0.1);
}
.net-node.active {
  background: rgba(79, 195, 247, 0.15);
}
.net-trend {
  font-size: 0.85rem;
  line-height: 1;
  background: none !important;
}
.net-name {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  white-space: nowrap;
}
.net-river {
  font-size: 0.6rem;
  color: #888;
  text-align: center;
  white-space: nowrap;
  margin-top: 0.25rem;
}
.net-height {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
}

/* Station grid */
.station-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.station-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.2s;
  perspective: 1000px;
}

/* Flip mécanique */
.flip-inner {
  transform-style: preserve-3d;
  transition: transform 0.5s;
  position: relative;
  min-height: 100%;
}
.flip-inner.flipped {
  transform: rotateY(180deg);
}
.card-face {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.card-front {
  display: flex;
  flex-direction: column;
  padding: 1.2rem;
}
.card-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotateY(180deg);
  background: var(--card);
  border-radius: 12px;
  padding: 1.2rem;
  box-sizing: border-box;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Layout verso — prévisions météo 4 blocs */
.card-back-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}
.card-back-meta {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.card-back-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}
.card-back-subtitle {
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.2;
}
.card-back-blocks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 0.5rem;
  flex: 1;
  min-height: 0;
}
.weather-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
}
.weather-block.wb-now {
  background: rgba(79, 195, 247, 0.07);
  border-color: rgba(79, 195, 247, 0.25);
}
.wb-label {
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.wb-icon {
  font-size: 1.5rem;
  line-height: 1.2;
}
.wb-temp {
  font-size: 0.95rem;
  font-weight: 700;
}
.wb-wind {
  font-size: 0.65rem;
  color: var(--muted);
}

/* Strip "Maintenant / Dans 1h" */
.card-back-now {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.6rem;
  margin-bottom: 0.6rem;
  padding: 0.55rem 0.75rem;
  background: rgba(79, 195, 247, 0.07);
  border: 1px solid rgba(79, 195, 247, 0.2);
  border-radius: 8px;
  flex-shrink: 0;
}
.now-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  flex: 1;
}
.now-label {
  font-size: 0.63rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.now-period {
  font-weight: 400;
}
.now-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.now-icon {
  font-size: 1.2rem;
  line-height: 1;
}
.now-temp {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.now-wind {
  font-size: 0.72rem;
  color: var(--muted);
}
.now-pipe {
  color: rgba(79, 195, 247, 0.25);
  margin: 0 0.2rem;
}
.card-back-now .now-pipe {
  width: 1px;
  align-self: stretch;
  background: rgba(79, 195, 247, 0.25);
  flex-shrink: 0;
  margin: 0.1rem 0;
}

/* Pill CTA météo (recto) */
.weather-flip-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  margin-top: 0.35rem;
  padding: 0.25rem 0.6rem;
  background: rgba(79, 195, 247, 0.07);
  border: 1px solid rgba(79, 195, 247, 0.25);
  border-radius: 20px;
  font-size: 0.72rem;
  color: var(--text);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}
.weather-flip-pill:hover {
  background: rgba(79, 195, 247, 0.15);
  color: var(--accent);
}

/* Bouton flip */
.flip-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  color: var(--muted);
  padding: 2px 4px;
  line-height: 1;
  transition:
    color 0.2s,
    transform 0.15s;
  opacity: 1;
  transform: scale(1.15);
}
.flip-btn:hover {
  color: var(--accent);
  opacity: 1;
  transform: scale(1.25);
}
.flip-back {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  background: rgba(79, 195, 247, 0.07);
  border: 1px solid rgba(79, 195, 247, 0.25) !important;
  border-radius: 20px;
  font-size: 0.72rem;
  color: var(--text);
  opacity: 1;
  flex-shrink: 0;
  white-space: nowrap;
  transform: none !important;
}
.flip-back:hover {
  background: rgba(79, 195, 247, 0.15);
  color: var(--accent);
}
.station-card.station-card-affluent {
  background: var(--card-affluent);
}
.station-card:hover {
  border-color: var(--accent);
}

/* Favorite station */
.favorite-card {
  margin-bottom: 0;
}
.favorite-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 0.5rem 1.2rem;
}
.favorite-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--yellow);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.favorite-remove {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.1rem 0.5rem;
  transition: color 0.2s;
}
.favorite-remove:hover {
  color: var(--red);
}
.favorite-card .station-card {
  border-color: var(--yellow);
  background: rgba(255, 167, 38, 0.05);
}
.favorite-card .prop-info br {
  display: none;
}
.favorite-card .prop-skip-note::before {
  content: "| ";
}
.fav-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--muted);
  transition: color 0.2s;
  padding: 0;
  line-height: 1;
  width: 1.5rem;
  flex-shrink: 0;
  text-align: center;
}
.fav-btn:hover {
  color: var(--yellow);
}
.fav-btn.fav-active {
  color: var(--yellow);
}
.station-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.station-row-1 {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}
.station-divider {
  width: 40%;
  margin: 0 auto;
  border: none;
  border-top: 1px solid var(--border);
  opacity: 0.5;
}
.station-row-2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.station-row-2-left {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.station-title {
  font-size: 1.1rem;
  font-weight: 600;
}
.station-meta {
  font-size: 0.75rem;
  font-weight: 400;
  color: #888;
}
.station-weather {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.2rem;
}
.station-weather-forecast {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}
.weather-line {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  flex-wrap: wrap;
  line-height: 1.2;
}
.weather-line-wind {
  margin-left: 0.15rem;
}
.weather-icon {
  font-size: 1.1rem;
  line-height: 1.2;
}
.weather-temp {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}
.weather-desc {
  font-size: 0.75rem;
  color: var(--muted);
}
.weather-trend,
.wind-trend {
  font-size: 0.75rem;
  white-space: nowrap;
  color: var(--muted);
}
.weather-wind-icon {
  line-height: 1;
}
.wind-icon--gap {
  display: inline-block;
  margin-left: 0.3em;
}
.weather-wind-speed {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}
.wind-gusts-moderate {
  color: var(--blue);
}
.wind-gusts-strong {
  color: var(--yellow);
}
.wind-gusts-extreme {
  color: var(--red);
}
.weather-age {
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
  transition: opacity 0.3s ease;
}
.weather-age.age-fade {
  opacity: 0.3;
}
.station-current {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}
.current-height {
  font-size: 2rem;
  font-weight: 700;
}
.current-unit {
  font-size: 1rem;
  color: var(--muted);
}
.current-age {
  font-size: 0.8rem;
  color: var(--muted);
  transition: opacity 0.3s ease;
}
.current-age.age-fade {
  opacity: 0.3;
}
.current-age.age-stale {
  color: var(--red);
  font-weight: 600;
}
/* Trend */
.trend-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 0.8rem;
}
.trend-up {
  background: rgba(239, 83, 80, 0.15);
  color: var(--red);
}
.trend-up-moderate {
  background: rgba(255, 167, 38, 0.15);
  color: var(--yellow);
}
.trend-up-light,
.trend-down-light {
  background: rgba(79, 195, 247, 0.18);
  color: var(--accent);
}
.trend-down {
  background: rgba(66, 187, 106, 0.15);
  color: var(--green);
}
.trend-stable {
  background: rgba(79, 195, 247, 0.18);
  color: var(--accent);
}
.trend-unknown,
.trend-no-data {
  background: rgba(122, 138, 154, 0.1);
  color: var(--muted);
}

/* Forecast */
.forecast-wrap {
  min-height: 7.5rem;
}
.forecast-blur {
  filter: blur(2.5px);
  opacity: 0.5;
  pointer-events: none;
}
.forecast-table {
  width: 100%;
  font-size: 0.85rem;
  border-collapse: collapse;
  margin-bottom: 0.8rem;
}
.forecast-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--border);
  width: 25%;
}
.forecast-table td {
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid rgba(42, 58, 74, 0.5);
}
.confidence-high {
  color: var(--green);
}
.confidence-medium {
  color: var(--yellow);
}
.confidence-low {
  color: var(--red);
}
.confidence-very_low {
  color: var(--red);
  opacity: 0.6;
}
.confidence-obsolete {
  color: var(--muted);
  text-decoration: line-through;
  opacity: 0.5;
}
.forecast-obsolete {
  opacity: 0.4;
}

/* Chart */
.chart-container {
  height: 140px;
  position: relative;
  margin-top: 0.5rem;
}
.chart-tooltip {
  position: absolute;
  background: rgba(255, 167, 38, 0.15);
  color: var(--yellow);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
  animation: tooltip-in 0.15s ease-out;
}
.chart-tooltip-active {
  background: rgba(79, 195, 247, 0.15);
  color: var(--accent);
}
.chart-tooltip-line {
  position: absolute;
  width: 0;
  border-left: 1px dashed rgba(79, 195, 247, 0.4);
  pointer-events: none;
  z-index: 9;
}
@keyframes tooltip-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.forecast-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  pointer-events: none;
  animation: dot-glow 3s ease-in-out infinite;
}
.forecast-dot.active {
  background: var(--accent);
  box-shadow: 0 0 6px 2px rgba(79, 195, 247, 0.4);
  animation: none;
}
@keyframes dot-glow {
  0%,
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
  50% {
    box-shadow: 0 0 4px 2px rgba(255, 167, 38, 0.35);
  }
}
canvas {
  width: 100% !important;
  height: 100% !important;
}

/* Propagation info */
.prop-info {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.prop-info-fallback {
  color: var(--yellow);
}

.prop-skip-note {
  font-size: 0.72rem;
  opacity: 1;
}

/* Quality bar */
.quality-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
  margin-top: 0.3rem;
}
.quality-fill {
  height: 4px;
  border-radius: 2px;
  flex: 1;
  background: var(--border);
  overflow: hidden;
}
.quality-fill-inner {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s;
}
.quality-label {
  font-size: 0.7rem;
  color: var(--muted);
  min-width: 2rem;
}

/* Refresh bar */
.refresh-bar {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0;
  font-size: 0.8rem;
}
.refresh-left,
.refresh-right {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  white-space: nowrap;
}
.refresh-left {
  align-items: flex-start;
}
.refresh-right {
  align-items: flex-end;
  text-align: right;
}
.refresh-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.refresh-value {
  font-size: 0.85rem;
  color: var(--text);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.refresh-countdown {
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 600;
}
.refresh-countdown.imminent {
  color: var(--green);
  animation: pulse-text 1s ease-in-out infinite;
}
@keyframes pulse-text {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}
.refresh-center {
  flex: 1;
  padding: 0 0.5rem;
}
.refresh-progress-wrap {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.refresh-progress {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width 1s linear;
}
.refresh-status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.85rem;
}
.refresh-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}
.refresh-status.connected::before {
  background: var(--green);
}
.refresh-status.disconnected::before {
  background: var(--red);
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.toast {
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 0.8rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transform: translateX(120%);
  opacity: 0;
  animation: toast-in 0.4s ease-out forwards;
  pointer-events: auto;
  max-width: 340px;
}
.toast.toast-out {
  animation: toast-out 0.3s ease-in forwards;
}
.toast-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}
.toast-body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.toast-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}
.toast-message {
  font-size: 0.75rem;
  color: var(--muted);
}
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--accent);
  border-radius: 0 0 10px 10px;
  animation: toast-progress-shrink linear forwards;
}
@keyframes toast-in {
  from {
    transform: translateX(120%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
@keyframes toast-out {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(120%);
    opacity: 0;
  }
}
@keyframes toast-progress-shrink {
  from {
    width: 100%;
  }
  to {
    width: 0%;
  }
}

/* Tidal notice */
.tidal-notice {
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
  padding: 0.5rem;
  background: rgba(122, 138, 154, 0.1);
  border-radius: 6px;
  margin-top: 0.5rem;
}

/* Loading / Error */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  padding: 2rem 4rem;
  color: var(--muted);
  font-size: 1.1rem;
  min-height: 60vh;
  grid-column: 1 / -1;
}
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Topology */
.topology-section {
  margin-top: 2rem;
}
.topology-section h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.8rem;
}
#stations-map {
  height: 380px;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
}
/* Popup Leaflet adapté au thème sombre */
.leaflet-popup-content-wrapper {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.leaflet-popup-tip {
  background: var(--card);
}
.map-popup-name {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
}
.map-popup-height {
  font-size: 1rem;
  font-weight: 700;
}
.map-popup-trend {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Responsive */
@media (max-width: 600px) {
  .station-grid {
    grid-template-columns: 1fr;
  }

  .weather-flip-pill {
    margin-top: -0.35rem;
  }

  /* --- Header mobile --- */
  header {
    flex-direction: column;
    align-items: stretch;
    padding: 1rem 0 0.75rem;
    gap: 0;
    border-bottom: none;
    margin-bottom: 1rem;
  }
  header h1 {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 1.5rem;
  }

  /* Meta + status : grille 2×2 uniforme */
  .header-meta-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0;
  }
  .meta-info {
    display: contents;
  }
  .meta-info > span,
  .header-meta-wrap > .refresh-status {
    font-size: 0.75rem;
    padding: 0.4rem 0.5rem;
    background: var(--card);
    border-radius: 8px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    text-align: center;
    line-height: 1.3;
  }
  .mode-label-desktop { display: none; }
  /* Switch mode : pleine largeur sous les pills */
  .header-meta-wrap > .mode-switch-wrap {
    grid-column: 1 / -1;
    justify-content: center;
    padding: 0.4rem 0.5rem;
    background: var(--card);
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 0.8rem;
  }

  /* Refresh bar mobile */
  .refresh-bar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0;
    padding: 0.5rem 0.65rem;
    background: var(--card);
    border-radius: 8px;
    border: 1px solid var(--border);
  }
  .refresh-left {
    flex-direction: row;
    align-items: baseline;
    gap: 0.3rem;
    flex: 1;
  }
  .refresh-right {
    flex-direction: row;
    align-items: baseline;
    gap: 0.3rem;
    order: 3;
    flex-basis: 100%;
    justify-content: flex-end;
    text-align: right;
    padding-top: 0.3rem;
  }
  .refresh-center {
    order: 2;
    flex-basis: 100%;
    padding: 0.5rem 0 0;
  }
  .refresh-label {
    font-size: 0.65rem;
  }
  .refresh-value {
    font-size: 0.8rem;
  }
  .refresh-countdown {
    font-size: 0.85rem;
  }

  .current-height {
    font-size: 1.5rem;
  }

  /* Forecast table: compact on mobile */
  .forecast-table {
    font-size: 0.75rem;
  }
  .forecast-table th,
  .forecast-table td {
    padding: 0.25rem 0.3rem;
  }
}

/* Network collapsible (tablette + mobile) */
@media (max-width: 1200px) {
  .network-wrap {
    margin-bottom: 1rem;
  }
  .network-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
  }
  .network-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--muted);
    cursor: pointer;
    transition:
      color 0.2s,
      border-color 0.2s;
  }
  .network-toggle:hover,
  .network-toggle:active {
    color: var(--accent);
    border-color: var(--accent);
  }
  .network-toggle--active {
    color: var(--yellow);
    border-color: var(--yellow);
  }
  .network-toggle--active:hover {
    color: var(--yellow);
    border-color: var(--yellow);
  }
  /* Bouton bookmark : même forme circulaire que le toggle */
  .network-controls .icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--card);
  }
  .network-collapsible {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.3s ease;
  }
  .network-collapsible.open {
    grid-template-rows: 1fr;
  }
  .network-collapsible > .network-bar {
    overflow: hidden;
    min-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    flex-direction: column;
    flex-wrap: nowrap;
    transition: padding 0.3s ease;
  }
  .network-collapsible.open > .network-bar {
    padding: 0.75rem 0;
  }
}

/* ── Halo périodique bouton bookmark/share ────────────────────────────────── */
@keyframes btn-halo {
  0% {
    box-shadow: 0 0 0 0 rgba(79, 195, 247, 0.3);
  }
  55% {
    box-shadow: 0 0 0 8px rgba(79, 195, 247, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(79, 195, 247, 0);
  }
}
.icon-btn--halo {
  animation: btn-halo 1.4s ease-out;
}

/* ── Modale favoris ───────────────────────────────────────────────────────── */
.bookmark-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.bookmark-overlay.active {
  display: flex;
}

.bookmark-modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem 1.8rem 1.8rem;
  max-width: 390px;
  width: 100%;
  position: relative;
  animation: bm-in 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes bm-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.bookmark-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.25rem 0.55rem;
  transition:
    color 0.2s,
    border-color 0.2s;
}
.bookmark-close:hover {
  color: var(--text);
  border-color: var(--muted);
}

.bookmark-modal-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: rgba(79, 195, 247, 0.1);
  border: 1px solid rgba(79, 195, 247, 0.2);
  margin: 0 auto 1.3rem;
  color: var(--accent);
}
.bookmark-modal-icon svg {
  width: 30px;
  height: 30px;
}

.bookmark-modal-title {
  text-align: center;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
}
.bookmark-modal-subtitle {
  text-align: center;
  font-size: 0.83rem;
  color: var(--muted);
  margin-bottom: 1.4rem;
  line-height: 1.5;
}

.bookmark-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.bookmark-steps li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.87rem;
  color: var(--text);
  margin: 0;
  line-height: 1.5;
}
.bookmark-steps li:last-child {
  border-bottom: none;
}

.bookmark-step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(79, 195, 247, 0.15);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.step-inline-icon {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  width: 16px;
  height: 16px;
  margin: 0 2px;
  position: relative;
  top: -1px;
}
.step-inline-icon svg {
  width: 15px;
  height: 15px;
}

.bookmark-shortcut {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: 1.6rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.bookmark-key {
  font-family: -apple-system, BlinkMacSystemFont, monospace;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(79, 195, 247, 0.08);
  border: 1px solid rgba(79, 195, 247, 0.3);
  border-radius: 8px;
  padding: 0.3rem 0.8rem;
  box-shadow: 0 3px 0 rgba(79, 195, 247, 0.15);
  letter-spacing: 0.04em;
}
.bookmark-shortcut-text {
  font-size: 0.88rem;
  color: var(--muted);
}

/* Very small screens: hide confidence column */
@media (max-width: 380px) {
  .forecast-table th:nth-child(4),
  .forecast-table td:nth-child(4) {
    display: none;
  }
}

/* === Alertes push === */

/* Conteneur cloche + étoile */
.station-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

/* Wrapper cloche + hauteur d'eau */
.current-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Bouton cloche */
.alert-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  margin-bottom: 7px;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  line-height: 1;
  width: 1.5rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}
.alert-btn:hover {
  color: var(--yellow);
}
.alert-btn.alert-active {
  color: var(--yellow);
}

/* Overlay */
.alert-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* Dialog */
.alert-dialog {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  width: min(92vw, 360px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.alert-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}
.alert-dialog-title {
  margin: 0 0 0.2rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.alert-current-level {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.alert-dialog-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
}
.alert-dialog-close:hover {
  color: var(--text);
}

.alert-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 1.25rem 0 0.6rem;
}

/* Liste des alertes */
.alert-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.alert-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.alert-list li:last-child {
  border-bottom: none;
}
.alert-empty {
  color: var(--muted);
  font-size: 0.84rem;
  font-style: italic;
}
.alert-badge {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.alert-badge-warning {
  color: #f59e0b;
}
.alert-badge-info {
  color: #4caf50;
}
.alert-delete-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0 4px;
  line-height: 1;
}
.alert-delete-btn:hover {
  color: var(--red);
}

/* Formulaire */
.alert-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-top: 1.5rem;
}
.alert-form-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.alert-form-label {
  font-size: 0.82rem;
  color: var(--muted);
  width: 75px;
  flex-shrink: 0;
}
.alert-toggle-group {
  display: flex;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid var(--border);
  flex: 1;
}
.alert-toggle-group button {
  flex: 1;
  padding: 0.3rem 0.5rem;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--muted);
  transition:
    background 0.15s,
    color 0.15s;
}
.alert-toggle-group button.active {
  background: var(--accent);
  color: #0f1923;
  font-weight: 600;
}
.alert-threshold-block {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.alert-threshold-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}
.alert-threshold-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  text-align: center;
  box-sizing: border-box;
}
.alert-create-btn {
  padding: 0.65rem 1rem;
  border-radius: 8px;
  background: var(--accent);
  color: #0f1923;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  margin-top: 0.1rem;
  transition: opacity 0.15s;
}
.alert-create-btn:hover {
  opacity: 0.85;
}
.alert-form-feedback {
  font-size: 0.82rem;
  min-height: 1.2em;
  color: var(--muted);
  margin: 0;
}
.alert-fb-ok {
  color: #4caf50;
}
.alert-fb-error {
  color: var(--red);
}

/* Bloc Nouvelle alerte — direction verticale */
.alert-new-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6rem;
  margin-top: 1.5rem;
  margin-bottom: 0;
}
.alert-new-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 0;
}
/* Button group — bordure partagée, séparateur interne */
.alert-dir-group {
  display: flex;
  flex-direction: column;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.alert-dir-group button {
  width: 100%;
  padding: 0.65rem 1rem;
  border: none;
  border-bottom: 1px solid var(--border);
  background: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  transition:
    background 0.15s,
    color 0.15s;
}
.alert-dir-group button:last-child {
  border-bottom: none;
}
.alert-dir-group button.active {
  background: var(--accent);
  color: #0f1923;
}

/* ===== Toggle switch Mode Crue / Météo ===== */
.mode-label-desktop {
  color: var(--muted);
  font-size: 0.8rem;
}
.mode-switch-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.mode-opt {
  transition: color 0.2s;
}
.mode-opt-crue {
  color: var(--text);
  font-weight: 600;
}
.mode-opt-meteo {
  color: var(--muted);
}
/* Piste du toggle */
.mode-track {
  position: relative;
  width: 34px;
  height: 18px;
  background: var(--border);
  border-radius: 9px;
  transition: background 0.2s;
  flex-shrink: 0;
}
/* Curseur du toggle */
.mode-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--text);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}
/* État météo actif */
.mode-switch-wrap.meteo-active .mode-opt-crue {
  color: var(--muted);
  font-weight: 400;
}
.mode-switch-wrap.meteo-active .mode-opt-meteo {
  color: var(--accent);
  font-weight: 600;
}
.mode-switch-wrap.meteo-active .mode-track {
  background: var(--accent);
}
.mode-switch-wrap.meteo-active .mode-thumb {
  transform: translateX(16px);
  background: #0f1923;
}
