/* ════════════════════════════════════════════════════════════
   Stadt Ibbenbüren – Stylesheet
   Mobile-first, vollständig responsive
   Breakpoints: sm=480, md=600, lg=900, xl=1200
   ════════════════════════════════════════════════════════════ */

/* ── CUSTOM PROPERTIES ───────────────────────────────────── */
:root {
  --accent:       #0d6fa8;
  --accent-rgb:   13,111,168;
  --accent-light: #1a88c8;
  --accent-glow:  rgba(13,111,168,0.18);
  --accent-soft:  rgba(13,111,168,0.10);
  --ok:           #38bdf8;
  --warn:         #f4a261;
  --critical:     #e63946;
  --unknown:      #7a8199;
  --radius:       12px;
  --radius-sm:    8px;
  --font-display: 'Nunito', sans-serif;
  --font-body:    'Source Sans 3', sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Mono', monospace;
}

[data-theme="dark"] {
  --bg:         #0f1410;
  --surface:    #161a22;
  --surface2:   #1e2330;
  --border:     rgba(255,255,255,0.07);
  --border2:    rgba(255,255,255,0.13);
  --text:       #e4e6ee;
  --text-muted: #7a8199;
  --shadow:     0 4px 24px rgba(0,0,0,0.35);
  --header-bg:  rgba(15,20,16,0.90);
  --map-filter: brightness(0.65) saturate(0.45) hue-rotate(10deg);
  --scrollbar:  #2a3a2d;
}
[data-theme="light"] {
  --bg:         #f4f2ed;
  --surface:    #ffffff;
  --surface2:   #edeae4;
  --border:     rgba(0,0,0,0.08);
  --border2:    rgba(0,0,0,0.15);
  --text:       #1a2219;
  --text-muted: #6b7280;
  --shadow:     0 4px 24px rgba(0,0,0,0.10);
  --header-bg:  rgba(244,242,237,0.92);
  --map-filter: brightness(1.0) saturate(0.7);
  --scrollbar:  #cdd5cb;
}

/* ── RESET & BASE ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s, color 0.25s;
}
main { flex: 1; }
img, canvas { display: block; max-width: 100%; }

/* ── CONTAINER ───────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}
@media (min-width: 600px) { .container { padding: 0 20px; } }
@media (min-width: 900px) { .container { padding: 0 28px; } }

/* ── HEADER ──────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 54px;
  gap: 12px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
  min-width: 0;
}
.logo-icon { font-size: 20px; line-height: 1; flex-shrink: 0; }
.logo-img { height: 32px; width: auto; display: block; flex-shrink: 0; }
.logo-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  color: var(--text);
  white-space: nowrap;
}
.logo-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-left: 1px solid var(--border);
  padding-left: 8px;
  white-space: nowrap;
  display: none;
}
@media (min-width: 480px) { .logo-label { display: block; } }

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.main-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}
.main-nav a:hover { color: var(--text); background: var(--surface2); }

/* ── THEME TOGGLE ────────────────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); }
.toggle-icon { font-size: 14px; line-height: 1; }
#toggle-label { display: none; }
@media (min-width: 600px) { #toggle-label { display: inline; } }

/* ── PROJECT SUB-NAV ─────────────────────────────────────── */
.project-subnav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.project-subnav::-webkit-scrollbar { display: none; }
.subnav {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 4px;
  /* allow sub-nav to use container width */
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}
@media (min-width: 600px) { .subnav { padding: 0 20px; } }
@media (min-width: 900px) { .subnav { padding: 0 28px; } }

.subnav-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.subnav-item:hover { color: var(--text); }
.subnav-item--active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── HOME HERO ───────────────────────────────────────────── */
.home-hero {
  padding: 36px 0 28px;
  position: relative;
  overflow: hidden;
}
@media (min-width: 600px) { .home-hero { padding: 56px 0 40px; } }
@media (min-width: 900px) { .home-hero { padding: 80px 0 56px; } }

