/* Gestaltung nach der DESIGN.md "Raycast" aus VoltAgent/awesome-design-md: durchgehend dunkler Grund,
   Flächen-Leiter statt Schatten, Haarlinien, weiße Pille als Hauptknopf, vier kräftige Akzentfarben für Kacheln.
   Handy zuerst; ab 48rem liegt die Navigation oben, ab 60rem wird die Startseite zum Kachelraster. */
:root {
  --grund: #07080a; --flaeche: #0d0d0d; --karte: #121212; --hoch: #18191a;
  --linie: #242728; --linie-stark: rgba(255, 255, 255, .16); --feldrand: #6a6b6c;
  --text: #f4f4f6; --fliess: #cdcdcd; --leise: #9c9c9d;
  --blau: #57c1ff; --rot: #ff6161; --gruen: #59d499; --gelb: #ffc533;
  --knopf: #ffffff; --knopf-text: #18191a;
  --f: var(--blau);  /* Farbe einer Kachel, eines Termins oder einer Person */
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--grund); color: var(--fliess);
  font: 400 1rem/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  letter-spacing: -.011em; -webkit-font-smoothing: antialiased;
}
body.angemeldet { padding-bottom: calc(5rem + env(safe-area-inset-bottom)); }
main { max-width: 44rem; margin: 0 auto; padding: 1.25rem 1rem 2rem; }
main.weit { max-width: 76rem; }
body:not(.angemeldet) main { max-width: 24rem; padding-top: 14vh; }
body:not(.angemeldet) form > button { width: 100%; }

h1, h2, h3 { color: var(--text); font-weight: 600; }
h1 { font-size: clamp(1.75rem, 5vw, 2.25rem); line-height: 1.1; letter-spacing: -.025em; margin: 0 0 1.25rem; text-wrap: balance; }
h2 { font-size: 1.125rem; line-height: 1.25; letter-spacing: -.015em; margin: 2rem 0 .75rem; }
h3 { font-size: 1rem; line-height: 1.3; margin: 1.5rem 0 .5rem; }
p { margin: 0 0 .75rem; }
a { color: var(--blau); text-decoration: none; }
a:hover { text-decoration: underline; }
small, .leise { color: var(--leise); font-size: .875rem; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .9em; color: var(--text); overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--blau); outline-offset: 2px; }

/* Karten und Kacheln: eine Stufe heller als der Grund, Haarlinie, kein Schatten */
section, .kachel, main > form:not(.hinzu), main > details, .posten, table {
  background: var(--karte); border: 1px solid var(--linie); border-radius: 16px;
}
section, main > form:not(.hinzu) { padding: 1.25rem; margin: 0 0 1rem; }
section > :first-child, form > :first-child { margin-top: 0; }
section > :last-child, form > :last-child, form > p:last-child > :last-child { margin-bottom: 0; }
form { margin: 0 0 1rem; }
section > form + form, section > p + form { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--linie); }
main > details { padding: 0 1.25rem; margin: 0 0 1rem; }
main > details > summary { display: flex; align-items: center; min-height: 52px; color: var(--blau); cursor: pointer; }
main > details[open] { padding-bottom: 1.25rem; }

