/* ===== v5 Design: ruhiger, übersichtlicher (lädt nach style.css) =====
   Grundregeln: eine Hauptfarbe (--primary-color) für die wichtigste Aktion, Grau für Nebensächliches,
   Rot nur für Warnungen und Löschen. Mehr Weißraum, weniger Rahmen und Schatten. */

:root {
  --d-bg: #f4f5f2;
  --d-card: #ffffff;
  --d-line: #e3e5e0;
  --d-text: #1f2a22;
  --d-muted: #5b655e;
  --d-radius: 14px;
  --d-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 4px 16px rgba(0, 0, 0, 0.04);
}
body { background: var(--d-bg); color: var(--d-text); }
.as-layout, .admin-layout { background: var(--d-bg); }

/* Karten: flacher, mehr Luft */
.card, .admin-card, .tasks-container {
  border-radius: var(--d-radius) !important;
  box-shadow: var(--d-shadow) !important;
  border: 1px solid var(--d-line);
  padding: 22px !important;
  margin-bottom: 22px !important;
}
.as-header, .admin-header {
  background: transparent !important;
  box-shadow: none !important;
  padding: 4px 0 !important;
  margin-bottom: 14px !important;
}
.admin-card h2, .card h2 { border-bottom: none !important; padding-bottom: 0 !important; margin-bottom: 14px; }

/* Emojis nur im Menü und auf Knöpfen – nicht in jeder Überschrift (a11y.js packt sie in span[aria-hidden]) */
.admin-card h2 > span[aria-hidden="true"]:first-child, .admin-card h3 > span[aria-hidden="true"]:first-child,
.card h2 > span[aria-hidden="true"]:first-child, .card h3 > span[aria-hidden="true"]:first-child,
.as-header h1 > span[aria-hidden="true"]:first-child, .admin-header h1 > span[aria-hidden="true"]:first-child { display: none; }

