/* ==========================================================
   Station Météo IoT — Mobile-First Clean Design v2
   Flat, professional, compact. Proper touch targets.
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #f2f2f7;
  --bg-card: #ffffff;
  --border: #e5e5ea;
  --text: #1c1c1e;
  --text-secondary: #636366;
  --text-tertiary: #aeaeb2;

  --blue: #007aff;
  --blue-light: #f0f5ff;
  --green: #34c759;
  --green-light: #f0fdf4;
  --amber: #ff9500;
  --amber-light: #fff8ec;
  --red: #ff3b30;
  --red-light: #fff2f0;
  --indigo: #5856d6;
  --indigo-light: #f3f0ff;

  --radius: 14px;
  --radius-sm: 10px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html {
  overflow-x: hidden;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d1d6; border-radius: 10px; }

/* ==========================================================
   Header / Top Bar
   ========================================================== */
.app-topbar {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  padding: 12px 0;
  min-height: 64px;
  display: flex;
  align-items: center;
}

.brand-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--blue-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.brand-caption {
  font-size: 0.65rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Topbar Buttons — 44px min touch targets */
.topbar-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.topbar-btn:hover, .topbar-btn:active {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
}

.topbar-btn-primary {
  background: var(--blue);
  color: #ffffff;
  border-radius: var(--radius-sm);
  padding: 0 14px;
}
.topbar-btn-primary:hover, .topbar-btn-primary:active {
  background: #0066d6;
  color: #ffffff;
}

/* Admin Session Chip */
.admin-session-chip {
  display: inline-flex;
  background: var(--green-light);
  color: #15803d;
  font-size: 0.72rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  border: 1px solid #bbf7d0;
}

.status-dot-emerald {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
}

.btn-logout-chip {
  background: transparent;
  border: none;
  color: #15803d;
  cursor: pointer;
  padding: 2px;
  min-width: 28px;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-logout-chip:hover { color: var(--text); }

/* Offline indicator */
.offline-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--amber-light);
  border: 1px solid #fed7aa;
  color: #9a3412;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
}

/* ==========================================================
   Main Content Area
   ========================================================== */
.app-main-content {
  padding-bottom: calc(1.5rem + var(--safe-bottom));
  min-width: 0;
}

/* ==========================================================
   Station Selector — Compact, full-width
   ========================================================== */
.station-selector-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  overflow: hidden;
}

.selector-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.station-dropdown {
  background: var(--bg) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  font-weight: 600 !important;
  font-size: 0.88rem !important;
  border-radius: var(--radius-sm) !important;
  padding: 8px 12px !important;
  min-height: 44px;
  width: 100% !important;
  max-width: 100% !important;
}
.station-dropdown:focus {
  border-color: var(--blue) !important;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15) !important;
}

.last-seen-badge {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-family: var(--mono);
  line-height: 1.4;
}

.station-info-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.action-icon-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.action-icon-btn:hover, .action-icon-btn:active {
  background: #dcdce0;
  color: var(--text);
}
.action-icon-btn-primary {
  background: var(--blue-light);
  color: var(--blue);
  border-color: transparent;
}
.action-icon-btn-primary:hover, .action-icon-btn-primary:active {
  background: #d6e8ff;
}

/* ==========================================================
   Metric Cards — 2×2 Grid
   ========================================================== */
.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-card-wide {
  grid-column: span 2;
}

.metric-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.metric-value .unit {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-left: 1px;
}

.metric-sub {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 500;
  line-height: 1.35;
  margin-top: 2px;
  /* Truncate on small cards */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-icon {
  width: 16px;
  height: 16px;
  opacity: 0.4;
}

/* Temperature hero card — full width with large temp */
.metric-card-hero {
  grid-column: span 2;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
}

.metric-card-hero .metric-value {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  flex-shrink: 0;
}

.hero-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.hero-minmax {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--blue);
  background: var(--blue-light);
  padding: 3px 8px;
  border-radius: 20px;
  width: fit-content;
}

/* Dew point badge */
.dew-badge, .dew-point-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--blue);
  background: var(--blue-light);
  padding: 3px 8px;
  border-radius: 20px;
  border: none;
  white-space: nowrap;
}

