:root {
  --accent: #0b6e69;
  --accent-ink: #ffffff;
  --accent-soft: #e3f3f1;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --ink: #15191e;
  --muted: #69727d;
  --line: #e2e5e9;
  --danger: #c93c3c;
  --hoch: #d64545;
  --mittel: #d99a00;
  --niedrig: #8a94a6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 14px rgba(0,0,0,.05);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #2bb3a8;
    --accent-ink: #04201e;
    --accent-soft: #123532;
    --bg: #0e1113;
    --surface: #181c20;
    --ink: #eef1f3;
    --muted: #97a1ab;
    --line: #2a3036;
    --shadow: none;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.view { min-height: 100%; display: flex; flex-direction: column; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.big { min-height: 56px; font-size: 17px; }
.btn.ghost { background: transparent; }
.btn.grow { flex: 1; }
.btn.danger-ghost { background: transparent; color: var(--danger); border-color: transparent; width: 100%; margin: 8px 0 24px; }
.btn[disabled] { opacity: .5; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 22px; border: 0; background: transparent;
  color: var(--ink); font-size: 28px; line-height: 1; cursor: pointer; flex: none;
}
.link { background: none; border: 0; color: var(--accent); font: inherit; font-size: 14px; padding: 10px 0 0; cursor: pointer; }

/* Formulare */
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
input, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 12px;
  font: inherit; font-size: 16px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.4; }
label.check input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--accent); }
label.check a { color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.error { color: var(--danger); font-size: 14px; margin: 0 0 12px; }
.warn { background: #fff4d6; color: #6b4e00; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
@media (prefers-color-scheme: dark) { .warn { background: #3a3013; color: #f3d98a; } }

/* Segment-Schalter */
.seg { display: flex; background: var(--line); border-radius: 12px; padding: 3px; }
.seg button {
  flex: 1; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600;
  min-height: 40px; border-radius: 9px; cursor: pointer;
}
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg.small button { min-height: 34px; font-size: 14px; }

/* Auth */
.auth-wrap { width: 100%; max-width: 420px; margin: 0 auto; padding: max(40px, env(safe-area-inset-top)) 20px 30px; }
.brand { text-align: center; margin-bottom: 26px; }
.brand h1 { margin-top: 10px; font-size: 26px; }
.brand p { margin: 6px 0 0; }
#auth-form { margin-top: 20px; }
#auth-form .btn { width: 100%; margin-top: 8px; }
.legal { text-align: center; font-size: 13px; margin-top: 24px; }
.legal a { color: var(--muted); margin: 0 8px; }

/* Kopfbereich */
.top {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  border-bottom: 1px solid var(--line);
}
.top.slim { padding-left: 6px; padding-right: 16px; }
.top-row { display: flex; align-items: center; gap: 6px; min-height: 44px; }
.top-row h1 { flex: 1; min-width: 0; }
.count { color: var(--muted); font-weight: 500; font-size: 18px; }
.event-pill {
  display: flex; gap: 6px; align-items: center; width: 100%; margin: 6px 0 10px; padding: 10px 12px;
  border: 1px dashed var(--accent); background: var(--accent-soft); color: var(--ink);
  border-radius: 10px; font: inherit; font-size: 15px; text-align: left; cursor: pointer;
}
.event-pill b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-row { display: flex; gap: 10px; align-items: center; }
.filter-row .seg { flex: none; width: 150px; }
.seg button { white-space: nowrap; }
.filter-row input { margin: 0; padding: 9px 12px; }

/* Liste */
.list { list-style: none; margin: 0; padding: 8px 12px 120px; flex: 1; }
.list li {
  display: flex; gap: 12px; align-items: center; background: var(--surface); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 8px; box-shadow: var(--shadow); cursor: pointer;
}
.list li:active { opacity: .7; }
.avatar {
  width: 42px; height: 42px; flex: none; border-radius: 21px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700;
}
.li-main { flex: 1; min-width: 0; }
.li-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-sub { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-side { text-align: right; font-size: 12px; color: var(--muted); flex: none; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 5px; background: var(--line); }
.dot.hoch { background: var(--hoch); } .dot.mittel { background: var(--mittel); } .dot.niedrig { background: var(--niedrig); }
.nonote { display: block; font-size: 11px; color: var(--mittel); margin-top: 4px; }
.empty { text-align: center; padding: 60px 30px; color: var(--muted); flex: 1; }
.empty-icon { font-size: 48px; }

/* Untere Leiste */
.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; gap: 10px; padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}

/* Detail */
.content { padding: 14px 16px 110px; max-width: 640px; width: 100%; margin: 0 auto; }
.card-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
#c-image { width: 110px; height: 66px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); flex: none; cursor: zoom-in; }
.c-company { font-weight: 600; font-size: 17px; }
.panel { background: var(--surface); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
details.panel > summary { color: var(--ink); list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary h2 { margin: 0; }
details.panel > summary::after { content: '›'; font-size: 24px; color: var(--muted); transition: transform .2s; }
details.panel[open] > summary::after { transform: rotate(90deg); }
details.panel[open] > summary { margin-bottom: 14px; }

.prio { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 10px; color: #fff; background: var(--niedrig); flex: none; }
.prio.hoch { background: var(--hoch); } .prio.mittel { background: var(--mittel); }
.prio-seg button.active[data-p="hoch"] { background: var(--hoch); color: #fff; }
.prio-seg button.active[data-p="mittel"] { background: var(--mittel); color: #fff; }
.prio-seg button.active[data-p="niedrig"] { background: var(--niedrig); color: #fff; }

/* Mikrofon */
.mic {
  width: 100%; min-height: 64px; display: flex; align-items: center; justify-content: center; gap: 12px;
  border: 0; border-radius: 16px; background: var(--accent); color: var(--accent-ink);
  font: inherit; font-size: 17px; font-weight: 700; cursor: pointer;
}
.mic-dot { width: 16px; height: 16px; border-radius: 8px; background: currentColor; opacity: .85; }
.mic.rec { background: var(--danger); color: #fff; }
.mic.rec .mic-dot { animation: pulse 1s infinite; border-radius: 3px; }
.mic-time { font-variant-numeric: tabular-nums; font-weight: 500; }
@keyframes pulse { 50% { opacity: .3; } }
#type-box { margin-top: 10px; }
#type-box .btn { width: 100%; margin-top: 8px; }

.summary { font-size: 16px; margin: 16px 0 8px; }
.bullets { margin: 0 0 12px; padding-left: 20px; }
.bullets li { margin: 4px 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; margin: 0 0 12px; font-size: 14px; align-items: center; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
details summary { cursor: pointer; color: var(--accent); font-size: 14px; padding: 6px 0; }
details textarea { margin: 8px 0; }

.actions-row { display: flex; gap: 10px; margin-bottom: 4px; }
.actions-row .btn { flex: 1; }

/* Dialoge */
dialog {
  border: 0; border-radius: 18px; padding: 20px; width: min(92vw, 420px);
  background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog h2 { font-size: 18px; }
.dlg-actions { display: flex; gap: 10px; margin-top: 16px; }
.dlg-actions .btn { flex: 1; }
.menu { display: flex; flex-direction: column; gap: 10px; }
.img-dlg { padding: 0; width: 96vw; max-width: 900px; background: #000; }
.img-dlg img { display: block; width: 100%; height: auto; }

/* Busy + Toast */
.busy {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(3px);
}
.busy p { font-weight: 600; margin-top: 16px; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 60;
  bottom: calc(96px + env(safe-area-inset-bottom)); max-width: 90vw;
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-size: 15px;
  box-shadow: 0 8px 30px rgba(0,0,0,.25);
}
.toast.err { background: var(--danger); color: #fff; }

@media (min-width: 700px) {
  .list { max-width: 680px; width: 100%; margin: 0 auto; }
  .top > * { max-width: 680px; margin-left: auto; margin-right: auto; }
  .bottom-bar { justify-content: center; }
  .bottom-bar .grow { max-width: 480px; }
}
