/* Putzplan: Gestaltung aus dem Prototyp, Schriften lokal. */
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 500 800; font-display: swap; src: url(fonts/bricolage-grotesque.woff2) format("woff2"); }
@font-face { font-family: "Figtree"; font-style: normal; font-weight: 400 600; font-display: swap; src: url(fonts/figtree.woff2) format("woff2"); }
:root {
  --bg: #EDF1F0; --surface: #FFFFFF; --ink: #17302F; --muted: #556E6D; --line: #D5DEDD;
  --accent: #1B6B73; --accent-ink: #FFFFFF; --ok: #1B6B73; --warn: #E3A21A; --late: #D2443A;
  --warn-bg: #FBF1D8; --late-bg: #FAE0DD; --shadow: 0 1px 2px rgba(23,48,47,.08);
  --display: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1B1B; --surface: #172827; --ink: #E4F0EE; --muted: #8FA8A6; --line: #284240;
    --accent: #5CC4CC; --accent-ink: #0F1B1B; --ok: #5CC4CC; --warn: #E8B440; --late: #EC6B61;
    --warn-bg: #3A3016; --late-bg: #3B1D1B; --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1B1B; --surface: #172827; --ink: #E4F0EE; --muted: #8FA8A6; --line: #284240;
  --accent: #5CC4CC; --accent-ink: #0F1B1B; --ok: #5CC4CC; --warn: #E8B440; --late: #EC6B61;
  --warn-bg: #3A3016; --late-bg: #3B1D1B; --shadow: none;
}
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
*, *::before, *::after { box-sizing: inherit; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.4; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.app { max-width: 520px; margin: 0 auto; padding: 20px 16px 120px; }

/* header */
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.head h1 { font-family: var(--display); font-weight: 700; font-size: 38px; line-height: 1; margin: 0; letter-spacing: -0.02em; }
.head .date { color: var(--muted); font-size: 15px; margin-top: 6px; }
.count { font-family: var(--display); font-weight: 700; font-size: 15px; background: var(--ink); color: var(--bg); padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.count.zero { background: var(--ok); color: var(--accent-ink); }

/* room chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 14px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 13px; font-size: 14px; font-weight: 500; min-height: 36px; }
.chip .n { font-weight: 700; }
.chip.warn { border-color: var(--warn); background: var(--warn-bg); }
.chip.late { border-color: var(--late); background: var(--late-bg); }
.chip.done { color: var(--muted); }
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* tiles */
.swipe { position: relative; margin-bottom: 10px; overflow: hidden; border-radius: 14px; transition: max-height .22s ease, margin .22s ease, opacity .22s ease; max-height: 120px; }
.swipe.leaving { max-height: 0; margin-bottom: 0; opacity: 0; }
.under { position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-end; padding-right: 22px; background: var(--accent); color: var(--accent-ink); font-weight: 600; border-radius: 14px; }
.tile { position: relative; display: flex; align-items: center; gap: 4px; background: var(--surface); border-radius: 14px; padding: 6px 6px 6px 18px; min-height: 68px; box-shadow: var(--shadow); touch-action: pan-y; user-select: none; -webkit-user-select: none; border-left: 7px solid var(--ok); }
.tile.s-warn { border-left-color: var(--warn); }
.tile.s-late { border-left-color: var(--late); }
.tile.s-soon { border-left-color: var(--line); }
.ring { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 2.5px solid var(--muted); display: grid; place-items: center; transition: background .15s, border-color .15s; }
.tile:active .ring, .tile-main:active .ring { background: var(--ok); border-color: var(--ok); }
.tile-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; background: transparent; border: 0; padding: 8px 0; min-height: 56px; text-align: left; border-radius: 10px; }
.txt { flex: 1; min-width: 0; }
.name { font-weight: 600; font-size: 17px; overflow-wrap: anywhere; }
.sub { color: var(--muted); font-size: 14px; margin-top: 1px; }
.s-warn .sub { color: color-mix(in srgb, var(--warn) 55%, var(--ink)); font-weight: 500; }
.s-late .sub { color: var(--late); font-weight: 600; }
.more { flex: none; width: 48px; height: 48px; border: 0; background: transparent; font-size: 22px; line-height: 1; border-radius: 12px; color: var(--muted); }

.bulk { display: block; width: 100%; margin: 6px 0 18px; border: 2px solid var(--ink); background: transparent; border-radius: 14px; padding: 14px; font-family: var(--display); font-weight: 700; font-size: 17px; }
.bulk:active { background: var(--ink); color: var(--bg); }

.empty { text-align: center; padding: 36px 12px 28px; }
.empty .big { font-family: var(--display); font-weight: 700; font-size: 26px; margin-bottom: 6px; }
.empty p { color: var(--muted); margin: 0; }

details.soon { margin-top: 10px; }
details.soon summary { cursor: pointer; font-weight: 600; color: var(--muted); padding: 10px 2px; list-style: none; }
details.soon summary::-webkit-details-marker { display: none; }
details.soon summary::before { content: "▸ "; }
details.soon[open] summary::before { content: "▾ "; }
details.soon .tile { box-shadow: none; background: transparent; border: 1.5px solid var(--line); border-left: 7px solid var(--line); }
details.soon .ring { border-style: dashed; }

/* plan tab */
.plan-row { display: flex; width: 100%; text-align: left; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface); border: 0; border-radius: 14px; padding: 14px 16px; margin-bottom: 8px; box-shadow: var(--shadow); min-height: 60px; }
.plan-row .meta { color: var(--muted); font-size: 14px; }
.plan-row .next { color: var(--muted); font-size: 14px; white-space: nowrap; text-align: right; }
.btn { display: block; width: 100%; border: 0; border-radius: 14px; padding: 15px; font-weight: 600; font-size: 16px; background: var(--accent); color: var(--accent-ink); margin: 14px 0 8px; }
.btn.ghost { background: transparent; color: var(--muted); border: 1.5px solid var(--line); font-weight: 500; }
.btn.danger { background: transparent; color: var(--late); border: 1.5px solid var(--late); }
h2.sec { font-family: var(--display); font-size: 22px; margin: 4px 0 12px; }

