:root {
  color-scheme: light;
  --bg: #eeefea; --surface: #f8f9f4; --surface-2: #ffffff;
  --text: #1b2420; --text-muted: #5c665f; --border: #dcddd3;
  --eg: #1f6f5c; --eg-soft: #e3f0ec; --dg: #5b4b8a; --dg-soft: #ece8f5;
  --eltern: #9c6b1f; --eltern-soft: #f3e7d2; --flur: #3d6ea5; --flur-soft: #dde9f5;
  --urgent: #b5601f; --urgent-soft: #f8e6d5; --urgent-ring: #d98a3f;
  --today-ring: #1b2420; --ok: #2f7a4d; --ok-soft: #e2f0e6;
  --shadow: 0 1px 2px rgba(27,36,32,0.06), 0 6px 16px rgba(27,36,32,0.05);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141712; --surface: #1c201b; --surface-2: #20241f;
    --text: #eceee8; --text-muted: #9ba39b; --border: #333a32;
    --eg: #63cdb2; --eg-soft: #1c3833; --dg: #b8a7e9; --dg-soft: #332b4d;
    --eltern: #e0b25e; --eltern-soft: #3a2f18; --flur: #7fb0e0; --flur-soft: #1c2c3a;
    --urgent: #e8a063; --urgent-soft: #3a2a19; --urgent-ring: #e8a063;
    --today-ring: #eceee8; --ok: #6fcf8e; --ok-soft: #1d3324;
    --shadow: 0 1px 2px rgba(0,0,0,0.35), 0 8px 20px rgba(0,0,0,0.35);
  }
}

:root[data-theme="dark"] {
  --bg: #141712; --surface: #1c201b; --surface-2: #20241f;
  --text: #eceee8; --text-muted: #9ba39b; --border: #333a32;
  --eg: #63cdb2; --eg-soft: #1c3833; --dg: #b8a7e9; --dg-soft: #332b4d;
  --eltern: #e0b25e; --eltern-soft: #3a2f18; --flur: #7fb0e0; --flur-soft: #1c2c3a;
  --urgent: #e8a063; --urgent-soft: #3a2a19; --urgent-ring: #e8a063;
  --today-ring: #eceee8; --ok: #6fcf8e; --ok-soft: #1d3324;
  --shadow: 0 1px 2px rgba(0,0,0,0.35), 0 8px 20px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
}

img { max-width: 100%; }

.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 28px 16px 56px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.eyebrow {
  font-family: "Archivo", sans-serif; font-weight: 700; font-size: 12px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-muted);
}

h1 {
  font-family: "Archivo", sans-serif; font-weight: 800;
  font-size: clamp(26px, 6vw, 36px); line-height: 1.08; letter-spacing: -0.01em;
  margin: 6px 0 0;
}

.sub { color: var(--text-muted); font-size: 15px; line-height: 1.5; margin: 10px 0 0; max-width: 50ch; }
.stand-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; flex-wrap: wrap; }
.stand { font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--text-muted); }
.sync-btn {
  font-family: "Archivo", sans-serif; font-weight: 700; font-size: 12px; letter-spacing: 0.02em;
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--eg); background: var(--eg-soft);
  color: var(--eg); cursor: pointer; white-space: nowrap;
}
.sync-btn:disabled { opacity: 0.6; cursor: default; }
.sync-btn:not(:disabled):hover { background: var(--eg); color: var(--surface-2); }
.savenote { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--text-muted); margin-top: 2px; min-height: 14px; }

section { display: flex; flex-direction: column; gap: 12px; }
.section-title {
  font-family: "Archivo", sans-serif; font-weight: 700; font-size: 13px;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted);
}

.today-list { display: flex; flex-direction: column; gap: 12px; }
.note.muted { color: var(--text-muted); font-size: 14px; }

