/* cmn-ai — warm, editorial chat UI (Design 3.0).
   Warm charcoal/cream palette, blue accent with a pink brand spark,
   Newsreader serif for display headings, Inter body, JetBrains Mono labels. */

:root {
  --bg: #1c1a18;
  --bg-rail: #1f1e1c;
  --panel: #26241f;
  --panel-2: #302f2b;
  --line: rgba(255, 255, 255, 0.07);
  --line-soft: rgba(255, 255, 255, 0.045);
  --ink: #f3f1ec;
  --ink-dim: #b6b1a9;
  --ink-faint: #6d6a62;
  --accent: #82b8e6;
  --accent-2: #3e97dd;
  --accent-ink: #ffffff;
  --bubble-user: #302f2b;
  --bubble-user-line: rgba(255, 255, 255, 0.09);
  --ok: #57b06f;
  --danger: #d9694a;
  --brand-pink: #f0569e;
  --radius: 14px;
  --radius-lg: 18px;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.25);
  /* mockup aliases (used by the shell markup) */
  --surface3: #302f2b;
  --inset: #1c1b19;
  --line2: rgba(255, 255, 255, 0.10);
  --hover: #2b2a28;
  --sidebar: var(--bg-rail);
}
:root[data-theme="light"] {
  --surface3: #f0ebe0;
  --inset: #f3efe6;
  --line2: rgba(40, 35, 28, 0.14);
  --hover: #eae4d8;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --surface3: #f0ebe0;
    --inset: #f3efe6;
    --line2: rgba(40, 35, 28, 0.14);
    --hover: #eae4d8;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100vh;
}

/* ---------- rail ---------- */
.rail {
  background: var(--bg-rail);
  border-right: 1px solid var(--line-soft);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}

.brand {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 8px; padding: 4px 4px 2px;
}
.brand-id { display: flex; flex-direction: column; gap: 2px; }
.icon-btn {
  flex: none; display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: transparent; border: 1px solid var(--line-soft);
  color: var(--ink-dim); cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.icon-btn:hover { background: var(--panel-2); color: var(--ink); border-color: var(--line); }

.new-chat {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; padding: 10px 12px;
  background: var(--accent-2); color: #fff; border: none; border-radius: 10px;
  font-family: var(--sans); font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}
.new-chat:hover { background: var(--accent); box-shadow: 0 4px 14px color-mix(in srgb, var(--accent-2) 35%, transparent); }

.chats-panel { display: flex; flex-direction: column; min-height: 0; max-height: 34vh; }
.chats { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.chats-empty { color: var(--ink-faint); font-size: 12.5px; padding: 2px 2px; }
.chat-item {
  display: flex; align-items: center; gap: 4px; border-radius: 8px;
  transition: background 0.12s;
}
.chat-item:hover { background: var(--panel-2); }
.chat-item.active { background: var(--panel-2); }
.chat-item.active .chat-title { color: var(--ink); }
.chat-title {
  flex: 1; min-width: 0; text-align: left; background: none; border: none;
  color: var(--ink-dim); font-family: var(--sans); font-size: 13px; cursor: pointer;
  padding: 8px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-del {
  flex: none; background: none; border: none; color: var(--ink-faint);
  font-size: 17px; line-height: 1; cursor: pointer; padding: 4px 8px; border-radius: 6px;
  opacity: 0; transition: opacity 0.12s, color 0.12s;
}
.chat-item:hover .chat-del { opacity: 1; }
.chat-del:hover { color: var(--danger); }

.brand-mark {
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
  line-height: 1;
}
.brand-mark span { color: var(--accent); }
.brand-sub {
  margin: 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 15px 15px 16px;
}
.panel-title {
  margin: 0 0 13px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.budget-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.budget-monthly { font-size: 20px; font-weight: 650; letter-spacing: -0.01em; }
.ghost-btn {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 11px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ghost-btn:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.bucket { margin-bottom: 14px; }
.bucket:last-child { margin-bottom: 0; }
.bucket-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12.5px;
  margin-bottom: 7px;
}
.bucket-name { color: var(--ink); text-transform: capitalize; font-weight: 500; }
.bucket-fig { font-family: var(--mono); color: var(--ink-dim); font-size: 11px; }
.meter {
  height: 6px;
  border-radius: 999px;
  background: var(--panel-2);
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  width: 0;
  border-radius: 999px;
  transition: width 0.5s ease;
}
.meter-fill.hot { background: linear-gradient(90deg, #d8633a, var(--danger)); }

.roster { list-style: none; margin: 0; padding: 0; }
.roster li {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 9px;
  padding: 8px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--line-soft);
}
.roster li:last-child { border-bottom: 0; }
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink-faint); flex: none;
}
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(63, 181, 100, 0.18); }
.roster .r-name { color: var(--ink); font-weight: 500; }
.roster .r-model {
  font-family: var(--mono); font-size: 10px; color: var(--ink-faint);
  margin-left: auto; white-space: nowrap; min-width: 0;
  overflow: hidden; text-overflow: ellipsis;
}
.roster .r-tools {
  font-size: 9px; color: var(--accent); margin-left: auto; padding: 2px 7px;
  border: 1px solid var(--line); border-radius: 999px; white-space: nowrap;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.this-week { float: right; color: var(--ink-faint); font-weight: 400; letter-spacing: 0.04em; }
.activity-empty { margin: 0; color: var(--ink-faint); font-size: 12.5px; }
.activity-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}
.activity-total { font-size: 20px; font-weight: 650; letter-spacing: -0.01em; }
.activity-count { font-family: var(--mono); font-size: 11px; color: var(--ink-dim); }
.act-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  padding: 5px 0;
}
.act-row .a-name { color: var(--ink-dim); text-transform: capitalize; }
.act-row .a-count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-dim);
}
.act-row .a-bar {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  flex: none;
}