.home-hero::before {
  content: '';
  position: absolute;
  top: -180px; right: -180px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(var(--accent-rgb),0.08) 0%, transparent 68%);
  pointer-events: none;
}

.home-hero-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.hero-eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 7vw, 54px);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}
.hero-title em {
  font-style: normal;
  background: linear-gradient(135deg, var(--accent), #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  color: var(--text-muted);
  font-size: 14px;
  max-width: 460px;
  line-height: 1.65;
}
@media (min-width: 600px) { .hero-sub { font-size: 15px; } }

/* Hero visual icon grid */
.hero-visual {
  position: relative;
  width: 180px;
  height: 180px;
  flex-shrink: 0;
  display: none;
}
@media (min-width: 760px) { .hero-visual { display: block; } }

.city-icon-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  position: relative;
  z-index: 1;
}
.city-icon-item {
  width: 50px; height: 50px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  animation: floatIn 0.5s ease both;
  animation-delay: var(--delay, 0s);
}
@keyframes floatIn {
  from { opacity: 0; transform: translateY(8px) scale(0.88); }
  to   { opacity: 1; transform: none; }
}
.hero-pulse--center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  pointer-events: none;
}

/* Hero stats bar */
.hero-stats {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hero-stat {
  flex: 1;
  min-width: 0;
  text-align: center;
  padding: 14px 8px;
}
@media (min-width: 600px) { .hero-stat { padding: 18px 12px; } }

.hero-stat-val {
  font-family: var(--font-display);
  font-size: clamp(18px, 4vw, 30px);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.hero-stat-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (min-width: 480px) { .hero-stat-label { font-size: 11px; } }

.hero-stat-sep {
  width: 1px;
  height: 32px;
  background: var(--border);
  flex-shrink: 0;
}

/* ── PROJECT HERO ────────────────────────────────────────── */
.project-hero {
  padding: 20px 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
@media (min-width: 600px) { .project-hero { padding: 32px 0 24px; } }
@media (min-width: 900px) { .project-hero { padding: 44px 0 32px; } }

.back-link {
  display: inline-block;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  margin-bottom: 12px;
  transition: color 0.15s;
}
.back-link:hover { color: var(--text); }

.project-hero-inner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.project-hero-icon { font-size: 28px; line-height: 1; flex-shrink: 0; }
.project-hero-inner h1 {
  font-family: var(--font-display);
  font-size: clamp(18px, 4vw, 26px);
  font-weight: 800;
  margin-bottom: 3px;
  letter-spacing: -0.01em;
}
.project-hero-inner p { color: var(--text-muted); font-size: 13px; line-height: 1.5; }
.project-meta { display: flex; gap: 6px; flex-wrap: wrap; }

.meta-badge {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 3px 10px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}
.meta-badge.ok       { color: var(--ok);       border-color: rgba(82,183,136,0.4); }
.meta-badge.warn     { color: var(--warn);     border-color: rgba(244,162,97,0.4); }
.meta-badge.critical { color: var(--critical); border-color: rgba(230,57,70,0.4); }

/* ── SECTION TITLES ──────────────────────────────────────── */
.section-title {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.section-title-large {
  font-family: var(--font-display);
  font-size: clamp(16px, 3vw, 22px);
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}
.section-sub { font-size: 13px; color: var(--text-muted); }
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.section-header .section-title { margin-bottom: 0; }
.section-link {
  font-size: 12px; font-weight: 700;
  color: var(--accent); text-decoration: none; white-space: nowrap;
}
.section-link:hover { color: var(--ok); }

/* ── DASHBOARD LAYOUT ────────────────────────────────────── */
.dashboard-section { padding: 16px 0 40px; }
@media (min-width: 600px) { .dashboard-section { padding: 24px 0 48px; } }
@media (min-width: 900px) { .dashboard-section { padding: 32px 0 60px; } }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 300px 1fr;
    gap: 20px;
    align-items: start;
  }
}
@media (min-width: 1100px) {
  .dashboard-grid { grid-template-columns: 320px 1fr; }
}

/* ── PANELS ──────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
  flex-wrap: wrap;
  min-height: 46px;
}
@media (min-width: 600px) { .panel-header { padding: 13px 16px; } }

.panel-header h2 {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.refresh-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 3px 9px;
  cursor: pointer;
  font-size: 15px;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s, transform 0.2s;
}
.refresh-btn:hover { color: var(--text); border-color: var(--accent); }
.refresh-btn.spinning { animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── SENSOR LIST ─────────────────────────────────────────── */
.sensor-list {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 420px;
  overflow-y: auto;
}
@media (min-width: 900px) { .sensor-list { max-height: 500px; } }

.sensor-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s;
}
.sensor-item:hover { transform: translateX(2px); border-color: rgba(var(--accent-rgb),0.3); }
.sensor-item.ok       { border-left-color: var(--ok); }
.sensor-item.warn     { border-left-color: var(--warn); }
.sensor-item.critical { border-left-color: var(--critical); }
.sensor-item.unknown  { border-left-color: var(--unknown); }
.sensor-item--active  {
  background: rgba(var(--accent-rgb),0.07) !important;
  border-color: rgba(var(--accent-rgb),0.35) !important;
  border-left-color: var(--accent) !important;
}

.sensor-label-wrap { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sensor-label {
  font-size: 12px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sensor-time { font-size: 10px; color: var(--text-muted); }
.sensor-time--stale { color: var(--warn); font-weight: 600; }

.sensor-bar-wrap { width: 48px; flex-shrink: 0; }
@media (min-width: 480px) { .sensor-bar-wrap { width: 64px; } }
.sensor-bar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.sensor-bar-fill { height: 100%; border-radius: 2px; transition: width 0.6s ease; }

.sensor-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  text-align: right;
  min-width: 44px;
  flex-shrink: 0;
  white-space: nowrap;
}
.sensor-value.ok       { color: var(--ok); }
.sensor-value.warn     { color: var(--warn); }
.sensor-value.critical { color: var(--critical); }
.sensor-value.unknown  { color: var(--unknown); }

/* ── MAP ─────────────────────────────────────────────────── */
.panel-map { display: flex; flex-direction: column; }
#map {
  flex: 1;
  min-height: 260px;
  width: 100%;
}
@media (min-width: 600px)  { #map { min-height: 360px; } }
@media (min-width: 900px)  { #map { min-height: 460px; } }

.panel-map--full #map { min-height: 300px; }
@media (min-width: 600px)  { .panel-map--full #map { min-height: 420px; } }
@media (min-width: 900px)  { .panel-map--full #map { min-height: 520px; } }

.leaflet-container { background: var(--bg) !important; }
[data-theme="dark"] .leaflet-tile { filter: var(--map-filter) !important; }

.leaflet-popup-content-wrapper {
  background: var(--surface2) !important;
  color: var(--text) !important;
  border: 1px solid var(--border2) !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2) !important;
  border-radius: 10px !important;
}
.leaflet-popup-tip { background: var(--surface2) !important; }

.popup-name { font-family: var(--font-display); font-weight: 700; font-size: 13px; margin-bottom: 8px; }
.popup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.popup-metric { background: var(--surface); border-radius: 7px; padding: 7px 9px; }
.popup-metric-label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); margin-bottom: 2px; }
.popup-metric-val { font-family: var(--font-mono); font-size: 15px; font-weight: 500; }
.popup-metric-unit { font-size: 10px; color: var(--text-muted); }
.popup-action {
  display: block; width: 100%; padding: 7px;
  background: rgba(var(--accent-rgb),0.1);
  border: 1px solid rgba(var(--accent-rgb),0.3);
  border-radius: 7px; color: var(--ok);
  font-family: var(--font-body); font-size: 12px; font-weight: 700;
  cursor: pointer; text-align: center; transition: background 0.15s;
}
.popup-action:hover { background: rgba(var(--accent-rgb),0.2); }

/* ── RANGE TABS ──────────────────────────────────────────── */
.range-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.range-tab {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 3px 10px;
  font-size: 11px;
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.range-tab:hover { color: var(--text); border-color: var(--accent); }
.range-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── CUSTOM DATE RANGE ───────────────────────────────────── */
.custom-range {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 0 0;
}
.range-arrow { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
input[type="datetime-local"] {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 8px;
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--text);
  outline: none;
  min-width: 0;
  max-width: 170px;
  width: 100%;
  transition: border-color 0.15s;
}
input[type="datetime-local"]:focus { border-color: var(--accent); }
.range-apply {
  background: var(--accent);
  border: none;
  border-radius: 7px;
  padding: 5px 13px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.range-apply:hover { opacity: 0.85; }

/* ── HISTORY CHARTS ──────────────────────────────────────── */
.history-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 12px;
  transition: opacity 0.2s ease;
}
@media (min-width: 600px) {
  .history-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; padding: 14px; }
}
@media (min-width: 1100px) {
  .history-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 16px; }
}

/* Untereinander über die volle Breite (z.B. Wasserqualität-Detail).
   Doppelte Klasse für höhere Spezifität, damit es unabhängig von der
   Deklarationsreihenfolge die .history-grid-Breakpoints überschreibt. */
.history-grid.history-grid--stacked { grid-template-columns: 1fr; }
@media (min-width: 600px) { .history-grid.history-grid--stacked { grid-template-columns: 1fr; } }
@media (min-width: 1100px) { .history-grid.history-grid--stacked { grid-template-columns: 1fr; } }
.history-grid--stacked .chart-wrap { height: 260px; }
@media (min-width: 600px) { .history-grid--stacked .chart-wrap { height: 320px; } }
@media (min-width: 900px) { .history-grid--stacked .chart-wrap { height: 380px; } }

.chart-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px 10px;
}
.chart-label {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.chart-unit { font-size: 10px; font-weight: 500; color: var(--text-muted); }
.chart-wrap { position: relative; height: 140px; }
@media (min-width: 600px) { .chart-wrap { height: 160px; } }
@media (min-width: 900px) { .chart-wrap { height: 180px; } }

/* ── SEARCH ──────────────────────────────────────────────── */
.search-wrap { flex: 1; min-width: 0; max-width: 180px; }
.sensor-search-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 9px;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.sensor-search-input::placeholder { color: var(--text-muted); }
.sensor-search-input:focus { border-color: var(--accent); }

/* ── SUBGROUP HEADER ─────────────────────────────────────── */
.subgroup-header {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 2px 4px;
  border-bottom: 1px solid var(--border);
  margin-top: 4px;
}
.subgroup-header:first-child { margin-top: 0; }

/* ── DETAIL PANEL ────────────────────────────────────────── */
.detail-panel { display: none; margin-top: 16px; }
.detail-panel--open { display: block; }
.detail-panel--fadein { animation: panelFadeIn 0.3s cubic-bezier(0.22,1,0.36,1) both; }
@keyframes panelFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.detail-panel-title {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  flex-wrap: wrap;
  min-width: 0;
}
.detail-panel-icon { font-size: 17px; flex-shrink: 0; }
.detail-panel-title h2 {
  font-size: 14px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0;
}

.detail-panel-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.detail-close {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 12px; flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s;
}
.detail-close:hover { color: var(--critical); border-color: var(--critical); }

.detail-current { padding: 10px 14px 0; }
.detail-current-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}
.detail-kpi {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--kpi-color, var(--accent));
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  min-width: 0;
}
.detail-kpi-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.7px; color: var(--text-muted); margin-bottom: 2px;
  overflow-wrap: break-word; word-break: break-word;
}
.detail-kpi-val {
  font-family: var(--font-display);
  font-size: clamp(16px, 3vw, 20px);
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}
.detail-kpi-unit { font-size: 11px; color: var(--text-muted); margin-left: 2px; font-weight: 400; }