.today-card {
  background: var(--surface-2); border: 1.5px solid var(--urgent-ring); border-radius: 16px;
  padding: 18px 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px;
}
.today-flag {
  display: inline-flex; align-self: flex-start; align-items: center; gap: 6px;
  background: var(--urgent-soft); color: var(--urgent); font-family: "Archivo", sans-serif;
  font-weight: 700; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
}
.today-flag .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--urgent); }
.card-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.apt-tag {
  font-family: "Archivo", sans-serif; font-weight: 800; font-size: 13px; letter-spacing: 0.03em;
  padding: 5px 10px; border-radius: 8px; white-space: nowrap;
}
.apt-tag.eg { background: var(--eg-soft); color: var(--eg); }
.apt-tag.dg { background: var(--dg-soft); color: var(--dg); }
.apt-tag.eltern { background: var(--eltern-soft); color: var(--eltern); }
.apt-tag.flur { background: var(--flur-soft); color: var(--flur); }
.date-big { font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; font-size: 20px; font-weight: 500; }
.date-big .wd { color: var(--text-muted); font-size: 13px; display: block; margin-bottom: 2px; }
.note { font-size: 14px; color: var(--text); line-height: 1.45; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 3px 9px;
  border-radius: 999px; background: var(--urgent-soft); color: var(--urgent);
  font-weight: 600; white-space: nowrap;
}
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.neutral { background: var(--border); color: var(--text-muted); }
.tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.calendars { display: flex; flex-direction: column; gap: 16px; }
.month {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
}
.month-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.month-title { font-family: "Archivo", sans-serif; font-weight: 700; font-size: 15px; }
.flur-status {
  font-family: "Archivo", sans-serif; font-weight: 700; font-size: 11px; letter-spacing: 0.02em;
  padding: 3px 9px; border-radius: 999px; background: var(--flur-soft); color: var(--flur); white-space: nowrap;
}
.flur-status.done { background: var(--ok-soft); color: var(--ok); }
.weekday-row, .day-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.weekday-row div {
  text-align: center; font-size: 11px; color: var(--text-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em; padding-bottom: 2px;
}
.day-cell {
  position: relative; min-height: 46px; border-radius: 8px; padding: 4px 3px 5px;
  display: flex; flex-direction: column; gap: 3px; background: transparent;
}
.day-cell.blank { visibility: hidden; }
.day-num {
  font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--text-muted);
  font-variant-numeric: tabular-nums; line-height: 1;
}
.day-cell.is-today { outline: 2px solid var(--today-ring); outline-offset: -2px; }
.day-cell.is-today .day-num { color: var(--text); font-weight: 700; }
.day-cell.has-putztag .day-num { color: var(--text); font-weight: 700; }
.bar-slot { position: relative; height: 9px; border-radius: 3px; background: transparent; }
.bar-slot.on.eg { background: var(--eg); }
.bar-slot.on.dg { background: var(--dg); }
.bar-slot.on.eltern { background: var(--eltern); }
.bar-slot.on.eltern.done { opacity: 0.4; }
.bar-slot.on.checkin { border-top-left-radius: 3px; border-bottom-left-radius: 3px; margin-left: 2px; }
.bar-slot.on.checkout { border-top-right-radius: 3px; border-bottom-right-radius: 3px; margin-right: 2px; opacity: 0.85; }
/* Broom sits directly on the apartment's own bar, so it's unambiguous which
   apartment needs cleaning that day - not a whole-cell marker. */
.checkout-marker {
  position: absolute; right: -3px; top: 50%; transform: translateY(-50%);
  font-size: 11px; line-height: 1; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.4));
  pointer-events: none;
}

.legend {
  display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--text-muted);
  border-top: 1px solid var(--border); padding-top: 14px;
}
.legend-row { display: flex; gap: 18px; flex-wrap: wrap; }
.legend span.item { display: inline-flex; align-items: center; gap: 7px; }
.swatch { width: 16px; height: 7px; border-radius: 3px; flex: none; }
.swatch.eg { background: var(--eg); }
.swatch.dg { background: var(--dg); }
.swatch.eltern { background: var(--eltern); }
.legend-note { line-height: 1.5; }

.agenda { display: flex; flex-direction: column; gap: 10px; }
.item {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 10px;
}
.item-top { display: flex; align-items: center; gap: 16px; }
.item .datecol { min-width: 76px; }
.clean-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border-top: 1px dashed var(--border); padding-top: 10px; margin-top: 2px;
}
.clean-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; user-select: none; }
.clean-check input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--ok); cursor: pointer; }
.remark-input {
  flex: 1; min-width: 140px; font-family: "IBM Plex Sans", sans-serif; font-size: 13px;
  padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
}
.remark-input::placeholder { color: var(--text-muted); }
.date-input {
  font-family: "IBM Plex Mono", monospace; font-size: 13px;
  padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
}
.flur-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--text-muted); }

footer { font-size: 13px; color: var(--text-muted); line-height: 1.6; }

@media (max-width: 460px) {
  .day-cell { min-height: 40px; padding: 3px 2px 4px; }
  .bar-slot { height: 6px; }
}
