:root {
  --sand: #f5f0e6;
  --sand-deep: #e3d6c4;
  --sand-line: rgba(190, 170, 140, 0.35);
  --stone: #d5c7b8;
  --stone-soft: rgba(213, 199, 184, 0.85);
  --text-main: #1f2933;
  --text-soft: #6b7280;
  --accent: #10b981;   /* energetisches Grün */
  --accent-soft: rgba(16,185,129,0.1);
  --accent-strong: #0ea5e9; /* leichter Energie-Schimmer */
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at 10% 0%, rgba(255,255,255,0.9), transparent 55%),
    radial-gradient(circle at 90% 100%, rgba(209,250,229,0.7), transparent 55%),
    linear-gradient(135deg, #f9f5ee 0%, #efe3d3 45%, #e2f5ef 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Zen-Garten Hintergrund – feine Linien */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.4;
  background-image:
    repeating-radial-gradient(
      circle at 20% 120%,
      transparent 0,
      transparent 10px,
      var(--sand-line) 11px,
      transparent 12px
    ),
    repeating-radial-gradient(
      circle at 80% -20%,
      transparent 0,
      transparent 12px,
      var(--sand-line) 13px,
      transparent 14px
    );
  mix-blend-mode: multiply;
  z-index: -1;
}

/* Header oben (Razen + Beta-Pill) */
header {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 30%, #ffffff 0, rgba(255,255,255,0) 45%),
    radial-gradient(circle at 70% 70%, var(--accent-strong) 0, rgba(14,165,233,0.1) 60%);
  box-shadow:
    0 0 0 1px rgba(148,163,184,0.35),
    0 8px 20px rgba(15,118,110,0.35);
  position: relative;
  overflow: hidden;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 30% 18%;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.8);
  border-top-color: rgba(16,185,129,0.95);
  transform: rotate(-18deg);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.brand-text span:first-child {
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.9rem;
}

.brand-text span:last-child {
  font-size: 0.8rem;
  color: var(--text-soft);
}

.beta-pill {
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid rgba(148,163,184,0.7);
  background: rgba(255,255,255,0.8);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-soft);
}

.beta-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(16,185,129,0.25);
}

/* Hauptbereich: 2 Spalten – links Text, rechts Zen-Karte */
main {
  flex: 1;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

@media (max-width: 880px) {
  main {
    padding: 1.25rem 1.25rem 1.75rem;
  }
  header {
    padding-inline: 1.25rem;
  }
}

/* Hero-Text links */
.hero-text {
  max-width: 560px;
}

.hero-eyebrow {
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: 0.75rem;
}

.hero-title {
  font-size: clamp(2.1rem, 4vw, 2.7rem);
  line-height: 1.1;
  margin: 0 0 0.9rem;
}

.hero-title span {
  color: var(--accent-strong);
}

.hero-subtitle {
  margin: 0 0 1.2rem;
  font-size: 0.95rem;
  color: var(--text-soft);
  max-width: 36rem;
}

.hero-subtitle-zen {
  font-size: 0.9rem;
  color: #4b5563;
  margin-bottom: 1.4rem;
}

.helper-text {
  font-size: 0.75rem;
  color: var(--text-soft);
  margin: 0.2rem 0 0.6rem;
  line-height: 1.4;
}

/* Rechte Seite – Zen-Karte */
.zen-card {
  position: relative;
  border-radius: 1.5rem;
  padding: 1.25rem 1.3rem 1.4rem;
  background:
    radial-gradient(circle at 10% 0%, rgba(255,255,255,0.9), transparent 50%),
    radial-gradient(circle at 110% 170%, rgba(16,185,129,0.18), transparent 55%),
    linear-gradient(145deg, rgba(255,255,255,0.92), rgba(245,236,224,0.96));
  box-shadow:
    0 18px 40px rgba(148,118,94,0.4),
    0 0 0 1px rgba(214,211,209,0.8);
  overflow: hidden;
  max-width: 1100px;
  margin: 0 auto;
}

.zen-card::before {
  /* Sandkreis */
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  inset: 45% auto auto 50%;
  transform: translate(-50%, -55%);
  background:
    radial-gradient(circle, rgba(255,255,255,0.95) 0, rgba(245,240,230,0.9) 55%, rgba(230,216,198,0.9) 100%);
  box-shadow:
    0 18px 50px rgba(148,118,94,0.45),
    0 0 0 1px rgba(209,213,219,0.8);
  z-index: 0;
}

.zen-card::after {
  /* feine Kreise im Sand */
  content: "";
  position: absolute;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  inset: 46% auto auto 50%;
  transform: translate(-50%, -55%);
  border: 1px solid rgba(209,213,219,0.6);
  box-shadow:
    0 0 0 10px rgba(209,213,219,0.25),
    0 0 0 22px rgba(209,213,219,0.18),
    0 0 0 34px rgba(209,213,219,0.1);
  opacity: 0.9;
  z-index: 0;
}

.zen-header {
  position: relative;
  z-index: 1;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
}

.zen-header h2 {
  margin: 0;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 600;
  color: #4b5563;
}

.zen-header span {
  font-size: 0.8rem;
  color: var(--text-soft);
}

/* Info-Row unten */
.zen-footer {
  position: relative;
  z-index: 1;
  margin-top: 0.7rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.7rem;
  color: var(--text-soft);
  flex-wrap: wrap;
}

.zen-footer span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.zen-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
}

