/* Clauden web — design tokens from the Android app / claude.ai */
@font-face {
  font-family: "Anthropic Sans";
  src: url("/fonts/anthropic_sans.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Anthropic Sans";
  src: url("/fonts/anthropic_sans_italic.ttf") format("truetype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Anthropic Serif";
  src: url("/fonts/anthropic_serif.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Anthropic Serif";
  src: url("/fonts/anthropic_serif_italic.ttf") format("truetype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains_mono.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-ui: "Anthropic Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Anthropic Serif", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --clay: #d97757;
  --clay-strong: #c96442;
  --clay-soft: rgba(217, 119, 87, 0.14);
  --radius: 12px;
  --sidebar-w: 276px;
  --content-w: 760px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #191919;
  --bg-side: #141414;
  --bg-elev: #1f1f1f;
  --surface: #1f1f1f;
  --surface-2: #262626;
  --surface-3: #2f2f2f;
  --user-bubble: #262626;
  --border: #2b2b2b;
  --border-strong: #4a4a4a;
  --text: #ededed;
  --text-2: #b9b9b9;
  --text-3: #9c9c9c;
  --code-bg: #121212;
  --hover: rgba(255, 255, 255, 0.06);
  --active: rgba(255, 255, 255, 0.1);
  --field: #1f1f1f;
  --danger: #e57373;
  --ok: #79c47f;
  --blue: #6da7ec;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  --scrim: rgba(0, 0, 0, 0.64);
  --badge: #2a2a2a;
  --scrim-soft: rgba(0, 0, 0, 0.35);
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f9f9f7;
  --bg-side: #f4f3ef;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f0efec;
  --surface-3: #e9e8e3;
  --user-bubble: #f0efec;
  --border: #e5e0d6;
  --border-strong: #c9c8c3;
  --text: #131313;
  --text-2: #383835;
  --text-3: #7b7974;
  --code-bg: #f0efec;
  --hover: rgba(0, 0, 0, 0.05);
  --active: rgba(0, 0, 0, 0.08);
  --field: #ffffff;
  --danger: #c0392b;
  --ok: #2f7d3a;
  --blue: #2a78d6;
  --shadow: 0 18px 50px rgba(40, 32, 20, 0.18);
  --scrim: rgba(0, 0, 0, 0.4);
  --badge: #e4e3de;
  --scrim-soft: rgba(0, 0, 0, 0.18);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}
body[data-font="system"] {
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg, video { max-width: 100%; }
::selection { background: var(--clay-soft); }
:focus-visible { outline: 2px solid var(--clay); outline-offset: 2px; }
[hidden] { display: none !important; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- boot ---------- */
.boot {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; background: var(--bg); z-index: 100;
}
.boot-logo { width: 64px; height: 64px; animation: breathe 2.4s ease-in-out infinite; }
.boot-name { font-family: var(--font-serif); font-size: 26px; letter-spacing: -0.3px; }
.boot-spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--clay);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 0%, 100% { transform: scale(1); opacity: 0.9; } 50% { transform: scale(1.07); opacity: 1; } }

/* ---------- shell ---------- */
.app { display: flex; height: 100dvh; overflow: hidden; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; background: var(--bg); }
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.screen-inner { flex: 1; overflow-y: auto; }
.page { max-width: 1040px; margin: 0 auto; padding: 28px 28px 80px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { font-family: var(--font-serif); font-size: 30px; line-height: 1.15; margin: 0; letter-spacing: -0.4px; }
.page-sub { color: var(--text-3); font-size: 13.5px; margin: 6px 0 0; }
.section-title { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); margin: 26px 0 10px; font-weight: 600; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 10px; padding: 9px 14px;
  background: transparent; color: var(--text); font-size: 14px; font-weight: 500;
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.08s ease, opacity 0.14s ease;
  white-space: nowrap; user-select: none;
}
.btn:active { transform: scale(0.985); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn-primary { background: var(--clay); color: #fff; }
.btn-primary:hover { background: var(--clay-strong); }
.btn-secondary { background: var(--surface); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-danger { background: rgba(229, 115, 115, 0.12); color: var(--danger); border-color: rgba(229, 115, 115, 0.28); }
.btn-danger:hover { background: rgba(229, 115, 115, 0.2); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 12px 18px; font-size: 15px; border-radius: 12px; }
.icon-btn {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 0; background: transparent; color: var(--text-2); flex: none;
  transition: background 0.14s ease, color 0.14s ease;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.sm { width: 26px; height: 26px; border-radius: 6px; }
.icon-btn.active { color: var(--clay); background: var(--clay-soft); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.sm svg { width: 15px; height: 15px; }

/* ---------- sidebar ---------- */
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--bg-side); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0; z-index: 30;
}
.side-head { padding: 14px 12px 8px; display: flex; flex-direction: column; gap: 10px; }
.brand { display: flex; align-items: center; gap: 9px; padding: 2px 6px 6px; min-width: 0; }
.brand-logo { width: 24px; height: 24px; flex: none; }
.brand-name { font-family: var(--font-serif); font-size: 21px; letter-spacing: -0.3px; white-space: nowrap; }
.brand-spacer { flex: 1; }
.new-chat {
  display: flex; align-items: center; gap: 9px; width: 100%; border: 0;
  background: var(--clay); color: #fff; border-radius: 10px; padding: 9px 11px;
  font-size: 14px; font-weight: 500; transition: background 0.15s ease;
}
.new-chat:hover { background: var(--clay-strong); }
.new-chat svg { width: 17px; height: 17px; }
.side-search { position: relative; }
.side-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-3); }
.side-search input {
  width: 100%; border: 1px solid var(--border); background: var(--surface); border-radius: 9px;
  padding: 7px 9px 7px 31px; font-size: 13px; color: var(--text); outline: none;
}
.side-search input:focus { border-color: var(--border-strong); }
.side-nav { padding: 4px 8px; display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 8px;
  color: var(--text-2); font-size: 13.5px; border: 0; background: transparent; text-align: left; width: 100%;
}
.nav-item svg { width: 16px; height: 16px; flex: none; }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { background: var(--active); color: var(--text); }
.nav-item .nav-count { margin-left: auto; font-size: 11.5px; color: var(--text-3); }
.side-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 8px 12px; }
.side-label { display: flex; align-items: center; justify-content: space-between; padding: 12px 9px 6px; font-size: 11.5px; color: var(--text-3); font-weight: 500; }
.chat-row {
  position: relative; display: flex; align-items: center; gap: 6px; padding: 6px 8px;
  border-radius: 8px; color: var(--text-2); font-size: 13.5px; cursor: pointer; user-select: none;
}
.chat-row:hover { background: var(--hover); color: var(--text); }
.chat-row.active { background: var(--active); color: var(--text); }
.chat-row-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row-pin { width: 12px; height: 12px; color: var(--text-3); flex: none; }
.chat-row .row-menu { opacity: 0; }
.chat-row:hover .row-menu, .chat-row.active .row-menu { opacity: 1; }
.row-menu { width: 24px; height: 24px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--text-3); flex: none; }
.row-menu:hover { background: var(--active); color: var(--text); }
.row-menu svg { width: 15px; height: 15px; }
.side-empty { padding: 16px 10px; color: var(--text-3); font-size: 13px; text-align: center; }
.side-foot { border-top: 1px solid var(--border); padding: 9px; display: flex; flex-direction: column; gap: 6px; }
.user-chip {
  display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 9px;
  border: 0; background: transparent; width: 100%; text-align: left; color: var(--text);
}
.user-chip:hover { background: var(--hover); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--clay); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex: none;
}
.user-chip-text { min-width: 0; flex: 1; }
.user-chip-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip-plan { font-size: 11px; color: var(--text-3); }
.plan-badge {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 6px; padding: 1px 6px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.03em; background: var(--badge); color: var(--text-2);
  border: 1px solid var(--border);
}
.plan-badge.pro { background: var(--clay-soft); color: var(--clay); border-color: rgba(217, 119, 87, 0.35); }

.side-backdrop { display: none; }

/* ---------- topbar ---------- */
.topbar {
  height: 54px; flex: none; display: flex; align-items: center; gap: 8px;
  padding: 0 14px; border-bottom: 1px solid transparent; background: var(--bg);
  position: relative; z-index: 12;
}
.topbar.bordered { border-bottom-color: var(--border); }
.topbar-title { font-size: 14px; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-sub { color: var(--text-3); font-size: 12px; margin-left: 2px; }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 2px; }
.mobile-only { display: none; }

/* ---------- chat ---------- */
.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; scroll-behavior: smooth; }
.thread { width: 100%; max-width: var(--content-w); margin: 0 auto; padding: 18px 24px 26px; }
.chat.is-empty .chat-scroll { display: none; }
.chat.is-empty .composer-wrap { margin: auto; padding-bottom: 0; }
.chat.is-empty .composer-wrap::after { content: ""; display: block; height: 0; }

.empty-state { display: none; text-align: center; padding: 0 8px 26px; }
.chat.is-empty .empty-state { display: block; }
.empty-logo { width: 52px; height: 52px; margin: 0 auto 16px; animation: breathe 4s ease-in-out infinite; }
.empty-title { font-family: var(--font-serif); font-size: 30px; line-height: 1.15; letter-spacing: -0.5px; margin: 0 0 8px; }
.empty-sub { color: var(--text-3); font-size: 13.5px; margin: 0 0 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 18px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  border-radius: 999px; padding: 6px 12px; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); background: var(--surface-2); }
.chip svg { width: 14px; height: 14px; }