.rail-foot {
  margin-top: auto;
  font-size: 11px;
  letter-spacing: 0.01em;
  color: var(--ink-faint);
  line-height: 1.6;
  padding: 0 4px;
}

/* ---------- stage ---------- */
.stage {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
}

.transcript {
  flex: 1;
  overflow-y: auto;
  padding: 40px max(8%, 28px) 16px;
  scroll-behavior: smooth;
}

.welcome { max-width: 600px; margin: 8vh auto 0; }
.welcome h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(32px, 4.2vw, 46px);
  letter-spacing: -0.015em;
  margin: 0 0 14px;
  background: linear-gradient(180deg, var(--ink), var(--ink-dim));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.welcome p { color: var(--ink-dim); font-size: 15.5px; line-height: 1.7; max-width: 52ch; }

.msg { max-width: 780px; margin: 0 auto 22px; }
.msg-user { display: flex; }
.msg-user .bubble {
  background: var(--bubble-user);
  border: 1px solid var(--bubble-user-line);
  margin-left: auto;
  max-width: 80%;
}
.bubble {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 13px 17px;
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  color: var(--ink-dim);
  margin-bottom: 9px;
  padding: 4px 11px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--panel);
}
.chip .cap { text-transform: uppercase; color: var(--accent); letter-spacing: 0.08em; font-weight: 500; }
.chip .who { color: var(--ink); }
.chip .sep { color: var(--ink-faint); }
.chip .cost { color: var(--ink); }
.chip.free .cost { color: var(--ok); }
.chip .flag { color: var(--danger); text-transform: uppercase; letter-spacing: 0.06em; }

.blocked {
  border: 1px solid rgba(229, 112, 75, 0.5);
  background: rgba(229, 112, 75, 0.08);
  border-radius: var(--radius);
  padding: 16px 18px;
  color: var(--ink);
}
.blocked h3 { margin: 0 0 6px; font-size: 16px; font-weight: 650; color: var(--danger); }
.blocked p { margin: 0 0 12px; color: var(--ink-dim); font-size: 14px; line-height: 1.6; }

.cursor::after {
  content: "▍";
  color: var(--accent);
  animation: blink 1s steps(2) infinite;
  margin-left: 1px;
}
@keyframes blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }

