:root {
  --bg: #f6f4f1;
  --card: #ffffff;
  --text: #1d1b19;
  --muted: #6f6a64;
  --line: #e4dfd8;
  --accent: #e8590c;
  --accent-ink: #ffffff;
  --soft: #fbe9dd;
  --danger: #c92a2a;
  --radius: 14px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151412;
    --card: #1f1d1b;
    --text: #efebe6;
    --muted: #a49d95;
    --line: #34302c;
    --soft: #3a2518;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
h1, h2 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.15rem; }
h2 { font-size: 1rem; margin-bottom: 0.5rem; }

.top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.25rem clamp(1rem, 4vw, 2.5rem); }
.brand { display: flex; gap: 0.75rem; align-items: center; }
.brand svg { width: 38px; height: 38px; flex: none; }
.sub { margin: 0; color: var(--muted); font-size: 0.85rem; }
.pill { font-size: 0.8rem; padding: 0.25rem 0.7rem; border-radius: 99px; background: var(--card); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pill.ok { color: #2b8a3e; }
.pill.bad { color: var(--danger); }

.grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 1rem; padding: 0 clamp(1rem, 4vw, 2.5rem) 2.5rem; max-width: 1200px; margin: 0 auto; }
.wide { grid-column: 1 / -1; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; display: flex; flex-direction: column; gap: 0.75rem; min-width: 0; }

.row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.label { font-weight: 600; font-size: 0.85rem; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; margin: 0; }

textarea, input[type="text"], input[type="password"], select {
  width: 100%; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 0.6rem 0.7rem;
}
textarea { resize: vertical; min-height: 170px; line-height: 1.6; }
textarea:focus, input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.row select { flex: 1; min-width: 0; }

.tags { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.tags select { width: auto; padding: 0.35rem 0.5rem; font-size: 0.85rem; }

.settings { display: grid; grid-template-columns: 2fr 1.3fr 1fr; gap: 0.9rem; }
@media (max-width: 640px) { .settings { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
input[type="range"] { accent-color: var(--accent); width: 100%; }
.check { display: flex; gap: 0.45rem; align-items: flex-start; font-size: 0.82rem; color: var(--muted); }
.check input { margin-top: 0.2rem; accent-color: var(--accent); }
.consent { color: var(--text); }

button, .file-btn { font: inherit; cursor: pointer; border-radius: 10px; border: 1px solid transparent; padding: 0.6rem 1rem; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.primary:hover:not(:disabled) { filter: brightness(1.06); }
.small-btn { padding: 0.6rem 0.9rem; }
.secondary, .file-btn { background: var(--soft); color: var(--text); border-color: var(--line); }
.icon-btn { background: var(--bg); border-color: var(--line); color: var(--text); padding: 0.55rem 0.75rem; }
.link { background: none; border: none; color: var(--muted); padding: 0; text-decoration: underline; font-size: 0.85rem; }
#recBtn.recording { background: var(--danger); color: #fff; }
.primary.busy { position: relative; color: transparent; }
.primary.busy::after { content: ""; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; border: 2px solid #fff; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.error { color: var(--danger); margin: 0; font-size: 0.88rem; }
audio { width: 100%; height: 38px; }

.history, .voices { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.history li { border: 1px solid var(--line); border-radius: 10px; padding: 0.7rem 0.8rem; display: grid; grid-template-columns: 1fr auto; gap: 0.4rem 0.8rem; }
.history li.empty { display: block; border-style: dashed; }
.history .meta { font-size: 0.78rem; color: var(--muted); }
.history .txt { grid-column: 1 / -1; font-size: 0.9rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.history audio { grid-column: 1 / -1; }
.history a { font-size: 0.82rem; color: var(--accent); }
.voices li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-bottom: 1px solid var(--line); padding-bottom: 0.5rem; }
.voices li:last-child { border-bottom: none; }

.login { display: grid; place-items: start center; padding: 6vh 1rem; }
.login form { width: min(400px, 100%); }
input[type="email"] { width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 0.6rem 0.7rem; }
.top .row { justify-content: flex-end; }
@media (max-width: 640px) { .top { flex-wrap: wrap; } }
[hidden] { display: none !important; }
a { color: var(--accent); }
a.brand { color: inherit; text-decoration: none; }
.foot { text-align: center; padding: 0 1rem 2rem; font-size: 0.82rem; color: var(--muted); }
.foot a { color: var(--muted); }
.legal { max-width: 760px; margin: 0 auto 1.5rem; padding: clamp(1.2rem, 4vw, 2.2rem); gap: 0.4rem; line-height: 1.65; }
.legal h1 { font-size: 1.5rem; margin-bottom: 0.2rem; }
.legal h2 { font-size: 1.05rem; margin: 1.2rem 0 0.2rem; }
.legal h3 { font-size: 0.95rem; margin: 0.8rem 0 0.1rem; }
.legal p, .legal ul { margin: 0.3rem 0; }
.legal li { margin-bottom: 0.35rem; }
.btn-link { display: inline-block; padding: 0.6rem 1rem; border-radius: 10px; text-decoration: none; }
@media (max-width: 640px) { .legal { margin: 0 1rem 1.5rem; } }
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--text); padding: 1.2rem; width: min(360px, 92vw); }
dialog form { display: flex; flex-direction: column; gap: 0.7rem; }
dialog::backdrop { background: rgb(0 0 0 / 0.4); }

/* Login-Varianten */
.oauth { display: flex; flex-direction: column; gap: 0.5rem; }
.oauth-btn { display: flex; align-items: center; justify-content: center; gap: 0.6rem; width: 100%; background: var(--card); color: var(--text); border: 1px solid var(--line); font-weight: 600; }
.oauth-btn:hover { background: var(--bg); }
.oauth-btn svg { width: 18px; height: 18px; flex: none; }
.divider { display: flex; align-items: center; gap: 0.6rem; color: var(--muted); font-size: 0.8rem; margin: 0.3rem 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.tab { background: none; padding: 0.45rem; font-size: 0.88rem; color: var(--muted); border-radius: 8px; }
.tab.active { background: var(--card); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgb(0 0 0 / 0.08); }
#newPwForm { width: min(400px, 100%); }
