/* Hausmeister Klaus – Raumwirkung: cremefarbene Wand mit Lampenlicht, mintgrüner Lambris, beiger Boden,
   Edelstahl-Akzente und anthrazitfarbene Latzhose als Textfarbe. */
:root {
  --wall: #F2D7A6;
  --wall-light: #FBEBC8;
  --mint: #93C7B2;
  --mint-edge: #6FA892;
  --mint-ink: #3F7A65;
  --floor: #EAE1CF;
  --card: #FCF8EF;
  --ink: #2E2F31;
  --muted: #6F6556;
  --brown: #6A4E3B;
  --line: rgba(46, 47, 49, .16);
  --danger: #A2462F;
  --done: #A39A8B;
  --yellow: #E2A632;
  --glass: rgba(252, 248, 239, .55);
  --shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 6px 18px -8px rgba(80, 60, 30, .35);
  --radius: 10px;
  --maxw: 760px;
  --font-head: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Work Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  /* Feierabend: Licht gedimmt */
  :root {
    --wall: #3A3227;
    --wall-light: #4A4031;
    --mint: #2E4A3F;
    --mint-edge: #3D6152;
    --mint-ink: #86C6AC;
    --floor: #26221D;
    --card: #2D2924;
    --ink: #F1E6D2;
    --muted: #B9AC96;
    --brown: #D9B48F;
    --line: rgba(241, 230, 210, .14);
    --danger: #E08A72;
    --done: #7E7566;
    --shadow: 0 8px 20px -10px rgba(0, 0, 0, .7);
    --glass: rgba(45, 41, 36, .7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; overflow-x: hidden; }
body {
  color: var(--ink);
  background: var(--floor);
  font: 16px/1.45 var(--font-body);
  padding-bottom: calc(110px + env(safe-area-inset-bottom));
  min-height: 100vh;
}
/* Der Raum: Wand, Lambris-Kante, Lambris, Boden. Fest stehend hinter dem Inhalt. */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse 38% 34% at 22% 0%, var(--wall-light), transparent 70%),
    radial-gradient(ellipse 38% 34% at 78% 0%, var(--wall-light), transparent 70%),
    linear-gradient(to bottom,
      var(--wall) 0, var(--wall) 46%,
      var(--mint-edge) 46%, var(--mint-edge) calc(46% + 3px),
      var(--mint) calc(46% + 3px), var(--mint) 84%,
      rgba(0,0,0,.08) 84%, var(--floor) calc(84% + 6px), var(--floor) 100%);
}