/* ── TOPICS SECTION ──────────────────────────────────────── */
.topics-section { padding: 0 0 40px; }
@media (min-width: 600px) { .topics-section { padding: 0 0 56px; } }

.topics-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 600px) { .topics-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; } }
@media (min-width: 960px) { .topics-grid { grid-template-columns: repeat(4, 1fr); gap: 18px; } }

.topics-grid--single {
  grid-template-columns: 1fr;
  max-width: 480px;
}

.topic-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.topic-card--active { border-color: rgba(var(--accent-rgb),0.3); cursor: pointer; }
.topic-card--active:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 10px 32px rgba(0,0,0,0.12);
}
.topic-card--featured { grid-column: span 1; }
@media (min-width: 600px) { .topic-card--featured { grid-column: span 2; } }
@media (min-width: 960px) { .topic-card--featured { grid-column: span 2; } }

.topic-card-header { display: flex; align-items: center; justify-content: space-between; }
.topic-icon { font-size: 26px; line-height: 1; }
.topic-status {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; padding: 3px 9px; border-radius: 20px;
}
.topic-status--live {
  display: flex; align-items: center; gap: 5px;
  background: rgba(var(--accent-rgb),0.12);
  color: var(--ok);
  border: 1px solid rgba(var(--accent-rgb),0.3);
}
.topic-status-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--ok);
  animation: livePulse 2s ease-in-out infinite;
}
@keyframes livePulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.65); }
}

