/* Provoid Hilfe-Chat – im Stil von www.provoid.de
   (hell, Inter, Himmelblau #3DB8DE, dünne graue Rahmen, kaum Rundungen) */
/* Inter wird selbst ausgeliefert (kein Google Fonts → DSGVO), inkl. kyrillisch & griechisch */
@import url('/fonts/inter/index.css');

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f5f5f5;
  --line: #e5e5e5;
  --ink: #0a0a0a;
  --text: #2a2a2a;
  --muted: #666666;
  --accent: #3DB8DE;                       /* PROVOID-Blau */
  --accent-ink: #167A99;                   /* dunkleres Blau für Links/Text (besser lesbar) */
  --accent-soft: rgba(61, 184, 222, .10);
  --accent-faint: rgba(61, 184, 222, .06);
  --accent-line: rgba(61, 184, 222, .45);
  --danger: #D7263D;
  --r: 4px;                                /* Karten */
  --r-btn: 2px;                            /* Knöpfe */
}

* { box-sizing: border-box; }
html { background: var(--bg); min-height: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100svh; color: var(--text); background: var(--bg);
  font: 17px/1.6 'Inter Variable', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
  display: flex; flex-direction: column;
}
/* Chat füllt genau den sichtbaren Bereich – auch wenn die Handy-Tastatur offen ist */
body.in-chat { position: fixed; inset: 0 0 auto 0; min-height: 0; height: 100svh; height: var(--app-h, 100dvh); overflow: hidden; }
button, a, .chips button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); }

/* Kopf – wie auf provoid.de: Logo + Unterzeile, heller Balken mit Linie */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: rgba(250, 250, 250, .95); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brandmark { width: 34px; height: 34px; object-fit: contain; flex: none; }
.brand { display: flex; flex-direction: column; line-height: 1.15; }
.logo { font-weight: 600; font-size: 19px; color: var(--ink); letter-spacing: -.01em; }
.tagline { font-size: 10.5px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-top: 2px; }
.partnermark { margin-left: auto; height: 36px; width: auto; flex: none; }
.partnermark + .sos { margin-left: 4px; }
.partner { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.partner img { height: 52px; width: auto; flex: none; }
.sos {
  margin-left: auto; font: inherit; font-weight: 700; font-size: 15px; letter-spacing: .08em;
  background: var(--danger); color: #fff; border: 0; border-radius: var(--r-btn);
  padding: 10px 16px; min-height: 44px; cursor: pointer;
}

.screen { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 24px 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px 20px; margin-bottom: 14px; }
h1, h2, h3 { color: var(--ink); font-weight: 600; }
h1 { font-size: 30px; line-height: 1.15; letter-spacing: -.025em; margin: 6px 0 12px; }
h2 { font-size: 22px; letter-spacing: -.02em; margin: 0 0 14px; }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.error { color: var(--danger); font-weight: 600; min-height: 1em; margin: 0; }
strong { color: var(--ink); font-weight: 600; }

/* Tabs */
.tabs { display: flex; margin-bottom: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.tab {
  flex: 1; border: 0; background: transparent; color: var(--muted);
  padding: 14px 10px; font: inherit; font-size: 16px; font-weight: 500; cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); background: var(--accent-faint); }

/* Formulare */
.form { display: flex; flex-direction: column; gap: 18px; }
.form label { display: flex; flex-direction: column; gap: 7px; font-size: 15px; font-weight: 500; color: var(--ink); }
.form label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; }
.form input:not([type=checkbox]), .form select, .form textarea {
  font: inherit; font-size: 17px; padding: 12px 14px; border-radius: var(--r-btn);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 100%; outline: none;
}
.form input::placeholder, .form textarea::placeholder { color: #a3a3a3; }
.form input:focus, .form select:focus, .form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 22px, calc(100% - 15px) 22px; background-size: 5px 5px; background-repeat: no-repeat;
}
.form label.consent { align-items: flex-start; font-size: 14px; line-height: 1.5; color: var(--text); }
.form label.consent input { margin-top: 2px; flex: none; }
input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--accent); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-size: 15px; font-weight: 500; color: var(--ink); margin-bottom: 8px; }
details summary { cursor: pointer; font-weight: 500; color: var(--accent-ink); padding: 4px 0; }
details[open] { display: flex; flex-direction: column; gap: 18px; }

/* Auswahl-Chips – wie die Pillen auf provoid.de */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button {
  font: inherit; font-size: 15px; padding: 8px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.chips button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); font-weight: 500; }
.chips button.on::before { content: "✓ "; color: var(--accent-ink); font-weight: 700; }

/* Knöpfe – wie „Erstgespräch vereinbaren“ / „Angebot ansehen“ */
.btn {
  font: inherit; font-weight: 600; font-size: 17px; border-radius: var(--r-btn); padding: 13px 24px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  cursor: pointer; min-height: 52px; width: 100%; transition: filter .15s;
}
.btn:hover { filter: brightness(.95); }
.btn.ghost { background: rgba(255,255,255,.5); color: var(--ink); border-color: var(--line); font-weight: 500; }
.btn.ghost:hover { background: var(--surface-2); filter: none; }
.btn:disabled { opacity: .55; }