/* tab bar */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 8px; background: var(--bg); border-top: 1px solid var(--line); padding: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px)); z-index: 5; }
.tabs button { flex: 1; max-width: 250px; border: 0; background: transparent; border-radius: 12px; padding: 12px; font-weight: 600; color: var(--muted); min-height: 48px; }
.tabs button[aria-current="page"] { background: var(--ink); color: var(--bg); }

/* sheet */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.42); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); width: 100%; max-width: 520px; border-radius: 22px 22px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px)); max-height: 90%; overflow-y: auto; animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet h2 { font-family: var(--display); font-size: 22px; margin: 0 0 12px; }
.sheet .act { display: block; width: 100%; text-align: left; background: var(--bg); border: 0; border-radius: 12px; padding: 15px 16px; margin-bottom: 8px; font-weight: 500; min-height: 52px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
.field input, .field select { width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; min-height: 48px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* toast */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(78px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); border-radius: 14px; padding: 8px 8px 8px 16px; display: flex; align-items: center; gap: 12px; z-index: 30; width: calc(100% - 32px); max-width: 488px; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.toast span { flex: 1; font-size: 15px; }
.toast button { border: 0; background: transparent; color: inherit; font-weight: 700; text-decoration: underline; padding: 12px; min-height: 44px; }


.card { background: var(--surface); border-radius: 14px; padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card h2 { font-family: var(--display); font-size: 20px; margin: 0 0 4px; }
.card p { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.stepper { display: flex; align-items: center; gap: 14px; }
.stepper button { width: 52px; height: 52px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg); font-size: 26px; line-height: 1; }
.stepper .val { font-family: var(--display); font-weight: 700; font-size: 32px; min-width: 64px; text-align: center; }
.stepper .unit { color: var(--muted); font-size: 14px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opts button { border: 1.5px solid var(--line); background: var(--bg); border-radius: 999px; padding: 10px 16px; font-weight: 500; min-height: 44px; }
.checks { display: flex; flex-direction: column; gap: 6px; }
.check { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--bg); min-height: 48px; text-align: left; border: 0; width: 100%; }
.check .box { flex: none; width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--muted); display: grid; place-items: center; font-size: 15px; font-weight: 700; color: var(--accent-ink); }
.check[aria-checked="true"] .box { background: var(--accent); border-color: var(--accent); }
.pausebox { text-align: center; padding: 34px 16px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); margin-bottom: 14px; }
.pausebox .big { font-family: var(--display); font-weight: 700; font-size: 26px; margin-bottom: 6px; }
.pausebox p { color: var(--muted); margin: 0 0 16px; }
.pausebox .btn { margin-bottom: 0; }
.morebtn { display: block; width: 100%; margin: 4px 0 18px; border: 1.5px dashed var(--muted); background: transparent; border-radius: 14px; padding: 14px; font-weight: 600; color: var(--ink); min-height: 52px; }
.link { display: block; width: 100%; background: transparent; border: 0; color: var(--muted); padding: 14px; font-weight: 500; text-decoration: underline; margin-top: 4px; }
textarea.json { width: 100%; height: 220px; font: 12px/1.4 ui-monospace, Menlo, Consolas, monospace; color: var(--ink); background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; padding: 10px; }
.tabs button { padding: 12px 6px; }

@media (prefers-reduced-motion: reduce) {
  .swipe, .sheet, .ring { transition: none; animation: none; }
}

/* Statuspunkt: grau = synchron, gelb = Änderungen warten, rot = Server nicht erreichbar oder Token ungültig */
.head-right { display: flex; align-items: center; gap: 10px; }
.sync { width: 36px; height: 36px; border: 0; background: transparent; border-radius: 50%; display: grid; place-items: center; padding: 0; }
.sync::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--muted); opacity: .55; }
.sync.s-wait::before { background: var(--warn); opacity: 1; }
.sync.s-err::before { background: var(--late); opacity: 1; }

/* ersetzt Inline-Styles (wegen strenger Content-Security-Policy) */
.btn.flush { margin: 0; }
.hint.tight { margin: -4px 0 12px; }
.sheet .note { color: var(--muted); margin: 0 0 10px; }
.sheet .error-text { color: var(--late); font-weight: 500; margin: 0 0 12px; }
.tile.dragging { transition: none; }