.zen-dot.pv {
  background: #facc15;
}

.zen-dot.grid {
  background: #ef4444;
}

/* Innerer Grid-Container für die App in der Zen-Karte */
.app-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 1rem;
}

@media (max-width: 880px) {
  .app-layout {
    grid-template-columns: 1fr;
  }
}

/* Karten in der Zen-Karte */
.card {
  background:
    radial-gradient(circle at 10% 0%, rgba(255,255,255,0.95), transparent 55%),
    linear-gradient(145deg, rgba(245,236,224,0.96), rgba(229,231,235,0.95));
  border-radius: 1.1rem;
  border: 1px solid rgba(209, 213, 219, 0.9);
  padding: 1rem 1.1rem;
  box-shadow:
    0 16px 32px rgba(148,118,94,0.28),
    0 0 0 1px rgba(214,211,209,0.9);
}

/* Überschrift in den Karten */
.card h2 {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4b5563;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Kleines Status-Chip */
.chip {
  display: inline-flex;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.7);
  font-size: 0.7rem;
  color: var(--text-soft);
  gap: 0.25rem;
  align-items: center;
  background: rgba(255,255,255,0.85);
}

.chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.2);
}

/* PV-Controls */
.pv-controls {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px dashed rgba(209,213,219,0.8);
  font-size: 0.8rem;
}

.pv-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pv-row label {
  min-width: 82px;
  color: var(--text-soft);
}

.pv-row input[type="range"] {
  flex: 1;
}

.pv-row select {
  flex: 1;
  font-size: 0.8rem;
  padding: 0.25rem 0.35rem;
  border-radius: 0.4rem;
  border: 1px solid rgba(209,213,219,0.9);
  background: rgba(255,255,255,0.9);
}

/* Device-List und Reihen – App im Zen-Garten */
.device-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* Voll ausgeklappter Zustand */
.device-row {
  border-radius: 0.8rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(209,213,219,0.9);
  background:
    radial-gradient(circle at top left, rgba(16,185,129,0.08), transparent 60%);
  display: grid;
  grid-template-columns: auto;
  gap: 0.4rem;
  font-size: 0.8rem;
  transition: background 0.15s ease, border-color 0.15s ease, padding 0.15s ease;
}

.device-row:hover {
  border-color: rgba(16,185,129,0.5);
  background:
    radial-gradient(circle at top left, rgba(16,185,129,0.12), transparent 60%);
}

