:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #efede8;
  --text: #1d1d1f;
  --muted: #6e6b66;
  --line: #e4e1db;
  --accent: #2f6fde;
  --accent-soft: #e3ecfb;
  --urgent: #d0402f;
  --urgent-soft: #fbe6e2;
  --warn: #b7791f;
  --warn-soft: #fbf0dc;
  --ok: #2f8f5b;
  --ok-soft: #e1f2e8;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.05);
  --radius: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151618;
    --surface: #1f2023;
    --surface-2: #2a2b2f;
    --text: #f2f1ee;
    --muted: #9c9a95;
    --line: #313237;
    --accent: #6c9cf0;
    --accent-soft: #23314a;
    --urgent: #f06a58;
    --urgent-soft: #3d2420;
    --warn: #e0a84d;
    --warn-soft: #3a2f1c;
    --ok: #5fc08a;
    --ok-soft: #1d3327;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(110px + var(--safe-bottom));
}
#app { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--urgent); min-height: 1.2em; font-size: 14px; }
button { font: inherit; color: inherit; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; width: 100%;
}
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; }
.login-card { width: 100%; max-width: 360px; text-align: center; }
.login-card h1 { margin: 8px 0 4px; font-size: 28px; }
.login-logo { width: 72px; height: 72px; border-radius: 18px; box-shadow: var(--shadow); }
.login-card form { display: grid; gap: 10px; margin-top: 24px; }

