/* Farben: hell als Standard, dunkel automatisch nach Geräte-Einstellung */
:root {
  color-scheme: light dark;
  --ground: #F3F5F4;
  --card: #FFFFFF;
  --border: #DDE3E1;
  --dashed: #B4BFBC;
  --text: #17201E;
  --muted: #55625F;
  --accent: #0F6E66;
  --accent-soft: #E1EFED;
  --on-accent: #FFFFFF;
  --error: #B3261E;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #111615;
    --card: #1A2120;
    --border: #2B3533;
    --dashed: #46524F;
    --text: #E9EFED;
    --muted: #9DAAA7;
    --accent: #5FD0C5;
    --accent-soft: #1F3331;
    --on-accent: #111615;
    --error: #F2B8B5;
  }
}

/* Grundlagen (gelten für alle Seiten) */
body { margin: 0; font: 16px/1.5 system-ui, sans-serif; background: var(--ground); color: var(--text); }
main { max-width: 26rem; margin: 10vh auto; padding: 0 1rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; margin-top: 1.5rem; }
a { color: var(--accent); }
label { display: block; margin: 0.9rem 0; }
input { display: block; width: 100%; box-sizing: border-box; padding: 0.65rem; font: inherit; margin-top: 0.25rem;
  background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 10px; }
button { padding: 0.65rem 1.2rem; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--accent); color: var(--on-accent); border: 0; border-radius: 10px; }
input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
pre { padding: 0.8rem; border: 1px solid var(--border); border-radius: 10px; background: var(--card); font-size: 1.05rem; white-space: pre-wrap; }
.error { padding: 0.6rem 0.8rem; border-left: 4px solid var(--error); }
.hint { font-size: 0.9rem; color: var(--muted); }

/* Interner Bereich (body class="app") */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.app main { flex: 1; width: 100%; max-width: 65rem; margin: 0 auto; padding: 3rem 1.5rem; box-sizing: border-box; }

.topbar { background: var(--card); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 65rem; margin: 0 auto; padding: 0.85rem 1.5rem; box-sizing: border-box;
  display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: space-between; align-items: center; }
.brand { display: flex; align-items: center; gap: 0.6rem; }
.brand a { color: var(--text); text-decoration: none; font-size: 1.125rem; font-weight: 700; letter-spacing: -0.01em; }
.badge { font-size: 0.75rem; font-weight: 600; padding: 0.2rem 0.6rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.user { display: flex; align-items: center; gap: 0.6rem; font-size: 0.875rem; color: var(--muted); }
.user form { margin: 0; }
.btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.9rem; box-sizing: border-box;
  background: none; border: 1px solid var(--border); border-radius: 10px; color: var(--text); text-decoration: none;
  font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { border-color: var(--accent); }

.intro { margin-bottom: 1.75rem; }
.intro h1 { margin: 0; font-size: 2rem; line-height: 1.2; letter-spacing: -0.02em; }
.intro p { margin: 0.35rem 0 0; color: var(--muted); }

/* Kacheln: füllen die Breite, auf dem iPhone eine Spalte */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 1rem; }
.tile { display: flex; flex-direction: column; gap: 0.9rem; min-height: 10.75rem; padding: 1.4rem; box-sizing: border-box;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px; color: var(--text); text-decoration: none; }
a.tile:hover { border-color: var(--accent); }
.tile-top { display: flex; justify-content: space-between; align-items: flex-start; color: var(--muted); }
.tile-icon { width: 44px; height: 44px; border-radius: 11px; display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); }
.tile-body { margin-top: auto; }
.tile-name { font-size: 1.125rem; font-weight: 600; }
.tile-text { font-size: 0.875rem; color: var(--muted); }
.tile-empty { background: none; border-style: dashed; border-color: var(--dashed); color: var(--muted); }
.tile-empty .tile-icon { background: none; border: 1px dashed var(--dashed); color: var(--muted); }

.foot { max-width: 65rem; width: 100%; margin: 0 auto; padding: 1.25rem 1.5rem; box-sizing: border-box; font-size: 0.8125rem; color: var(--muted); }

