:root {
  /* Grün aus App-Icon (#9cb884) */
  --icon-green: #9cb884;
  --bg: #162016;
  --bg-elev: #223324;
  --bg-soft: #2c4030;
  --text: #f2f6ee;
  --muted: #b4c9a8;
  --accent: #e0b456;
  --accent-dim: #c4923a;
  --danger: #e34d46;
  --ok: #9cb884;
  --line: rgba(242, 246, 238, 0.12);
  --radius: 16px;
  --touch: 52px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(224, 180, 86, 0.12), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(156, 184, 132, 0.16), transparent 50%),
    var(--bg);
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  /* Allow Android/iOS pinch-zoom on the whole UI */
  touch-action: pan-x pan-y pinch-zoom;
}

/* iOS standalone / notch: keep chrome clear of status bar & home indicator */
body {
  padding-top: env(safe-area-inset-top, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
}

a { color: var(--accent); text-decoration: none; }

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 14px 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px 14px;
  position: relative;
  z-index: 2;
}

.brand {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
  display: block;
  object-fit: cover;
}
.brand strong { font-size: 1.15rem; letter-spacing: 0.02em; }
.brand span { color: var(--muted); font-size: 0.8rem; }
.online-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-left: -2px;
  color: var(--muted);
  transition: color 0.2s ease;
}
.online-badge.is-online { color: var(--ok); }
.online-badge.is-offline { color: var(--danger); }
.online-icon {
  display: block;
  fill: currentColor;
}
.online-badge.is-online .online-icon {
  animation: online-pulse 2.4s ease-in-out infinite;
}
@keyframes online-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-actions form {
  margin: 0;
}

.icon-btn {
  width: var(--touch);
  height: var(--touch);
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text);
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  line-height: 1;
}
.icon-btn:active { transform: scale(0.97); }

.section {
  margin-bottom: 16px;
}

.stream-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #101a10;
  border: 1px solid var(--line);
  aspect-ratio: 16 / 10;
}
.stream-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #101a10;
}
.stream-actions {
  position: absolute;
  right: 8px;
  bottom: 8px;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn {
  min-height: var(--touch);
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 600;
  padding: 12px 14px;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease, transform 0.08s ease;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}
.btn-primary {
  background: linear-gradient(180deg, #e0b456, var(--accent-dim));
  color: #1a1408;
  border-color: transparent;
}
.btn-danger {
  background: linear-gradient(180deg, #d45a4b, #9e352a);
  border-color: transparent;
}
.btn-ghost {
  background: var(--bg-soft);
}
.btn-block { width: 100%; }
.btn-on {
  background: linear-gradient(180deg, #f0d27a, #c9a13a);
  color: #1a1408;
}

.panel {
  background: rgba(34, 51, 36, 0.88);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}
.panel h2 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.panel-head h2 {
  margin: 0;
}
.status-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 0.95rem;
  text-transform: none;
  letter-spacing: 0;
}

.meta {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}
.meta strong { color: var(--text); font-weight: 600; }
.meta .pair {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,0.22);
  font-size: 0.9rem;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
}
.dot.warn { background: var(--accent); }
.dot.err { background: var(--danger); }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.switch-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.switch-title {
  line-height: 1.35;
}

.heat-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 12px;
  row-gap: 10px;
  align-items: center;
}
.heat-label {
  line-height: 1.35;
  min-width: 0;
}
.heat-temp {
  color: var(--muted);
  font-size: 0.95rem;
}
.heat-control {
  width: 52px;
  display: grid;
  place-items: center;
  justify-self: end;
}
.flame {
  height: 32px;
  display: grid;
  place-items: center;
}
.flame svg {
  display: block;
}
.flame-on svg {
  fill: #e23b2f;
  stroke: #e23b2f;
  stroke-width: 0;
}
.flame-off svg {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.6;
  stroke-linejoin: round;
}
.switch {
  position: relative;
  width: 52px;
  height: 32px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  inset: 0;
  background: #3a4f38;
  border-radius: 999px;
  transition: 0.2s;
}
.slider:before {
  content: "";
  position: absolute;
  height: 24px;
  width: 24px;
  left: 4px;
  bottom: 4px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}
.switch input:checked + .slider { background: var(--ok); }
.switch input:checked + .slider:before { transform: translateX(20px); }

.chart {
  width: 100%;
  height: 140px;
  display: block;
}

.login-wrap {
  min-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(400px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px 22px;
}
.login-card h1 {
  margin: 0 0 6px;
  font-size: 1.5rem;
}
.login-card p {
  margin: 0 0 20px;
  color: var(--muted);
}
.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}
.field label { font-size: 0.85rem; color: var(--muted); }
.field input, .field select {
  min-height: var(--touch);
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  padding: 0 14px;
  font-size: 1rem;
}
.error {
  background: rgba(196, 75, 60, 0.18);
  color: #ffb4aa;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 0.92rem;
}
.ok-banner {
  background: rgba(156, 184, 132, 0.2);
  color: #d4e8c8;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  text-align: center;
}
.login-brand img {
  width: 88px;
  height: 88px;
  border-radius: 22px;
  display: block;
  object-fit: cover;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}
.login-brand h1 {
  margin: 0;
}
.config-list { display: grid; gap: 12px; }
.log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.log-entry {
  display: grid;
  gap: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.log-entry:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}
.log-meta {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 8px;
  color: var(--muted);
  font-size: 0.78rem;
}
.log-level {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
}
.log-DEBUG { color: var(--muted); }
.log-INFO { color: var(--ok); }
.log-WARNING { color: var(--accent); }
.log-ERROR,
.log-CRITICAL { color: var(--danger); }
.log-name {
  min-width: 0;
}
.log-msg {
  margin: 0;
  font-size: 1rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.hint { color: var(--muted); font-size: 0.8rem; }
.kv .hint,
.meta .hint { margin-top: -4px; }
.switch-copy .hint { margin-top: 0; line-height: 1.35; }
