/* ─────────────────────────────────────────────────────────────────────────
   Steuer-Assistent — Styles. Warm, ruhig, groß & klar lesbar (laientauglich).
   ───────────────────────────────────────────────────────────────────────── */
:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1c2536;
  --muted: #64748b;
  --line: #e3e8f2;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --accent: #0f9d76;
  --accent-soft: #e7f6f0;
  --warn: #b45309;
  --warn-soft: #fef3e2;
  --danger: #dc2626;
  --danger-soft: #fdeaea;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(20, 33, 61, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ── Topbar ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; }
.brand .logo { font-size: 1.4rem; }
.top-right { display: flex; align-items: center; gap: 10px; }

.wrap { max-width: 860px; margin: 0 auto; padding: 22px 18px 60px; }

/* ── Programm-Umschalter ── */
.program-switch {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 16px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
}
.ps-label { font-weight: 700; color: var(--muted); }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button {
  border: 2px solid var(--line); background: #fff; color: var(--ink);
  padding: 10px 16px; border-radius: 12px; font-weight: 700; cursor: pointer;
  font-size: 0.98rem; transition: all .12s ease;
}
.seg button small { display: block; font-weight: 500; color: var(--muted); font-size: .72rem; }
.seg button.active { border-color: var(--brand); background: #eef4ff; color: var(--brand-dark); }
.seg button.active small { color: var(--brand-dark); opacity: .8; }
.engine-wrap { margin-left: auto; }
.engine-toggle select {
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px;
  font-size: .85rem; background: #fff; color: var(--ink); cursor: pointer;
}

/* ── Modus-Umschalter ── */
.mode-switch { display: flex; gap: 8px; margin-bottom: 14px; }
.mode-btn {
  flex: 1; border: 1px solid var(--line); background: #fff; color: var(--muted);
  padding: 12px; border-radius: 12px; font-weight: 700; cursor: pointer; font-size: 1rem;
}
.mode-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ── Eingabe ── */
.ask-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.ask-hint { color: var(--muted); margin-bottom: 10px; font-size: .95rem; }
.input-row { display: flex; gap: 10px; align-items: stretch; }
textarea#frage {
  flex: 1; resize: vertical; min-height: 70px; border: 2px solid var(--line);
  border-radius: 12px; padding: 12px 14px; font-size: 1.05rem; font-family: inherit;
  color: var(--ink); background: #fcfdff;
}
textarea#frage:focus { outline: none; border-color: var(--brand); }
.mic {
  width: 54px; border: 2px solid var(--line); background: #fff; border-radius: 12px;
  font-size: 1.4rem; cursor: pointer; flex: 0 0 auto;
}
.mic.recording { background: var(--danger-soft); border-color: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }

.ask-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; flex: 1; }
.chip {
  border: 1px dashed var(--line); background: #fff; color: var(--muted);
  border-radius: 999px; padding: 6px 12px; font-size: .82rem; cursor: pointer;
}
.chip:hover { border-color: var(--brand); color: var(--brand-dark); }

/* ── Buttons ── */
button.primary {
  background: var(--brand); color: #fff; border: none; border-radius: 12px;
  padding: 12px 22px; font-weight: 800; font-size: 1rem; cursor: pointer;
}
button.primary:hover { background: var(--brand-dark); }
button.primary:disabled { opacity: .6; cursor: default; }
button.ghost {
  background: #fff; border: 1px solid var(--line); color: var(--ink);
  border-radius: 10px; padding: 9px 14px; font-weight: 600; cursor: pointer;
}
button.ghost.small { padding: 6px 12px; font-size: .85rem; }

/* ── Status / Pills ── */
.pill {
  font-size: .78rem; font-weight: 700; padding: 5px 11px; border-radius: 999px;
  background: #eef2f8; color: var(--muted);
}
.pill.live { background: var(--accent-soft); color: var(--accent); }
.pill.demo { background: var(--warn-soft); color: var(--warn); }

