/* Ask Hormozi – "Whiteboard im Workshop": kühles Weiß, schwarzer Marker, blauer Marker für dich und Quellen,
   roter Marker nur für unbelegte Aussagen. Eine Schriftfamilie (Archivo), Persönlichkeit über die Breite. */
:root {
  --board: #F5F6F3;
  --paper: #FFFFFF;
  --ink: #16181A;
  --graphite: #61666C;
  --line: #DDE0DA;
  --blue: #2347C5;
  --blue-soft: #E7ECFB;
  --red: #C7362B;
  --red-soft: #FBEAE8;
  --focus: #2347C5;
  --radius-s: 6px;
  --radius-m: 10px;
  --side: 268px;
  --col: 720px;
  font-family: "Archivo", system-ui, sans-serif;
  font-variation-settings: "wdth" 100;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --board: #1A1D1B; --paper: #222624; --ink: #ECEDE9; --graphite: #9BA19D; --line: #333833;
    --blue: #93A9FF; --blue-soft: #252C45; --red: #FF7C70; --red-soft: #3A2423; --focus: #93A9FF;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--board); color: var(--ink); }
body { font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

.wordmark {
  font-weight: 900; font-variation-settings: "wdth" 125; letter-spacing: -0.02em; line-height: .95;
  font-size: clamp(2.6rem, 7vw, 4rem); margin: 0;
}
.wordmark.small { font-size: 1.15rem; letter-spacing: -0.01em; }

/* ---------- Buttons */
.btn {
  border: 1.5px solid var(--ink); background: transparent; border-radius: var(--radius-s);
  padding: .55rem .95rem; font-weight: 600; transition: background .15s, color .15s;
}
.btn:hover { background: var(--ink); color: var(--board); }
.btn.primary { background: var(--ink); color: var(--board); }
.btn.primary:hover { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.ghost { border-color: var(--line); }
.btn:disabled { opacity: .45; cursor: default; }
.icon-btn { border: 0; background: transparent; width: 2.25rem; height: 2.25rem; border-radius: var(--radius-s); font-size: 1.1rem; }
.icon-btn:hover { background: var(--line); }
.link-btn { border: 0; background: none; padding: .35rem 0; text-align: left; color: var(--ink); }
.link-btn:hover { color: var(--blue); }

/* ---------- Anmeldung */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(420px, 100%); }
.auth-sub { color: var(--graphite); margin: 1rem 0 2rem; max-width: 34ch; }
.tabs { display: flex; gap: 1.25rem; border-bottom: 1.5px solid var(--line); margin-bottom: 1.25rem; }
.tabs button { border: 0; background: none; padding: .5rem 0; font-weight: 600; color: var(--graphite); border-bottom: 3px solid transparent; margin-bottom: -1.5px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--ink); }
.form { display: grid; gap: .9rem; }
.form label { display: grid; gap: .3rem; font-size: .9rem; font-weight: 600; }
.form input, .search, .row input {
  border: 1.5px solid var(--line); background: var(--paper); border-radius: var(--radius-s); padding: .65rem .75rem; font-weight: 400;
}
.form input:focus, .search:focus, .row input:focus { border-color: var(--ink); outline: none; }
.form-error { color: var(--red); min-height: 1.5em; margin: .8rem 0 0; }
.form.compact { gap: .6rem; }

/* ---------- Layout */
.app { display: grid; grid-template-columns: var(--side) 1fr auto; height: 100dvh; }
.sidebar { border-right: 1.5px solid var(--line); display: flex; flex-direction: column; padding: 18px 14px 14px; min-height: 0; background: var(--board); }
.side-head { display: flex; align-items: center; justify-content: space-between; margin: 2px 4px 18px; }
.new-chat { width: 100%; margin-bottom: 14px; }
.conv-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin: 0 -4px; padding: 0 4px; }
.conv { display: flex; align-items: center; border-radius: var(--radius-s); }
.conv a { flex: 1; padding: .45rem .6rem; color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .93rem; }
.conv:hover, .conv.active { background: var(--paper); }
.conv.active a { font-weight: 600; }
.conv .icon-btn { width: 1.9rem; height: 1.9rem; font-size: .85rem; opacity: 0; color: var(--graphite); }
.conv:hover .icon-btn, .conv.active .icon-btn, .conv .icon-btn:focus-visible { opacity: 1; }
.side-foot { border-top: 1.5px solid var(--line); padding-top: 10px; display: grid; gap: 2px; font-size: .93rem; }
.who { color: var(--graphite); font-size: .85rem; padding-top: 4px; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-bottom: 1.5px solid var(--line); min-height: 56px; }
.conv-title { font-size: 1rem; font-weight: 600; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scroll { flex: 1; overflow-y: auto; }
.thread { max-width: var(--col); margin: 0 auto; padding: 28px 20px 40px; }

/* ---------- Leerer Zustand */
.empty { padding-top: 8vh; }
.empty-head { font-weight: 900; font-variation-settings: "wdth" 125; font-size: clamp(2rem, 5.5vw, 3.4rem); line-height: 1; letter-spacing: -0.02em; margin: 0 0 1rem; }
.empty-sub { color: var(--graphite); max-width: 52ch; margin: 0 0 2rem; }
.starters { display: grid; gap: 8px; }
.starter { text-align: left; border: 1.5px solid var(--line); background: var(--paper); border-radius: var(--radius-m); padding: .8rem 1rem; line-height: 1.45; }
.starter:hover { border-color: var(--ink); }

/* ---------- Nachrichten */
.msg { margin: 0 0 28px; }
.msg.user { border-left: 3px solid var(--blue); padding: .1rem 0 .1rem 1rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user .files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; white-space: normal; }
.file-chip { font-size: .8rem; border: 1px solid var(--line); border-radius: 99px; padding: 2px 10px; background: var(--paper); }
.msg.bot { overflow-wrap: anywhere; }
.msg.bot :is(p, ul, ol) { margin: 0 0 .85em; }
.msg.bot :is(h1, h2, h3, h4) { font-size: 1.02rem; margin: 1.3em 0 .4em; font-weight: 800; }
.msg.bot strong { font-weight: 750; }
.msg.bot li { margin: .2em 0; }
.msg.bot code { background: var(--paper); border: 1px solid var(--line); border-radius: 4px; padding: 0 .3em; font-size: .9em; }
.msg.bot blockquote { margin: .8em 0; padding-left: 1em; border-left: 3px solid var(--line); color: var(--graphite); }
.msg.bot table { border-collapse: collapse; margin: .8em 0; font-size: .92rem; }
.msg.bot :is(td, th) { border: 1px solid var(--line); padding: .3em .6em; }
.cite {
  display: inline-block; vertical-align: super; font-size: .68rem; line-height: 1; font-weight: 700;
  color: var(--blue); background: var(--blue-soft); border: 0; border-radius: 4px; padding: 2px 4px; margin: 0 1px;
}
.cite:hover { background: var(--blue); color: #fff; }
.status { color: var(--graphite); font-size: .92rem; display: flex; align-items: center; gap: .5rem; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-top: 10px; font-size: .84rem; color: var(--graphite); }
.meta button { border: 0; background: none; padding: 0; color: var(--graphite); text-decoration: underline; text-underline-offset: 3px; }
.meta button:hover { color: var(--ink); }
.meta .flag { color: var(--red); }
.flags { margin-top: 10px; border: 1.5px solid var(--red); background: var(--red-soft); border-radius: var(--radius-m); padding: .7rem .9rem; font-size: .9rem; }
.flags p { margin: 0 0 .4rem; }
.flags ul { margin: 0; padding-left: 1.1rem; }
.err { color: var(--red); }

/* ---------- Eingabe */
.composer { max-width: calc(var(--col) + 40px); width: 100%; margin: 0 auto; padding: 0 20px 14px; }
.composer-box { display: flex; align-items: flex-end; gap: 6px; border: 1.5px solid var(--ink); background: var(--paper); border-radius: var(--radius-m); padding: 6px; }
.composer-box.drag { border-color: var(--blue); background: var(--blue-soft); }
#input { flex: 1; border: 0; background: transparent; resize: none; max-height: 40vh; padding: .5rem .3rem; outline: none; line-height: 1.5; }
.send { background: var(--ink); color: var(--board); }
.send:hover { background: var(--blue); border-color: var(--blue); color: #fff; }
.attach { font-size: 1.3rem; }
.attach-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.attach-list .file-chip button { border: 0; background: none; padding: 0 0 0 6px; color: var(--graphite); }
.disclaimer { font-size: .76rem; color: var(--graphite); text-align: center; margin: 8px 0 0; }

/* ---------- Quellen-Schublade */
.drawer { width: 380px; border-left: 1.5px solid var(--line); background: var(--board); display: flex; flex-direction: column; min-height: 0; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 12px 18px; border-bottom: 1.5px solid var(--line); min-height: 56px; }
.drawer-head h3 { margin: 0; font-size: 1rem; }
.drawer-body { overflow-y: auto; padding: 14px 18px 24px; display: grid; gap: 12px; align-content: start; }
.src { border: 1.5px solid var(--line); background: var(--paper); border-radius: var(--radius-m); padding: .8rem .9rem; font-size: .9rem; scroll-margin: 12px; }
.src.hl { border-color: var(--blue); }
.src-n { font-weight: 800; color: var(--blue); margin-right: .35rem; }
.src-title { font-weight: 650; }
.src-ep { color: var(--graphite); font-size: .82rem; margin: .35rem 0; }
.src-ep a { color: var(--blue); }
.src q { display: block; font-style: italic; color: var(--graphite); }

/* ---------- Dialoge */
.modal { border: 1.5px solid var(--ink); border-radius: var(--radius-m); background: var(--board); color: var(--ink); padding: 0; width: min(520px, calc(100vw - 24px)); max-height: 86vh; }
.modal.wide { width: min(860px, calc(100vw - 24px)); }
.modal::backdrop { background: rgba(20, 22, 24, .45); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px 12px 20px; border-bottom: 1.5px solid var(--line); position: sticky; top: 0; background: var(--board); }
.modal-head h3 { margin: 0; font-size: 1.05rem; }
.modal-sec { padding: 16px 20px; border-bottom: 1.5px solid var(--line); }
.modal-sec:last-child { border-bottom: 0; }
.modal-sec h4 { margin: 0 0 .6rem; font-size: .95rem; }
.hint { color: var(--graphite); font-size: .86rem; margin: 0 0 .6rem; }
.row { display: flex; gap: 8px; }
.row input { flex: 1; }
.code-out { font-weight: 800; font-variation-settings: "wdth" 115; font-size: 1.35rem; letter-spacing: .04em; margin: .8rem 0 0; user-select: all; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px 18px; font-size: .9rem; }
.stats b { display: block; font-size: 1.35rem; font-variation-settings: "wdth" 115; }
.search { width: calc(100% - 40px); margin: 16px 20px 6px; }
.concepts { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 20px 12px; }
.concepts button { border: 1.5px solid var(--line); background: var(--paper); border-radius: 99px; padding: .2rem .7rem; font-size: .85rem; }
.concepts button:hover, .concepts button.on { border-color: var(--ink); }
.concepts small { color: var(--graphite); }
.items { padding: 0 20px 20px; display: grid; gap: 10px; }

/* ---------- Mobil */
.only-mobile { display: none; }
@media (max-width: 1100px) {
  .drawer { position: fixed; right: 0; top: 0; bottom: 0; z-index: 20; width: min(380px, 92vw); box-shadow: -8px 0 30px rgba(0, 0, 0, .18); }
  .app { grid-template-columns: var(--side) 1fr; }
}
@media (max-width: 780px) {
  .only-mobile { display: inline-block; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 30; transform: translateX(-102%); transition: transform .2s; box-shadow: 8px 0 30px rgba(0, 0, 0, .18); }
  .sidebar.open { transform: none; }
  .topbar { padding: 10px 12px; }
  .thread { padding: 20px 16px 32px; }
  .composer { padding: 0 12px 10px; }
  .send { padding: .55rem .7rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}
.item-text { margin: .3rem 0; }
/* ---------- Sprachumschalter */
.lang-switch { display: inline-flex; border: 1.5px solid var(--line); border-radius: 99px; padding: 2px; gap: 2px; }
.lang-switch button { border: 0; background: none; border-radius: 99px; padding: .15rem .6rem; font-size: .78rem; font-weight: 700; color: var(--graphite); }
.lang-switch button[aria-pressed="true"] { background: var(--ink); color: var(--board); }
.auth-card .lang-switch { float: right; margin-top: .3rem; }
.foot-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 4px; }
.foot-row .who { padding-top: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