/* ===== Knöpfe: ein Hauptknopf, Rest ruhig ===== */
.btn { border-radius: 10px; }
.btn-danger {
  background: #fff !important;
  color: #b3261e !important;
  border: 1px solid #e6b8b4 !important;
}
.btn-danger:hover { background: #fdecea !important; }
/* Telegram-Knöpfe (bisher knallblau) als ruhige Zweitknöpfe */
button[style*="#2ea6ff"] {
  background: #fff !important;
  color: var(--d-text) !important;
  border: 1px solid var(--d-line) !important;
}
/* „Foto hinzufügen“ unauffälliger */
.info-photo-upload .btn-sm, .info-photo-upload label.btn {
  background: transparent !important;
  color: var(--d-muted) !important;
  border: 1px dashed #b9beb6 !important;
}

/* ===== Datum: schlichte Zeile statt rotem Balken + gelben Knöpfen ===== */
.date-nav { gap: 10px !important; margin-bottom: 18px !important; flex-wrap: nowrap !important; }
.date-display {
  background: transparent !important;
  color: var(--d-text) !important;
  font-size: 20px !important;
  font-weight: 700 !important;
  min-width: 0 !important;
  flex: 1;
  padding: 6px 4px !important;
}
.date-nav .btn-sm {
  background: #fff !important;
  color: var(--d-text) !important;
  border: 1px solid var(--d-line) !important;
  border-radius: 999px !important;
  white-space: nowrap;
}
.date-nav .date-arrow-label { }
@media (max-width: 600px) {
  .date-nav .date-arrow-label { display: none; } /* am Handy nur Pfeile (Name bleibt für Screenreader) */
  .date-nav .btn-sm { min-width: 44px; min-height: 44px; font-size: 18px !important; padding: 0 !important; }
  .date-display { font-size: 17px !important; }
}

/* ===== Jeden Tag: Fortschritt oben, Erledigtes unten ===== */
.day-progress { margin: 0 0 18px; }
.day-progress-text { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 6px; }
.day-progress-bar { height: 12px; background: #e6e9e3; border-radius: 999px; overflow: hidden; }
.day-progress-fill { height: 100%; background: var(--primary-color); border-radius: 999px; transition: width .3s; }
.stats-info { display: none; } /* Zahl steht jetzt oben im Fortschritt */
.tasks-container { padding: 14px !important; }
.task-item { border-radius: 12px !important; margin-bottom: 10px !important; box-shadow: none !important; }
.done-section { margin-top: 14px; border-top: 1px solid var(--d-line); padding-top: 10px; }
.done-section > summary { cursor: pointer; font-weight: 700; color: var(--d-muted); padding: 8px 4px; list-style: none; }
.done-section > summary::-webkit-details-marker { display: none; }
.done-section > summary::before { content: '▸ '; }
.done-section[open] > summary::before { content: '▾ '; }
.task-section-title { font-size: 14px; font-weight: 700; color: var(--d-muted); text-transform: uppercase; letter-spacing: .04em; margin: 6px 4px 8px; }

/* ===== Admin: Wochentage aufklappbar ===== */
details.day-card > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 10px; }
details.day-card > summary::-webkit-details-marker { display: none; }
details.day-card > summary h2 { margin: 0 !important; }
details.day-card > summary::after { content: '▸'; margin-left: auto; color: var(--d-muted); }
details.day-card[open] > summary::after { content: '▾'; }
details.day-card[open] > summary { margin-bottom: 14px; }
.day-count { color: var(--d-muted); font-weight: 600; }

/* ===== Lange Erklärtexte hinter „ⓘ“ ===== */
details.card-help { margin: -6px 0 14px; }
details.card-help > summary { cursor: pointer; color: var(--d-muted); font-size: 14px; display: inline-block; padding: 4px 0; }
details.card-help > p { margin-top: 6px !important; }

/* ===== Handy: Menüleiste unten statt Kacheln oben ===== */
.bottom-nav { display: none; }
@media (max-width: 768px) {
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 9990;
    background: #fff; border-top: 1px solid var(--d-line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
  }
  .bottom-nav button {
    flex: 1; min-width: 0; background: none; border: none; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 2px; border-radius: 10px; color: var(--d-muted); font-size: 12px; font-weight: 600;
    position: relative;
  }
  .bottom-nav button .bn-icon { font-size: 22px; line-height: 1; }
  .bottom-nav button .bn-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .bottom-nav button.active { color: var(--primary-color); background: #eef3ea; }
  .bottom-nav .info-badge { position: absolute; top: 2px; right: calc(50% - 22px); margin: 0; }

  /* Seitenleiste nur noch als „Mehr“-Blatt */
  .as-sidebar, .admin-sidebar { display: none !important; }
  body.sheet-open .as-sidebar, body.sheet-open .admin-sidebar {
    display: block !important; position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 9995;
    max-height: 85vh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 18px 16px 90px !important;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25);
  }
  body.sheet-open::after { content: ''; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 9994; }
  .as-content, .admin-content { padding-bottom: 96px !important; }
  #helpFab { bottom: 76px !important; }
  #helpBubble { bottom: 150px !important; }
  #helpPanel { bottom: 76px !important; }
  .version-badge { bottom: 76px !important; }
}

/* ===== Tabellen am Handy als Karten ===== */
@media (max-width: 600px) {
  table.stacked, table.stacked tbody, table.stacked tr, table.stacked td { display: block; width: 100% !important; }
  table.stacked thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.stacked tr { background: #fff; border: 1px solid var(--d-line); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; }
  table.stacked td { border: none !important; padding: 4px 0 !important; text-align: left !important; }
  table.stacked td[data-label]:not([data-label=""])::before { content: attr(data-label) ": "; font-weight: 700; color: var(--d-muted); }
}

/* Leichte Sprache bleibt größer (a11y.js) */
html.ls .bottom-nav button { font-size: 13px; }

/* Korrekturen nach Sichtprüfung */
.date-nav { flex-direction: row !important; }
.date-display { min-width: 0 !important; }
.day-progress, .tasks-container { margin-right: 0; }
@media (min-width: 769px) { .as-content, .admin-content { padding-right: 90px !important; } } /* Platz für Karl Klammer */
@media (max-width: 768px) {
  .version-badge { display: none !important; }
  .sheet-version { display: block; margin-top: 18px; font-size: 13px; opacity: .85; }
}
@media (min-width: 769px) { .sheet-version { display: none; } }
.sheet-version { color: #fff; }

/* Kontrastkorrektur (a11y.js) sofort wirksam, ohne Überblenden */
[data-a11y-fg], [data-a11y-bg] { transition: none !important; }