.topic-title {
  font-family: var(--font-display);
  font-size: 15px; font-weight: 800;
  color: var(--text); line-height: 1.2;
}
.topic-desc { font-size: 12.5px; color: var(--text-muted); line-height: 1.55; flex: 1; }

.topic-kpis {
  display: flex; gap: 0;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}
.topic-kpi {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 7px 4px;
  border-right: 1px solid var(--border);
  min-width: 0;
}
.topic-kpi:last-child { border-right: none; }
.topic-kpi-val {
  font-family: var(--font-display);
  font-size: clamp(12px, 2.5vw, 15px);
  font-weight: 800; color: var(--text); line-height: 1.1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.topic-kpi-label {
  font-size: 9px; color: var(--text-muted); margin-top: 2px;
  text-align: center; white-space: nowrap;
}

.topic-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 700; color: var(--ok);
  padding-top: 4px; border-top: 1px solid var(--border); margin-top: auto;
}
.topic-arrow { transition: transform 0.2s; }
.topic-card--active:hover .topic-arrow { transform: translateX(4px); }

/* ── PROJECTS GRID ───────────────────────────────────────── */
.projects-section { padding: 0 0 48px; }
.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 480px) { .projects-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 760px) { .projects-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
@media (min-width: 1100px){ .projects-grid { grid-template-columns: repeat(4, 1fr); } }

.project-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--card-accent, var(--accent));
  border-radius: var(--radius);
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  min-width: 0;
}
.project-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
.project-card-icon { font-size: 24px; flex-shrink: 0; }
.project-card-body { flex: 1; min-width: 0; }
.project-card-body h3 {
  font-family: var(--font-display);
  font-size: 13px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-bottom: 2px;
}
.project-card-body p { font-size: 11px; color: var(--text-muted); line-height: 1.4; }
.project-card-meta { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.project-card-val {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 500;
  background: var(--surface2);
  border-radius: 4px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.project-card-val.ok       { color: var(--ok);       border-color: rgba(82,183,136,0.3); }
.project-card-val.warn     { color: var(--warn);     border-color: rgba(244,162,97,0.3); }
.project-card-arrow {
  color: var(--text-muted); flex-shrink: 0; font-size: 14px;
  transition: transform 0.15s, color 0.15s;
}
.project-card:hover .project-card-arrow { color: var(--card-accent, var(--accent)); transform: translateX(3px); }

/* ── ABOUT SECTION ───────────────────────────────────────── */
.about-section { padding: 0 0 48px; }
.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  border-top: 1px solid var(--border);
  padding-top: 28px;
}
@media (min-width: 600px) { .about-grid { grid-template-columns: repeat(3, 1fr); gap: 20px; } }
.about-card { display: flex; flex-direction: column; gap: 7px; }
.about-icon { font-size: 24px; line-height: 1; }
.about-card h3 { font-family: var(--font-display); font-size: 14px; font-weight: 700; }
.about-card p  { font-size: 13px; color: var(--text-muted); line-height: 1.6; }

/* ── HOME HERO VISUAL ────────────────────────────────────── */
.home-hero-inner { margin-bottom: 24px; }

/* ── COMPARE PAGE ────────────────────────────────────────── */
.compare-controls {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.compare-control-group {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}
.compare-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted);
  padding-top: 5px; min-width: 72px; flex-shrink: 0;
}
@media (max-width: 599px) { .compare-label { min-width: 100%; padding-top: 0; } }