.msg { margin: 0 0 20px; position: relative; }
.msg-user { display: flex; flex-direction: column; align-items: flex-end; }
.msg-user .bubble {
  max-width: 82%; background: var(--user-bubble); color: var(--text); border-radius: 12px;
  padding: 10px 14px; font-size: 15px; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}
.msg-user .bubble .md { font-family: var(--font-ui); font-size: 15px; line-height: 1.5; }
.msg-user .bubble .md p { margin: 0 0 8px; }
.msg-user .bubble .md p:last-child { margin: 0; }
.msg-meta { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-3); margin-top: 5px; min-height: 18px; }
.msg-meta .icon-btn { width: 22px; height: 22px; }
.msg-meta .icon-btn svg { width: 13px; height: 13px; }
.msg-assistant .body { font-family: var(--font-serif); font-size: 16px; line-height: 1.62; color: var(--text); padding-right: 30px; }
.msg-assistant .body.streaming::after {
  content: ""; display: inline-block; width: 7px; height: 16px; margin-left: 2px;
  background: var(--clay); vertical-align: -2px; animation: blink 1s steps(2) infinite; border-radius: 1px;
}
@keyframes blink { 50% { opacity: 0; } }
.msg-actions { display: flex; align-items: center; gap: 1px; margin-top: 6px; opacity: 0; transition: opacity 0.15s; }
.msg:hover .msg-actions, .msg-actions.visible { opacity: 1; }
.disclaimer { color: var(--text-3); font-size: 11.5px; margin: 8px 0 0; font-family: var(--font-ui); }
@media (hover: none) { .msg-actions { opacity: 1; } }