/* ==========================================================
   Section Heading & Time Filters
   ========================================================== */
.section-heading {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.time-pills-container {
  display: inline-flex;
  background: #e5e5ea;
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}

.time-pill-btn {
  background: transparent;
  border: none;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 32px;
}
.time-pill-btn:hover { color: var(--text); }
.time-pill-btn.active {
  background: #ffffff;
  color: var(--blue);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ==========================================================
   Chart Cards
   ========================================================== */
.clean-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 10px;
  overflow: hidden;
}

.card-title-row {
  margin-bottom: 8px;
}

.card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}

.card-subtitle {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  display: block;
}

.chart-header-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.icon-chip {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chip-blue { background: var(--blue-light); color: var(--blue); }
.chip-amber { background: var(--amber-light); color: var(--amber); }
.chip-green { background: var(--green-light); color: var(--green); }
.chip-indigo { background: var(--indigo-light); color: var(--indigo); }

.chart-wrapper {
  position: relative;
  width: 100%;
  margin: 0;
  overflow: hidden;
}

/* ==========================================================
   Fleet Table — Responsive card layout on mobile
   ========================================================== */
.fleet-table {
  font-size: 0.82rem;
}

.fleet-table thead th {
  background: var(--bg);
  color: var(--text-tertiary);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  white-space: nowrap;
}

.fleet-table tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.fleet-table tbody tr:hover td {
  background: #fafafa;
}

/* Actions Flotte avec espacement et fond */
.fleet-table tbody td:nth-child(7) {
  white-space: nowrap;
}

.fleet-actions,
.fleet-table tbody td .btn-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.fleet-actions .btn,
.fleet-table tbody td .btn-group .btn {
  border-radius: var(--radius-sm) !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0 !important;
  font-weight: 500;
  transition: all 0.15s ease;
}

.fleet-actions .btn-outline-primary,
.fleet-table tbody td .btn-outline-primary {
  background: #eef6ff !important;
  border-color: #bfdbfe !important;
  color: #1d4ed8 !important;
}
.fleet-actions .btn-outline-primary:hover,
.fleet-table tbody td .btn-outline-primary:hover {
  background: #007aff !important;
  border-color: #007aff !important;
  color: #ffffff !important;
}

.fleet-actions .btn-outline-secondary,
.fleet-table tbody td .btn-outline-secondary {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #475569 !important;
}
.fleet-actions .btn-outline-secondary:hover,
.fleet-table tbody td .btn-outline-secondary:hover {
  background: #64748b !important;
  border-color: #64748b !important;
  color: #ffffff !important;
}

.fleet-actions .btn-outline-warning,
.fleet-table tbody td .btn-outline-warning {
  background: #fffbeb !important;
  border-color: #fde68a !important;
  color: #b45309 !important;
}
.fleet-actions .btn-outline-warning:hover,
.fleet-table tbody td .btn-outline-warning:hover {
  background: #f59e0b !important;
  border-color: #f59e0b !important;
  color: #ffffff !important;
}

.fleet-actions .btn-outline-danger,
.fleet-table tbody td .btn-outline-danger {
  background: #fef2f2 !important;
  border-color: #fecaca !important;
  color: #dc2626 !important;
}
.fleet-actions .btn-outline-danger:hover,
.fleet-table tbody td .btn-outline-danger:hover {
  background: #ef4444 !important;
  border-color: #ef4444 !important;
  color: #ffffff !important;
}

/* Mobile: hide table, show card layout */
@media (max-width: 767px) {
  .fleet-table thead {
    display: none;
  }

  .fleet-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    padding: 14px 0;
    gap: 6px 12px;
    border-bottom: 1px solid var(--border);
    align-items: center;
  }

  .fleet-table tbody tr:last-child {
    border-bottom: none;
  }

  .fleet-table tbody td {
    border: none;
    padding: 0;
    display: block;
  }

  /* 1st col (ID) */
  .fleet-table tbody td:nth-child(1) {
    order: 1;
    font-size: 0.72rem;
    color: var(--text-tertiary);
  }

  /* 2nd col (Name) — primary, full width on first line with ID */
  .fleet-table tbody td:nth-child(2) {
    order: 2;
    flex: 1;
    font-size: 0.92rem;
    font-weight: 600;
  }

  /* 3rd col (Status) */
  .fleet-table tbody td:nth-child(3) {
    order: 3;
  }

  /* 4th col (Firmware) */
  .fleet-table tbody td:nth-child(4) {
    order: 4;
  }

  /* 5th col (Veille/Sleep) */
  .fleet-table tbody td:nth-child(5) {
    order: 5;
    font-size: 0.75rem;
    color: var(--text-secondary);
  }

  /* 6th col (Last seen) */
  .fleet-table tbody td:nth-child(6) {
    order: 6;
    width: 100%;
    font-size: 0.72rem;
    color: var(--text-tertiary);
    padding-top: 4px;
  }

  /* 7th col (Actions) */
  .fleet-table tbody td:nth-child(7) {
    order: 7;
    width: 100%;
    padding-top: 8px;
    white-space: normal;
  }

  .fleet-table tbody td:nth-child(7) .fleet-actions,
  .fleet-table tbody td:nth-child(7) .btn-group {
    display: flex;
    gap: 6px;
    width: 100%;
  }

  .fleet-table tbody td:nth-child(7) .fleet-actions .btn,
  .fleet-table tbody td:nth-child(7) .btn-group .btn {
    flex: 1;
    min-height: 40px;
    justify-content: center;
    border-radius: var(--radius-sm) !important;
  }
}