/* ---------- Abo-Überwacher (/intern/abo/) ---------- */
[hidden] { display: none !important; }
.abo-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.abo-stat, .abo-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 1.1rem 1.25rem; }
.abo-card { margin-bottom: 1rem; }
.abo-card h2 { margin: 0 0 0.9rem; }
.abo-stat-label, .abo-stat-sub { font-size: 0.875rem; color: var(--muted); }
.abo-stat-value { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Balken pro Kategorie */
.abo-bar-row { display: grid; grid-template-columns: minmax(5.5rem, 9rem) 1fr auto; gap: 0.6rem; align-items: center; margin: 0.45rem 0; font-size: 0.92rem; }
.abo-bar-track { height: 14px; border-radius: 7px; background: var(--accent-soft); overflow: hidden; }
.abo-bar-fill { height: 100%; min-width: 3px; border-radius: 7px; background: var(--accent); }
.abo-bar-amt { font-variant-numeric: tabular-nums; white-space: nowrap; }
.abo-bar-amt small { color: var(--muted); }

/* Werkzeugleiste und Liste */
.abo-toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; }
.abo-toolbar h2 { margin: 0; flex: 1; }
.abo-toolbar button { min-height: 44px; }
.abo-select, .abo-form select, .abo-form textarea { box-sizing: border-box; min-height: 44px; padding: 0.55rem 0.65rem; font: inherit;
  background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 10px; max-width: 100%; }
.abo-row { display: grid; grid-template-columns: 1fr auto; gap: 0.25rem 0.75rem; width: 100%; padding: 0.85rem 0; text-align: left;
  background: none; color: var(--text); font-weight: 400; border: 0; border-top: 1px solid var(--border); border-radius: 0; }
.abo-row:hover .abo-name { color: var(--accent); }
.abo-name { font-weight: 600; }
.abo-meta { font-size: 0.875rem; color: var(--muted); }
.abo-price { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.abo-price small { display: block; font-weight: 400; color: var(--muted); }
.abo-off { opacity: 0.6; }
.abo-badge { display: inline-block; margin-top: 0.3rem; padding: 0.15rem 0.65rem; border-radius: 10px; font-size: 0.8125rem;
  border: 1px solid var(--border); color: var(--muted); }
.abo-badge-soon { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.abo-badge-urgent { border-color: var(--error); color: var(--error); font-weight: 600; }
.abo-empty { text-align: center; color: var(--muted); padding: 1.25rem 0; }
.abo-export { margin: 0.75rem 0 0; font-size: 0.875rem; }

/* Formular im Dialog */
.abo-dialog { width: min(35rem, calc(100vw - 1.5rem)); max-height: calc(100vh - 1.5rem); box-sizing: border-box; padding: 1.25rem;
  background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 14px; }
.abo-dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.abo-dialog h2 { margin: 0 0 0.5rem; }
.abo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 0.75rem; }
.abo-full { grid-column: 1 / -1; }
.abo-form label { margin: 0.45rem 0; font-size: 0.875rem; color: var(--muted); }
.abo-form input, .abo-form select, .abo-form textarea { display: block; width: 100%; margin-top: 0.25rem; background: var(--ground); }
.abo-inline { display: flex; gap: 0.4rem; }
.abo-inline input { flex: 1; min-width: 0; }
.abo-form .abo-inline select { width: auto; }
.abo-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.abo-actions button { min-height: 44px; }
.abo-spacer { flex: 1; }
.abo-danger { color: var(--error); }
@media (max-width: 32rem) {
  .abo-grid { grid-template-columns: 1fr; }
  /* Schmal: Name und Betrag oben, Balken in voller Breite darunter */
  .abo-bar-row { grid-template-columns: 1fr auto; }
  .abo-bar-track { grid-column: 1 / -1; grid-row: 2; }
}

/* =========================================================
   Öffentliche Startseite (httpdocs/index.php) – Variante 1b «Kacheln»
   An das Ende von httpdocs/style.css anhängen.
   Nutzt nur die vorhandenen Variablen aus :root
   (--ground, --card, --border, --text, --muted, --accent,
   --accent-soft, --on-accent). Keine neuen Farben.
   ========================================================= */

body.home {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ground);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Kopfzeile: Marke links, «Anmelden» dezent rechts */
.home-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px clamp(16px, 5vw, 56px);
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.home-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 15px;
  font-weight: 650;
}
.home-brand::before {           /* kleines Petrol-Quadrat als Marke */
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--accent);
}
.home-login {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 4px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
}
.home-login:hover { color: var(--text); }
.home-login svg { width: 15px; height: 15px; }

/* Inhaltsbereich */
.home-main {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  box-sizing: border-box;
  padding: clamp(32px, 7vw, 88px) clamp(16px, 5vw, 56px) clamp(32px, 5vw, 64px);
  display: flex;
  flex-direction: column;
  gap: clamp(32px, 5vw, 56px);
}

/* Begrüssung */
.home-hero {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 640px;
}
.home-kicker {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}
.home-hero h1 {
  margin: 0;
  font-size: clamp(42px, 9vw, 80px);
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.home-accent { color: var(--accent); }   /* letztes Wort der Überschrift */

/* Kleines Etikett «Website im Aufbau» mit pulsierendem Punkt */
.home-badge {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}
.home-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: home-pulse 2s ease-in-out infinite;
}
@keyframes home-pulse { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .home-badge::before { animation: none; } }
.home-lead {
  margin: 0;
  font-size: clamp(16px, 1.8vw, 19px);
  line-height: 1.55;
  color: var(--muted);
  text-wrap: pretty;
}

