:root {
  --bg: #111827; --card: #1f2937; --border: #374151;
  --text: #e5e7eb; --muted: #9ca3af;
  --green: #16a34a; --amber: #d97706; --red: #dc2626; --blue: #60a5fa;
  --accent: #3b82f6;
  --nav-h: 58px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); overscroll-behavior-x: none; }
body {
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px; max-width: 600px; margin: 0 auto;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px);
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font-family: inherit; }

/* Kopfzeile */
.topbar {
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top));
  display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 15px; font-weight: 700; flex: 1; }
.topbar .sub { font-size: 10px; color: var(--muted); font-weight: 400; }
.topbar button {
  background: none; border: 1px solid var(--border); color: var(--blue);
  padding: 4px 10px; border-radius: 6px; font-size: 12px; cursor: pointer;
}

/* Navigation unten */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
  background: #0b1220; border-top: 1px solid var(--border);
  display: flex; justify-content: center;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav .inner { display: flex; width: 100%; max-width: 600px; }
.bottom-nav a {
  flex: 1; height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--muted); text-decoration: none; font-size: 10px; gap: 2px;
}
.bottom-nav a .i { font-size: 20px; line-height: 1; filter: grayscale(.6); opacity: .75; }
.bottom-nav a.active { color: var(--blue); font-weight: 700; }
.bottom-nav a.active .i { filter: none; opacity: 1; }

/* Karten & Allgemeines */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin: 10px 12px; }
.card h2 { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.muted { color: var(--muted); }
.btn {
  display: block; width: 100%; padding: 12px; background: var(--accent); border: none; border-radius: 10px;
  color: #fff; font-size: 15px; font-weight: 700; cursor: pointer; text-align: center; text-decoration: none;
}
.btn:disabled { background: #374151; color: var(--muted); }
.btn.secondary { background: var(--card); border: 1px solid var(--border); color: var(--text); }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 9px 10px; font-size: 14px; -webkit-appearance: none; appearance: none;
}
textarea { resize: vertical; min-height: 60px; }
::placeholder { color: var(--muted); }
.status { margin-top: 10px; padding: 10px 12px; border-radius: 8px; font-size: 12px; display: none; text-align: center; font-weight: 600; }
.status.ok  { background: #14532d; color: #86efac; display: block; }
.status.err { background: #7f1d1d; color: #fca5a5; display: block; }
.empty { text-align: center; color: var(--muted); padding: 32px 0; font-size: 12px; }
.loading { text-align: center; color: var(--muted); padding: 40px; }

/* Dialog (Konto) */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 950; display: none; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 960; background: #1e293b; color: var(--text);
  border-radius: 14px 14px 0 0; padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom));
  display: none; flex-direction: column; gap: 10px; max-width: 600px; margin: 0 auto;
}
.sheet.open, .sheet-bg.open { display: flex; }
.sheet-bg.open { display: block; }

/* Eingebettet im HA-Dashboard (?embed=1): keine eigene Navigation */
.embed body { padding-bottom: 12px; }
.embed { --nav-h: 0px; }