.status-line {
  margin: 16px 0; padding: 14px 16px; background: #eef4ff; border: 1px solid #d6e4ff;
  border-radius: 12px; color: var(--brand-dark); font-weight: 600;
  display: flex; align-items: center; gap: 10px;
}
.spinner {
  width: 18px; height: 18px; border: 3px solid #c7dbff; border-top-color: var(--brand);
  border-radius: 50%; animation: spin .8s linear infinite; flex: 0 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Alerts ── */
.alert { padding: 12px 15px; border-radius: 12px; margin: 14px 0; font-weight: 600; }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.info { background: #eef4ff; color: var(--brand-dark); }

/* ── Ergebnis ── */
.result { margin-top: 18px; display: flex; flex-direction: column; gap: 14px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 10px; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.answer-main { font-size: 1.1rem; }
.answer-main p { margin: 0 0 10px; }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li {
  position: relative; padding: 9px 0 9px 40px; border-bottom: 1px dashed var(--line);
}
.steps li:last-child { border-bottom: none; }
.steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 8px; width: 26px; height: 26px;
  background: var(--brand); color: #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .8rem;
}

/* Buchungs-Tabelle */
.booking-grid { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; }
.booking-grid dt { color: var(--muted); font-weight: 700; }
.booking-grid dd { margin: 0; font-weight: 600; }
.konto { font-family: ui-monospace, "SF Mono", Menlo, monospace; background: #f1f5fb;
  padding: 2px 7px; border-radius: 6px; }

.card.tipps { background: var(--accent-soft); border-color: #bfe6d7; }
.card.tipps h3 { color: var(--accent); }

/* Aufklappbare Profi-Ebene */
details.card.fachlich { background: #f8fafc; }
details.card.fachlich summary {
  cursor: pointer; font-weight: 800; font-size: 1.02rem; list-style: none;
  display: flex; align-items: center; gap: 8px;
}
details.card.fachlich summary::-webkit-details-marker { display: none; }
details.card.fachlich summary::before { content: "▸"; color: var(--brand); font-weight: 900; }
details.card.fachlich[open] summary::before { content: "▾"; }
details.card.fachlich summary .muted { font-weight: 500; font-size: .82rem; }
.fachlich-body { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: .97rem; }
.fachlich-body p { margin: 0 0 10px; }
.card.warn { background: var(--warn-soft); border-color: #f5d8a8; }
.card.warn h3 { color: var(--warn); }
.list-plain { margin: 0; padding-left: 20px; }
.list-plain li { margin: 5px 0; }

.badges { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.badge { font-size: .76rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: #eef2f8; color: var(--muted); }
.badge.hoch { background: var(--accent-soft); color: var(--accent); }
.badge.mittel { background: var(--warn-soft); color: var(--warn); }
.badge.gering { background: var(--danger-soft); color: var(--danger); }

.sources { display: flex; flex-direction: column; gap: 6px; }
.sources a { color: var(--brand-dark); font-size: .88rem; text-decoration: none; word-break: break-all; }
.sources a:hover { text-decoration: underline; }

.followups { display: flex; flex-wrap: wrap; gap: 8px; }
.followups button {
  border: 1px solid var(--brand); color: var(--brand-dark); background: #fff;
  border-radius: 999px; padding: 8px 14px; font-size: .9rem; cursor: pointer; font-weight: 600;
}
.followups button:hover { background: #eef4ff; }

.badge.archive { background: #eae2fb; color: #6d28d9; }
.card.from-archive { border-color: #d6c9f5; background: #faf8ff; }

/* Ähnliche gespeicherte Antworten */
.related-list { display: flex; flex-direction: column; gap: 6px; }
.related-item {
  text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 9px 12px; cursor: pointer; font-size: .92rem; display: flex; gap: 8px; align-items: center;
}
.related-item:hover { border-color: var(--brand); background: #f7faff; }
.related-item .tag { font-size: .7rem; font-weight: 700; color: var(--muted); flex: 0 0 auto; }

/* Archiv-Panel */
#archiveSearch {
  width: 100%; padding: 11px 12px; border: 2px solid var(--line); border-radius: 10px;
  font-size: 1rem; margin: 6px 0 4px;
}
#archiveSearch:focus { outline: none; border-color: var(--brand); }
.arch-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.arch-row .q { flex: 1; cursor: pointer; }
.arch-row .q:hover { color: var(--brand-dark); }
.arch-row .q small { display: block; color: var(--muted); font-size: .75rem; margin-top: 2px; }

/* Profil-Formular */
#profileSelect, .profile-form input[type=text], .profile-form select, .profile-form textarea {
  width: 100%; padding: 10px 12px; border: 2px solid var(--line); border-radius: 10px;
  font-size: .98rem; font-family: inherit; color: var(--ink); background: #fff;
}
.profile-form { margin-top: 6px; }
.profile-form label { display: block; font-weight: 700; margin: 10px 0 4px; font-size: .88rem; }
.profile-form .row-check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.profile-form textarea { resize: vertical; }

.note-line {
  margin-top: 10px; padding: 10px 12px; background: var(--warn-soft); color: var(--warn);
  border-radius: 10px; font-size: .9rem; font-weight: 600;
}

.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ── Overlays (Login / Admin) ── */
.overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .55);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 18px;
}
.login-card, .admin-card {
  background: #fff; border-radius: var(--radius); padding: 26px; width: 100%;
  box-shadow: var(--shadow);
}
.login-card { max-width: 380px; }
.admin-card { max-width: 640px; max-height: 82vh; overflow: auto; }
.login-card label, .admin-card label { display: block; font-weight: 700; margin: 12px 0 4px; font-size: .9rem; }
.login-card input[type=email], .login-card input[type=password] {
  width: 100%; padding: 11px 12px; border: 2px solid var(--line); border-radius: 10px; font-size: 1rem;
}
.row-check { display: flex !important; align-items: center; gap: 8px; font-weight: 500 !important; margin-top: 14px !important; }
.login-actions { display: flex; gap: 10px; margin-top: 18px; }
.login-actions .primary { flex: 1; }

.admin-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.admin-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.admin-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px;
}
.admin-row .who { flex: 1; }
.admin-row .who small { color: var(--muted); display: block; }

@media (max-width: 620px) {
  .engine-wrap { margin-left: 0; width: 100%; }
  .engine-toggle select { width: 100%; }
  .booking-grid { grid-template-columns: 1fr; gap: 2px 0; }
  .booking-grid dt { margin-top: 8px; }
}
