@import url("fonts/fonts.css");
:root {
  --bg: #f7f6f2;
  --paper: #ffffff;
  --ink: #182322;
  --ink-2: #4b5654;
  --ink-3: #7c8583;
  --line: #e0ddd5;
  --accent: #0f6b63;
  --accent-2: #0b5751;
  --accent-soft: #e5f1ee;
  --warm: #8a5d0c;
  --warm-soft: #fcefd3;
  --delta: #0f6b63;
  --danger: #a23b2a;
  --radius: 12px;
  --sans: "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --serif: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono: var(--sans);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16.5px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; width: 100%; max-width: 920px; margin: 0 auto; padding: 24px 16px 64px; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-family: var(--serif); font-weight: 800; font-size: clamp(32px, 5.4vw, 52px); letter-spacing: -.035em; }
h2 { font-family: var(--serif); font-weight: 700; font-size: 26px; letter-spacing: -.02em; }
h3 { font-family: var(--serif); font-weight: 700; }
h3 { font-size: 17px; }
p { margin: 0 0 1em; }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; color: var(--ink-3); }

/* Kopf & Fuß */
.topbar { padding: 14px 16px; border-bottom: 1px solid var(--line); background: rgba(244,246,245,.92); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 5; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 650; letter-spacing: -.01em; }
.brand .mk { width: 27px; height: 27px; flex: none; }
.brand span { font: 800 22px/1 var(--serif); letter-spacing: -.04em; display: flex; }
.brand .wm { height: 24px; width: auto; display: block; }
.foot { text-align: center; padding: 20px 16px 28px; font-size: 13px; color: var(--ink-3); }
.foot a { color: var(--ink-3); margin: 0 8px; }