.compare-chart-wrap {
  padding: 14px;
  height: 280px;
  position: relative;
}
@media (min-width: 600px) { .compare-chart-wrap { height: 340px; } }
@media (min-width: 900px) { .compare-chart-wrap { height: 400px; } }

.compare-table-wrap { overflow-x: auto; }
.compare-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
  min-width: 480px;
}
.compare-table th {
  padding: 9px 12px; text-align: left;
  font-size: 10px; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-muted);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.compare-table td {
  padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle;
}
.compare-table tr:last-child td { border-bottom: none; }
.compare-table tr:hover td { background: var(--surface2); }
.td-mono { font-family: var(--font-display); font-weight: 600; font-size: 12px; }
.td-muted { color: var(--text-muted); font-weight: 400; }

/* ── SENSOR DETAIL PANEL HISTORY ─────────────────────────── */
.panel-history {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* ── FOOTER ──────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--border); padding: 16px 0; }
.site-footer p { color: var(--text-muted); font-size: 12px; text-align: center; }
.site-footer a { color: var(--text-muted); text-decoration: underline; }
.site-footer a:hover { color: var(--text); }
.footer-partner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
}
.footer-partner-logo { height: 22px; width: auto; vertical-align: middle; }

/* ── LOADING ─────────────────────────────────────────────── */
.loading-spinner {
  text-align: center; color: var(--text-muted);
  padding: 28px 16px; font-size: 13px;
}