/* Kacheln: 3 nebeneinander auf Desktop, untereinander auf dem iPhone */
.home-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.home-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.home-card h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
}
.home-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
}
.home-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.home-icon svg { width: 20px; height: 20px; }

/* Kontaktkarte: Text links, Knopf rechts; bricht auf dem iPhone um */
.home-contact {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.home-contact > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.home-mail {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 20px;
  box-sizing: border-box;
  max-width: 100%;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.home-mail:hover { filter: brightness(1.08); }
.home-mail svg { width: 20px; height: 20px; flex: 0 0 20px; }

/* Fusszeile */
.home-foot {
  margin-top: auto;
  padding: 20px clamp(16px, 5vw, 56px);
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* Sichtbarer Fokus für Tastaturbedienung */
.home-login:focus-visible,
.home-mail:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* iPhone: Mail-Knopf über die ganze Breite, weniger Innenabstand,
   damit die Adresse auf eine Zeile passt (sonst Umbruch beim @) */
@media (max-width: 30rem) {
  .home-mail { width: 100%; justify-content: center; padding: 0 14px; font-size: 14px; }
}

/* ---------- Kontaktformular (Startseite) und Nachrichten (/intern/kontakt/) ---------- */
/* Karte: Text links, Knopf «Nachricht schreiben» rechts. Das Formular steckt in
   <details>: öffnet sich ohne JavaScript, wenn man auf den Knopf (summary) klickt. */
.home-form { position: relative; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.home-form > div { display: flex; flex-direction: column; gap: 4px; }
.home-details[open] { flex: 1 1 100%; }

/* summary als Knopf gestalten, Dreieck des Browsers ausblenden */
.home-details > summary { list-style: none; cursor: pointer; }
.home-details > summary::-webkit-details-marker { display: none; }
.home-open { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 22px;
  box-sizing: border-box; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-size: 15px; font-weight: 600; }
.home-open:hover { filter: brightness(1.08); }
.home-open svg { width: 20px; height: 20px; }
.home-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.home-close { display: none; }
/* Offen: Knopf wird zu «Schliessen», oben rechts in der Karte */
.home-details[open] > summary { position: absolute; top: 16px; right: 16px; min-height: 44px; padding: 0 14px;
  background: none; color: var(--muted); border: 1px solid var(--border); font-size: 14px; }
.home-details[open] > summary:hover { color: var(--text); filter: none; }
.home-details[open] .home-label { display: none; }
.home-details[open] .home-close { display: inline; }
.home-details[open] > summary svg { display: none; }
/* Platz für «Schliessen», damit der Text nicht darunter läuft */
.home-form:has(> .home-details[open]) > div { padding-right: 110px; }

.home-form form { display: flex; flex-direction: column; gap: 14px; margin: 4px 0 0; }
.home-form label { margin: 0; font-size: 14px; font-weight: 600; }
/* 16 px in Feldern: sonst zoomt Safari auf dem iPhone beim Antippen hinein */
.home-form input { font-size: 16px; font-weight: 400; min-height: 44px; }
/* Nachricht: gleich wie die anderen Felder, nur höher; langer Text scrollt */
.home-textarea { display: block; width: 100%; box-sizing: border-box; margin-top: 0.25rem; padding: 0.65rem;
  height: 14rem; min-height: 8rem; overflow-y: auto; resize: vertical;
  font: inherit; font-size: 16px; font-weight: 400; line-height: 1.5;
  background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 10px; }
.home-textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.home-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.home-send { display: inline-flex; align-items: center; justify-content: center; gap: 10px; align-self: flex-start;
  min-height: 48px; padding: 0 22px; font-size: 15px; }
.home-send svg { width: 20px; height: 20px; }
.home-ok { flex: 1 1 100%; margin: 0; padding: 14px 16px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 15px; }
.home-form .error p { margin: 0; color: var(--text); }
/* Bot-Falle: aus dem sichtbaren Bereich geschoben (nicht display:none, das erkennen manche Bots) */
.home-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 30rem) {
  .home-form-row { grid-template-columns: 1fr; }
  .home-send, .home-details:not([open]), .home-details:not([open]) > .home-open { width: 100%; }
}

.kontakt-back { margin: -0.75rem 0 1.25rem; font-size: 0.875rem; }
.kontakt-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 1.1rem 1.25rem; margin-bottom: 1rem; }
.kontakt-subject { font-weight: 600; overflow-wrap: anywhere; }
.kontakt-meta { font-size: 0.875rem; color: var(--muted); overflow-wrap: anywhere; }
.kontakt-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0.75rem 0; }
.kontakt-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.kontakt-actions form { margin: 0; }
.kontakt-delete { color: var(--error); }
