:root {
  --bg: #111418;
  --surface: #1a1f26;
  --surface-2: #232a33;
  --border: #2f3742;
  --text: #e8edf3;
  --muted: #9aa7b6;
  --accent: #2563eb;
  --accent-soft: #1e3a8a;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #d97706;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  overscroll-behavior-y: contain;
}

#app { max-width: 720px; margin: 0 auto; padding: 0 16px calc(28px + var(--safe-b)); }

/* ---------- Kopfzeile ---------- */
header.top {
  position: sticky; top: 0; z-index: 20; background: var(--bg);
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0 10px; border-bottom: 1px solid var(--border); margin-bottom: 16px;
}
header.top h1 { font-size: 19px; margin: 0; flex: 1; font-weight: 650; letter-spacing: -0.2px; }
header.top .sub { font-size: 12px; color: var(--muted); font-weight: 400; display: block; }

/* ---------- Buttons ---------- */
button {
  font: inherit; color: inherit; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 15px; min-height: 44px;
}
button:active { transform: scale(0.985); }
button:disabled { opacity: 0.45; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.danger { background: transparent; border-color: #5b2020; color: #f38b8b; }
button.ghost { background: transparent; }
button.small { padding: 7px 11px; min-height: 36px; font-size: 14px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Aufnahme ---------- */
.recorder { text-align: center; padding: 26px 0 18px; }
.rec-button {
  width: 168px; height: 168px; border-radius: 50%; border: none;
  background: var(--accent); color: #fff; font-size: 17px; font-weight: 650;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; box-shadow: 0 10px 34px rgba(37, 99, 235, 0.35); transition: background .2s;
}
.rec-button .glyph { font-size: 42px; line-height: 1; }
.rec-button.recording { background: var(--danger); box-shadow: 0 10px 34px rgba(220, 38, 38, 0.35); animation: pulse 2s infinite; }
.rec-button.paused { background: var(--warn); animation: none; }
@keyframes pulse { 0%,100% { box-shadow: 0 10px 34px rgba(220,38,38,.35); } 50% { box-shadow: 0 10px 48px rgba(220,38,38,.6); } }
@media (prefers-reduced-motion: reduce) { .rec-button.recording { animation: none; } }

.timer { font-size: 34px; font-variant-numeric: tabular-nums; margin: 18px 0 4px; font-weight: 300; letter-spacing: 1px; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 14px; }

/* ---------- Karten ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px;
}
.card.tappable { cursor: pointer; }
.card h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.card .meta { color: var(--muted); font-size: 12.5px; display: flex; gap: 10px; flex-wrap: wrap; }
.card .preview { color: var(--muted); font-size: 13.5px; margin-top: 7px; }

.section { margin: 22px 0 10px; }
.section h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin: 0 0 10px; font-weight: 600; }

/* ---------- Status ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px;
  padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border); white-space: nowrap;
}
.badge.active { background: var(--accent-soft); color: #c7d8ff; border-color: #2a4b9b; }
.badge.ok { background: #0f2e1c; color: #86efac; border-color: #1c5334; }
.badge.err { background: #351416; color: #fca5a5; border-color: #5b2020; }
.badge.wait { background: #3a2a0d; color: #fcd34d; border-color: #6b4a13; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.progress { height: 5px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin-top: 9px; }
.progress > i { display: block; height: 100%; background: var(--accent); transition: width .4s; }

/* ---------- Formulare ---------- */
input[type="text"], input[type="password"], input[type="search"], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 12px 13px; min-height: 46px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 5px; }

/* ---------- Detailansicht ---------- */
.detail h2 { font-size: 15px; margin: 24px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.detail ul { margin: 0; padding-left: 20px; }
.detail li { margin-bottom: 7px; }
.prose { white-space: pre-wrap; word-wrap: break-word; }
.prose h1, .prose h2, .prose h3 { text-transform: none; letter-spacing: 0; color: var(--text); }
.transcript {
  white-space: pre-wrap; font-size: 14.5px; line-height: 1.7; color: #cfd8e3;
  max-height: 60vh; overflow: auto; background: var(--surface); padding: 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
}
.task { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 11px 13px; margin-bottom: 8px; }
.task .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.uncertain { border-left: 3px solid var(--warn); padding-left: 11px; margin-bottom: 10px; }
details > summary { cursor: pointer; padding: 12px 0; color: var(--muted); font-size: 14px; }

.error-box { background: #351416; border: 1px solid #5b2020; color: #fca5a5; padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; font-size: 14px; }
.notice { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--warn); padding: 11px 13px; border-radius: 8px; color: var(--muted); font-size: 13.5px; margin-bottom: 12px; }
.empty { text-align: center; color: var(--muted); padding: 34px 12px; font-size: 14.5px; }

/* ---------- Systemseite ---------- */
.kv { display: grid; grid-template-columns: 1fr auto; gap: 7px 14px; font-size: 14px; }
.kv .k { color: var(--muted); }
.kv .v { font-variant-numeric: tabular-nums; text-align: right; }
.bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; grid-column: 1 / -1; }
.bar > i { display: block; height: 100%; background: var(--ok); }
.bar > i.warn { background: var(--warn); }
.bar > i.crit { background: var(--danger); }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(22px + var(--safe-b)); transform: translateX(-50%) translateY(140%);
  background: #f1f5f9; color: #0f172a; padding: 11px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 500; transition: transform .28s; z-index: 100;
  max-width: 90vw; text-align: center; box-shadow: 0 6px 24px rgba(0,0,0,.4);
}
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.err { background: #fecaca; color: #7f1d1d; }

.login { max-width: 340px; margin: 16vh auto 0; text-align: center; }
.login .logo { font-size: 46px; margin-bottom: 6px; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