/* Knöpfe: weiße Pille, zweite Wahl als dunkle Fläche. Touch-Ziele mindestens 44px */
button, .knopf {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 1.25rem;
  font: inherit; font-weight: 600; letter-spacing: inherit; text-align: center; text-decoration: none; cursor: pointer;
  color: var(--knopf-text); background: var(--knopf); border: 1px solid var(--knopf); border-radius: 9999px;
  transition: transform .1s ease, background-color .15s ease;
}
button:hover, .knopf:hover { background: #e8e8e8; }
button:active, .knopf:active { transform: scale(.97); }
a.knopf:hover { text-decoration: none; }
.zweit, a.rund { color: var(--text); background: var(--hoch); border-color: var(--linie-stark); font-weight: 500; }
.zweit:hover, a.rund:hover { background: #222325; }
.gefahr { color: var(--rot); background: rgba(255, 97, 97, .15); border-color: rgba(255, 97, 97, .35); font-weight: 500; }
.gefahr:hover { background: rgba(255, 97, 97, .25); }
.rund { flex: none; width: 44px; padding: 0; font-size: 1.5rem; font-weight: 400; line-height: 1; }
.aktionen { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0 0 1.25rem; }
.aktionen > * { white-space: nowrap; }

/* Formulare */
input, select, textarea {
  width: 100%; max-width: 100%; min-height: 44px; margin: 0; padding: 10px 14px;
  font: inherit; letter-spacing: inherit; color: var(--text); background: var(--flaeche);
  border: 1px solid var(--feldrand); border-radius: 10px;
}
input:focus, select:focus, textarea:focus { border-color: var(--blau); }
textarea { display: block; resize: vertical; }
input[readonly] { color: var(--fliess); font-size: .875rem; }
input[type=checkbox], input[type=radio] { flex: none; width: 22px; height: 22px; min-height: 0; padding: 0; accent-color: var(--blau); }
input[type=color] { width: 4rem; padding: 4px; }
label { display: block; margin: 0 0 .3rem; color: var(--leise); font-size: .875rem; }
label + br { display: none; }
label:has(input) { display: flex; align-items: center; gap: .6rem; min-height: 44px; margin: 0; color: var(--text); font-size: inherit; }
form p { margin: 0 0 .9rem; }
form > input, form > select { margin-bottom: .75rem; }
fieldset { min-width: 0; margin: 0 0 .75rem; padding: 0; border: 0; }
legend { padding: 0; margin-bottom: .25rem; color: var(--leise); font-size: .875rem; font-weight: 600; }
.paar { display: grid; grid-template-columns: 3fr 2fr; gap: .75rem; }
[role=alert], [role=status] { padding: .75rem 1rem; border-radius: 10px; font-size: .875rem; font-weight: 600; }
[role=alert] { color: var(--rot); background: rgba(255, 97, 97, .15); }
[role=status] { color: var(--text); background: rgba(87, 193, 255, .15); }

/* Kopfleiste: Marke und Bereich links, Menü rechts. Die Navigation liegt am Handy unten, ab 48rem oben */
.kopf { position: sticky; top: 0; z-index: 20; background: var(--grund); border-bottom: 1px solid var(--linie); padding-top: env(safe-area-inset-top); }
.kopf-innen { display: flex; align-items: center; gap: .75rem; max-width: 76rem; min-height: 60px; margin: 0 auto; padding: 0 1rem; }
.kopf form { margin: 0; min-width: 0; }
.logo {
  flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  color: #fff; font-weight: 700; font-size: .95rem; background: linear-gradient(135deg, #ff5757, #a1131a);
}
.marke, .bereich { color: var(--text); font-size: 1rem; font-weight: 600; }
.bereich { width: auto; field-sizing: content; padding-left: 0; background: transparent; border-color: transparent; text-overflow: ellipsis; }
.bereich option { background: var(--karte); }
.leiste {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around;
  padding: 4px 8px env(safe-area-inset-bottom); border-top: 1px solid var(--linie);
  background: rgba(13, 13, 13, .92); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.leiste a {
  flex: 1; max-width: 9rem; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--leise); font-size: .72rem; font-weight: 500; text-decoration: none; border-radius: 12px;
}
.leiste a[aria-current=page] { color: var(--text); }
.leiste a[aria-current=page] svg { stroke: var(--blau); }
.leiste svg, .leerbild svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.qr svg { display: block; width: 12rem; height: 12rem; margin: 0 0 1rem; border-radius: 10px; }
.leiste svg { width: 22px; height: 22px; }
.mehr { position: relative; flex: none; margin-left: auto; }
.mehr > summary {
  display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; padding: 0 .9rem 0 .35rem; list-style: none; cursor: pointer;
  color: var(--text); font-size: .875rem; background: var(--karte); border: 1px solid var(--linie); border-radius: 9999px;
}
.mehr > summary::-webkit-details-marker { display: none; }
.mehr > summary:hover { border-color: var(--linie-stark); }
.avatar {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; font-weight: 600; text-transform: uppercase;
  color: var(--f); background: color-mix(in srgb, var(--f) 22%, var(--hoch));
}
.mehr-menue {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 15rem; padding: .5rem 1rem 1rem;
  display: flex; flex-direction: column; background: var(--hoch); border: 1px solid var(--linie-stark); border-radius: 16px;
}
.mehr-menue > .leise, .mehr-menue > a { display: flex; align-items: center; min-height: 44px; border-bottom: 1px solid var(--linie); }
.mehr-menue > a { color: var(--text); }
.mehr-menue form { margin: 1rem 0 0; }
.mehr-menue button { width: 100%; }

/* Umschalter in der Verwaltung */
.segmente { display: flex; gap: .25rem; padding: .25rem; margin: 0 0 1.5rem; background: var(--karte); border: 1px solid var(--linie); border-radius: 9999px; }
.segmente a {
  flex: 1; min-height: 40px; display: flex; align-items: center; justify-content: center;
  color: var(--leise); font-size: .875rem; font-weight: 500; border-radius: 9999px; text-decoration: none;
}
.segmente a[aria-current=page] { color: var(--knopf-text); background: var(--knopf); font-weight: 600; }

/* Zeilen in Karten */
ul.zeilen, .posten, .kachel ul { list-style: none; margin: 0; padding: 0; }
main > ul { list-style: none; margin: 0 0 1rem; padding: 0; }
main > ul > li { padding: .6rem 0; }
main > ul > li + li, .zeilen > li + li, .posten > li + li { border-top: 1px solid var(--linie); }
ul.zeilen { margin: 0 0 -.5rem; }
.zeile { display: flex; align-items: center; gap: .75rem; min-height: 48px; padding: .5rem 0; color: var(--text); text-decoration: none; }
a.zeile:hover { text-decoration: none; }
a.zeile::after { content: "\203A"; content: "\203A" / ""; flex: none; color: var(--leise); font-size: 1.4rem; line-height: 1; }
.titel { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.zeile > .leise { white-space: nowrap; }
.zeile .titel > .leise { display: block; }
.zeit { flex: none; min-width: 2.9rem; color: var(--leise); font-size: .875rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.punkt { flex: none; width: 10px; height: 10px; border-radius: 50%; }
.zurueck::before { content: "\2039\00a0"; }

/* Startseite: Kachelraster */
.bento { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.kachel { min-width: 0; margin: 0; padding: 1.25rem; }
.kachel-kopf { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin: 0 0 1rem; }
.kachel-kopf h2 { margin: 0; }
.kachel-kopf a { color: var(--leise); font-size: .875rem; }
.kachel-kopf a.rund { width: 36px; min-height: 36px; font-size: 1.25rem; color: var(--text); }
.kachel-kopf a.rund:hover { text-decoration: none; }

.held {
  position: relative; isolation: isolate; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end;
  min-height: 12.5rem; padding: 1.5rem;
}
/* das Erkennungszeichen der Vorlage: rote Schrägstreifen, hier weich gezeichnet als Lichtschein */
.held::before {
  content: ""; position: absolute; z-index: -1; top: -45%; right: -12%; width: 75%; height: 150%; opacity: .75; filter: blur(30px);
  background: linear-gradient(115deg, transparent 22%, #ff5757 22% 31%, transparent 31% 40%, #d92b35 40% 53%, transparent 53% 62%, #a1131a 62% 80%, transparent 80%);
  -webkit-mask-image: linear-gradient(to bottom, #000 25%, transparent 80%); mask-image: linear-gradient(to bottom, #000 25%, transparent 80%);
}
.gruss { margin: 0 0 .35rem; color: var(--fliess); font-size: .9375rem; }
.held h1 { margin: 0 0 1.1rem; font-size: clamp(2rem, 4.4vw, 3.25rem); line-height: 1.04; letter-spacing: -.035em; }
.kennzahlen { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; }
.zahl {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: 0 1rem; border-radius: 9999px; font-size: .875rem;
  color: var(--f); background: color-mix(in srgb, var(--f) 15%, var(--karte)); border: 1px solid color-mix(in srgb, var(--f) 30%, transparent);
}
.zahl:hover { text-decoration: none; border-color: var(--f); }
.zahl b { font-size: 1.0625rem; }

.woche { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .4rem; align-items: stretch; padding: .75rem; }
.tag {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; min-height: 5.75rem; padding: .5rem 0;
  color: var(--text); background: var(--hoch); border: 1px solid transparent; border-radius: 12px;
}
.tag:hover { text-decoration: none; border-color: var(--linie-stark); }
.tag .wt { color: var(--leise); font-size: .72rem; font-weight: 500; letter-spacing: .05em; text-transform: uppercase; }
.tag .nr { font-size: 1.375rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.tag.vorbei { background: transparent; }
.tag.vorbei .nr { color: var(--leise); }
.tag.heute { color: var(--knopf-text); background: var(--knopf); }
.tag.heute .wt { color: #434345; }
.punkte { display: flex; gap: 3px; align-items: center; justify-content: center; min-height: 8px; }
.punkte .punkt { width: 6px; height: 6px; }
.punkte small { font-size: .625rem; }

.zeitleiste { display: grid; gap: .5rem; }
.termin {
  display: flex; align-items: center; gap: .85rem; min-height: 62px; padding: .6rem .9rem; border-radius: 12px; color: var(--text);
  background: color-mix(in srgb, var(--f) 9%, var(--hoch)); border: 1px solid color-mix(in srgb, var(--f) 24%, transparent);
}
a.termin:hover { text-decoration: none; border-color: color-mix(in srgb, var(--f) 60%, transparent); }
.uhr { flex: none; display: flex; flex-direction: column; width: 3.3rem; line-height: 1.25; font-variant-numeric: tabular-nums; }
.uhr b { font-weight: 600; }
.uhr span { color: var(--leise); font-size: .8125rem; }
.balken { flex: none; align-self: stretch; width: 4px; border-radius: 4px; background: var(--f); box-shadow: 0 0 12px color-mix(in srgb, var(--f) 60%, transparent); }
.termin .titel { display: flex; flex-direction: column; }
.etikett {
  flex: none; padding: .2rem .6rem; border-radius: 9999px; font-size: .75rem; font-weight: 600; white-space: nowrap;
  color: var(--f); background: color-mix(in srgb, var(--f) 18%, transparent);
}
.demnaechst li + li { border-top: 1px solid var(--linie); }
.kommend { display: flex; align-items: center; gap: .85rem; min-height: 60px; padding: .45rem 0; color: var(--text); }
a.kommend:hover { text-decoration: none; }
.kommend .titel { display: flex; flex-direction: column; }
.datum {
  flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 2.9rem; height: 2.9rem;
  line-height: 1.1; border-radius: 10px; background: var(--hoch); border: 1px solid var(--linie);
}
.datum span { color: var(--leise); font-size: .6875rem; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }
.datum b { font-size: 1.0625rem; font-weight: 600; }

.listen-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .75rem; margin: 0 0 1rem; }
.kachel .listen-raster { margin: 0; }
.liste {
  display: flex; flex-direction: column; gap: .5rem; min-height: 8.75rem; padding: 1rem 1.1rem; border-radius: 14px; color: var(--text);
  background: color-mix(in srgb, var(--f) 9%, var(--hoch)); border: 1px solid color-mix(in srgb, var(--f) 24%, transparent);
}
.liste:hover { text-decoration: none; border-color: color-mix(in srgb, var(--f) 60%, transparent); }
.f1 { --f: var(--gruen); }
.f2 { --f: var(--gelb); }
.f3 { --f: var(--rot); }
.liste .name { font-size: 1.0625rem; font-weight: 600; overflow-wrap: anywhere; }
.liste .stand { color: var(--leise); font-size: .875rem; }
.liste .stand b { color: var(--f); font-weight: 600; }
.fortschritt { height: 6px; overflow: hidden; border-radius: 6px; background: rgba(255, 255, 255, .08); }
.fortschritt i { display: block; height: 100%; border-radius: 6px; background: var(--f); }
.vorschau { margin-top: auto; overflow: hidden; color: var(--fliess); font-size: .875rem; text-overflow: ellipsis; white-space: nowrap; }

.leerbild {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .85rem; min-height: 10rem; padding: 1.5rem 1rem;
  color: var(--leise); text-align: center; border: 1px dashed var(--linie-stark); border-radius: 12px;
}
.leerbild p { margin: 0; }
.leerbild svg { width: 30px; height: 30px; }

/* Agenda */
.tage { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr)); gap: 1rem; align-items: start; }
.tage > section { margin: 0; }
.tage > .leer { display: flex; align-items: center; min-height: 3.5rem; margin: 0; padding: 0 1.25rem; border: 1px dashed var(--linie); border-radius: 16px; }

/* Einkaufsliste */
.hinzu { display: flex; align-items: center; gap: .5rem; max-width: 40rem; }
.hinzu input { flex: 1; min-width: 0; margin: 0; padding-inline: 1.1rem; border-radius: 9999px; }
.hinzu input.schmal { flex: 0 0 5.5rem; }
.posten { margin: 0 0 1rem; padding: 0 1.25rem 0 .4rem; }
.posten > li { position: relative; }
.posten-zeile { display: flex; align-items: center; gap: .25rem; min-height: 52px; padding-right: 4.25rem; color: var(--text); }
.posten-zeile form { margin: 0; }
.haken { position: relative; isolation: isolate; flex: none; width: 44px; padding: 0; background: transparent; border: 0; color: var(--knopf-text); font-size: .85rem; }
.haken:hover { background: transparent; }
.haken::before { content: ""; position: absolute; inset: 10px; z-index: -1; border: 1.5px solid var(--feldrand); border-radius: 50%; }
.haken:hover::before { border-color: var(--gruen); }
.erledigt .haken::before { background: var(--gruen); border-color: var(--gruen); }
.erledigt .titel { color: var(--leise); }
.aendern > summary {
  position: absolute; top: 0; right: 0; height: 52px; display: flex; align-items: center; list-style: none; cursor: pointer;
  color: var(--leise); font-size: .875rem;
}
.aendern > summary:hover { color: var(--text); }
.aendern > summary::-webkit-details-marker { display: none; }
.aendern[open] { padding: 0 0 1rem .85rem; }
.aendern form { margin: 0 0 .75rem; }
.aendern input { margin-bottom: .6rem; }

/* Monatsraster */
.monat-kopf { display: flex; align-items: center; gap: .5rem; margin: 0 0 1.25rem; }
.monat-kopf h1 { flex: 1; margin: 0; text-align: center; }
table { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; padding: .5rem .25rem; }
th { padding: .5rem 0; color: var(--leise); font-size: .72rem; font-weight: 500; letter-spacing: .05em; text-transform: uppercase; }
td { padding: 2px 0 6px; text-align: center; vertical-align: top; }
td a { display: grid; place-items: center; width: 40px; height: 40px; margin: 0 auto; border-radius: 50%; color: var(--text); font-variant-numeric: tabular-nums; }
td a:hover { text-decoration: none; background: var(--hoch); }
td.fremd a { color: var(--feldrand); }
td.heute a { color: var(--knopf-text); background: var(--knopf); font-weight: 600; }

@media (min-width: 48rem) {
  body.angemeldet { padding-bottom: 0; }
  main { padding: 2rem 1.5rem 3rem; }
  .kopf-innen { padding: 0 1.5rem; }
  .leiste { position: static; flex: 1; justify-content: flex-start; gap: .25rem; margin-left: 1rem; padding: 0; background: none; border: 0; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .leiste a { flex: none; max-width: none; min-height: 40px; flex-direction: row; gap: .5rem; padding: 0 .9rem; font-size: .9375rem; border-radius: 10px; border: 1px solid transparent; }
  .leiste a:hover { color: var(--text); background: var(--karte); }
  .leiste a[aria-current=page] { background: var(--hoch); border-color: var(--linie); }
  .leiste svg { width: 18px; height: 18px; }
  .mehr { margin-left: 0; }
  td { height: 6.25rem; padding: .4rem 0; border-top: 1px solid var(--linie); }
  tbody tr:first-child td { border-top: 0; }
  .punkte .punkt { width: 8px; height: 8px; }
}
@media (min-width: 60rem) {
  .bento { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .held { grid-column: span 7; }
  .woche { grid-column: span 5; padding: 1rem; }
  .termine, .demnaechst { grid-column: span 6; }
  .held.breit, .listen { grid-column: 1 / -1; }
  .tag { min-height: 100%; }
}
@media (prefers-reduced-motion: reduce) { button, .knopf { transition: none; } }