/* Minimierte Geräte: etwas kompakter, aber Header bleibt sichtbar */
.device-row.collapsed {
  background:
    radial-gradient(circle at top left, rgba(16,185,129,0.04), transparent 60%);
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

/* Nur Details (Meta + Controls) ausblenden, nicht Header */
.device-row.collapsed .device-controls,
.device-row.collapsed .device-meta {
  display: none;
}

/* Sicherstellen, dass Header im collapsed-Zustand sichtbar bleibt */
.device-row.collapsed .device-header {
  display: flex;
}

/* „aktiv“-Label und Hinweis beim aktiven Gerät */
.device-enable span {
  font-size: 0.72rem;
  color: var(--text-soft);
}

.device-row:not(.collapsed) .device-name::after {
  content: " · aktiv";
  font-size: 0.7rem;
  color: #047857;
}

.device-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.device-header-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.device-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.device-meta {
  display: flex;
  gap: 0.4rem;
  color: var(--text-soft);
  font-size: 0.75rem;
  flex-wrap: wrap;
}

.device-meta span {
  white-space: nowrap;
}

.device-controls {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.1rem;
}

.range-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.range-row label {
  font-size: 0.75rem;
  color: var(--text-soft);
  min-width: 58px;
}

input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

.time-label {
  font-size: 0.75rem;
  color: var(--text-main);
  min-width: 46px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
  margin-top: 0.1rem;
}

.toggle-row label {
  font-size: 0.75rem;
  color: var(--text-soft);
}

/* Tarif-Legende */
.tariff-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-soft);
}

.tariff-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(209,213,219,0.9);
  background: rgba(255,255,255,0.9);
}

.tariff-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.tariff-dot.night {
  background: rgba(37, 99, 235, 0.9);  /* blau */
}

.tariff-dot.daylow {
  background: rgba(22, 163, 74, 0.9);  /* grün */
}

.tariff-dot.normal {
  background: rgba(148, 163, 184, 0.9); /* grau */
}

/* Summary-Badges unter dem Chart */
.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.summary-item {
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(209,213,219,0.9);
  font-size: 0.75rem;
  color: var(--text-soft);
  background: rgba(255,255,255,0.9);
}

.summary-item span {
  color: #047857;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  margin-left: 0.35rem;
}

/* Chart etwas kleiner halten */
canvas {
  max-height: 450px;
}

/* ============================= */
/* Feedback-Formular im Zen-Stil */
/* ============================= */

.feedback-card {
  max-width: 960px;
  margin: 1.5rem auto 0;
}

.feedback-card h2 {
  margin-bottom: 0.75rem;
}

.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  font-size: 0.85rem;
}

.feedback-block {
  padding: 0.6rem 0.75rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(209,213,219,0.9);
  background:
    radial-gradient(circle at top left, rgba(255,255,255,0.98), rgba(245,236,224,0.92));
}

.feedback-question-title {
  margin-bottom: 0.45rem;
  font-weight: 500;
}

.feedback-help {
  font-size: 0.75rem;
  color: var(--text-soft);
  margin-top: 0.2rem;
}

.feedback-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.9rem;
}

.feedback-options label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.feedback-options input[type="radio"],
.feedback-options input[type="checkbox"] {
  accent-color: var(--accent);
}

.feedback-inline-input {
  background: rgba(255,255,255,0.9);
  border-radius: 0.5rem;
  border: 1px solid rgba(209,213,219,0.9);
  padding: 0.35rem 0.5rem;
  color: var(--text-main);
  font-size: 0.8rem;
  min-width: 130px;
}

.feedback-textarea {
  width: 100%;
  min-height: 70px;
  resize: vertical;
  background: rgba(255,255,255,0.9);
  border-radius: 0.6rem;
  border: 1px solid rgba(209,213,219,0.9);
  padding: 0.55rem 0.7rem;
  color: var(--text-main);
  font-size: 0.8rem;
}

.feedback-submit-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.4rem;
}

.feedback-email {
  flex: 1 1 180px;
}

.feedback-email input {
  width: 100%;
  background: rgba(255,255,255,0.9);
  border-radius: 0.6rem;
  border: 1px solid rgba(209,213,219,0.9);
  padding: 0.45rem 0.6rem;
  color: var(--text-main);
  font-size: 0.8rem;
}

.feedback-submit-btn {
  padding: 0.55rem 1.2rem;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #0b1120;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(16,185,129,0.35);
  white-space: nowrap;
}

.feedback-submit-btn:hover {
  filter: brightness(1.05);
}

/* Footer unten */
footer {
  padding: 1rem 1.5rem 1.25rem;
  font-size: 0.75rem;
  color: var(--text-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

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

footer a:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  footer {
    flex-direction: column;
    align-items: flex-start;
    padding-inline: 1.25rem;
  }
}