/* ---------- composer ---------- */
.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px max(8%, 28px) 22px;
  background: linear-gradient(180deg, transparent, var(--bg) 32%);
}
.model-select {
  flex: none;
  align-self: stretch;
  max-width: 190px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-dim);
  font-family: var(--sans);
  font-size: 13px;
  padding: 0 10px;
  outline: none;
  cursor: pointer;
}
.model-select:focus { border-color: var(--accent-2); }
.msg-error { border-color: rgba(229, 112, 75, 0.5); color: var(--danger); }
.composer textarea {
  flex: 1;
  resize: none;
  max-height: 200px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  padding: 13px 16px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.composer textarea:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 18%, transparent);
}
.composer textarea::placeholder { color: var(--ink-faint); }
#send {
  flex: none;
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border: none;
  border-radius: 12px;
  background: var(--accent-2);
  color: #fff;
  cursor: pointer;
  transition: transform 0.12s, background 0.15s, box-shadow 0.15s;
}
#send:hover { background: var(--accent); box-shadow: 0 4px 14px color-mix(in srgb, var(--accent-2) 40%, transparent); }
#send:active { transform: scale(0.94); }
#send:disabled { background: var(--ink-faint); cursor: not-allowed; box-shadow: none; }

/* ---------- settings modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(6, 7, 9, 0.6); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 24px;
}
.modal-overlay[hidden] { display: none; }
.modal {
  width: min(520px, 100%); max-height: 86vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 0; background: var(--panel);
}
.modal-head h2 { margin: 0; font-family: var(--serif); font-size: 20px; font-weight: 500; }
.modal-body { padding: 8px 20px 20px; }
.set-section { padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.set-section:last-child { border-bottom: 0; }
.set-section h3 {
  margin: 0 0 10px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-dim);
}
.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 13.5px; padding: 5px 0;
}
.set-control { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-dim); }
.set-control input {
  width: 80px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink); font-family: var(--mono); font-size: 13px; padding: 6px 8px; outline: none;
}
.set-control input:focus { border-color: var(--accent-2); }
.set-hint { margin: 8px 0 0; font-size: 11.5px; color: var(--ink-faint); }
#vault-files { flex: 1; min-width: 0; font-size: 12px; color: var(--ink-dim); }
#vault-files::file-selector-button {
  background: var(--panel-2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 5px 10px; margin-right: 8px; cursor: pointer; font-size: 12px;
}
.mono { font-family: var(--mono); font-size: 12px; color: var(--ink); }
.set-models { list-style: none; margin: 0; padding: 0; }
.set-models li { display: flex; align-items: center; gap: 9px; padding: 7px 0; font-size: 13px; }
.set-models .r-name { color: var(--ink); font-weight: 500; }
.set-models .r-model { font-family: var(--mono); font-size: 10px; color: var(--ink-faint); }
.set-models .set-state {
  margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--ink-faint);
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #2f333b; }

/* ---------- login / signup page ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px; padding: 24px;
}
.auth-card {
  width: min(380px, 100%); background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 30px 28px;
}
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand .brand-mark { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.auth-brand .brand-mark span { color: var(--accent); }
.auth-brand .brand-sub {
  margin: 6px 0 0; font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-faint);
}
.auth-tabs {
  display: flex; gap: 4px; background: var(--bg); border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 4px; margin-bottom: 18px;
}
.auth-tab {
  flex: 1; padding: 8px; border: none; background: transparent; cursor: pointer;
  color: var(--ink-dim); font-family: var(--sans); font-size: 13.5px; font-weight: 500;
  border-radius: 7px; transition: background 0.15s, color 0.15s;
}
.auth-tab.active { background: var(--panel-2); color: var(--ink); }
#auth-form { display: flex; flex-direction: column; gap: 11px; }
#auth-form input {
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); font-family: var(--sans); font-size: 14.5px; padding: 12px 14px; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#auth-form input:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 18%, transparent); }
#auth-form input::placeholder { color: var(--ink-faint); }
#auth-submit {
  margin-top: 4px; padding: 12px; border: none; border-radius: 10px;
  background: var(--accent-2); color: #fff; font-family: var(--sans);
  font-size: 14.5px; font-weight: 600; cursor: pointer; transition: background 0.15s;
}
#auth-submit:hover { background: var(--accent); }
#auth-submit:disabled { background: var(--ink-faint); cursor: not-allowed; }
.auth-msg { margin: 4px 0 0; font-size: 12.5px; text-align: center; min-height: 1em; }
.auth-msg.error { color: var(--danger); }
.auth-msg.ok { color: var(--ok); }
.auth-foot { font-family: var(--mono); font-size: 10px; color: var(--ink-faint); letter-spacing: 0.06em; }

/* ---------- landing page (rough scaffold) ---------- */
.lp { max-width: 960px; margin: 0 auto; padding: 0 24px; }
.lp-nav {
  display: flex; align-items: center; justify-content: space-between; padding: 22px 0;
}
.lp-nav .brand-mark { font-size: 22px; font-weight: 700; }
.lp-nav .brand-mark span { color: var(--accent); }
.lp-nav-cta { color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 500; }
.lp-hero { padding: 8vh 0 6vh; }
.lp-eyebrow {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink-faint); margin: 0 0 14px;
}
.lp-hero h1 {
  font-family: var(--serif);
  font-size: clamp(34px, 5.5vw, 64px); font-weight: 500; letter-spacing: -0.015em;
  line-height: 1.04; margin: 0 0 20px;
  background: linear-gradient(180deg, var(--ink), var(--ink-dim));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.lp-sub { color: var(--ink-dim); font-size: 17px; line-height: 1.6; max-width: 56ch; margin: 0 0 26px; }
.lp-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.lp-btn {
  display: inline-block; padding: 12px 22px; border-radius: 12px; text-decoration: none;
  background: var(--accent-2); color: #fff; font-weight: 600; font-size: 15px;
  transition: background 0.15s, box-shadow 0.15s;
}
.lp-btn:hover { background: var(--accent); box-shadow: 0 8px 24px color-mix(in srgb, var(--accent-2) 42%, transparent); }
.lp-btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.lp-btn.ghost:hover { background: var(--panel-2); box-shadow: none; }
.lp-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 4vh 0; }
.lp-card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 20px; }
.lp-card h3 { margin: 0 0 8px; font-size: 15px; }
.lp-card p { margin: 0; color: var(--ink-dim); font-size: 13.5px; line-height: 1.6; }
.lp-install { text-align: center; padding: 8vh 0 4vh; }
.lp-install h2 { font-family: var(--serif); font-size: 32px; font-weight: 500; letter-spacing: -0.01em; margin: 0 0 12px; }
.lp-install p { color: var(--ink-dim); max-width: 52ch; margin: 0 auto 22px; line-height: 1.6; }
.lp-foot {
  text-align: center; padding: 40px 0; color: var(--ink-faint);
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em;
}
@media (max-width: 680px) { .lp-features { grid-template-columns: 1fr; } }