/* ── PULSE ANIMATION ─────────────────────────────────────── */
.pulse-dot {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  width: 16px; height: 16px; border-radius: 50%; background: var(--accent);
}
.pulse-ring {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  width: 16px; height: 16px;
  border: 2px solid var(--accent); border-radius: 50%;
  animation: pulseRing 2.4s ease-out infinite; opacity: 0;
}
.pulse-ring:nth-child(2) { animation-delay: 1.2s; }
@keyframes pulseRing {
  0%   { width: 16px; height: 16px; opacity: 0.7; }
  100% { width: 80px; height: 80px; opacity: 0; }
}

/* ── SCROLLBAR ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 3px; }

/* ── TRANSITIONS ─────────────────────────────────────────── */
.panel, .sensor-item, .project-card, .topic-card, .meta-badge {
  transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

/* ═══════════════════════════════════════════════════════════
   Durchflussmessungen – spezifische Komponenten
   ═══════════════════════════════════════════════════════════ */

/* Dashboard-Grid: 2 gleichbreite Spalten für Durchfluss */
.dashboard-grid--equal {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 900px) {
  .dashboard-grid--equal { grid-template-columns: 1fr 1fr; gap: 20px; }
}

/* Untereinander über die volle Breite (z.B. Verlaufscharts).
   Doppelte Klasse für höhere Spezifität, unabhängig von der Deklarationsreihenfolge. */
.dashboard-grid--equal.dashboard-grid--stacked { grid-template-columns: 1fr; }
@media (min-width: 900px) {
  .dashboard-grid--equal.dashboard-grid--stacked { grid-template-columns: 1fr; }
}

/* Panel-Hint (kleiner grauer Zusatztext im Header) */
.panel-hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 4px;
}