button, input, select, textarea { font: inherit; color: inherit; }
button {
  cursor: pointer; border-radius: 999px; padding: 8px 16px; min-height: 40px;
  border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
  font-weight: 500; letter-spacing: .01em;
  transition: transform .08s ease, background-color .15s ease;
}
button:active { transform: translateY(1px); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--yellow); outline-offset: 2px;
}
button.primary { background: var(--ink); color: var(--card); }
button.ghost { background: transparent; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--ink);
}
label { display: block; margin: 12px 0; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
label input, label select, label textarea { margin-top: 5px; text-transform: none; letter-spacing: normal; font-weight: 400; font-size: 16px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }

/* Kopf: Schild an der Wand */
.top {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  max-width: var(--maxw); margin: 0 auto;
  padding: calc(22px + env(safe-area-inset-top)) 16px 10px;
}
.brand h1 {
  margin: 0; font-family: var(--font-head); font-weight: 600; font-size: 30px; line-height: 1.05;
  letter-spacing: -.01em; color: var(--brown);
  font-variation-settings: "SOFT" 100, "WONK" 1;
}
.brand p { margin: 4px 0 0; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.top-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.top-actions button { padding: 6px 12px; min-height: 36px; font-size: 14px; white-space: nowrap; background: var(--glass); }

.filters { display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px 6px; max-width: var(--maxw); margin: 0 auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip { white-space: nowrap; padding: 6px 14px; min-height: 36px; font-size: 14px; background: var(--glass); border-color: var(--line); }
.chip.active { background: var(--ink); color: var(--card); border-color: var(--ink); }

main { max-width: var(--maxw); margin: 0 auto; padding: 4px 16px; }
.range { display: flex; align-items: center; gap: 8px; margin: 10px 0 16px; }
.range span { flex: 1; font-family: var(--font-head); font-size: 19px; font-weight: 600; color: var(--ink); }
.range button { padding: 6px 12px; min-height: 36px; background: var(--glass); }

.list { display: flex; flex-direction: column; gap: 18px; }
.day h3 {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 8px; font-size: 12px; font-weight: 600; color: var(--brown);
  text-transform: uppercase; letter-spacing: .16em;
}
.stamp {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  background: var(--ink); color: var(--card); letter-spacing: .14em; font-size: 11px;
}
.task {
  position: relative; display: flex; gap: 14px; align-items: flex-start;
  background: var(--card); border-radius: var(--radius); padding: 14px 14px 12px 18px; margin-bottom: 10px;
  box-shadow: var(--shadow); overflow: hidden;
}
/* farbiger Streifen links = zuständige Person */
.task::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--who, var(--mint-edge)); }
.task.done { opacity: .78; }
.task.done .title { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--done); }
.check {
  width: 30px; height: 30px; min-width: 30px; min-height: 30px; border-radius: 50%;
  border: 2px solid var(--ink); background: transparent; padding: 0; margin-top: 1px;
  display: grid; place-items: center;
}
.task.done .check { background: var(--mint-ink); border-color: var(--mint-ink); }
.task.done .check::after { content: "✓"; color: var(--card); font-size: 16px; font-weight: 700; }
.body { flex: 1; min-width: 0; }
.title { font-weight: 600; font-size: 17px; overflow-wrap: anywhere; }
.meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; align-items: center; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; box-shadow: 0 0 0 1.5px rgba(0,0,0,.12); }
.notes { font-size: 14px; color: var(--muted); margin-top: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.task-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.task-actions button { padding: 4px 12px; font-size: 13px; min-height: 32px; border-color: var(--line); }
.task-actions input[type=date] { width: auto; min-width: 0; max-width: 100%; padding: 4px 8px; font-size: 13px; }
.danger { color: var(--danger); }
.task-actions .danger { border-color: transparent; }

.list, .day, .task, .body { min-width: 0; max-width: 100%; }

/* Leerzustand */
.empty { text-align: center; color: var(--ink); padding: 36px 16px; background: var(--glass); border-radius: var(--radius); }
.empty svg { width: 120px; height: auto; display: block; margin: 0 auto 12px; }
.empty strong { display: block; font-family: var(--font-head); font-size: 22px; font-weight: 600; color: var(--brown); }
.empty span { font-size: 14px; color: var(--muted); }
.empty[hidden] { display: none; }

/* Hinzufügen-Knopf als Edelstahl-Sauger mit gelbem Band */
.fab {
  position: fixed; right: 20px; bottom: calc(22px + env(safe-area-inset-bottom));
  width: 64px; height: 64px; min-height: 64px; border-radius: 50%; padding: 0;
  font-size: 34px; line-height: 1; font-weight: 400; color: #2E2F31;
  border: 2px solid #2E2F31;
  background: radial-gradient(circle at 35% 30%, #fbfcfc, #d3d7da 45%, #9aa1a7 100%);
  box-shadow: 0 0 0 4px var(--yellow), 0 10px 22px -6px rgba(40, 30, 10, .55);
}

/* Dialoge: Karteikarte mit Lambris-Kante oben */
dialog {
  width: min(480px, calc(100vw - 32px)); border: none; border-radius: var(--radius); padding: 22px 20px 20px;
  background: var(--card); color: var(--ink);
  border-top: 10px solid var(--mint);
  box-shadow: 0 24px 60px -20px rgba(0,0,0,.5);
}
dialog::backdrop { background: rgba(46, 38, 26, .5); }
dialog h2 { margin: 0 0 6px; font-family: var(--font-head); font-size: 24px; font-weight: 600; color: var(--brown); }
dialog p { color: var(--muted); font-size: 14px; }
.dlg-body { display: block; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.members { list-style: none; padding: 0; margin: 0 0 14px; }
.members li { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.members button { padding: 4px 10px; font-size: 13px; min-height: 30px; border-color: transparent; }
#formMember input[type=color] { flex: 0 0 56px; padding: 4px; height: 44px; }
#icsUrl { font-size: 13px; }

#toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(104px + env(safe-area-inset-bottom));
  background: var(--ink); color: var(--card); padding: 10px 18px; border-radius: 999px;
  font-size: 14px; max-width: calc(100vw - 32px); box-shadow: 0 8px 20px -8px rgba(0,0,0,.5);
}
#toast[hidden] { display: none; }

@media (max-width: 420px) {
  .brand h1 { font-size: 26px; }
  .top { align-items: flex-start; }
  .top-actions { width: 100%; justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Logo neben dem Titel */
.brand-wrap { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo {
  width: 64px; height: 64px; flex: 0 0 64px; border-radius: 50%;
  border: 2px solid var(--ink); background: var(--card);
  box-shadow: 0 0 0 4px var(--glass), 0 8px 18px -8px rgba(60, 40, 20, .5);
}
@media (max-width: 420px) {
  .logo { width: 54px; height: 54px; flex-basis: 54px; }
}

/* Versionsanzeige */
.version { max-width: var(--maxw); margin: 24px auto 0; padding: 0 16px; text-align: center; font-size: 12px; letter-spacing: .08em; color: var(--muted); }

/* ===== v1.0: Anmeldung, Ansichten, Verwaltung ===== */
body.wide { --maxw: 1180px; }
[hidden] { display: none !important; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; background: var(--glass); padding: 1px 5px; border-radius: 4px; }
.hint { font-size: 14px; color: var(--muted); margin: 6px 0 10px; }
.form-error { color: var(--danger); font-size: 14px; font-weight: 500; margin: 6px 0 0; }
button.wide { width: 100%; margin-top: 10px; min-height: 46px; }
button.danger { color: var(--danger); border-color: transparent; }
.push-left { margin-right: auto; }

/* Anmeldung & Einrichtung */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); max-width: none; }
.auth-card {
  width: min(420px, 100%); background: var(--card); border-radius: var(--radius); padding: 26px 22px 22px;
  border-top: 10px solid var(--mint); box-shadow: 0 24px 60px -24px rgba(60, 40, 20, .55); text-align: left;
}
.auth-card h1 { font-family: var(--font-head); color: var(--brown); font-size: 28px; margin: 10px 0 4px; font-weight: 600; }
.logo-big { width: 96px; height: 96px; display: block; margin: -62px auto 0; }
.auth-card h1, .auth-card > .hint { text-align: center; }
.steps { padding-left: 20px; font-size: 14px; color: var(--muted); }
.steps li { margin: 6px 0; }
#key { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; }

/* Profil-Knopf */
#btnProfile { display: inline-flex; align-items: center; gap: 2px; background: var(--glass); }

/* Ansicht-Umschalter */
.views { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 8px 0 4px; border: 1.5px solid var(--ink); border-radius: 999px; overflow: hidden; background: var(--glass); }
.views button { border: none; border-radius: 0; min-height: 38px; padding: 6px 4px; font-size: 14px; background: transparent; }
.views button + button { border-left: 1.5px solid var(--line); }
.views button.active { background: var(--ink); color: var(--card); }
#today { min-width: 0; }

/* Tageslisten */
.free { margin: 0 0 6px; font-size: 13px; color: var(--muted); font-style: italic; }
.stamp.warn { background: var(--danger); }
.day.overdue h3 { color: var(--danger); }
.meta .open { font-style: italic; }
.task .body { cursor: pointer; border-radius: 6px; outline-offset: 4px; }
.task .body:focus-visible { outline: 3px solid var(--yellow); }

/* Woche: am großen Bildschirm sieben Spalten */
.task.compact { padding: 10px 10px 10px 14px; gap: 10px; }
.task.compact .title { font-size: 15px; }
.task.compact .check { width: 26px; height: 26px; min-width: 26px; min-height: 26px; }
@media (min-width: 960px) {
  .list.view-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; align-items: start; }
  .list.view-week .day { background: var(--glass); border-radius: var(--radius); padding: 8px; min-height: 160px; }
  .list.view-week .day h3 { flex-wrap: wrap; letter-spacing: .08em; }
  .list.view-week .task.compact { flex-direction: column; gap: 6px; }
  .list.view-week .meta { font-size: 12px; }
}
.day h3 .wd { font-weight: 700; }

/* Monat */
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.month .dow { text-align: center; font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--brown); padding: 2px 0 4px; }
.mcell {
  display: flex; flex-direction: column; align-items: stretch; gap: 3px; min-height: 96px; min-width: 0;
  padding: 6px; border: none; border-radius: 8px; background: var(--card); color: var(--ink);
  box-shadow: var(--shadow); text-align: left; font-weight: 400; overflow: hidden;
}
.mcell.out { opacity: .5; }
.mcell .num { font-size: 13px; font-weight: 600; align-self: flex-start; padding: 0 6px; border-radius: 999px; line-height: 1.6; }
.mcell.today .num { background: var(--ink); color: var(--card); }
.mchip { font-size: 12px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid var(--who, var(--mint-edge)); padding-left: 5px; }
.mchip.done { text-decoration: line-through; color: var(--done); }
.mcell .more { font-size: 11px; color: var(--muted); }
@media (max-width: 600px) {
  .month { gap: 3px; }
  .mcell { min-height: 58px; padding: 4px 3px; gap: 2px; }
  .mcell .num { font-size: 12px; padding: 0 4px; }
  .mchip { font-size: 0; height: 5px; padding: 0; border: none; border-radius: 3px; background: var(--who, var(--mint-edge)); }
  .mchip.done { opacity: .35; }
  .mcell .more { font-size: 10px; }
}

/* Dialog-Abschnitte */
.section { border-top: 1px dashed var(--line); padding-top: 12px; margin-top: 14px; }
.section h3 { margin: 0 0 4px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--brown); }
#dlgProfile, #dlgFamily { max-height: calc(100vh - 32px); overflow: auto; }
.check-label { display: flex; align-items: center; gap: 8px; text-transform: none; letter-spacing: normal; font-size: 15px; font-weight: 500; color: var(--ink); }
.check-label input { width: auto; margin: 0; }
.color-label { flex: 0 0 90px !important; }
.color-label input { height: 44px; padding: 4px; }
.members li { gap: 10px; flex-wrap: wrap; }
.members .who { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; min-width: 0; }
.members small { color: var(--muted); font-size: 12px; margin-left: 4px; }
.member-actions { display: flex; gap: 4px; margin-left: auto; }
.member-actions button { border-color: var(--line); }

.range span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 420px) { .range span { font-size: 17px; } .range button { padding: 6px 10px; } }

/* Slogan */
.slogan { font-family: var(--font-head); font-style: italic; font-weight: 600; text-transform: none !important; letter-spacing: .01em !important; font-size: 15px !important; color: var(--muted); margin: 2px 0 0; }
.auth-card .slogan { text-align: center; font-size: 17px !important; margin-top: 0; }