/* responsive: collapse the rail on narrow screens */
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .rail { display: none; }
}


/* Brand logo (inline SVG wordmark; "ai" inherits the text color) */
.brand-mark svg { height: 44px; width: auto; display: block; }
.lp-nav .brand-mark svg { height: 38px; }


/* Attachments */
.attach-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 8px; }
.attach-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font: 500 0.75rem var(--mono); color: var(--ink-dim);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 10px;
}
.attach-chip button {
  background: none; border: 0; color: var(--ink-faint); cursor: pointer;
  font-size: 0.9rem; padding: 0 2px;
}
.attach-chip button:hover { color: var(--danger); }
#attach {
  background: none; border: 0; color: var(--ink-dim); cursor: pointer;
  padding: 8px; border-radius: 10px; display: grid; place-items: center;
}
#attach:hover { color: var(--ink); background: var(--panel-2); }
#attach:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dl-btn {
  align-self: flex-start; margin-top: 4px;
  background: none; border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink-faint); font: 500 0.72rem var(--mono);
  padding: 3px 10px; cursor: pointer;
}
.dl-btn:hover { color: var(--ink); border-color: var(--ink-dim); }

.dl-row { display: flex; gap: 6px; margin-top: 4px; }
.dl-btn:disabled { opacity: 0.5; cursor: wait; }