/* History-Wrap: Bereich für Verlaufscharts */
.history-wrap {
  padding: 12px 14px;
  min-height: 200px;
}
.history-wrap canvas {
  width: 100% !important;
  height: 240px !important;
  display: block;
}

/* Legende neben Chart-Titel */
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  flex: 1;
  justify-content: flex-end;
  min-width: 0;
}
.leg-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}
.leg-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Zeitraum-Steuerung */
.timecontrol {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0 16px;
}
.timecontrol-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.timecontrol-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  flex-shrink: 0;
  display: none;
}
@media (min-width: 600px) { .timecontrol-sep { display: block; } }

/* Custom-Zeitraum Eingaben */
.custom-range-inputs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.dt-field {
  display: flex;
  align-items: center;
  gap: 4px;
}
.dt-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.dt-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 4px 8px;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  width: 120px;
}
.dt-input.dt-time { width: 70px; }
.dt-input:focus { border-color: var(--accent); }
.dt-arrow {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Export-Button */
.export-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 3px 12px;
  font-size: 11px;
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.export-btn:hover { color: var(--accent); border-color: var(--accent); }
.export-btn.loading { opacity: 0.6; pointer-events: none; }

/* Statistik-Karten */
#stats-grid {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stat-sensor-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.stat-sensor-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.stat-sensor-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.stat-sensor-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}
.stat-sensor-period {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.stat-sensor-values {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
@media (max-width: 599px) { .stat-sensor-values { grid-template-columns: repeat(2, 1fr); } }

.stat-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.stat-val {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.stat-val.warn { color: var(--warn); }
.stat-unit {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
}

/* Mini-Charts Einzelsensoren */
.chart-current {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  margin-left: auto;
}

/* Sensor-Liste Durchfluss: Balken innerhalb Label-Wrap */
.sensor-label-wrap .sensor-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
  width: 100%;
}
.sensor-label-wrap .sensor-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}

/* ═══════════════════════════════════════════════════════════
   Fehlende Klassen – Ibbenbüren spezifisch
   ═══════════════════════════════════════════════════════════ */

/* Logo-Mark (SVG-Icon im Header) */
.logo-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Panel-Varianten */
.panel-sensors {
  display: flex;
  flex-direction: column;
}
.panel-sensors .sensor-list {
  flex: 1;
  overflow-y: auto;
}

.panel-map--full {
  display: flex;
  flex-direction: column;
}
.panel-map--full #map,
.panel-map--full #wetter-map {
  flex: 1;
  min-height: 300px;
}
@media (min-width: 600px) {
  .panel-map--full #map,
  .panel-map--full #wetter-map { min-height: 420px; }
}
@media (min-width: 900px) {
  .panel-map--full #map,
  .panel-map--full #wetter-map { min-height: 520px; }
}

/* Wetter-Karte: eigene ID */
#wetter-map {
  width: 100%;
  background: var(--surface2);
}

/* history-grid für Einzelcharts */
.history-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 12px;
  transition: opacity 0.2s ease;
}
@media (min-width: 600px) {
  .history-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; padding: 14px; }
}
@media (min-width: 1100px) {
  .history-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 16px; }
}

/* ── Leaflet z-index: Karte bleibt unter Header und Content ── */
.leaflet-control-container { z-index: 400 !important; }
.leaflet-top,
.leaflet-bottom { z-index: 400 !important; }
.leaflet-pane   { z-index: 200 !important; }
.leaflet-map-pane { z-index: 200 !important; }
.leaflet-overlay-pane { z-index: 250 !important; }
.leaflet-marker-pane  { z-index: 300 !important; }
.leaflet-popup-pane   { z-index: 350 !important; }
/* Header hat z-index 1000, Karten-Controls bleiben darunter beim Scrollen */
.panel-map, .panel-map--full {
  overflow: hidden;
  position: relative;
  z-index: 0;
}

