[hidden] { display: none !important; }
:root {
  --bg: #f6f5f2; --panel: #ffffff; --side: #111214; --side-fg: #e9e7e2; --fg: #1b1c1f;
  --muted: #6c6f76; --line: #e4e2dc; --accent: #111214; --accent-fg: #fff;
  --claude: #c96442; --gpt: #10a37f; --gemini: #3b78e7;
  --ok: #2f8f5b; --warn: #b7791f; --err: #c0392b; --soft: #f0eee9;
  --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.05);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg:#16171a; --panel:#1e2024; --fg:#ececea; --muted:#9a9ca3; --line:#2d3036;
          --accent:#ececea; --accent-fg:#111214; --soft:#25282d; --side:#0e0f11; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); }
body { font-size: 15px; line-height: 1.55; }
a { color: inherit; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }

/* Logo */
.logo { font-weight: 700; font-size: 20px; letter-spacing: .3px; display: flex; align-items: center; gap: 4px; }
.logo .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.logo .dot:last-of-type { margin-right: 8px; }
.dot.c { background: var(--claude); } .dot.g { background: var(--gpt); } .dot.m { background: var(--gemini); }

/* Buttons */
.btn { border: 1px solid var(--line); background: var(--panel); color: var(--fg); border-radius: 9px;
       padding: 8px 13px; font: inherit; font-size: 14px; cursor: pointer; text-decoration: none;
       display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { filter: brightness(.97); }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; justify-content: center; }
.btn.small { padding: 4px 9px; font-size: 12.5px; }
.btn.danger { color: var(--err); }
.icon-btn { background: none; border: none; color: inherit; font-size: 20px; cursor: pointer; padding: 4px 8px; }

/* Layout */
.app { display: flex; height: 100%; }
aside { width: 270px; background: var(--side); color: var(--side-fg); display: flex; flex-direction: column;
        padding: 16px; gap: 14px; flex-shrink: 0; }
aside .btn.ghost { color: var(--side-fg); border-color: #2c2e33; }
aside .btn.primary { background: var(--side-fg); color: var(--side); border-color: var(--side-fg); }
.side-head { display: flex; justify-content: space-between; align-items: center; }
#projectList { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.proj-item { padding: 9px 11px; border-radius: 8px; cursor: pointer; font-size: 14px; display: flex;
             justify-content: space-between; gap: 8px; }