.auth-link {
  background: none; border: 0; color: var(--ink-faint); font-size: 0.82rem;
  cursor: pointer; margin-top: 10px; text-align: center; width: 100%;
}
.auth-link:hover { color: var(--accent); text-decoration: underline; }

.bench-results { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.bench-row {
  font: 500 0.78rem var(--mono); color: var(--ink-dim);
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 12px;
}
.bench-row:first-child { border-color: var(--accent); color: var(--ink); }
.bench-fail { color: var(--ink-faint); }


/* ---------- Light mode (Design 2.0) ----------
   Explicit choice via data-theme, else the OS decides. The logo's "ai" follows
   automatically (currentColor). */
:root[data-theme="light"] {
  --bg: #f4efe6;
  --bg-rail: #f0ebe0;
  --panel: #ffffff;
  --panel-2: #f0ebe0;
  --line: rgba(40, 35, 28, 0.09);
  --line-soft: rgba(40, 35, 28, 0.06);
  --ink: #22201b;
  --ink-dim: #57534b;
  --ink-faint: #928c81;
  --accent: #2b7fc4;
  --accent-2: #2b7fc4;
  --accent-ink: #ffffff;
  --bubble-user: #ffffff;
  --bubble-user-line: rgba(40, 35, 28, 0.10);
  --ok: #3a9b58;
  --danger: #c25733;
  --brand-pink: #d84389;
  --shadow: 0 1px 2px rgba(40, 35, 28, 0.08), 0 12px 30px rgba(40, 35, 28, 0.10);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
  --bg: #f4efe6;
  --bg-rail: #f0ebe0;
  --panel: #ffffff;
  --panel-2: #f0ebe0;
  --line: rgba(40, 35, 28, 0.09);
  --line-soft: rgba(40, 35, 28, 0.06);
  --ink: #22201b;
  --ink-dim: #57534b;
  --ink-faint: #928c81;
  --accent: #2b7fc4;
  --accent-2: #2b7fc4;
  --accent-ink: #ffffff;
  --bubble-user: #ffffff;
  --bubble-user-line: rgba(40, 35, 28, 0.10);
  --ok: #3a9b58;
  --danger: #c25733;
  --brand-pink: #d84389;
  --shadow: 0 1px 2px rgba(40, 35, 28, 0.08), 0 12px 30px rgba(40, 35, 28, 0.10);
  }
}