/* Fehlerseite ohne Token */
.gate { max-width: 420px; margin: 0 auto; padding: 20vh 24px 24px; text-align: center; }
.gate h1 { font-family: var(--display); font-size: 32px; margin: 0 0 10px; }
.gate p { color: var(--muted); margin: 0 0 12px; }

/* Hinweis auf neue Version */
.update { position: fixed; left: 50%; transform: translateX(-50%); top: calc(10px + env(safe-area-inset-top, 0px)); z-index: 40; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 999px; padding: 10px 18px; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.25); }

[hidden] { display: none !important; }
.txt .name, .txt .sub { display: block; }

/* Plan: Gruppierung und Filter */
.seg { display: flex; gap: 4px; background: var(--surface); border-radius: 12px; padding: 4px; margin: 12px 0 10px; box-shadow: var(--shadow); }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 9px; padding: 10px 6px; font-weight: 600; color: var(--muted); min-height: 44px; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.chips.tight { padding-bottom: 8px; }
h2.sec { margin-top: 18px; }
h2.sec .cnt, .plan-group-head .cnt { font-family: var(--body); font-size: 14px; font-weight: 500; color: var(--muted); }
.plan-group { background: var(--surface); border-radius: 14px; margin-bottom: 8px; box-shadow: var(--shadow); overflow: hidden; }
.plan-row.nested { box-shadow: none; border-radius: 0; margin-bottom: 0; background: transparent; min-height: 52px; padding-top: 10px; padding-bottom: 10px; }
.plan-row.nested + .plan-row.nested { border-top: 1px solid var(--line); }
.plan-group-head { display: flex; justify-content: space-between; gap: 10px; width: 100%; text-align: left; align-items: center; background: transparent; border: 0; padding: 12px 16px; min-height: 60px; }
.plan-group-head .meta { color: var(--muted); font-size: 14px; }
.plan-group-head .next { color: var(--muted); font-size: 14px; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.chev { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .15s; }
.plan-group.open .chev { transform: rotate(-135deg); }
.plan-group.open .plan-group-head { border-bottom: 1px solid var(--line); }

/* Am PC (Maus): Chips umbrechen statt seitlich zu scrollen, das geht mit der Maus nicht */
@media (hover: hover) and (pointer: fine) {
  .chips { flex-wrap: wrap; overflow-x: visible; }
}

/* Desktop und breite Tablets: zwei Spalten, Navigation oben, Dialog statt Bottom-Sheet. Handy bleibt unverändert. */
@media (min-width: 860px) {
  .app {
    max-width: 1040px; padding: 92px 32px 64px;
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; align-items: start;
  }
  .app > * { grid-column: 1 / -1; }
  .app > .swipe, .app > .plan-row, .app > .plan-group, .app > .card { grid-column: auto; }
  .app > .gate { grid-column: 1 / -1; }
  .head { margin-bottom: 22px; }
  .head h1 { font-size: 46px; }
  .chips { margin: 0; padding-left: 0; padding-right: 0; }
  .btn.flush { justify-self: start; width: auto; padding: 14px 28px; }
  .bulk { width: auto; justify-self: start; padding: 14px 28px; }
  .morebtn { width: auto; justify-self: start; padding: 14px 28px; }
  .tile-main:hover .ring { border-color: var(--ok); }
  .tile, .plan-row, .plan-group-head, .more, .chip, .opts button, .check, .seg button, .morebtn, .bulk, .btn { transition: background-color .12s, border-color .12s, box-shadow .12s; }
  .plan-row:hover, .plan-group-head:hover { background: color-mix(in srgb, var(--surface) 92%, var(--accent)); }
  .more:hover { background: var(--bg); color: var(--ink); }
  .chip:hover:not(.active) { border-color: var(--muted); }
  .opts button:hover, .check:hover { border-color: var(--muted); }
  .morebtn:hover, .bulk:hover { background: var(--surface); }
  .seg { max-width: 420px; }

  /* Tab-Leiste als obere Navigation, bündig mit der Inhaltsspalte */
  .tabs {
    top: 0; bottom: auto; justify-content: flex-start; gap: 6px;
    border-top: 0; border-bottom: 1px solid var(--line);
    padding: 12px max(32px, calc((100% - 1040px) / 2 + 32px)) 12px;
  }
  .tabs button { flex: none; min-width: 120px; max-width: none; padding: 10px 22px; min-height: 44px; }
  .tabs button:not([aria-current="page"]):hover { background: var(--surface); color: var(--ink); }

  /* Dialog mittig */
  .backdrop { align-items: center; }
  .sheet { max-width: 480px; border-radius: 22px; max-height: 86vh; padding-bottom: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
  .toast { bottom: 28px; max-width: 520px; }
  .update { top: 72px; }

  /* "Demnächst" ebenfalls zweispaltig */
  details.soon { grid-column: 1 / -1; }
  @supports selector(::details-content) {
    details.soon[open]::details-content { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; }
  }
}