.proj-item:hover { background: #1f2125; } .proj-item.active { background: #2a2c31; }
.proj-item .meta { color: #8b8e95; font-size: 12px; white-space: nowrap; }
.side-foot { display: flex; flex-direction: column; gap: 6px; }
.side-foot .muted { color: #8b8e95; text-align: center; }

main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-bottom: 1px solid var(--line);
          background: var(--panel); }
.topbar h1 { font-size: 17px; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; gap: 6px; }
.only-mobile { display: none; }

.proj-info { background: var(--panel); border-bottom: 1px solid var(--line); padding: 14px 20px;
             max-height: 45vh; overflow-y: auto; font-size: 14px; }
.proj-info h4 { margin: 10px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.proj-info p { margin: 0; white-space: pre-wrap; }
.decision { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; background: var(--soft);
            border-radius: 8px; margin: 4px 0; }

.feed { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.empty { margin: auto; max-width: 520px; text-align: center; color: var(--muted); }
.empty h2 { color: var(--fg); }

/* Frage + Karte */
.q-bubble { align-self: flex-end; max-width: 760px; background: var(--accent); color: var(--accent-fg);
            padding: 10px 14px; border-radius: 14px 14px 4px 14px; white-space: pre-wrap; }
.q-meta { align-self: flex-end; font-size: 12px; color: var(--muted); margin-top: -12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
        padding: 16px 18px; max-width: 900px; width: 100%; }
.card h5 { margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.card .summary { font-size: 16px; font-weight: 500; }
.card ul { margin: 4px 0; padding-left: 20px; }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--soft); margin-right: 4px; }
.badge.agree-high { background: #e3f3ea; color: var(--ok); } .badge.agree-mid { background: #fbf1df; color: var(--warn); }
.badge.agree-low { background: #f9e4e1; color: var(--err); }
@media (prefers-color-scheme: dark) {
  .badge.agree-high { background:#1d3326; } .badge.agree-mid { background:#3a2f1a; } .badge.agree-low { background:#3d211e; }
}
.dissent { border-left: 3px solid var(--warn); padding: 6px 12px; margin: 8px 0; background: var(--soft); border-radius: 0 8px 8px 0; }
.dissent .pos { margin: 4px 0; }
.who { font-weight: 600; } .who.claude { color: var(--claude); } .who.gpt { color: var(--gpt); } .who.gemini { color: var(--gemini); }
.card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.sources a { font-size: 13px; color: var(--muted); word-break: break-all; }
.progress { font-size: 13.5px; color: var(--muted); }
.progress div { padding: 2px 0; }
.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--fg);
           border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -1px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-box { color: var(--err); background: #f9e4e1; padding: 10px 12px; border-radius: 8px; }
@media (prefers-color-scheme: dark) { .error-box { background:#3d211e; } }

/* Markdown */
.md p { margin: 6px 0; } .md h1, .md h2, .md h3, .md h4 { margin: 12px 0 6px; font-size: 15.5px; }
.md code { background: var(--soft); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.codeblock { position: relative; margin: 8px 0; }
.codeblock pre { background: #15161a; color: #e6e6e6; padding: 12px; border-radius: 8px; overflow-x: auto; font-size: 12.5px; margin: 0; }
.codeblock pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.codeblock .code-tools { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; }
.codeblock .code-tools button { font-size: 11.5px; padding: 3px 8px; border-radius: 6px; border: 1px solid #3a3c42;
                                background: #24262b; color: #ddd; cursor: pointer; }
.md table { border-collapse: collapse; margin: 8px 0; font-size: 13.5px; }
.md td, .md th { border: 1px solid var(--line); padding: 4px 8px; }

/* Composer */
.composer { background: var(--panel); border-top: 1px solid var(--line); padding: 10px 20px calc(12px + env(safe-area-inset-bottom)); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.chip { border: 1px solid var(--line); background: var(--panel); color: var(--fg); border-radius: 99px; padding: 5px 12px;
        font: inherit; font-size: 13px; cursor: pointer; }
.chip.active { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.chip.disabled { opacity: .45; cursor: not-allowed; }
.mode-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13.5px; }
.mode-lbl { color: var(--muted); } .mode-lbl.active { color: var(--fg); font-weight: 600; }
.switch { position: relative; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 99px; cursor: pointer; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff;
                       border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--claude); }
.switch input:checked + span::before { transform: translateX(20px); }
.input-row { display: flex; gap: 8px; align-items: flex-end; }
textarea, input[type=text], input[type=password], input[type=number] {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit;
  background: var(--bg); color: var(--fg); resize: vertical; }
#questionInput { max-height: 40vh; min-height: 46px; }
.send { height: 46px; width: 50px; justify-content: center; font-size: 18px; }
.pseudo-hint { font-size: 12.5px; background: #eef4ff; color: #2a4a8a; padding: 6px 10px; border-radius: 8px; margin-bottom: 8px; }
@media (prefers-color-scheme: dark) { .pseudo-hint { background:#1b2840; color:#a9c4f5; } }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center;
         z-index: 50; padding: 16px; }
.modal-box { background: var(--panel); border-radius: 14px; width: 100%; max-width: 860px; max-height: 92vh; display: flex;
             flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-body label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.turn { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 8px 0; }
.turn-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 4px; }
.round-title { margin: 16px 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }

/* Login */
.login-body { display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { background: var(--panel); padding: 28px; border-radius: 16px; box-shadow: var(--shadow); width: 100%;
              max-width: 360px; display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--line); }
.err { color: var(--err); margin: 0; }

/* Mobil */
@media (max-width: 820px) {
  aside { position: fixed; inset: 0 auto 0 0; z-index: 40; transform: translateX(-100%); transition: transform .2s;
          width: 84%; max-width: 320px; padding-top: calc(16px + env(safe-area-inset-top)); }
  aside.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .only-mobile { display: inline-block; }
  .topbar { padding: calc(10px + env(safe-area-inset-top)) 12px 10px; }
  .feed { padding: 14px 12px; }
  .composer { padding-left: 12px; padding-right: 12px; }
  .top-actions .btn { padding: 6px 9px; font-size: 13px; }
}

/* Druck / PDF: ganzer Verlauf oder eine einzelne Karte */
@media print {
  :root { --bg: #fff; --panel: #fff; --fg: #000; --soft: #f3f3f3; --line: #ddd; }
  html, body, .app, main { height: auto !important; overflow: visible !important; display: block !important; background: #fff; }
  aside, .composer, .top-actions, .card-actions, .only-mobile, .code-tools, .modal, #projInfo { display: none !important; }
  .topbar { border: none; padding: 0 0 8px; }
  .feed { overflow: visible !important; height: auto !important; padding: 0; display: block; }
  .feed > * { margin-bottom: 12px; }
  .card { box-shadow: none; border: 1px solid #ccc; max-width: none; break-inside: auto; }
  .dissent, .codeblock, .q-bubble { break-inside: avoid; }
  .q-bubble { background: #eee !important; color: #000 !important; max-width: none; border: 1px solid #ccc; }
  .codeblock pre { background: #f5f5f5 !important; color: #000 !important; white-space: pre-wrap; }
  a { text-decoration: none; }
  body.print-one .feed > * { display: none !important; }
  body.print-one .feed > .print-target, body.print-one .feed > .print-target-q { display: block !important; }
}