/* Chat */
.chat { display: flex; flex-direction: column; padding: 0; height: 0; min-height: 0; }
.statusbar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.spacer { flex: 1; }
.credits { font-size: 13px; font-weight: 500; color: var(--accent-ink); background: var(--accent-soft); padding: 4px 10px; border-radius: var(--r-btn); }
.credits.low { color: var(--danger); background: rgba(215, 38, 61, .08); }
.link { font: inherit; font-size: 15px; font-weight: 500; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-btn); padding: 8px 12px; min-height: 40px; cursor: pointer; }
.link:hover { background: var(--surface-2); }
.menu { position: absolute; right: 16px; margin-top: 56px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); z-index: 10; display: flex; flex-direction: column; overflow: hidden; min-width: 250px; box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.menu button { font: inherit; font-size: 16px; text-align: left; padding: 14px 18px; border: 0; background: none; color: var(--ink); cursor: pointer; border-bottom: 1px solid var(--line); }
.menu button:last-child { border-bottom: 0; }
.menu button:hover { background: var(--surface-2); }
.menu button.danger { color: var(--danger); }

.messages { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 20px 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 88%; padding: 12px 16px; border-radius: var(--r); overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--ink); white-space: pre-wrap; }
.msg.assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); }
.msg.system { align-self: center; color: var(--muted); font-size: 14px; text-align: center; background: var(--surface-2); }
.msg p { margin: 0 0 8px; } .msg p:last-child { margin-bottom: 0; }
.msg ul, .msg ol { margin: 4px 0 8px; padding-left: 22px; }
.msg li { margin: 3px 0; }
.msg li::marker { color: var(--accent); }
.msg h3, .msg h4 { font-size: 18px; margin: 12px 0 4px; }
.msg a { color: var(--accent-ink); font-weight: 600; text-underline-offset: 3px; }
.letter { background: var(--bg); border: 1px dashed var(--accent-line); border-radius: var(--r); padding: 14px; margin: 10px 0; white-space: pre-wrap; font-family: ui-serif, Georgia, serif; font-size: 16px; color: var(--ink); }
.letter-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.letter-actions button { font: inherit; font-size: 14px; font-weight: 500; padding: 7px 14px; border-radius: var(--r-btn); border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.letter-actions button:hover { background: var(--surface-2); }
.report-link { display: block; margin-top: 10px; padding: 0; border: 0; background: none; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.report-link:hover { color: var(--ink); }
.typing span { display: inline-block; width: 7px; height: 7px; margin: 0 2px; border-radius: 50%; background: var(--accent); animation: blink 1.2s infinite both; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2 } 40% { opacity: 1 } }

.quick { display: flex; gap: 8px; overflow-x: auto; padding: 8px 16px; scrollbar-width: none; }
.quick::-webkit-scrollbar { display: none; }
.quick button { flex: none; font: inherit; font-size: 15px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.quick button:hover { border-color: var(--accent); background: var(--accent-faint); }

.composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.inputwrap { flex: 1; background: var(--surface); border-radius: var(--r-btn); border: 1px solid var(--line); padding: 3px; }
.inputwrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer textarea { width: 100%; font: inherit; border: 0; background: transparent; color: var(--ink); resize: none; padding: 9px 10px; max-height: 140px; outline: none; }
.composer textarea::placeholder { color: #a3a3a3; }
.icon, .send { flex: none; width: 50px; height: 50px; border-radius: var(--r-btn); cursor: pointer; font-size: 20px; }
.icon { background: var(--surface); border: 1px solid var(--line); }
.send { background: var(--accent); border: 0; color: #fff; }
.send:disabled { opacity: .5; }
.photoPreview { display: flex; align-items: center; gap: 8px; padding: 6px; font-size: 14px; color: var(--muted); }
.photoPreview img { width: 46px; height: 46px; object-fit: cover; border-radius: var(--r); border: 1px solid var(--line); }
.photoPreview button { margin-left: auto; border: 0; background: none; font-size: 20px; cursor: pointer; color: var(--muted); }

/* Dialoge */
dialog.sheet { border: 1px solid var(--line); border-radius: var(--r); padding: 24px 22px; width: min(520px, calc(100% - 24px)); background: var(--surface); color: var(--text); box-shadow: 0 20px 50px rgba(0,0,0,.15); }
dialog::backdrop { background: rgba(10,10,10,.4); backdrop-filter: blur(2px); }
.call { display: block; padding: 14px 16px; margin-bottom: 10px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 500; }
.call:hover { border-color: var(--accent); }
.call.big { font-size: 20px; font-weight: 700; }
.call.red { background: var(--danger); border-color: var(--danger); color: #fff; }
.contact { padding: 14px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); margin-bottom: 10px; }
.contact.highlight { border-color: var(--accent); background: var(--accent-faint); }
.contact strong { display: block; font-size: 18px; }
.contact p { margin: 4px 0; color: var(--text); }
.contact a { color: var(--accent-ink); }

@media print {
  body { background: #fff; }
  body * { visibility: hidden; }
  .print-me, .print-me * { visibility: visible; }
  .print-me { position: absolute; left: 0; top: 0; width: 100%; border: 0; background: #fff; color: #000; font-size: 12pt; }
}

/* ---------- Handy ---------- */
@media (max-width: 480px) {
  .topbar { padding: calc(8px + env(safe-area-inset-top)) 12px 8px; gap: 8px; }
  .brandmark { width: 30px; height: 30px; }
  .logo { font-size: 17px; }
  .tagline { font-size: 9.5px; letter-spacing: .1em; }
  .partnermark { height: 30px; }
  .sos { padding: 8px 12px; min-height: 40px; font-size: 14px; }
  .screen { padding: 16px 12px; }
  .screen.chat { padding: 0; }
  .card { padding: 18px 16px; }
  h1 { font-size: 26px; }
  .statusbar { padding: 8px 12px; }
  .link { padding: 7px 10px; font-size: 14px; }
  .messages { padding: 14px 12px; gap: 10px; }
  .msg { max-width: 94%; padding: 11px 14px; }
  .quick { padding: 6px 12px; }
  .composer { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); gap: 6px; }
  .icon, .send { width: 48px; height: 48px; }
  .menu { right: 12px; left: 12px; min-width: 0; }
}