/* ---------- Kopf ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 0 8px;
}
.brand { font-size: 26px; margin: 0; letter-spacing: -.02em; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  border: 0; background: var(--surface); width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; box-shadow: var(--shadow); cursor: pointer; color: var(--muted);
}
.tabs {
  display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 12px; margin: 8px 0 12px;
  position: sticky; top: 0; z-index: 5;
}
.tab {
  flex: 1; border: 0; background: transparent; padding: 8px 4px; border-radius: 9px; font-size: 15px;
  font-weight: 500; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.badge {
  display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent);
  color: #fff; font-size: 12px; line-height: 18px; text-align: center; margin-left: 2px;
}
.filters { display: flex; gap: 6px; overflow-x: auto; padding: 0 0 10px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px;
  font-size: 14px; white-space: nowrap; cursor: pointer;
}
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- Fokus ---------- */
.focus {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px;
  margin-bottom: 18px;
}
.focus h2 { margin: 0 0 2px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.focus .summary { margin: 0 0 10px; font-size: 15px; }
.focus .task { border: 0; padding-left: 12px; padding-right: 0; background: none; box-shadow: none; }
.focus .task + .task { border-top: 1px solid var(--line); border-radius: 0; }
.focus .task .title { font-size: 17px; font-weight: 600; }

.section-title {
  font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  margin: 20px 4px 8px; display: flex; justify-content: space-between;
}
.group { display: grid; gap: 8px; }

/* ---------- Aufgabe ---------- */
.task {
  display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border-radius: 12px;
  padding: 12px 14px; box-shadow: var(--shadow); cursor: pointer; position: relative;
}
.task.urgent::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px;
  background: var(--urgent);
}
.check {
  flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); background: transparent;
  margin-top: 1px; cursor: pointer; display: grid; place-items: center; padding: 0;
}
.check:hover { border-color: var(--ok); }
.task.done .check { background: var(--ok); border-color: var(--ok); color: #fff; }
.task.done .title { text-decoration: line-through; color: var(--muted); }
.task-body { flex: 1; min-width: 0; }
.title { font-weight: 500; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; align-items: center; font-size: 13px; color: var(--muted); }
.pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px;
  background: var(--surface-2); font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap;
}
.pill.urgent { background: var(--urgent-soft); color: var(--urgent); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.subtle { background: transparent; border: 1px solid var(--line); }
.src { font-weight: 600; }
.src-gmail { color: #c5221f; } .src-notes { color: #b58a00; } .src-reminders { color: #2f6fde; }
.src-calendar { color: #8e44ad; } .src-call { color: #2f8f5b; } .src-whatsapp { color: #25a35a; }
.src-voice { color: #d35400; } .src-manual { color: var(--muted); }
.review-actions { display: flex; gap: 8px; margin-top: 10px; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty .big { font-size: 40px; display: block; margin-bottom: 8px; }

/* ---------- Mikrofon-Knopf ---------- */
.fab {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(22px + var(--safe-bottom)); z-index: 20;
  width: 68px; height: 68px; border-radius: 50%; border: 0; background: var(--accent); color: #fff;
  box-shadow: 0 6px 20px rgba(47,111,222,.45); cursor: pointer; display: grid; place-items: center;
}
.fab:active { transform: translateX(-50%) scale(.95); }

/* ---------- Bottom-Sheet ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 30; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; background: var(--bg);
  border-radius: 18px 18px 0 0; max-height: 92vh; overflow-y: auto;
  padding: 10px 16px calc(20px + var(--safe-bottom)); max-width: 760px; margin: 0 auto;
  animation: up .18s ease-out;
}
@keyframes up { from { transform: translateY(30px); opacity: .5; } to { transform: none; opacity: 1; } }
.sheet .grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 10px; }
.sheet h2 { margin: 4px 0 12px; font-size: 20px; }
.sheet h3 { margin: 22px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 13px; color: var(--muted); }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.seg { display: flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: none; padding: 8px 2px; border-radius: 8px; font-size: 14px; cursor: pointer; }
.seg button.active { background: var(--surface); box-shadow: var(--shadow); font-weight: 600; }
.seg button.active[data-p="1"] { color: var(--urgent); }
.btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 10px 14px;
  font-weight: 500; cursor: pointer; text-align: center; text-decoration: none; display: inline-flex;
  align-items: center; justify-content: center; gap: 6px; color: var(--text);
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--urgent); }
.btn.small { padding: 6px 10px; font-size: 14px; }
.btn:disabled { opacity: .5; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.evidence {
  background: var(--surface); border-left: 3px solid var(--line); padding: 8px 12px; border-radius: 6px;
  font-size: 14px; color: var(--muted); margin: 0 0 12px;
}
.card { background: var(--surface); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); margin-bottom: 8px; }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv > span:first-child { flex: none; }
.kv > span:last-child { text-align: right; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 6px; }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--urgent); } .dot.warn { background: var(--warn); }
.qr svg { width: 200px; height: 200px; display: block; margin: 8px auto; border-radius: 8px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; overflow-wrap: anywhere; }
ol.steps { padding-left: 20px; margin: 6px 0; }
ol.steps li { margin-bottom: 6px; }

/* ---------- Spracheingabe ---------- */
.voice-orb {
  width: 96px; height: 96px; border-radius: 50%; margin: 10px auto 14px; display: grid; place-items: center;
  background: var(--accent); color: #fff; border: 0; cursor: pointer;
}
.voice-orb.listening { animation: pulse 1.4s infinite; background: var(--urgent); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(208,64,47,.45); } 70% { box-shadow: 0 0 0 22px rgba(208,64,47,0); } 100% { box-shadow: 0 0 0 0 rgba(208,64,47,0); } }
.voice-hint { text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.created-list .task { box-shadow: none; border: 1px solid var(--line); }
.spinner.dark { border-color: rgba(127,127,127,.35); border-top-color: var(--accent); display: inline-block; vertical-align: -3px; margin-right: 6px; }
.voice-meter { height: 4px; width: 160px; margin: 0 auto 10px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.voice-meter > div { height: 100%; width: 0; background: var(--urgent); transition: width .08s linear; }
.voice-orb:disabled { opacity: .5; }
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(104px + var(--safe-bottom)); z-index: 40;
  background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 12px; display: flex; gap: 14px;
  align-items: center; font-size: 15px; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: calc(100% - 32px);
}
.toast button { background: none; border: 0; color: var(--accent); font-weight: 600; cursor: pointer; padding: 0; }
@media (prefers-color-scheme: dark) { .toast button { color: #1f4fae; } }

@media (min-width: 700px) {
  .sheet { left: 50%; transform: translateX(-50%); bottom: auto; top: 6vh; border-radius: 18px; width: 600px; max-height: 88vh; }
  @keyframes up { from { opacity: .3; } to { opacity: 1; } }
}