/* Status Badges */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.status-online {
  background: var(--green-light);
  color: #15803d;
  border: 1px solid #bbf7d0;
}
.status-online .status-dot { background: var(--green); }

.status-offline {
  background: var(--red-light);
  color: #b91c1c;
  border: 1px solid #fecaca;
}
.status-offline .status-dot { background: var(--red); }

.status-disabled {
  background: var(--bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.status-disabled .status-dot { background: #aeaeb2; }

/* ==========================================================
   Modals — Bottom Sheet on Mobile
   ========================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  z-index: 1050;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius) var(--radius) 0 0;
  max-width: 520px;
  width: 100%;
  max-height: 85vh;
  max-height: 85dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.15);
}

.modal-backdrop.active .modal-card {
  transform: translateY(0);
}

/* Forms inside modal-card must flex vertically so footer stays pinned */
.modal-card > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* Bottom sheet drag handle indicator */
.modal-header::before {
  content: '';
  display: block;
  width: 36px;
  height: 5px;
  background: #d1d1d6;
  border-radius: 3px;
  margin: 0 auto 10px;
}

.modal-header {
  flex-shrink: 0;
  padding: 10px 16px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  z-index: 2;
}

.modal-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0;
  color: var(--text);
  width: 100%;
}

.modal-header .modal-close {
  background: var(--bg);
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  position: absolute;
  right: 16px;
  top: 14px;
}
.modal-header .modal-close:hover {
  color: var(--text);
  background: #dcdce0;
}

.modal-body {
  padding: 16px;
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

.modal-footer {
  flex-shrink: 0;
  padding: 12px 16px;
  padding-bottom: max(14px, calc(12px + var(--safe-bottom)));
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  background: var(--bg-card);
  z-index: 2;
}

.modal-footer .btn {
  min-height: 42px;
  padding: 8px 16px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}

/* Form Controls */
.form-control, .form-select {
  background: var(--bg) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  font-size: 0.92rem !important;
  border-radius: var(--radius-sm) !important;
  min-height: 44px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--blue) !important;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15) !important;
}

/* Bootstrap btn overrides — proper touch targets */
.btn-sm {
  min-height: 40px;
  padding: 8px 16px !important;
  font-size: 0.85rem !important;
  border-radius: var(--radius-sm) !important;
}

.btn-primary {
  background: var(--blue) !important;
  border-color: var(--blue) !important;
}
.btn-primary:hover, .btn-primary:active {
  background: #0066d6 !important;
  border-color: #0066d6 !important;
}

/* Token display */
.token-display-box {
  background: var(--bg);
  border: 1px dashed #d1d1d6;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  word-break: break-all;
}
.token-code {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--blue);
  font-weight: 600;
}

/* ==========================================================
   Toasts — Full width on mobile, bottom
   ========================================================== */
.toast-container {
  position: fixed;
  bottom: calc(12px + var(--safe-bottom));
  left: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1060;
  pointer-events: none;
}