/* Landing 2.0 additions */
.lp-nav-links { display: flex; align-items: center; gap: 20px; }
.lp-nav-links a { color: var(--ink-dim); text-decoration: none; font-size: 0.9rem; }
.lp-nav-links a:hover { color: var(--ink); }
.lp-steps { margin: 16px auto 24px; padding: 0 0 0 20px; max-width: 560px; text-align: left; }
.lp-steps li { color: var(--ink-dim); font-size: 0.95rem; margin-bottom: 10px; line-height: 1.6; }
.lp-features { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .lp-features { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .lp-features { grid-template-columns: 1fr; } }


/* Rendered markdown in assistant bubbles */
.bubble.md p { margin: 0 0 10px; }
.bubble.md p:last-child { margin-bottom: 0; }
.bubble.md pre {
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; overflow-x: auto; font: 400 0.85rem var(--mono); margin: 10px 0;
}
.bubble.md code { font: 400 0.85em var(--mono); background: var(--panel-2);
  border-radius: 4px; padding: 1px 5px; }
.bubble.md pre code { background: none; padding: 0; }
.bubble.md ul, .bubble.md ol { margin: 6px 0 10px; padding-left: 22px; }
.bubble.md li { margin-bottom: 4px; }
.bubble.md h1, .bubble.md h2, .bubble.md h3 { font-size: 1.02em; margin: 14px 0 6px; }
.bubble.md blockquote { border-left: 2px solid var(--line); margin: 8px 0;
  padding-left: 12px; color: var(--ink-dim); }
.bubble.md table { border-collapse: collapse; margin: 10px 0; font-size: 0.9em; }
.bubble.md th, .bubble.md td { border: 1px solid var(--line); padding: 5px 10px; }
.bubble.md a { color: var(--accent); }

.bubble.md pre { position: relative; }
.copy-btn {
  position: absolute; top: 6px; right: 6px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px;
  color: var(--ink-faint); font: 500 0.68rem var(--mono); padding: 2px 8px;
  cursor: pointer; opacity: 0; transition: opacity 0.15s ease-out;
}
.bubble.md pre:hover .copy-btn { opacity: 1; }
.copy-btn:hover { color: var(--ink); }

/* Syntax highlighting (highlight.js) — coloured with the design tokens so code
   looks native in both light and dark themes rather than importing a CDN theme. */
.bubble.md pre code.hljs { display: block; background: none; padding: 0; color: var(--ink); }
.hljs-comment, .hljs-quote { color: var(--ink-faint); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-name, .hljs-tag { color: var(--accent); }
.hljs-string, .hljs-title, .hljs-section, .hljs-attr, .hljs-attribute, .hljs-literal,
.hljs-template-tag, .hljs-template-variable, .hljs-type, .hljs-addition, .hljs-regexp {
  color: #2a9d5c;
}
.hljs-number, .hljs-symbol, .hljs-bullet, .hljs-link, .hljs-meta, .hljs-selector-id,
.hljs-selector-class, .hljs-title.class_ { color: #c2701a; }
.hljs-deletion { color: #c0392b; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

/* Mermaid diagrams rendered inline in an answer */
.bubble.md .mermaid {
  margin: 12px 0; padding: 12px; text-align: center; overflow-x: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
}
.bubble.md .mermaid svg { max-width: 100%; height: auto; }

/* Copy-whole-answer button (lives in the download row) */
.dl-btn.dl-copy { color: var(--accent); }
#share-btn.copied { color: var(--accent); }

/* Drag & drop target highlight */
main.stage { position: relative; }
main.stage.dropzone-active::after {
  content: "Dateien hier ablegen";
  position: absolute; inset: 8px; z-index: 5;
  display: grid; place-items: center;
  font: 600 1rem var(--mono); color: var(--accent);
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  border: 2px dashed var(--accent); border-radius: 14px;
  pointer-events: none;
}

/* Model-authored file downloads */
.file-card {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 8px; padding: 8px 14px;
  font: 600 0.8rem var(--mono); color: var(--ink);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; text-decoration: none;
}
.file-card:hover { border-color: var(--accent); color: var(--accent); }

/* Collapsed model reasoning ("So hat die KI gedacht") */
.thinking-box {
  margin: 0 0 6px; max-width: 85%;
  border: 1px dashed var(--line); border-radius: 12px;
  background: var(--panel);
}
.thinking-box summary {
  cursor: pointer; padding: 6px 12px;
  font: 500 0.75rem var(--mono); color: var(--ink-faint);
  list-style: none;
}
.thinking-box summary::-webkit-details-marker { display: none; }
.thinking-box[open] summary { color: var(--ink-dim); }
.thinking-body {
  padding: 0 12px 10px;
  font-size: 0.82rem; color: var(--ink-dim);
  white-space: pre-wrap; line-height: 1.5;
}

/* ============================================================
   Design 3.0 shell — chat page rebuilt 1:1 from the mockup.
   These rules come last so they win over the older layout rules. */
.cc { display: grid; grid-template-columns: 276px 1fr; height: 100vh; }
.cc-scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.cc-scroll::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }

/* sidebar */
.cc-side { background: var(--sidebar); border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; overflow: hidden; }
.cc-brand { padding: 18px 18px 6px; }
.cc-brand .brand-mark { display: inline-block; height: 26px; }
.cc-brand .brand-mark svg { height: 26px; width: auto; display: block; }
.cc-newwrap { padding: 10px 12px 14px; }
.cc-new {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 10px 12px;
  background: transparent; color: var(--ink); border: 1px solid var(--line2); border-radius: 10px;
  font-family: var(--sans); font-size: 14px; font-weight: 500; cursor: pointer; transition: background .15s, border-color .15s;
}
.cc-new:hover { background: var(--hover); }
.cc-chats { flex: 1; overflow-y: auto; padding: 0 12px 12px; }
.cc-h { margin: 0 0 6px; padding: 0 8px; font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-faint); }
.cc-account { border-top: 1px solid var(--line-soft); padding: 10px 12px; }
.cc-acct-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; background: transparent; border: none; border-radius: 10px; cursor: pointer; text-align: left; transition: background .15s; }
.cc-acct-btn:hover { background: var(--hover); }
.cc-avatar { flex: none; width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--accent-2), var(--accent)); display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.cc-acct-id { flex: 1; min-width: 0; }
.cc-acct-name { display: block; font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-acct-sub { display: block; font-size: 11px; color: var(--ink-faint); }

/* stage / topbar */
.stage { display: flex; flex-direction: column; height: 100vh; position: relative; min-width: 0; }
.cc-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; border-bottom: 1px solid var(--line-soft); background: var(--bg); }
.cc-model select {
  appearance: none; -webkit-appearance: none;
  padding: 7px 34px 7px 12px; border-radius: 9px; background: transparent; border: 1px solid var(--line2);
  color: var(--ink); font-family: var(--sans); font-size: 13.5px; font-weight: 500; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239a938a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.cc-model select:hover { background-color: var(--hover); }
.cc-top-actions { display: flex; align-items: center; gap: 4px; }
.cc-ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: transparent; border: none; color: var(--ink-dim); cursor: pointer; transition: background .15s, color .15s; }
.cc-ic:hover { background: var(--hover); color: var(--ink); }