/* Bausteine */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card + .card { margin-top: 16px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.btn {
  font-family: var(--serif);
  appearance: none; border: 1px solid var(--accent); background: var(--accent); color: #fff;
  font: inherit; font-weight: 600; padding: 11px 18px; border-radius: 10px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; min-height: 44px;
}
.btn:hover { background: var(--accent-2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.small { padding: 6px 12px; min-height: 34px; font-size: 14px; }
.btn.danger { background: transparent; color: var(--danger); border-color: #e3c4bd; }
.linkbtn { background: none; border: 0; color: var(--ink-2); font: inherit; font-size: 14px; text-decoration: underline; cursor: pointer; padding: 6px 0; }
input[type=text], input[type=password], select, textarea {
  font: inherit; color: var(--ink); width: 100%; padding: 11px 13px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; min-height: 44px;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field + .field { margin-top: 14px; }
.notice { background: var(--warm-soft); border: 1px solid #ecd8b6; border-radius: 10px; padding: 12px 14px; font-size: 14px; }
.notice.ok { background: var(--accent-soft); border-color: #cfe0d6; }
.notice.err { background: #f8e7e3; border-color: #ecc9c1; color: #6e281c; }
.pill { display: inline-block; font-size: 12px; font-weight: 650; padding: 3px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.pill.warm { background: var(--warm-soft); color: var(--warm); }
.pill.grey { background: #eceae4; color: var(--ink-2); }
.spinner { width: 18px; height: 18px; border: 2.5px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.center { text-align: center; }
.loading { padding: 60px 0; text-align: center; color: var(--ink-2); }

/* Startseite */
.hero { padding: 28px 0 8px; }
.hero p.lead { font-size: 19px; color: var(--ink-2); max-width: 640px; }
.steps { counter-reset: s; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 26px 0; }
.steps .step { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.steps .step::before { counter-increment: s; content: counter(s); display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.steps h3 { margin-bottom: 4px; }
.steps p { margin: 0; color: var(--ink-2); font-size: 15px; }
.mine a { display: block; padding: 8px 0; border-top: 1px solid var(--line); text-decoration: none; }

/* Chat */
.chat-wrap { display: flex; flex-direction: column; min-height: calc(100vh - 170px); }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.chat-head h2 { font-size: 21px; margin: 0; }
.progress { height: 6px; background: #e7e3da; border-radius: 99px; overflow: hidden; margin-bottom: 16px; }
.progress > span { display: block; height: 100%; background: var(--accent); transition: width .4s; }
.msgs { flex: 1; display: flex; flex-direction: column; gap: 12px; padding-bottom: 16px; }
.msg { max-width: 86%; padding: 12px 15px; border-radius: 16px; white-space: pre-wrap; word-wrap: break-word; }
.msg.a { background: var(--paper); border: 1px solid var(--line); border-bottom-left-radius: 5px; align-self: flex-start; }
.msg.u { background: var(--accent); color: #fff; border-bottom-right-radius: 5px; align-self: flex-end; }
.msg.typing { color: var(--ink-3); }
.dots span { display: inline-block; width: 6px; height: 6px; margin: 0 2px; border-radius: 50%; background: var(--ink-3); animation: blink 1.2s infinite; }
.dots span:nth-child(2) { animation-delay: .2s; } .dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.composer { position: sticky; bottom: 0; background: linear-gradient(to top, var(--bg) 75%, rgba(244,246,245,0)); padding: 14px 0 calc(8px + env(safe-area-inset-bottom)); }
.composer-box { display: flex; gap: 8px; align-items: flex-end; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 6px; }
.composer textarea { border: 0; resize: none; min-height: 44px; max-height: 180px; padding: 10px; }
.composer textarea:focus { outline: none; }
.iconbtn { width: 44px; height: 44px; border-radius: 10px; border: 0; background: var(--accent-soft); color: var(--accent); cursor: pointer; display: grid; place-items: center; flex: none; }
.iconbtn.send { background: var(--accent); color: #fff; }
.iconbtn.rec { background: var(--danger); color: #fff; animation: pulse 1.2s infinite; }
.iconbtn:disabled { opacity: .4; cursor: default; }
@keyframes pulse { 50% { opacity: .7; } }
.composer-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; flex-wrap: wrap; }

/* Dashboard */
.phase { display: flex; gap: 14px; align-items: flex-start; }
.phase-num { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: #eceae4; color: var(--ink-2); }
.phase.done .phase-num { background: var(--accent); color: #fff; }
.phase.active .phase-num { background: var(--warm); color: #fff; }
.phase-body { flex: 1; min-width: 0; }
.invite { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: #fcfbf8; }
.invite .qr { width: 132px; height: 132px; background: #fff; padding: 6px; border-radius: 8px; border: 1px solid var(--line); }
.invite .qr img, .invite .qr canvas { width: 100% !important; height: auto !important; }
.copyline { display: flex; gap: 6px; }
.copyline input { font-size: 13.5px; min-height: 38px; padding: 7px 10px; }
.stat { font-size: 30px; font-weight: 700; font-family: var(--serif); line-height: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 12px; border-radius: 99px; background: #eceae4; font-size: 14px; }
.chip button { border: 0; background: rgba(0,0,0,.07); width: 22px; height: 22px; border-radius: 50%; cursor: pointer; line-height: 1; color: var(--ink-2); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 8px 16px; font: inherit; cursor: pointer; }
.seg button.on { background: var(--accent); color: #fff; }
details summary { cursor: pointer; font-weight: 600; }

/* Bericht */
.report { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 5vw, 56px); }
.report h2 { margin-top: 1.6em; padding-top: .6em; border-top: 1px solid var(--line); }
.report h2:first-of-type { border-top: 0; margin-top: .8em; }
.cover { border-bottom: 3px solid var(--accent); padding-bottom: 22px; margin-bottom: 8px; }
.cover .kicker { text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 700; color: var(--accent); }
.cover h1 { margin: 8px 0 6px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 20px 0; }
.kpi { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fcfbf8; }
.kpi .v { font-family: var(--serif); font-size: 28px; font-weight: 700; color: var(--accent); line-height: 1.1; }
.kpi .l { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.summary { font-size: 18px; line-height: 1.6; font-family: var(--serif); }
.finding { padding: 12px 0 12px 16px; border-left: 3px solid var(--accent-soft); margin-bottom: 10px; }
.finding h3 { margin-bottom: 4px; }
table.overview { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.overview th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); border-bottom: 1px solid var(--line); padding: 8px 6px; }
table.overview td { border-bottom: 1px solid var(--line); padding: 10px 6px; vertical-align: top; }
table.overview td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }
.pot { border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin: 14px 0; break-inside: avoid; }
.pot-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.pot-head h3 { font-size: 19px; margin: 0; }
.pot dl { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; margin: 12px 0 0; font-size: 15px; }
.pot dt { color: var(--ink-3); font-size: 13px; font-weight: 650; padding-top: 2px; }
.pot dd { margin: 0; }
.pot ol { margin: 0; padding-left: 18px; }
.qw { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.qw > div { background: var(--accent-soft); border-radius: 12px; padding: 14px; break-inside: avoid; }
.qw h3 { font-size: 15.5px; margin-bottom: 4px; }
.plan { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.plan > div { border-top: 3px solid var(--accent); padding-top: 10px; break-inside: avoid; }
.plan ul, .report ul { padding-left: 18px; margin: 6px 0 0; }
.plan li, .report li { margin-bottom: 5px; }
.cta { margin-top: 28px; background: var(--ink); color: #fff; border-radius: 12px; padding: 20px 22px; break-inside: avoid; }
.cta h3 { color: #fff; }
.method { font-size: 13px; color: var(--ink-3); margin-top: 28px; border-top: 1px solid var(--line); padding-top: 14px; }

@media (max-width: 640px) {
  .pot dl { grid-template-columns: 1fr; gap: 2px; }
  .pot dd { margin-bottom: 8px; }
  .plan { grid-template-columns: 1fr; }
  .msg { max-width: 92%; }
  .card { padding: 18px; }
}

@media print {
  @page { size: A4; margin: 16mm 14mm; }
  body { background: #fff; font-size: 11pt; }
  .no-print, .topbar, .foot { display: none !important; }
  main { max-width: none; padding: 0; }
  .report { border: 0; padding: 0; }
  .report h2 { break-after: avoid; }
  .pot, .finding, .kpi, .qw > div, .plan > div { break-inside: avoid; }
  .cta { background: #fff; color: var(--ink); border: 2px solid var(--ink); }
  .cta h3 { color: var(--ink); }
  a { color: inherit; text-decoration: none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (hover: none) { .hint-desktop { visibility: hidden; } }

.stat, .kpi .v, table.overview td.num { font-variant-numeric: tabular-nums; }
.kpi .v .d { color: var(--delta); margin-right: 4px; }
.cover { border-bottom-color: var(--ink); }
.cover .kicker { display: flex; align-items: center; gap: 8px; }
.cover .kicker svg { width: 18px; height: 18px; }
.plan > div { border-top-color: var(--ink); }
.qw > div { background: var(--accent-soft); }
.phase.active .phase-num { background: var(--accent); color: #f7f6f2; }
.pill.warm { color: var(--warm); }