.toast {
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  padding: 12px 16px;
  color: var(--text);
  font-size: 0.85rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastSlideUp 0.3s ease forwards;
  pointer-events: auto;
}
.toast-success { border-left: 4px solid var(--green) !important; }
.toast-error { border-left: 4px solid var(--red) !important; }
.toast-info { border-left: 4px solid var(--blue) !important; }
.toast-warning { border-left: 4px solid var(--amber) !important; }

@keyframes toastSlideUp {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ==========================================================
   Mobile-specific refinements (< 576px)
   ========================================================== */
@media (max-width: 575px) {
  .metric-card-hero .metric-value {
    font-size: 2.75rem;
  }

  .hero-minmax {
    font-size: 0.72rem;
  }

  /* Hide y-axis titles to save horizontal space */
  .apexcharts-yaxis-title {
    display: none !important;
  }

  /* Minimal padding on chart cards */
  .clean-card {
    padding: 10px 6px;
    border-radius: var(--radius-sm);
  }

  .card-title-row {
    padding: 0 6px;
  }

  .section-heading {
    font-size: 1rem;
  }

  /* Main container: reduce side padding */
  .container-xl {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  /* Metrics grid tighter gaps */
  .metrics-grid {
    gap: 8px;
  }

  .metric-card {
    padding: 12px;
  }

  .metric-card-hero {
    padding: 12px 14px;
  }

  .modal-card {
    width: 100%;
    max-height: calc(88dvh - env(safe-area-inset-bottom, 0px));
  }

  .modal-footer {
    gap: 10px;
    padding: 12px 16px;
    padding-bottom: max(16px, calc(14px + env(safe-area-inset-bottom, 0px)));
  }

  .modal-footer .btn {
    flex: 1;
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* ==========================================================
   Desktop (≥576px)
   ========================================================== */
@media (min-width: 576px) {
  .modal-backdrop {
    align-items: center;
    padding: 1rem;
  }

  .modal-card {
    border-radius: var(--radius);
    transform: translateY(20px);
  }

  .modal-backdrop.active .modal-card {
    transform: translateY(0);
  }

  .modal-header::before {
    display: none;
  }

  .modal-header .modal-close {
    position: static;
  }

  .modal-title {
    width: auto;
  }

  .toast-container {
    left: auto;
    right: 20px;
    bottom: 20px;
    max-width: 380px;
  }
}

/* ==========================================================
   Tablet (≥768px)
   ========================================================== */
@media (min-width: 768px) {
  .metrics-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .metric-card-hero {
    grid-column: span 2;
  }

  .metric-value { font-size: 1.6rem; }

  .metric-card-hero .metric-value {
    font-size: 2.25rem;
  }

  .station-dropdown {
    width: auto !important;
    max-width: 320px !important;
  }
}

/* ==========================================================
   Desktop (≥992px)
   ========================================================== */
@media (min-width: 992px) {
  .metric-card-hero .metric-value {
    font-size: 2.75rem;
  }

  .metric-card-hero {
    grid-column: span 1;
  }
}

/* Gauge footer */
.gauge-footer-text {
  font-size: 0.72rem;
  color: var(--text-tertiary);
}

/* Refresh animation */
.action-icon-btn.loading svg {
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* stat-foot, stat-note — backward compat with app.js */
.stat-foot { margin-top: 2px; }
.stat-note {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

/* ==========================================================
   PWA Banner — Bottom fixed bar
   ========================================================== */
.pwa-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  padding-bottom: calc(12px + var(--safe-bottom));
  display: none;
  align-items: center;
  gap: 12px;
  z-index: 1040;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}
.pwa-banner.visible {
  display: flex;
}

.pwa-banner-icon img {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
}

.pwa-banner-content {
  flex: 1;
  min-width: 0;
}

.pwa-banner-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

.pwa-banner-desc {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.pwa-banner-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.pwa-btn-install {
  background: var(--blue);
  color: #ffffff;
  border: none;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background 0.15s;
  min-height: 44px;
}
.pwa-btn-install:hover {
  background: #0066d6;
}

.pwa-btn-close {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 8px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pwa-btn-close:hover {
  color: var(--text);
}
