:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --ink: #1d2524;
  --muted: #5d6967;
  --line: #dcdad2;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --gold: #ecb81c;
  --good: #2f8f4e;
  --bad: #c0392b;
  --radius: 14px;
  --gutter: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121817; --surface: #1b2322; --ink: #eceeed; --muted: #9aa8a5; --line: #2c3736;
    --accent: #2dd4bf; --accent-ink: #052e2a; --good: #5ec27e; --bad: #ef7b6e;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
main { max-width: 640px; margin: 0 auto; padding: 20px var(--gutter) 24px; }
h1 { font-size: 1.5rem; line-height: 1.2; margin: 0 0 4px; }
h2 { font-size: 1.1rem; margin: 24px 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); font-size: .92rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0 0 12px; }
.card h3 { margin: 0 0 2px; font-size: 1rem; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1 1 140px; }

label { display: block; font-weight: 600; font-size: .9rem; margin: 0 0 4px; }
input[type=date], input[type=number], input[type=month], input[type=text], input[type=email], input[type=password], textarea {
  width: 100%; font: inherit; color: inherit; background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
textarea { min-height: 150px; resize: vertical; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

button { font: inherit; cursor: pointer; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 10px 16px; min-height: 44px; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.ghost { background: transparent; }
button.danger { color: var(--bad); }
button:disabled { opacity: .45; cursor: not-allowed; }

.progress { display: flex; gap: 6px; margin: 12px 0 18px; }
.progress span { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.progress span.done { background: var(--accent); }
.question { font-size: 1.35rem; line-height: 1.3; font-weight: 700; margin: 0 0 16px; }

.mic { width: 84px; height: 84px; border-radius: 50%; padding: 0; background: var(--accent); color: var(--accent-ink); border: 0; font-size: 2rem; display: grid; place-items: center; margin: 0 auto 8px; }
.mic .icon { width: 36px; height: 36px; }
.mic[aria-pressed="true"] { background: var(--bad); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(192,57,43,.45); } 50% { box-shadow: 0 0 0 16px rgba(192,57,43,0); } }
@media (prefers-reduced-motion: reduce) { .mic[aria-pressed="true"] { animation: none; } }
.mic-hint { text-align: center; margin: 0 0 14px; }
.nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }

.scale { display: grid; grid-template-columns: 90px 1fr; gap: 6px 10px; align-items: center; margin: 0 0 10px; }
.scale .opts { display: flex; gap: 6px; }
.scale button { flex: 1; padding: 6px 0; min-height: 46px; display: grid; place-items: center; color: var(--muted); }
.scale button .icon { width: 28px; height: 28px; stroke-width: 1.75; }
.scale button[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); box-shadow: inset 0 0 0 1px var(--accent); }

.summary dt { font-weight: 600; font-size: .85rem; color: var(--muted); margin-top: 10px; }
.summary dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

.entry p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 4px 0 0; }
.tag { display: inline-block; font-size: .78rem; padding: 1px 9px; border-radius: 99px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); margin: 2px 4px 2px 0; font-weight: 600; }
.delta-besser { color: var(--good); font-weight: 700; }
.delta-schlechter { color: var(--bad); font-weight: 700; }
.delta-gleich, .delta-offen { color: var(--muted); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: .95rem; }
th { font-size: .8rem; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.ms { display: flex; gap: 10px; align-items: center; padding: 6px 0; }
.ms input[type=checkbox] { width: 24px; height: 24px; accent-color: var(--accent); flex: none; }
.ms span { flex: 1; overflow-wrap: anywhere; }
.ms.done span { text-decoration: line-through; color: var(--muted); }
.ms button { min-height: 36px; padding: 4px 10px; }

#tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
#tabs button { flex: 1; border: 0; border-radius: 0; background: transparent; padding: 10px 2px 8px; font-size: .74rem; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 58px; }
#tabs button .icon { width: 24px; height: 24px; stroke-width: 1.75; }
#tabs button[aria-current="page"] { color: var(--accent); font-weight: 700; }

#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + env(safe-area-inset-bottom)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 99px; max-width: calc(100% - 32px); z-index: 10; }
.notice { border-left: 4px solid var(--gold); background: color-mix(in srgb, var(--gold) 14%, transparent); padding: 10px 12px; border-radius: 8px; margin: 0 0 14px; font-size: .92rem; }

.field { margin: 0 0 12px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 0 0 12px; }
.check[hidden] { display: none; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.error { color: var(--bad); font-weight: 600; margin: 0 0 12px; }
button.block { width: 100%; }
button.link { border: 0; background: transparent; color: var(--accent); text-decoration: underline; padding: 8px; }
.center { text-align: center; }
.account { margin: -8px 0 8px; }
.account button { min-height: 36px; padding: 4px 10px; }

.icon { display: block; flex: none; }
.ok { display: inline-block; vertical-align: -4px; color: var(--good); }
.ok .icon { width: 20px; height: 20px; }
.ms button .icon { width: 18px; height: 18px; }
.typ { flex: 1 1 0; }
.typ[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); box-shadow: inset 0 0 0 1px var(--accent); font-weight: 600; }
select { width: 100%; font: inherit; min-height: 44px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: inherit; }

/* Tabea: Knopf, Chatfenster, Checkliste */
.tabea-fab, .tabea-chat, .tabea-liste { position: fixed; z-index: 20; }
.tabea-fab[hidden], .tabea-chat[hidden], .tabea-liste[hidden] { display: none; }
.tabea-fab { right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 8px; padding: 0 18px 0 14px; min-height: 52px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); }
.tabea-fab .icon { width: 24px; height: 24px; }
.tabea-chat { left: 8px; right: 8px; bottom: calc(70px + env(safe-area-inset-bottom)); max-width: 620px; margin: 0 auto; height: min(56vh, 440px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 28px rgba(0, 0, 0, .3); }
.tabea-kopf { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--line); }
.tabea-kopf .grow { flex: 1; }
.tabea-kopf button { min-height: 36px; padding: 4px 8px; }
.tabea-kopf .icon { width: 20px; height: 20px; }
.tabea-log { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.tabea-msg { margin: 0; padding: 8px 12px; border-radius: 14px; max-width: 86%; white-space: pre-wrap; overflow-wrap: anywhere; }
.tabea-msg.tabea { align-self: flex-start; background: color-mix(in srgb, var(--accent) 12%, transparent); }
.tabea-msg.ich { align-self: flex-end; background: var(--accent); color: var(--accent-ink); }
.tabea-form { display: flex; gap: 8px; align-items: center; padding: 8px; border-top: 1px solid var(--line); }
.tabea-form input { flex: 1; min-width: 0; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.tabea-form .mic { width: 44px; height: 44px; flex: none; }
.tabea-liste { top: calc(8px + env(safe-area-inset-top)); left: 8px; right: 8px; max-width: 620px; margin: 0 auto; max-height: 42vh; overflow-y: auto; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 80%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); pointer-events: none; }
.tabea-liste-kopf { display: flex; justify-content: space-between; margin-bottom: 4px; }
.tabea-liste ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.tabea-liste li { display: grid; grid-template-columns: 22px auto 1fr; gap: 8px; align-items: center; font-size: .92rem; }
.tabea-liste li .box { width: 18px; height: 18px; border: 2px solid var(--muted); border-radius: 5px; display: grid; place-items: center; }
.tabea-liste li.ok .box { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tabea-liste li .box .icon { width: 14px; height: 14px; stroke-width: 3; }
.tabea-liste li .wert { text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (prefers-reduced-motion: no-preference) { .tabea-liste li.ok .box { transition: background .2s; } }