.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.attachment {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border);
  background: var(--surface); border-radius: 9px; padding: 5px 8px; font-size: 12px; color: var(--text-2); max-width: 260px;
}
.attachment img { width: 30px; height: 30px; object-fit: cover; border-radius: 5px; }
.attachment-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-size { color: var(--text-3); font-size: 11px; }
.attachment .icon-btn { width: 20px; height: 20px; }

.thinking { margin: 0 0 12px; }
.thinking-head {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); border-radius: 999px; padding: 4px 10px;
  font-size: 12px; font-family: var(--font-ui);
}
.thinking-head svg { width: 13px; height: 13px; color: var(--clay); }
.thinking-body { margin-top: 8px; border-left: 2px solid var(--border); padding-left: 12px; }
.steps { display: flex; flex-direction: column; gap: 5px; margin: 6px 0 0; font-family: var(--font-ui); }
.step { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.step-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; flex: none; background: var(--text-3); }
.step.running .step-dot { background: var(--clay); animation: pulse 1.1s ease-in-out infinite; }
.step.done .step-dot { background: var(--ok); }
.step.failed .step-dot { background: var(--danger); }
.step-detail { color: var(--text-3); font-size: 11.5px; }
@keyframes pulse { 0%, 100% { opacity: 0.35; transform: scale(0.9); } 50% { opacity: 1; transform: scale(1.15); } }
.sources { margin-top: 12px; font-family: var(--font-ui); }
.sources-label { font-size: 11.5px; color: var(--text-3); margin-bottom: 6px; }
.source-list { display: flex; flex-wrap: wrap; gap: 6px; }
.source {
  display: inline-flex; align-items: center; gap: 6px; max-width: 260px; border: 1px solid var(--border);
  border-radius: 8px; padding: 4px 8px; font-size: 12px; color: var(--text-2); background: var(--surface);
}
.source:hover { color: var(--text); border-color: var(--border-strong); text-decoration: none; }
.source span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source svg { width: 12px; height: 12px; color: var(--text-3); flex: none; }