/* custom-range innerhalb timecontrol: kein Extra-Padding (Durchfluss-Pattern) */
.timecontrol .custom-range {
  padding: 0;
  flex-basis: 100%;
}
@media (min-width: 900px) {
  .timecontrol .custom-range {
    flex-basis: auto;
  }
}

/* ── Startseite: Übersichtskarte ─────────────────────────── */

.map-section {
  padding: 0 0 48px;
}

.home-map-panel {
  padding: 0;
  overflow: hidden;
}

#home-map {
  width: 100%;
  height: 380px;
  background: var(--surface2);
}

@media (min-width: 600px)  { #home-map { height: 440px; } }
@media (min-width: 900px)  { #home-map { height: 520px; } }

/* Niederschlag Toggle-Button */
.rain-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 2px 10px;
  font-size: 11px;
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
}
.rain-toggle:hover { color: #38bdf8; border-color: #38bdf8; }
.rain-toggle.active {
  background: rgba(56,189,248,0.12);
  color: #38bdf8;
  border-color: #38bdf8;
}

/* Panel-Header mit Chart-Legende: zweizeilig ohne Umbruch-Chaos */
.panel-header--chart {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}
.panel-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}
.panel-header--chart .chart-legend {
  min-height: 0;
  flex-wrap: wrap;
}


/* ── Pegel ───────────────────────────────────────────────── */

.pegel-current {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  padding: 12px 0 8px;
}

.pegel-kpi {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-top: 3px solid var(--kpi-color, var(--accent));
  border-radius: 8px;
  padding: 10px 12px;
}
.pegel-kpi-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.pegel-kpi-val {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--kpi-color, var(--text-primary));
  line-height: 1;
}
.pegel-kpi-unit {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 2px;
}

.pegel-history-wrap {
  padding: 14px;
  min-height: 300px;
}
.pegel-history-wrap canvas {
  width: 100% !important;
  height: 280px !important;
}

/* Stations-Checkboxen im Vergleich */
.station-check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0;
}
.station-check {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  user-select: none;
}
.station-check input { display: none; }
.station-check-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid var(--sc, var(--accent));
  transition: background 0.15s;
  flex-shrink: 0;
}
.station-check input:checked ~ .station-check-dot {
  background: var(--sc, var(--accent));
}
.station-check input:checked ~ span { color: var(--text-primary); font-weight: 600; }

/* Tabellen-Zellen Pegel */
.td-mono { font-size: 12px; font-family: monospace; }
.td-muted { color: var(--text-muted); }

/* Login & Logout */
.logout-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 4px 12px;
  font-size: 12px;
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.logout-btn:hover { color: var(--text); border-color: var(--text-muted); }

.login-section {
  min-height: calc(100vh - 120px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 40px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.10);
  text-align: center;
}
.login-logo { margin-bottom: 20px; display: flex; justify-content: center; }
.login-logo-img { height: 56px; width: auto; max-width: 100%; }
.login-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 6px;
}
.login-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 24px;
}
.login-error {
  background: rgba(230,57,70,0.12);
  border: 1px solid var(--critical);
  color: var(--critical);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.88rem;
  margin-bottom: 20px;
  text-align: left;
}
.login-form { text-align: left; }
.login-field { margin-bottom: 16px; }
.login-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.login-field input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color 0.2s;
  outline: none;
}
.login-field input:focus { border-color: var(--accent); }
.login-pw-wrap { position: relative; }
.login-pw-wrap input { padding-right: 44px; }
.login-pw-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  opacity: 0.6;
  transition: opacity 0.2s;
}
.login-pw-toggle:hover { opacity: 1; }
.login-btn {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  margin-top: 8px;
  transition: opacity 0.2s, transform 0.1s;
}
.login-btn:hover  { opacity: 0.9; }
.login-btn:active { transform: scale(0.98); }
.login-footer {
  margin-top: 24px;
  font-size: 0.78rem;
  color: var(--text-muted);
}
@media (max-width: 480px) {
  .login-card { padding: 28px 20px 24px; }
}