/* transcript */
.transcript { flex: 1; overflow-y: auto; padding: 40px max(9%, 32px) 8px; display: flex; flex-direction: column; align-items: center; scroll-behavior: smooth; }
.transcript > * { width: 100%; max-width: 720px; }
.welcome { max-width: 720px; margin: 6vh auto 0; }

/* composer pill */
.cc-composer { padding: 12px max(9%, 32px) 22px; background: linear-gradient(180deg, transparent, var(--bg) 34%); }
.cc-composer .attach-chips { max-width: 720px; margin: 0 auto 8px; padding: 0; }
.composer {
  max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px;
  background: var(--bubble-user); border: 1px solid var(--line2); border-radius: 20px;
  padding: 12px 12px 10px 16px; box-shadow: 0 2px 20px rgba(0,0,0,0.14);
}
.composer #prompt { width: 100%; resize: none; background: transparent; border: none; outline: none; color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.6; padding: 2px 0; max-height: 180px; }
.composer #prompt::placeholder { color: var(--ink-faint); }
.composer-row { display: flex; align-items: center; gap: 8px; }
.composer-spacer { flex: 1; }
.composer #attach { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: none; border: none; color: var(--ink-dim); cursor: pointer; transition: background .15s, color .15s; }
.composer #attach:hover { background: var(--hover); color: var(--ink); }
.composer #send { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border: none; border-radius: 11px; background: var(--accent-2); color: #fff; cursor: pointer; transition: background .15s, box-shadow .15s, transform .1s; }
.composer #send:hover { background: var(--accent); box-shadow: 0 4px 16px color-mix(in srgb, var(--accent-2) 40%, transparent); }
.composer #send:active { transform: scale(0.94); }
.cc-hint { text-align: center; margin: 10px auto 0; max-width: 720px; font-size: 11.5px; color: var(--ink-faint); }

/* settings: serif section headings, model list */
.set-models { list-style: none; margin: 0; padding: 0; }

/* Live "thinking" wait indicator (shown while the models compute) */
.think-wait { display: inline-flex; align-items: center; gap: 9px; color: var(--ink-faint); font-size: 0.92rem; }
.tw-label { animation: tw-pulse 1.5s ease-in-out infinite; }
.tw-dots { display: inline-flex; gap: 4px; }
.tw-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); display: inline-block; animation: tw-bounce 1.2s infinite ease-in-out both; }
.tw-dots i:nth-child(2) { animation-delay: 0.16s; }
.tw-dots i:nth-child(3) { animation-delay: 0.32s; }
@keyframes tw-bounce { 0%, 80%, 100% { transform: scale(0.5); opacity: 0.35; } 40% { transform: scale(1); opacity: 1; } }
@keyframes tw-pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