.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: 12px 0; font-family: var(--font-ui); }
.file-card {
  display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); background: var(--surface);
  border-radius: 10px; padding: 9px 10px; min-width: 0; color: var(--text); text-align: left;
}
.file-card:hover { border-color: var(--border-strong); text-decoration: none; }
.file-icon { width: 34px; height: 34px; border-radius: 8px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; flex: none; color: var(--clay); }
.file-icon svg { width: 17px; height: 17px; }
.file-text { min-width: 0; flex: 1; }
.file-name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { font-size: 11px; color: var(--text-3); }
.media-item { border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.media-item img, .media-item video { display: block; width: 100%; max-height: 420px; object-fit: contain; background: #000; }

.widget-card { border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 14px; margin: 12px 0; font-family: var(--font-ui); }
.widget-title { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.widget-bars { display: flex; flex-direction: column; gap: 7px; }
.widget-bar { display: grid; grid-template-columns: minmax(60px, 26%) 1fr auto; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-2); }
.widget-bar-track { height: 8px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.widget-bar-fill { height: 100%; background: var(--clay); border-radius: 6px; }
.widget-bar-value { color: var(--text-3); font-variant-numeric: tabular-nums; }
.widget-frame { width: 100%; height: 320px; border: 0; border-radius: 10px; background: #fff; }
.action-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; font-family: var(--font-ui); }
.action-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 999px; padding: 3px 9px; font-size: 11.5px; color: var(--text-3); }
.action-chip svg { width: 12px; height: 12px; }

.error-box {
  border: 1px solid rgba(229, 115, 115, 0.35); background: rgba(229, 115, 115, 0.08);
  color: var(--danger); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin: 8px 0;
  font-family: var(--font-ui);
}
.error-box .btn { margin-top: 8px; }
.notice-box {
  border: 1px solid var(--border); background: var(--surface); border-radius: 10px;
  padding: 10px 12px; font-size: 12.5px; color: var(--text-2); margin: 8px 0; font-family: var(--font-ui);
}

/* ---------- composer ---------- */
.composer-wrap { padding: 6px 24px 14px; width: 100%; max-width: calc(var(--content-w) + 48px); margin: 0 auto; flex: none; }
.composer {
  border: 1px solid var(--border-strong); background: var(--field); border-radius: 14px;
  padding: 10px 10px 8px 12px; transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 10px var(--scrim-soft);
}
.composer:focus-within { border-color: var(--clay); box-shadow: 0 0 0 3px var(--clay-soft); }
.composer-attach { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 6px; }
.composer textarea {
  width: 100%; border: 0; background: transparent; resize: none; outline: none;
  font-size: 16px; line-height: 1.5; color: var(--text); max-height: 220px; min-height: 26px; padding: 2px 2px;
}
.composer textarea::placeholder { color: var(--text-3); }
.composer-bar { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.composer-plus {
  width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.composer-plus:hover { background: var(--hover); color: var(--text); }
.composer-plus svg { width: 18px; height: 18px; }
.model-pill {
  display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent;
  color: var(--text-2); font-size: 12.5px; padding: 5px 7px; border-radius: 7px; max-width: 220px;
}
.model-pill:hover { background: var(--hover); color: var(--text); }
.model-pill svg { width: 13px; height: 13px; color: var(--text-3); flex: none; }
.model-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-spacer { flex: 1; }
.composer-hint { font-size: 11px; color: var(--text-3); margin-right: 6px; }
.send-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 0; background: var(--clay); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.send-btn:hover { background: var(--clay-strong); }
.send-btn[disabled] { background: var(--surface-3); color: var(--text-3); cursor: default; }
.send-btn svg { width: 17px; height: 17px; }
.send-btn.stop { background: var(--text); color: var(--bg); }
.composer-note { text-align: center; color: var(--text-3); font-size: 11px; margin-top: 7px; }
.plan-note { text-align: center; font-size: 11.5px; color: var(--text-3); margin-top: 6px; }
.plan-note a { color: var(--clay); }

/* ---------- markdown ---------- */
.md { font-family: var(--font-serif); font-size: 16px; line-height: 1.62; word-break: break-word; }
.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }
.md p { margin: 0 0 12px; }
.md h1, .md h2, .md h3, .md h4 { font-family: var(--font-serif); font-weight: 600; line-height: 1.25; margin: 22px 0 10px; letter-spacing: -0.2px; }
.md h1 { font-size: 24px; }
.md h2 { font-size: 20px; }
.md h3 { font-size: 17px; }
.md h4 { font-size: 15.5px; }
.md ul, .md ol { margin: 0 0 12px; padding-left: 22px; }
.md li { margin: 4px 0; }
.md li > p { margin: 0 0 4px; }
.md blockquote { margin: 12px 0; padding: 2px 0 2px 14px; border-left: 2px solid var(--clay); color: var(--text-2); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.md code { font-family: var(--font-mono); font-size: 0.82em; background: var(--surface-2); border-radius: 4px; padding: 2px 5px; }
.md pre { margin: 12px 0; }
.md pre code { background: transparent; padding: 0; font-size: 12.5px; line-height: 1.55; }
.md table { border-collapse: collapse; width: 100%; margin: 12px 0; font-family: var(--font-ui); font-size: 13px; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.md th { background: var(--surface-2); font-weight: 600; }
.md img { border-radius: 8px; margin: 8px 0; }
.md a { color: var(--blue); }
.md strong { font-weight: 600; }
.md input[type="checkbox"] { margin-right: 6px; }

.code-block { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--code-bg); margin: 12px 0; font-family: var(--font-ui); }
.code-head { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--border); color: var(--text-3); font-size: 11.5px; }
.code-lang { text-transform: lowercase; }
.code-head .icon-btn { margin-left: auto; }
.code-block pre { margin: 0; padding: 12px 14px; overflow-x: auto; }
.code-block code { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.55; background: transparent; padding: 0; }
.hljs { color: var(--text); background: transparent; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-section, .hljs-link { color: #c678dd; }
.hljs-function .hljs-keyword, .hljs-built_in { color: #61afef; }
.hljs-string, .hljs-attr, .hljs-template-tag, .hljs-template-variable { color: #98c379; }
.hljs-number, .hljs-symbol, .hljs-bullet { color: #d19a66; }
.hljs-comment, .hljs-quote { color: #7f848e; font-style: italic; }
.hljs-title, .hljs-name, .hljs-type { color: #e5c07b; }
.hljs-variable, .hljs-params { color: #e06c75; }
.hljs-meta { color: #56b6c2; }

/* ---------- lists / cards ---------- */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.card {
  border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 14px;
  min-width: 0; transition: border-color 0.15s ease, background 0.15s ease;
}
.card.clickable { cursor: pointer; }
.card.clickable:hover { border-color: var(--border-strong); background: var(--surface-2); }
.card-title { font-size: 14px; font-weight: 600; margin: 0 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-sub { color: var(--text-3); font-size: 12px; margin: 0; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-meta { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 11.5px; margin-top: 10px; }
.card-icon { width: 32px; height: 32px; border-radius: 8px; background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; color: var(--clay); margin-bottom: 10px; }
.card-icon svg { width: 16px; height: 16px; }
.project-card { display: flex; flex-direction: column; min-height: 128px; }
.project-card .card-title { font-family: var(--font-serif); font-size: 17px; font-weight: 400; }
.list { display: flex; flex-direction: column; gap: 2px; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--text); text-align: left; width: 100%; }
.list-row:hover { background: var(--hover); }
.list-row.active { background: var(--active); }
.list-row-icon { width: 30px; height: 30px; border-radius: 8px; background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); flex: none; }
.list-row-icon svg { width: 15px; height: 15px; }
.list-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.list-row-title { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row-sub { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row-meta { font-size: 11px; color: var(--text-3); flex: none; }
.empty-block { text-align: center; color: var(--text-3); padding: 48px 20px; }
.empty-block svg { width: 34px; height: 34px; margin-bottom: 12px; color: var(--border-strong); }
.empty-block h3 { font-family: var(--font-serif); font-weight: 400; font-size: 20px; color: var(--text-2); margin: 0 0 6px; }
.empty-block p { font-size: 13px; margin: 0 auto 16px; max-width: 360px; }

/* ---------- artifacts ---------- */
.artifact-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; cursor: pointer; }
.artifact-preview { height: 150px; background: var(--surface-2); border-bottom: 1px solid var(--border); overflow: hidden; position: relative; }
.artifact-preview iframe { width: 200%; height: 200%; transform: scale(0.5); transform-origin: 0 0; border: 0; pointer-events: none; background: #fff; }
.artifact-preview .preview-fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--text-3); }
.artifact-preview .preview-fallback svg { width: 32px; height: 32px; }
.artifact-body { padding: 10px 12px; }
.artifact-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.artifact-meta { font-size: 11px; color: var(--text-3); margin-top: 3px; display: flex; gap: 8px; }
.artifact-view { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.artifact-toolbar { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-bottom: 1px solid var(--border); flex: none; }
.artifact-frame-wrap { flex: 1; min-height: 0; background: #fff; }
.artifact-frame-wrap iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.artifact-code { flex: 1; overflow: auto; padding: 16px; background: var(--code-bg); }
.artifact-code pre { margin: 0; }
.artifact-code code { font-family: var(--font-mono); font-size: 12.5px; white-space: pre-wrap; }
.artifact-ask { flex: none; border-top: 1px solid var(--border); padding: 10px 14px; display: flex; gap: 8px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.field-hint { font-size: 11.5px; color: var(--text-3); }
.input, .textarea, .select {
  width: 100%; border: 1px solid var(--border); background: var(--field); color: var(--text);
  border-radius: 9px; padding: 9px 11px; font-size: 14px; outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--clay); box-shadow: 0 0 0 3px var(--clay-soft); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.form-row { display: flex; gap: 10px; align-items: center; }
.form-row > * { flex: 1; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track { position: absolute; inset: 0; background: var(--surface-3); border-radius: 999px; transition: background 0.16s ease; pointer-events: none; }
.switch-track::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: transform 0.16s ease; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + .switch-track { background: var(--clay); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; padding: 2px; gap: 2px; background: var(--surface); flex-wrap: wrap; }
.segmented button { border: 0; background: transparent; color: var(--text-2); border-radius: 7px; padding: 5px 10px; font-size: 12.5px; }
.segmented button.active { background: var(--surface-3); color: var(--text); }
.segmented button:hover { color: var(--text); }
.radio-card { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.radio-card.active { border-color: var(--clay); background: var(--clay-soft); }
.radio-card input { accent-color: var(--clay); }

/* ---------- modal / menu / toast ---------- */
#modal-root { position: relative; z-index: 80; }
.modal-backdrop {
  position: fixed; inset: 0; background: var(--scrim); display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 80; animation: fade 0.14s ease;
}
.modal {
  width: min(520px, 100%); max-height: min(86dvh, 900px); overflow: auto; background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); animation: rise 0.18s ease;
}
.modal.wide { width: min(820px, 100%); }
.modal.full { width: min(1100px, 100%); height: min(88dvh, 900px); display: flex; flex-direction: column; overflow: hidden; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; }
.modal-title { font-family: var(--font-serif); font-size: 20px; margin: 0; flex: 1; font-weight: 400; }
.modal-body { padding: 16px 18px 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 18px 18px; }
.modal .list { max-height: 50dvh; overflow-y: auto; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(0.99); } }
.menu {
  position: fixed; z-index: 90; min-width: 190px; background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow); padding: 4px; animation: fade 0.1s ease;
}
.menu-item { display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: transparent; color: var(--text); text-align: left; padding: 7px 9px; border-radius: 7px; font-size: 13px; }
.menu-item:hover { background: var(--hover); }
.menu-item svg { width: 15px; height: 15px; color: var(--text-3); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger svg { color: var(--danger); }
.menu-sep { height: 1px; background: var(--border); margin: 4px 2px; }
.toast-root { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: var(--text); color: var(--bg); border-radius: 10px; padding: 9px 14px; font-size: 13px;
  box-shadow: var(--shadow); animation: rise 0.2s ease; max-width: 90vw; text-align: center;
}
.toast.error { background: var(--danger); color: #fff; }
.toast.success { background: var(--ok); color: #08120a; }

/* ---------- auth ---------- */
.auth { flex: 1 1 auto; width: 100%; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; background: radial-gradient(1200px 600px at 50% -10%, var(--clay-soft), transparent 60%), var(--bg); }
.auth-card { width: min(400px, 100%); }
.auth-logo { width: 62px; height: 62px; display: block; margin: 0 auto 18px; }
.auth-title { font-family: var(--font-serif); font-size: 32px; line-height: 1.12; text-align: center; margin: 0 0 8px; letter-spacing: -0.6px; }
.auth-sub { color: var(--text-3); text-align: center; font-size: 13.5px; margin: 0 0 26px; }
.auth-actions { display: flex; flex-direction: column; gap: 9px; }
.google-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  background: #fff; color: #1f1f1f; border: 1px solid #dadce0; border-radius: 10px; padding: 11px 14px;
  font-size: 14px; font-weight: 500;
}
.google-btn:hover { background: #f7f7f7; }
.google-btn svg { width: 18px; height: 18px; }
.auth-sep { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 11.5px; margin: 16px 0; }
.auth-sep::before, .auth-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-note { color: var(--text-3); font-size: 11.5px; text-align: center; margin-top: 18px; line-height: 1.5; }
.auth-note a { color: var(--text-2); text-decoration: underline; }
.auth-back { display: inline-flex; align-items: center; gap: 5px; color: var(--text-3); font-size: 12.5px; margin-bottom: 14px; background: none; border: 0; padding: 0; }
.auth-back:hover { color: var(--text); }
.code-input { letter-spacing: 0.35em; text-align: center; font-family: var(--font-mono); font-size: 20px; }
.auth-plan-hint { border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 10px 12px; font-size: 12px; color: var(--text-2); margin-top: 14px; }
.onboarding { width: min(440px, 100%); }
.steps-dots { display: flex; gap: 5px; justify-content: center; margin-bottom: 18px; }
.steps-dots i { width: 22px; height: 3px; border-radius: 2px; background: var(--border-strong); }
.steps-dots i.on { background: var(--clay); }

/* ---------- settings ---------- */
.settings { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 34px; max-width: 1000px; margin: 0 auto; padding: 26px 26px 90px; width: 100%; }
.settings-nav { display: flex; flex-direction: column; gap: 1px; position: sticky; top: 10px; align-self: start; }
.settings-nav button { display: flex; align-items: center; gap: 9px; border: 0; background: transparent; color: var(--text-2); padding: 7px 9px; border-radius: 8px; font-size: 13.5px; text-align: left; }
.settings-nav button svg { width: 15px; height: 15px; color: var(--text-3); }
.settings-nav button:hover { background: var(--hover); color: var(--text); }
.settings-nav button.active { background: var(--active); color: var(--text); }
.settings-nav button.active svg { color: var(--clay); }
.settings-pane { min-width: 0; }
.settings-title { font-family: var(--font-serif); font-size: 26px; margin: 0 0 4px; font-weight: 400; letter-spacing: -0.3px; }
.settings-desc { color: var(--text-3); font-size: 13px; margin: 0 0 22px; }
.settings-group { border: 1px solid var(--border); background: var(--surface); border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.setting-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: 0; }
.setting-text { flex: 1; min-width: 0; }
.setting-name { font-size: 13.5px; }
.setting-hint { color: var(--text-3); font-size: 11.5px; margin-top: 2px; line-height: 1.4; }
.setting-row .btn { flex: none; }
.setting-row.clickable { cursor: pointer; }
.setting-row.clickable:hover { background: var(--hover); }
.settings-account { display: flex; align-items: center; gap: 12px; padding: 14px; border-bottom: 1px solid var(--border); }
.settings-account .avatar { width: 42px; height: 42px; font-size: 16px; }
.plan-card { border: 1px solid var(--border); background: var(--surface); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.plan-card.current { border-color: var(--clay); box-shadow: 0 0 0 3px var(--clay-soft); }
.plan-card.featured { border-color: var(--clay); }
.plan-head { display: flex; align-items: baseline; gap: 8px; }
.plan-name { font-family: var(--font-serif); font-size: 21px; }
.plan-price { font-size: 26px; font-weight: 600; letter-spacing: -0.5px; }
.plan-price small { font-size: 12px; color: var(--text-3); font-weight: 400; }
.plan-tagline { color: var(--text-3); font-size: 12.5px; min-height: 34px; }
.plan-features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.plan-features li { display: flex; gap: 7px; align-items: flex-start; }
.plan-features svg { width: 13px; height: 13px; color: var(--ok); margin-top: 3px; flex: none; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.usage-row { margin: 16px 0; }
.usage-head { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; }
.usage-head span:last-child { color: var(--text-3); font-variant-numeric: tabular-nums; }
.usage-bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.usage-fill { height: 100%; background: var(--clay); border-radius: 999px; transition: width 0.4s ease; }
.usage-fill.high { background: var(--danger); }
.usage-reset { font-size: 11.5px; color: var(--text-3); margin-top: 6px; }
.checkout-method { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; cursor: pointer; margin-bottom: 8px; }
.checkout-method.active { border-color: var(--clay); background: var(--clay-soft); }
.checkout-method input { accent-color: var(--clay); }
.checkout-method .method-name { flex: 1; font-size: 13.5px; }
.checkout-method .method-currency { font-size: 11.5px; color: var(--text-3); }
.order-qr { display: flex; align-items: center; justify-content: center; padding: 16px; background: #fff; border-radius: 12px; margin: 12px 0; }
.order-qr img { width: 220px; height: 220px; image-rendering: pixelated; }
.order-link { word-break: break-all; font-size: 12px; color: var(--text-2); }

/* ---------- code ---------- */
.code-layout { display: flex; flex: 1; min-height: 0; }
.code-side { width: 300px; flex: none; border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; background: var(--bg-side); }
.code-side-head { padding: 12px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--border); }
.code-side-scroll { flex: 1; overflow-y: auto; padding: 8px; }
.code-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.code-messages { flex: 1; overflow-y: auto; padding: 18px 20px 8px; }
.code-msg { margin: 0 0 18px; font-size: 13.5px; }
.code-msg.user { border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 9px 11px; }
.code-msg.user::before { content: "> Вы"; display: block; font-family: var(--font-mono); font-size: 10.5px; color: var(--clay); margin-bottom: 4px; }
.code-msg.assistant { font-family: var(--font-serif); font-size: 15px; line-height: 1.6; }
.code-msg.assistant .md { font-size: 15px; }
.term-steps { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; font-family: var(--font-mono); font-size: 12px; color: var(--text-2); }
.term-step { display: flex; gap: 8px; align-items: flex-start; }
.term-step::before { content: "●"; color: var(--text-3); font-size: 9px; line-height: 1.7; }
.term-step.running::before { color: var(--clay); animation: pulse 1.1s infinite; }
.term-step.done::before { color: var(--ok); }
.term-step.failed::before { color: var(--danger); }
.term-step .detail { color: var(--text-3); }
.code-composer { border-top: 1px solid var(--border); padding: 10px 16px 14px; }
.code-composer textarea { width: 100%; border: 1px solid var(--border-strong); background: var(--field); border-radius: 10px; padding: 9px 11px; font-family: var(--font-mono); font-size: 13px; resize: none; outline: none; min-height: 42px; max-height: 160px; }
.code-composer textarea:focus { border-color: var(--clay); }
.code-composer-bar { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.code-status { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-3); }
.code-status .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); margin-right: 5px; }
.code-status.working .dot { background: var(--clay); animation: pulse 1s infinite; }
.code-status.failed .dot { background: var(--danger); }
.terminal {
  background: #0f0f0f; color: #d6d6d6; border-radius: 12px; border: 1px solid #262626;
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.55; padding: 12px; overflow: auto; max-height: 420px;
}
html[data-theme="light"] .terminal { background: #141414; color: #e6e6e6; }
.terminal .t-cmd { color: #d97757; }
.terminal .t-out { color: #a8a8a8; white-space: pre-wrap; }
.code-session-card { border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 10px; margin-bottom: 6px; cursor: pointer; }
.code-session-card:hover { border-color: var(--border-strong); }
.code-session-card.active { border-color: var(--clay); background: var(--clay-soft); }
.code-session-title { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-session-sub { font-size: 11px; color: var(--text-3); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-flex; align-items: center; border-radius: 6px; padding: 1px 6px; font-size: 10.5px; background: var(--badge); color: var(--text-2); border: 1px solid var(--border); }
.badge.ok { color: var(--ok); border-color: rgba(121,196,127,.3); background: rgba(121,196,127,.08); }
.badge.warn { color: var(--clay); border-color: rgba(217,119,87,.3); background: var(--clay-soft); }
.badge.err { color: var(--danger); border-color: rgba(229,115,115,.3); background: rgba(229,115,115,.08); }

/* ---------- market ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab { border: 0; background: transparent; color: var(--text-3); padding: 8px 12px; font-size: 13px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--clay); }
.market-card { display: flex; flex-direction: column; gap: 8px; }
.market-card .card-title { white-space: normal; }
.market-card .card-sub { -webkit-line-clamp: 3; }
.market-actions { display: flex; gap: 6px; margin-top: auto; padding-top: 4px; }

/* ---------- misc ---------- */
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.mono { font-family: var(--font-mono); }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.kbd { font-family: var(--font-mono); font-size: 10.5px; border: 1px solid var(--border); border-radius: 4px; padding: 1px 4px; color: var(--text-3); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--clay); animation: spin 0.8s linear infinite; display: inline-block; }
.center { display: flex; align-items: center; justify-content: center; }
.pad { padding: 20px; }
.loading-block { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px; color: var(--text-3); font-size: 13px; }
.offline-banner { background: var(--clay-soft); color: var(--clay); text-align: center; font-size: 12px; padding: 5px; }
.install-banner { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin-bottom: 14px; font-size: 12.5px; }
.install-banner svg { width: 16px; height: 16px; color: var(--clay); flex: none; }
.install-banner .btn { margin-left: auto; }
.search-overlay { position: fixed; inset: 0; z-index: 70; background: var(--scrim); display: flex; justify-content: center; padding: 10vh 20px 20px; }
.search-panel { width: min(620px, 100%); height: fit-content; max-height: 70dvh; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.search-input { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.search-input svg { width: 17px; height: 17px; color: var(--text-3); }
.search-input input { flex: 1; border: 0; background: transparent; outline: none; font-size: 15px; }
.search-results { overflow-y: auto; padding: 6px; }
.search-hit { display: block; width: 100%; text-align: left; border: 0; background: transparent; color: var(--text); padding: 9px 10px; border-radius: 8px; }
.search-hit:hover { background: var(--hover); }
.search-hit-title { font-size: 13px; }
.search-hit-sub { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-hit mark { background: var(--clay-soft); color: var(--clay); border-radius: 3px; padding: 0 1px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .mobile-only { display: inline-flex; }
  .desktop-only { display: none !important; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; transform: translateX(-102%); transition: transform 0.2s ease;
    width: min(300px, 86vw); box-shadow: var(--shadow);
  }
  .app.sidebar-open .sidebar { transform: translateX(0); }
  .app.sidebar-open .side-backdrop { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 29; }
  .thread { padding: 12px 16px 20px; }
  .composer-wrap { padding: 6px 12px 12px; }
  .page { padding: 18px 16px 70px; }
  .page-title { font-size: 25px; }
  .empty-title { font-size: 25px; }
  .msg-user .bubble { max-width: 90%; }
  .msg-assistant .body { padding-right: 0; }
  .settings { grid-template-columns: 1fr; gap: 14px; padding: 16px 14px 80px; }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
  .settings-nav button { white-space: nowrap; }
  .code-layout { flex-direction: column; }
  .code-side { width: 100%; max-height: 34dvh; border-right: 0; border-bottom: 1px solid var(--border); }
  .plan-grid { grid-template-columns: 1fr; }
  .modal { border-radius: 14px; }
  .modal.full { height: 92dvh; }
}
@media (max-width: 520px) {
  .composer-hint { display: none; }
  .model-pill { max-width: 150px; }
  .topbar { padding: 0 8px; }
  .chips { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .chip { white-space: nowrap; }
  .empty-state { text-align: left; }
  .empty-logo { margin-left: 0; }
  .empty-title, .empty-sub { text-align: left; }
}

/* print / reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
