/* ==========================================================================
   Eltes AI — application shell
   ========================================================================== */

/* ------------------------------ chat themes ------------------------------ */
/* Every accent in the chat shell reads these variables, so a theme can swap
   the whole palette in one place. Obsidian (true black) is the default;
   Graphite is the softer neutral option. There is no blue theme. */

body.app {
  --accent-rgb: 196, 199, 207;
  --accent-soft-rgb: 230, 232, 238;
  --accent-line-rgb: 212, 214, 222;
  --accent-cyan-rgb: 204, 207, 214;
  --accent-grad-a: #b4b8c1;
  --accent-grad-b: #71767f;
  --accent-text: #e4e6eb;
  --accent-text-strong: #f8f9fa;
  --shell-1: #070708;
  --shell-2: #030304;
  --shell-3: #000000;
  --side-a: #050506;
  --side-b: #010102;
  --bubble-a: #212226;
  --bubble-b: #17181b;
  --accent-glow: rgba(var(--accent-rgb), 0.16);

  --ink-0: #000000;
  --ink-1: #040405;
  --ink-2: #08080a;
  --ink-3: #0d0d0f;
  --ink-4: #131316;
  --ink-5: #1a1a1e;
  --panel: rgba(8, 8, 10, 0.9);
  --panel-solid: #08080a;

  --line: rgba(255, 255, 255, 0.075);
  --line-2: rgba(255, 255, 255, 0.13);
  --line-3: rgba(255, 255, 255, 0.22);

  --text: #f2f3f5;
  --text-2: #a6a8ae;
  --text-3: #787a80;
  --text-4: #4e5055;

  --blue: #bcbfc7;
  --blue-hi: #eef0f3;
  --blue-lo: #70747c;
  --cyan: #c3c6cd;
  --violet: #c4c1cc;

  --grad-brand: linear-gradient(135deg, #bcc0c8 0%, #858b95 45%, #a6abb4 100%);
  --grad-text: linear-gradient(96deg, #ffffff 6%, #e7e9ed 48%, #a8acb4 100%);
  --grad-line: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.42), transparent);
  --shadow-blue: 0 18px 48px -22px rgba(0, 0, 0, 0.9);
}

/* Graphite — grey, not blue. */
body.app[data-theme="grey"] {
  --accent-rgb: 158, 163, 173;
  --accent-soft-rgb: 198, 202, 210;
  --accent-line-rgb: 190, 195, 204;
  --accent-cyan-rgb: 176, 181, 190;
  --accent-grad-a: #868d99;
  --accent-grad-b: #565d69;
  --accent-text: #d6dae1;
  --accent-text-strong: #f0f2f5;
  --shell-1: #0d0e10;
  --shell-2: #0a0b0c;
  --shell-3: #060607;
  --side-a: #0b0c0d;
  --side-b: #070708;
  --bubble-a: #24272c;
  --bubble-b: #1a1d21;

  --ink-0: #0a0b0d;
  --ink-1: #0d0e10;
  --ink-2: #111214;
  --ink-3: #151619;
  --ink-4: #1a1c1f;
  --ink-5: #202226;
  --panel: rgba(16, 17, 19, 0.86);
  --panel-solid: #101113;

  --line: rgba(200, 204, 212, 0.09);
  --line-2: rgba(200, 204, 212, 0.15);
  --line-3: rgba(205, 210, 218, 0.26);

  --text: #ececee;
  --text-2: #a8abb2;
  --text-3: #787c84;
  --text-4: #4f535b;

  --blue: #b8bcc5;
  --blue-hi: #e4e6ea;
  --blue-lo: #6c717a;
  --cyan: #b8bcc5;
  --violet: #b6b6c0;

  --grad-brand: linear-gradient(135deg, #aeb2ba 0%, #7c828d 45%, #9aa0a9 100%);
  --grad-text: linear-gradient(96deg, #ffffff 6%, #e0e2e6 48%, #a9adb5 100%);
  --grad-line: linear-gradient(90deg, transparent, rgba(200, 204, 212, 0.5), transparent);
  --shadow-blue: 0 18px 48px -20px rgba(120, 126, 138, 0.5);
}

/* The search/connect brand marks keep their own colours; the shell stays grey. */

html, body.app { height: 100%; }
body.app {
  overflow: hidden;
  background:
    radial-gradient(ellipse 68% 52% at 50% -12%, rgba(var(--accent-rgb), 0.26), transparent 72%),
    linear-gradient(180deg, var(--shell-1) 0%, var(--shell-2) 52%, var(--shell-3) 100%);
}

.shell {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  height: 100dvh;
  transition: grid-template-columns 0.26s var(--ease);
}
.shell.collapsed { grid-template-columns: 0 minmax(0, 1fr); }

/* ================================= sidebar ================================ */

.side {
  position: relative;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--side-a) 0%, var(--side-b) 100%);
  overflow: hidden;
  transition: opacity 0.2s, transform 0.26s var(--ease);
}
.shell.collapsed .side { opacity: 0; pointer-events: none; }

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 58px;
  padding: 0 12px 0 16px;
  flex: none;
}
.side-head .brand { font-size: 16px; gap: 9px; }

.side-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 10px 0;
  min-height: 0;
  flex: 1;
}

.new-chat {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border-radius: 9px;
  border: 1px solid rgba(var(--accent-line-rgb), 0.18);
  background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.14), rgba(var(--accent-rgb), 0.06));
  color: #eceef1;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.18s, border-color 0.18s;
}
.new-chat:hover {
  background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.22), rgba(var(--accent-rgb), 0.09));
  border-color: rgba(var(--accent-line-rgb), 0.3);
}
.new-chat .kbd { margin-left: auto; }
.new-chat .icon { color: var(--accent-text); }

.side-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 33px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--text-3);
  font-size: 13px;
  transition: background 0.16s, color 0.16s;
}
.side-search:hover { background: rgba(255, 255, 255, 0.038); color: var(--text-2); }
.side-search .kbd { margin-left: auto; }

.chat-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  margin-top: 6px;
  padding-bottom: 8px;
}
.chat-group { margin-bottom: 14px; }
.chat-group h5 {
  padding: 6px 10px;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #4f535b;
}
.chat-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 33px;
  padding: 0 6px 0 10px;
  border-radius: 7px;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
}
.chat-row .icon { color: #52565e; flex: none; }
.chat-row .title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-row:hover { background: rgba(255, 255, 255, 0.035); color: var(--text); }
.chat-row.active {
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.14), rgba(var(--accent-rgb), 0.05));
  color: #eef0f3;
  box-shadow: inset 2px 0 0 var(--blue);
}
.chat-row.active .icon { color: var(--accent-text); }
.chat-row .row-actions { display: flex; gap: 1px; opacity: 0; transition: opacity 0.14s; }
.chat-row:hover .row-actions, .chat-row.menu-open .row-actions { opacity: 1; }
.chat-row .mini-btn {
  width: 23px;
  height: 23px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  color: var(--text-3);
}
.chat-row .mini-btn:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.chat-row .pin-mark { color: var(--blue-hi); opacity: 0.8; display: inline-flex; }

.chat-empty {
  padding: 18px 12px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-4);
  text-align: center;
}

.side-foot { flex: none; padding: 10px; border-top: 1px solid var(--line); }
.side-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.16s;
}
.side-card:hover { background: rgba(255, 255, 255, 0.035); }
.side-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex: none;
  background: linear-gradient(160deg, #26292e, #191b1e);
  border: 1px solid rgba(var(--accent-line-rgb), 0.18);
  color: #d6dae1;
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
}
.side-card .meta { min-width: 0; flex: 1; }
.side-card .meta strong {
  display: block;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.side-card .meta span {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  color: var(--text-3);
}
.side-card .meta span i { width: 5px; height: 5px; border-radius: 50%; background: var(--green); }
.side-card .meta span i.off { background: var(--amber); }

.storage { padding: 4px 10px 8px; }
.storage .lbl { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--text-4); margin-bottom: 5px; }
.storage .track { height: 3px; border-radius: 99px; background: rgba(255, 255, 255, 0.05); overflow: hidden; }
.storage .track i {
  display: block;
  height: 100%;
  width: 8%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--violet));
  transition: width 0.4s var(--ease);
}

/* ================================== main ================================== */

.main {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100dvh;
  overflow: hidden;
}

.topbar {
  position: relative;
  z-index: 12;
  flex: none;
  display: flex;
  align-items: center;
  gap: 9px;
  height: 58px;
  padding: 0 12px 0 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(3, 7, 13, 0.6);
  backdrop-filter: blur(16px);
}
.topbar .grow { flex: 1; }

.model-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 9px 0 5px;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.022);
  transition: background 0.16s, border-color 0.16s;
  max-width: 320px;
}
.model-btn:hover { background: rgba(255, 255, 255, 0.05); border-color: var(--line-3); }
.model-btn .name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.model-btn .tier {
  font-size: 9.5px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text-3);
  letter-spacing: 0.02em;
}
.model-btn .chev { color: var(--text-3); }

.key-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border-radius: 99px;
  border: 1px solid rgba(255, 194, 102, 0.22);
  background: rgba(255, 194, 102, 0.06);
  color: #edc489;
  font-size: 10.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.16s, border-color 0.16s;
}
.key-pill .icon { color: #edbd77; }
.key-pill.live {
  border-color: rgba(55, 214, 160, 0.24);
  background: rgba(55, 214, 160, 0.06);
  color: #8ce6c4;
}
.key-pill.live .icon { color: var(--green); }
.key-pill:hover { filter: brightness(1.15); }

.topbar-right { display: flex; align-items: center; gap: 2px; }
.topbar-right .icon-btn { width: 32px; height: 32px; border-radius: 8px; }
.topbar-right .sep { width: 1px; height: 20px; margin: 0 5px; background: var(--line-2); }

.account-slot { position: relative; margin-left: 5px; }
.account-slot .avatar { width: 30px; height: 30px; border-radius: 9px; }
.account-slot .signin-btn { height: 32px; padding: 0 12px; font-size: 12.5px; }

/* ================================= thread ================================= */

.thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  position: relative;
}
.thread-inner {
  width: 100%;
  max-width: 810px;
  margin: 0 auto;
  padding: 26px 26px 12px;
}

/* -------------------------------- empty ---------------------------------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 24px 26px 8px;
  text-align: center;
  animation: fade-up 0.5s var(--ease) both;
}
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } }

.empty-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 15px;
  background: radial-gradient(120% 120% at 25% 0%, var(--accent-grad-a), var(--accent-grad-b) 55%, #2f3135);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset, 0 18px 50px -18px rgba(var(--accent-rgb), 0.8);
}
.empty-mark::after {
  content: "";
  position: absolute;
  inset: -22px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.26), transparent 68%);
  z-index: -1;
}
.empty h1 {
  margin-top: 22px;
  font-size: 29px;
  font-weight: 550;
  letter-spacing: -0.035em;
}
.empty h1 em {
  font-style: normal;
  background: linear-gradient(96deg, var(--accent-text-strong), var(--accent-text) 55%, var(--accent-text));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.empty p.sub {
  margin-top: 10px;
  font-size: 13.5px;
  color: var(--text-2);
  max-width: 440px;
  line-height: 1.6;
}

/* ----------------------------- embers (empty) ---------------------------- */

/* A warm counterpoint to the black shell: the canvas under the new-chat
   screen glows orange and throws embers as the pointer moves. It only shows
   while that screen is visible and is purely decorative. */
.ember-field {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: screen;
  transition: opacity 900ms var(--ease);
}
.ember-field.is-on { opacity: 1; }
.empty { position: relative; z-index: 1; }
body.reduce-motion .ember-field { transition: none; }

.connect-strip {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 590px;
  margin-top: 22px;
  padding: 12px 13px 12px 15px;
  border-radius: 12px;
  border: 1px solid rgba(255, 194, 102, 0.22);
  background: linear-gradient(180deg, rgba(255, 194, 102, 0.07), rgba(255, 194, 102, 0.02));
  text-align: left;
}
.connect-strip .cs-text { flex: 1; min-width: 0; }
.connect-strip strong { display: block; font-size: 12.5px; font-weight: 550; color: #f4d7a5; }
.connect-strip span { display: block; margin-top: 2px; font-size: 11.5px; color: #a8926c; line-height: 1.5; }
.connect-strip .btn { flex: none; }

.provider-quick {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  max-width: 590px;
  margin-top: 18px;
}
.provider-quick:empty { display: none; }
.provider-quick button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 9px 0 4px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.022);
  font-size: 11px;
  color: var(--text-2);
  transition: background 0.16s, border-color 0.16s, transform 0.16s;
}
.provider-quick button:hover { background: rgba(255, 255, 255, 0.05); border-color: var(--line-3); transform: translateY(-1px); }
.provider-quick button.connected { border-color: rgba(55, 214, 160, 0.24); color: #a9e6cf; }

.suggestions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  width: 100%;
  max-width: 590px;
  margin-top: 24px;
  text-align: left;
}
.suggestion {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 13px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
  text-align: left;
  transition: background 0.18s, border-color 0.18s, transform 0.18s var(--ease);
}
.suggestion:hover {
  background: rgba(255, 255, 255, 0.042);
  border-color: rgba(var(--accent-line-rgb), 0.22);
  transform: translateY(-1px);
}
.suggestion .sicon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 7px;
  background: rgba(var(--accent-rgb), 0.1);
  border: 1px solid rgba(var(--accent-soft-rgb), 0.14);
  color: var(--accent-text);
}
.suggestion strong { display: block; font-size: 12.5px; font-weight: 550; color: var(--text); }
.suggestion span.txt { display: block; margin-top: 2px; font-size: 11.5px; line-height: 1.45; color: var(--text-3); }

.empty .kbd-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 22px;
  font-size: 11.5px;
  color: var(--text-4);
}
.empty .kbd-row .dot-sep { width: 3px; height: 3px; border-radius: 50%; background: #2b2e33; margin: 0 4px; }

/* -------------------------------- messages -------------------------------- */

.msg {
  display: flex;
  gap: 13px;
  padding: 14px 0;
  animation: msg-in 0.32s var(--ease) both;
}
@keyframes msg-in { from { opacity: 0; transform: translateY(7px); } }

.avatar-ai {
  width: 27px;
  height: 27px;
  flex: none;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: radial-gradient(120% 120% at 22% 0%, var(--accent-text), var(--accent-grad-b));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.26) inset;
}
.msg-body { min-width: 0; flex: 1; }
.msg-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-bottom: 6px;
  min-height: 20px;
}
.msg-head .who { font-size: 12.5px; font-weight: 550; color: var(--text); }
.msg-head .model-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 7px 1px 2px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(var(--accent-line-rgb), 0.09);
  font-size: 10.5px;
  color: var(--text-3);
}
.msg-head .model-chip .p-logo { width: 14px; height: 14px; border-radius: 4px; border: 0; background: none; }
.msg-head .time { font-size: 11px; color: var(--text-4); }
.msg-head .streaming-dot { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--blue-hi); }
.msg-head .streaming-dot i { width: 5px; height: 5px; border-radius: 50%; background: var(--blue-hi); animation: pulse-dot 1.1s infinite; }
@keyframes pulse-dot { 50% { opacity: 0.25; } }

.prose {
  font-size: 14.5px;
  line-height: 1.7;
  color: #cbcfd6;
  letter-spacing: -0.006em;
  overflow-wrap: anywhere;
}
.prose > * + * { margin-top: 12px; }
.prose h1, .prose h2, .prose h3 {
  margin-top: 22px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #fff;
}
.prose h1 { font-size: 19px; }
.prose strong { color: var(--accent-text-strong); font-weight: 600; }
.prose em { color: #e2e5e9; }
.prose a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: rgba(var(--accent-line-rgb), 0.38); }
.prose a:hover { color: #bdc1c8; }
.prose ul, .prose ol { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li::marker { color: var(--text-4); }
.prose blockquote { padding: 2px 0 2px 14px; border-left: 2px solid rgba(var(--accent-soft-rgb), 0.36); color: var(--text-2); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.prose code.inline {
  font-family: var(--mono);
  font-size: 0.86em;
  padding: 1.5px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--accent-text);
}
.table-wrap { margin-top: 12px; overflow-x: auto; border-radius: 8px; }
.prose table { width: 100%; min-width: 420px; border-collapse: collapse; font-size: 13px; }
.prose th, .prose td { padding: 7px 10px; border: 1px solid var(--line); text-align: left; }
.prose th { background: rgba(255, 255, 255, 0.025); font-weight: 550; color: var(--text); }

/* code blocks */
.code {
  margin-top: 12px;
  border-radius: 10px;
  border: 1px solid rgba(var(--accent-line-rgb), 0.12);
  background: #040912;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.025) inset;
}
.code-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 11px;
  border-bottom: 1px solid rgba(var(--accent-line-rgb), 0.09);
  background: rgba(255, 255, 255, 0.018);
}
.code-head .lang { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10px; color: #747880; }
.code-head .cpy {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 23px;
  padding: 0 7px;
  border-radius: 5px;
  font-size: 10.5px;
  color: var(--text-3);
  transition: background 0.15s, color 0.15s;
}
.code-head .cpy:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.code-head .cpy.copied { color: var(--green); }
.code pre {
  padding: 11px 13px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.72;
  color: #a5a9b0;
  tab-size: 2;
}
.code pre code { font: inherit; white-space: pre; }
.tok-key { color: var(--accent-text); }
.tok-str { color: #74d6b0; }
.tok-num { color: #f0b47c; }
.tok-com { color: #565a62; font-style: italic; }
.tok-fn { color: var(--accent-text); }
.tok-attr { color: #bfa2ff; }
.tok-tag { color: var(--accent-text); }

/* message actions */
.msg-actions {
  display: flex;
  align-items: center;
  gap: 1px;
  margin-top: 9px;
  opacity: 0;
  transition: opacity 0.16s;
}
.msg:hover .msg-actions, .msg-actions:focus-within { opacity: 1; }
.msg-actions .mini-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 7px;
  border-radius: 6px;
  font-size: 11px;
  color: var(--text-3);
  transition: background 0.15s, color 0.15s;
}
.msg-actions .mini-btn:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.msg-actions .mini-btn.on { color: var(--blue-hi); }
.msg-actions .sep { width: 1px; height: 12px; margin: 0 5px; background: var(--line-2); }

/* user bubble */
.msg.user { justify-content: flex-end; }
.msg.user .msg-body { flex: 0 1 auto; max-width: 82%; display: flex; flex-direction: column; align-items: flex-end; }
.msg.user .bubble {
  padding: 10px 14px;
  border-radius: 13px 13px 4px 13px;
  background: linear-gradient(180deg, var(--bubble-a), var(--bubble-b));
  border: 1px solid rgba(var(--accent-line-rgb), 0.16);
  font-size: 14px;
  line-height: 1.6;
  color: #dfe2e6;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.035) inset;
}
.msg.user .msg-actions { flex-direction: row-reverse; }
.msg.user .msg-head { display: none; }

/* ------------------------------ tool cards ------------------------------ */

.tools-panel {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 2px 0 12px;
}
.tool-card {
  border-radius: 10px;
  border: 1px solid rgba(var(--accent-line-rgb), 0.12);
  background: rgba(5, 11, 20, 0.72);
  overflow: hidden;
  animation: fade-up 0.28s var(--ease) both;
}
.tool-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border-bottom: 1px solid rgba(var(--accent-line-rgb), 0.08);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.014);
}
.tool-head .tool-ico {
  width: 19px;
  height: 19px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  background: rgba(var(--accent-rgb), 0.14);
  border: 1px solid rgba(var(--accent-soft-rgb), 0.2);
  color: var(--accent-text);
  flex: none;
}
.tool-head .tname { color: #b2b6bd; font-weight: 500; }
.tool-head .state {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 9.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-4);
}
.tool-head .state .spinner {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.4px solid rgba(var(--accent-line-rgb), 0.25);
  border-top-color: var(--blue-hi);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.tool-head .state.done { color: #7fd9b8; }
.tool-head .state.error { color: #ff9dab; }
.tool-body { padding: 8px 11px 10px; }
.tool-kv { display: flex; gap: 8px; font-family: var(--mono); font-size: 10.5px; line-height: 1.7; color: #878b93; }
.tool-kv .k { color: #5f636b; flex: none; }
.tool-kv .v { color: #a9adb4; overflow-wrap: anywhere; }
.tool-result {
  margin-top: 7px;
  padding: 7px 9px;
  border-radius: 7px;
  border: 1px solid rgba(55, 214, 160, 0.16);
  background: rgba(55, 214, 160, 0.055);
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.65;
  color: #9fe8cb;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 150px;
  overflow: auto;
}
.tool-result.error {
  border-color: rgba(255, 112, 134, 0.24);
  background: rgba(255, 112, 134, 0.07);
  color: #ffb6c1;
}

/* thinking */
.thinking { display: inline-flex; align-items: center; gap: 9px; padding: 5px 0; font-size: 12.5px; color: var(--text-2); }
.thinking .dots { display: inline-flex; gap: 3px; }
.thinking .dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-text);
  animation: bounce 1.2s infinite;
}
.thinking .dots i:nth-child(2) { animation-delay: 0.15s; }
.thinking .dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-3px); opacity: 1; } }
.thinking .shimmer {
  background: linear-gradient(90deg, #7c8088 20%, #e4e6ea 45%, #7c8088 70%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 2s linear infinite;
}
@keyframes shimmer { to { background-position: -220% 0; } }

/* metrics */
.metrics {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid rgba(var(--accent-line-rgb), 0.07);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-4);
}
.metrics span { display: inline-flex; align-items: center; gap: 4px; }
.metrics b { color: #969aa2; font-weight: 500; }
.metrics .ok { color: #6fceac; }

/* errors + connect card */
.stream-error,
.connect-card {
  margin-top: 10px;
  padding: 12px 13px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.62;
}
.stream-error {
  border: 1px solid rgba(255, 112, 134, 0.22);
  background: rgba(255, 112, 134, 0.055);
  color: #ffc2cb;
}
.stream-error strong { color: #ffdfe4; }
.stream-error .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.connect-card {
  border: 1px solid rgba(var(--accent-soft-rgb), 0.22);
  background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.09), rgba(var(--accent-rgb), 0.02));
  color: var(--text-2);
}
.connect-card strong { color: #eef0f3; }
.connect-card .actions { display: flex; gap: 8px; margin-top: 11px; flex-wrap: wrap; }
.connect-card .providers { display: flex; gap: 5px; margin-top: 10px; flex-wrap: wrap; }
.connect-card .providers .p-logo { cursor: pointer; transition: transform 0.16s; }
.connect-card .providers .p-logo:hover { transform: translateY(-2px); }

/* ================================ composer ================================ */

.composer-dock {
  flex: none;
  position: relative;
  z-index: 11;
  width: 100%;
  max-width: 810px;
  margin: 0 auto;
  padding: 6px 26px 14px;
  background: linear-gradient(180deg, transparent, rgba(2, 5, 10, 0.9) 34%);
}
.composer {
  position: relative;
  border-radius: 14px;
  border: 1px solid rgba(var(--accent-line-rgb), 0.18);
  background: rgba(5, 11, 20, 0.94);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 18px 46px -26px rgba(0, 0, 0, 0.95);
  transition: border-color 0.2s, box-shadow 0.2s;
  backdrop-filter: blur(16px);
}
.composer.dragging {
  border-color: rgba(var(--accent-line-rgb), 0.66);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.14), 0 18px 46px -26px rgba(0, 0, 0, 0.95);
}
.composer:focus-within {
  border-color: rgba(var(--accent-line-rgb), 0.38);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.045) inset, 0 0 0 3px rgba(var(--accent-rgb), 0.08),
    0 18px 46px -26px rgba(0, 0, 0, 0.95);
}
.composer textarea {
  display: block;
  width: 100%;
  min-height: 52px;
  max-height: 190px;
  padding: 15px 16px 4px;
  border: 0;
  background: none;
  resize: none;
  outline: none;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text);
  caret-color: var(--blue-hi);
}
.composer textarea::placeholder { color: #5c6068; }

.composer-bar { display: flex; align-items: center; gap: 6px; padding: 5px 8px 8px 10px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 27px;
  padding: 0 9px;
  border-radius: 7px;
  border: 1px solid transparent;
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 500;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}
.chip:hover { background: rgba(255, 255, 255, 0.045); color: var(--text-2); }
.chip.on {
  background: rgba(var(--accent-rgb), 0.12);
  border-color: rgba(var(--accent-soft-rgb), 0.24);
  color: var(--accent-text);
}
.chip .icon { color: currentColor; }
.chip.model-chip-btn { padding-left: 5px; max-width: 240px; }
.chip.model-chip-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.model-chip-btn .p-logo { width: 18px; height: 18px; border-radius: 5px; }

.composer-bar .grow { flex: 1; }
.composer-hint { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--text-4); white-space: nowrap; }
.composer-hint .kbd { height: 17px; min-width: 17px; font-size: 9.5px; }

.send-btn {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  border-radius: 9px;
  background: linear-gradient(180deg, var(--accent-grad-a), var(--accent-grad-b));
  color: #fff;
  border: 1px solid rgba(var(--accent-soft-rgb), 0.3);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 10px 20px -12px rgba(var(--accent-rgb), 0.95);
  transition: opacity 0.16s, transform 0.16s, background 0.16s;
}
.send-btn:hover { filter: brightness(1.12); }
.send-btn:disabled { opacity: 0.32; cursor: not-allowed; box-shadow: none; }
.send-btn.stop {
  background: linear-gradient(180deg, var(--bubble-a), var(--bubble-b));
  border-color: rgba(var(--accent-line-rgb), 0.22);
  box-shadow: none;
}
.send-btn.stop:hover { background: linear-gradient(180deg, #3d4149, #2a2d32); }
.send-btn .stop-square { width: 10px; height: 10px; border-radius: 2px; background: #d8dbe0; }

.composer-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 7px;
  font-size: 10.5px;
  color: var(--text-4);
  text-align: center;
}
.composer-foot .icon { opacity: 0.8; }

/* ============================== model picker ============================== */

.field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.field input {
  flex: 1;
  min-width: 0;
  height: 28px;
  border: 0;
  background: none;
  outline: none;
  font-size: 13.5px;
  color: var(--text);
}
.field input::placeholder { color: var(--text-4); }
.field .icon { color: var(--text-3); }
.field .esc { font-size: 10px; }

.picker-list { flex: 1; min-height: 130px; overflow-y: auto; padding: 8px; }
.pick-group {
  padding: 7px 9px 5px;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-4);
}
.pick-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  text-align: left;
  border: 1px solid transparent;
  transition: background 0.13s, border-color 0.13s;
}
.pick-item:hover, .pick-item.cursor { background: rgba(255, 255, 255, 0.045); border-color: rgba(var(--accent-line-rgb), 0.12); }
.pick-item.current { background: rgba(var(--accent-rgb), 0.09); border-color: rgba(var(--accent-soft-rgb), 0.22); }
.pick-item .p-logo { width: 28px; height: 28px; border-radius: 8px; }
.pick-item .info { min-width: 0; flex: 1; }
.pick-item .info strong { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 550; color: var(--text); }
.pick-item .info strong .tag {
  font-size: 9px;
  font-weight: 500;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--line-2);
  color: var(--text-3);
  letter-spacing: 0.02em;
}
.pick-item .info span {
  display: block;
  margin-top: 1px;
  font-size: 11px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pick-item .right { display: flex; align-items: center; gap: 6px; flex: none; color: var(--text-4); font-size: 10.5px; }
.pick-item .right .check { color: var(--blue-hi); }
.pick-item .star {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  color: var(--text-4);
  opacity: 0;
  cursor: pointer;
}
.pick-item:hover .star { opacity: 1; }
.pick-item .star.on { opacity: 1; color: var(--amber); }
.pick-item .star:hover { background: rgba(255, 255, 255, 0.07); }
.pick-item .needs-key { color: #c9a56b; font-size: 9.5px; }
.pick-empty { padding: 30px 16px; text-align: center; font-size: 12.5px; color: var(--text-3); }

/* command palette */
.cmd-list { flex: 1; min-height: 0; overflow-y: auto; padding: 8px; }
.cmd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  text-align: left;
  border: 1px solid transparent;
  color: var(--text-2);
  font-size: 13px;
}
.cmd-item .icon { color: var(--text-3); }
.cmd-item.cursor, .cmd-item:hover {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(var(--accent-line-rgb), 0.12);
  color: var(--text);
}
.cmd-item .hint { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; color: var(--text-4); }
.cmd-item .trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ================================ settings =============================== */

.dlg.settings { width: min(890px, calc(100vw - 32px)); height: min(648px, calc(100dvh - 56px)); max-height: none; }
.settings-body { display: flex; min-height: 0; flex: 1; }
.settings-nav {
  width: 196px;
  flex: none;
  padding: 10px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(255, 255, 255, 0.01);
}
.settings-nav button {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 34px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 12.5px;
  color: var(--text-2);
  text-align: left;
}
.settings-nav button .icon { color: var(--text-3); }
.settings-nav button:hover { background: rgba(255, 255, 255, 0.035); color: var(--text); }
.settings-nav button.active {
  background: rgba(var(--accent-rgb), 0.12);
  color: #e8eaee;
  box-shadow: inset 2px 0 0 var(--blue);
}
.settings-nav button.active .icon { color: var(--accent-text); }
.settings-nav .nav-foot { margin-top: auto; padding: 10px; font-size: 10px; line-height: 1.6; color: var(--text-4); }

.settings-panel { flex: 1; min-width: 0; overflow-y: auto; padding: 20px 22px 28px; }
.settings-panel > section { display: none; animation: fade-up 0.25s var(--ease); }
.settings-panel > section.active { display: block; }
.settings-panel h4 { font-size: 13.5px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.settings-panel .group-desc { font-size: 12px; color: var(--text-3); margin-bottom: 14px; line-height: 1.6; }
.settings-panel .group-desc a { color: var(--accent-text); }
.set-group + .set-group { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }

.set-row { display: flex; align-items: center; gap: 14px; padding: 11px 0; }
.set-row + .set-row { border-top: 1px solid rgba(var(--accent-line-rgb), 0.05); }
.set-row .lbl { flex: 1; min-width: 0; }
.set-row .lbl strong { display: block; font-size: 13px; font-weight: 500; color: var(--text); }
.set-row .lbl span { display: block; margin-top: 2px; font-size: 11.5px; color: var(--text-3); line-height: 1.5; }
.set-row .ctl { flex: none; display: flex; align-items: center; gap: 8px; }

.select {
  height: 32px;
  padding: 0 30px 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.035) 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='%236b7b99' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center;
  color: var(--text);
  font-size: 12.5px;
  appearance: none;
  cursor: pointer;
  outline: none;
}
.select:focus { border-color: var(--line-3); }
select option { background: #070d17; color: var(--text); }

.toggle {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(var(--accent-line-rgb), 0.14);
  transition: background 0.2s, border-color 0.2s;
  flex: none;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #c6cad1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  transition: transform 0.22s var(--ease), background 0.2s;
}
.toggle[aria-checked="true"] {
  background: linear-gradient(180deg, var(--accent-grad-a), var(--accent-grad-b));
  border-color: rgba(var(--accent-line-rgb), 0.36);
}
.toggle[aria-checked="true"]::after { transform: translateX(16px); background: #fff; }

/* keys */
.key-provider {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 13px;
  margin-bottom: 9px;
  background: rgba(255, 255, 255, 0.012);
  transition: border-color 0.2s, background 0.2s;
}
.key-provider.connected { border-color: rgba(55, 214, 160, 0.24); background: rgba(55, 214, 160, 0.03); }
.key-top { display: flex; align-items: center; gap: 10px; }
.key-top .who { flex: 1; min-width: 0; }
.key-top .who strong { display: block; font-size: 12.5px; font-weight: 550; }
.key-top .who span { display: block; font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.key-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid var(--line-2);
  color: var(--text-3);
  white-space: nowrap;
}
.key-status.ok { border-color: rgba(55, 214, 160, 0.28); background: rgba(55, 214, 160, 0.08); color: #8ce6c4; }
.key-status i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.key-input-row { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.key-input {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 9px;
  border-radius: 7px;
  border: 1px solid var(--line-2);
  background: rgba(0, 0, 0, 0.24);
}
.key-input:focus-within { border-color: rgba(var(--accent-soft-rgb), 0.42); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.07); }
.key-input input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  outline: none;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text);
  letter-spacing: 0.01em;
}
.key-input input::placeholder { color: var(--text-4); letter-spacing: 0; font-family: var(--font); }
.key-input .icon-btn { width: 24px; height: 24px; border-radius: 5px; }
.key-actions { display: flex; gap: 6px; flex: none; }
.key-help { display: flex; align-items: center; gap: 5px; margin-top: 7px; font-size: 10.5px; color: var(--text-4); }
.key-help a { color: var(--accent-text); }

/* mcp */
.mcp-presets { display: grid; gap: 10px; margin-top: 10px; }
.mcp-card { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 13px; background: rgba(255, 255, 255, 0.022); }
.mcp-card-head { display: flex; align-items: flex-start; gap: 10px; }
.mcp-ico { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px; background: rgba(122, 166, 255, 0.12); color: var(--accent-text); }
.mcp-card-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mcp-card-title strong { font-size: 13px; color: var(--text); }
.mcp-card-title small { font-size: 11px; line-height: 1.45; color: var(--text-3); }
.mcp-card-head .btn { margin-left: auto; flex: 0 0 auto; }
.mcp-steps { margin: 10px 0 0; padding-left: 18px; display: grid; gap: 3px; font-size: 11px; line-height: 1.5; color: var(--text-3); }
.mcp-steps li::marker { color: var(--text-4); }
.mcp-card-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.mcp-card-foot .mcp-status { margin-left: auto; }
.mcp-status { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-4); white-space: nowrap; }
.mcp-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.mcp-status.is-on { color: var(--green); }
.mcp-status.is-wait { color: var(--amber); }
.mcp-status.is-err { color: var(--red); }
.mcp-servers { display: grid; gap: 0; margin-top: 8px; }
.mcp-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.mcp-row:first-child { border-top: 0; }
.mcp-row-main { display: flex; flex-direction: column; min-width: 0; }
.mcp-row-main strong { font-size: 12.5px; color: var(--text); }
.mcp-row-main small { font-size: 10.5px; color: var(--text-4); overflow: hidden; text-overflow: ellipsis; }
.mcp-row .mcp-status { margin-left: auto; }
.mcp-empty { margin: 10px 0 0; font-size: 11.5px; color: var(--text-4); }
.mcp-add { display: flex; align-items: center; gap: 7px; margin-top: 11px; flex-wrap: wrap; }
.mcp-input { flex: 0 1 160px; min-width: 0; padding: 7px 9px; border-radius: var(--r-sm); border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); color: var(--text); font-size: 12px; }
.mcp-input.grow { flex: 1 1 220px; }
.mcp-input:focus { outline: none; border-color: rgba(122, 166, 255, 0.45); }
#mcpChip.is-wait { border-color: rgba(255, 194, 102, 0.4); color: var(--amber); }

/* data */
.data-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.014);
  margin-bottom: 9px;
}
.data-card .dico {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-2);
  background: rgba(var(--accent-rgb), 0.07);
  color: var(--accent-text);
  flex: none;
}
.data-card .info { flex: 1; min-width: 0; }
.data-card .info strong { display: block; font-size: 12.5px; font-weight: 550; }
.data-card .info span { display: block; font-size: 11px; color: var(--text-3); margin-top: 1px; }

.about-box {
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 18px;
  background: linear-gradient(160deg, rgba(var(--accent-rgb), 0.07), rgba(255, 255, 255, 0.012));
}
.about-box .brand { margin-bottom: 10px; }
.about-box p { font-size: 12.5px; line-height: 1.65; color: var(--text-3); }
.about-box .kv { display: flex; justify-content: space-between; padding: 7px 0; border-top: 1px solid var(--line); font-size: 11.5px; margin-top: 12px; }
.about-box .kv span:first-child { color: var(--text-3); }
.about-box .kv span:last-child { color: var(--text-2); font-family: var(--mono); font-size: 11px; }

/* account panel */
.profile-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: linear-gradient(160deg, rgba(var(--accent-rgb), 0.08), rgba(255, 255, 255, 0.012));
  margin-bottom: 12px;
}
.profile-card .avatar.lg { width: 44px; height: 44px; border-radius: 12px; font-size: 15px; }
.profile-card .who { flex: 1; min-width: 0; }
.profile-card .who strong { display: block; font-size: 14px; font-weight: 550; }
.profile-card .who span { display: block; font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; }
.profile-card .badge { height: 22px; font-size: 10px; }

/* ================================ share ================================= */

.share-preview {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.26);
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.7;
  color: var(--text-3);
  max-height: 140px;
  overflow: auto;
  white-space: pre-wrap;
}

/* ================================= menu ================================= */

.menu {
  position: fixed;
  z-index: 300;
  min-width: 172px;
  padding: 5px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: rgba(7, 14, 24, 0.98);
  box-shadow: 0 22px 48px -22px rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(14px);
  animation: menu-in 0.14s var(--ease);
}
@keyframes menu-in { from { opacity: 0; transform: scale(0.97) translateY(-3px); } }
.menu button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 30px;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--text-2);
  text-align: left;
}
.menu button:hover { background: rgba(255, 255, 255, 0.055); color: var(--text); }
.menu button .icon { color: var(--text-3); }
.menu button.danger { color: #ffb3bd; }
.menu button.danger .icon { color: #ff8e9d; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }

/* ============================== refinements ============================== */

.rename-input {
  flex: 1;
  min-width: 0;
  height: 24px;
  padding: 0 6px;
  border-radius: 5px;
  border: 1px solid rgba(var(--accent-soft-rgb), 0.42);
  background: rgba(0, 0, 0, 0.4);
  outline: none;
  font-size: 12.5px;
  color: var(--text);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.09);
}

body.compact .msg { padding: 9px 0; gap: 11px; }
body.compact .prose { font-size: 14px; line-height: 1.62; }
body.compact .prose > * + * { margin-top: 9px; }
body.compact .thread-inner { padding-top: 14px; }
body.compact .code pre { line-height: 1.6; }

body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

.prose:empty { display: none; }
.thinking { min-height: 24px; }

/* ============================== responsive ================================ */

.side-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 19;
  background: rgba(1, 3, 7, 0.62);
  backdrop-filter: blur(2px);
}
.side-backdrop.show { display: block; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 0 minmax(0, 1fr); }
  .side {
    position: fixed;
    inset: 0 auto 0 0;
    width: 276px;
    z-index: 21;
    transform: translateX(-100%);
    box-shadow: 30px 0 80px -40px rgba(0, 0, 0, 0.9);
  }
  .shell:not(.collapsed) .side { transform: none; opacity: 1; pointer-events: auto; }
  .shell.collapsed .side { transform: translateX(-100%); }
  .topbar-right .desk-only { display: none; }
  .chat-row .row-actions { opacity: 1; }
  .msg-actions { opacity: 1; }
}

@media (max-width: 640px) {
  .topbar { padding: 0 8px 0 10px; height: 54px; gap: 6px; }
  .key-pill { display: none; }
  .model-btn { max-width: 190px; height: 32px; }
  .model-btn .tier { display: none; }
  .thread-inner { padding: 16px 16px 8px; }
  .composer-dock { padding: 4px 12px 10px; }
  .composer textarea { font-size: 16px; min-height: 46px; }
  .composer-hint { display: none; }
  .empty { padding: 20px 16px 4px; }
  .empty h1 { font-size: 24px; }
  .suggestions { grid-template-columns: 1fr; margin-top: 20px; }
  .connect-strip { flex-direction: column; align-items: stretch; gap: 10px; }
  .connect-strip .btn { width: 100%; }
  .msg.user .msg-body { max-width: 90%; }
  .prose { font-size: 14px; }
  .settings-nav { width: 58px; padding: 8px 6px; }
  .settings-nav button { justify-content: center; padding: 0; height: 38px; font-size: 0; }
  .settings-nav button .icon { width: 18px; height: 18px; }
  .settings-nav .nav-foot { display: none; }
  .settings-panel { padding: 16px 14px 22px; }
  .dlg.settings { height: calc(100dvh - 24px); }
  .set-row { gap: 10px; }
  .key-provider { padding: 10px; }
  .key-input-row .key-input { max-width: none !important; flex-basis: 100%; }
  .key-actions { width: 100%; }
  .key-actions .btn { flex: 1; }
  .model-btn .name { max-width: 110px; }
  .account-slot .signin-btn { display: none; }
  .empty .kbd-row { display: none; }
  .provider-quick { gap: 6px; }
}

/* ============================ account chip ============================== */

.account-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 7px 0 4px;
  border-radius: 9px;
  border: 1px solid transparent;
  transition: background 0.16s, border-color 0.16s;
}
.account-btn:hover { background: rgba(255, 255, 255, 0.045); border-color: var(--line); }
.account-btn .who { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.account-btn .who strong { font-size: 11.5px; font-weight: 550; color: var(--text); max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-btn .who span { font-size: 9.5px; color: var(--text-4); letter-spacing: 0.02em; }

.account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 300;
  min-width: 232px;
  padding: 5px;
  border-radius: 11px;
  border: 1px solid var(--line-2);
  background: rgba(7, 14, 24, 0.98);
  box-shadow: 0 26px 54px -24px rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(16px);
  animation: menu-in 0.15s var(--ease);
}
.account-menu a,
.account-menu button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 32px;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--text-2);
  text-align: left;
}
.account-menu a:hover,
.account-menu button:hover { background: rgba(255, 255, 255, 0.055); color: var(--text); }
.account-menu .icon { color: var(--text-3); }
.account-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }
.account-menu .am-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 10px;
  margin-bottom: 3px;
  border-bottom: 1px solid var(--line);
}
.account-menu .am-head div { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.account-menu .am-head strong { font-size: 12.5px; font-weight: 550; color: var(--text); }
.account-menu .am-head span { font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu .am-head .avatar { width: 30px; height: 30px; border-radius: 9px; font-size: 11px; }

/* picker star fill */
.pick-item .star.on { color: #ffcf7a; }
.pick-item .star:hover { color: #ffcf7a; }

/* sign-in prompt for signed-out state */
.signin-btn .icon { color: var(--text-2); }

/* ==========================================================================
   v3 — deep-blue workspace, living block field, real-time states
   ========================================================================== */

body.app {
  background:
    radial-gradient(ellipse 70% 52% at 52% -14%, rgba(255, 255, 255, 0.045), transparent 72%),
    radial-gradient(ellipse 48% 40% at 92% 108%, rgba(255, 255, 255, 0.02), transparent 70%),
    radial-gradient(ellipse 40% 36% at 2% 78%, rgba(255, 255, 255, 0.016), transparent 72%),
    #000000;
  color: var(--text);
}

.block-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  --sy: 0;
  opacity: 0.9;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.35), #000 36%, #000 74%, rgba(0, 0, 0, 0.4));
}
.block-field .bf-block {
  position: absolute;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  width: calc(var(--s) * 1px);
  height: calc(var(--s) * 1px);
  border-radius: 6px;
  border: 1px solid rgba(var(--accent-soft-rgb), 0.18);
  background: linear-gradient(150deg, rgba(var(--accent-rgb), 0.14), rgba(18, 18, 22, 0.05));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transform: translate3d(0, calc(var(--sy) * var(--d) * 0.02px), 0) rotate(var(--r));
  animation: bf-drift 16s ease-in-out infinite alternate;
  animation-delay: calc(var(--delay) * -1s);
  will-change: transform;
}
.block-field .bf-block:nth-child(3n) {
  border-color: rgba(255, 214, 170, 0.16);
  background: linear-gradient(150deg, rgba(255, 214, 170, 0.1), rgba(46, 34, 22, 0.04));
}
.block-field .bf-block:nth-child(4n) {
  border-radius: 3px;
  border-color: rgba(210, 212, 220, 0.16);
  background: linear-gradient(150deg, rgba(210, 212, 220, 0.09), rgba(18, 18, 22, 0.03));
}
.block-field .bf-block:nth-child(7n) {
  border-color: rgba(226, 190, 208, 0.16);
  background: linear-gradient(150deg, rgba(226, 190, 208, 0.09), rgba(38, 26, 32, 0.03));
}
@keyframes bf-drift {
  from { margin-top: -6px; }
  to { margin-top: 10px; }
}
body.reduce-motion .block-field .bf-block,
.block-field.still .bf-block {
  animation: none;
  transform: rotate(var(--r));
  margin-top: 0;
}

.shell { position: relative; z-index: 1; }

.side {
  background: linear-gradient(180deg, rgba(5, 13, 28, 0.94) 0%, rgba(3, 9, 20, 0.97) 100%);
  border-right: 1px solid rgba(var(--accent-line-rgb), 0.16);
  backdrop-filter: blur(6px);
}
.topbar {
  background: rgba(4, 10, 22, 0.62);
  border-bottom: 1px solid rgba(var(--accent-line-rgb), 0.14);
}
.thread {
  background:
    linear-gradient(180deg, rgba(8, 8, 10, 0.42), rgba(2, 2, 4, 0.62)),
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(255, 255, 255, 0.05), transparent 70%);
}
.thread-inner { position: relative; z-index: 1; }
.composer-dock { position: relative; z-index: 2; }
.composer {
  background: rgba(8, 8, 10, 0.94);
  border-color: rgba(var(--accent-line-rgb), 0.26);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 22px 54px -30px rgba(0, 0, 0, 0.98);
}
.composer:focus-within {
  border-color: rgba(var(--accent-soft-rgb), 0.46);
  box-shadow: 0 0 0 1px rgba(var(--accent-soft-rgb), 0.12), 0 24px 60px -30px rgba(0, 0, 0, 0.7);
}

/* real-time badges */
.rt-badge, .rt-inline, .local-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 560;
  letter-spacing: 0.02em;
  border: 1px solid rgba(57, 220, 162, 0.28);
  background: rgba(57, 220, 162, 0.08);
  color: #8ff0c8;
  white-space: nowrap;
}
.rt-badge { margin-left: 2px; }
.rt-badge i, .rt-inline i, .local-chip i {
  width: 5px; height: 5px; border-radius: 50%;
  background: #39dca2;
  box-shadow: 0 0 0 0 rgba(57, 220, 162, 0.5);
  animation: rt-pulse 1.6s ease-out infinite;
}
.local-chip { border-color: rgba(var(--accent-soft-rgb), 0.26); background: rgba(var(--accent-rgb), 0.09); color: var(--accent-text); }
.local-chip i { background: var(--accent-text); animation: none; }
.local-chip.agent-chip { border-color: rgba(167, 139, 250, 0.32); background: rgba(139, 92, 246, 0.12); color: #c4b5fd; }
.local-chip.agent-chip i { background: #a78bfa; }
.rt-inline { padding: 1px 6px; font-size: 9.5px; }
.rt-badge[hidden] { display: none; }
@keyframes rt-pulse {
  0% { box-shadow: 0 0 0 0 rgba(57, 220, 162, 0.5); }
  70% { box-shadow: 0 0 0 5px rgba(57, 220, 162, 0); }
  100% { box-shadow: 0 0 0 0 rgba(57, 220, 162, 0); }
}
.avatar-ai {
  background: radial-gradient(120% 120% at 22% 0%, #123c31, #061a16);
  box-shadow: inset 0 0 0 1px rgba(57, 220, 162, 0.35), 0 4px 16px -8px rgba(57, 220, 162, 0.6);
  color: #63e8b9;
}
.key-pill.local { color: #9cf3d3; border-color: rgba(57, 220, 162, 0.3); background: rgba(57, 220, 162, 0.07); }
.key-pill.local .icon { color: #63e8b9; }

/* picker: account chips + realtime tags */
.provider-connect {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px 12px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.provider-connect::-webkit-scrollbar { display: none; }
.pc-label {
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #565a62;
  margin-right: 2px;
  flex: none;
}
.pc-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  padding: 5px 9px 5px 7px;
  border-radius: 8px;
  border: 1px solid rgba(var(--accent-line-rgb), 0.2);
  background: rgba(255, 255, 255, 0.022);
  color: var(--text-2);
  font-size: 11.5px;
  transition: border-color 0.16s, background 0.16s, transform 0.16s;
}
.pc-chip:hover { border-color: rgba(var(--accent-line-rgb), 0.45); background: rgba(var(--accent-rgb), 0.1); transform: translateY(-1px); }
.pc-chip.on { border-color: rgba(57, 220, 162, 0.28); }
.pc-state { font-size: 9.5px; color: #6b6f77; }
.pc-chip.on .pc-state { color: #6fdcb6; }
.pc-chip .p-logo { width: 15px; height: 15px; border: 0; background: none; }
.pc-chip.on-device { border-color: rgba(var(--accent-soft-rgb), 0.24); }
.pc-chip.on-device .pc-state { color: var(--accent-text); }

.pick-item .tag.rt { color: #8ff0c8; border-color: rgba(57, 220, 162, 0.24); gap: 4px; }
.pick-item .tag.rt .rt-dot { width: 4px; height: 4px; border-radius: 50%; background: #39dca2; }

/* message entrance + block echo for the thread */
.msg { position: relative; }
@media (prefers-reduced-motion: no-preference) {
  .msg.ai { animation: msg-in 0.34s var(--ease) both; }
  .msg.user .bubble { animation: bubble-in 0.26s var(--ease) both; }
}
@keyframes bubble-in { from { opacity: 0; transform: translateY(5px) scale(0.99); } }

/* local model callout inside an answer */
.local-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  padding: 9px 11px;
  border: 1px solid rgba(var(--accent-soft-rgb), 0.16);
  border-radius: 9px;
  background: rgba(var(--accent-rgb), 0.055);
  color: var(--text-3);
  font-size: 11.5px;
}

body.compact .msg { padding: 9px 0; }

@media (max-width: 640px) {
  .rt-badge { display: none !important; }
  .composer-bar .rt-badge { display: none !important; }
}

/* streaming caret + live token counter */
.caret {
  display: inline-block;
  width: 7px;
  height: 1.02em;
  margin-left: 2px;
  vertical-align: -0.14em;
  border-radius: 1px;
  background: var(--blue-hi);
  animation: caret-blink 1s steps(2, end) infinite;
}
@keyframes caret-blink { 50% { opacity: 0; } }
.live-count { font-variant-numeric: tabular-nums; }
.live-count b { font-weight: 600; color: #b6f7dc; }
@media (prefers-reduced-motion: reduce) {
  .caret { animation: none; opacity: 0.8; }
}

/* Model availability and sandboxed code preview */
.picker-tabs { display: flex; gap: 5px; padding: 0 18px 10px; }
.picker-tabs button { padding: 6px 10px; border: 1px solid transparent; border-radius: 7px; color: var(--text-3); font-size: 11px; }
.picker-tabs button:hover { color: var(--text); background: rgba(255,255,255,.035); }
.picker-tabs button.active { color: var(--accent-text); background: rgba(var(--accent-rgb), .13); border-color: rgba(var(--accent-line-rgb), .18); }
.coming-model { display:flex; align-items:center; gap:11px; padding:13px 14px; border-bottom:1px solid var(--line); opacity:.84; }
.coming-model > span:nth-child(2) { display:flex; min-width:0; flex-direction:column; gap:3px; }
.coming-model strong { color:var(--text-2); font-size:12px; font-weight:550; }
.coming-model small { color:var(--text-3); font-size:10.5px; line-height:1.5; }
.coming-indicator { color:#8b8f97; }
.coming-tag { margin-left:auto; flex:none; color:#999da5; font-size:9px; border:1px solid var(--line-2); padding:3px 6px; border-radius:999px; }
.code-head .cpy { margin-left:0; }
.code-head .lang + .cpy { margin-left:auto; }
.html-preview-dialog { width:min(1050px,calc(100vw - 24px)); max-width:none; height:min(780px,calc(100dvh - 32px)); }
.html-preview-shell { width:100%; height:100%; max-height:none; display:flex; flex-direction:column; }
.html-preview-shell iframe { width:100%; min-height:0; flex:1; background:#fff; border:0; border-radius:8px; }
.html-preview-shell .dlg-actions { flex:none; }
.profile-bio-row .profile-bio-ctl { align-items:flex-end; }
.profile-bio-ctl textarea { width:min(290px,45vw); min-height:72px; padding:9px 10px; resize:vertical; border:1px solid var(--line-2); border-radius:8px; color:var(--text); background:#050b15; font:inherit; font-size:12px; }
.profile-bio-ctl textarea:focus { outline:1px solid rgba(var(--accent-soft-rgb),.55); }
.profile-upload-ctl { flex-wrap:wrap; }
@media (max-width:600px) {
  .profile-bio-row .ctl { align-items:stretch; flex-direction:column; }
  .profile-bio-ctl textarea { width:100%; }
  .coming-model { align-items:flex-start; }
  .coming-tag { margin-top:1px; }
}
.code-head .code-preview { width: 27px; min-width: 27px; justify-content: center; padding: 0; color: var(--accent-text); }
.code-head .code-preview:hover { color: var(--accent-text-strong); background: rgba(var(--accent-soft-rgb),.12); }

/* Slash command autocomplete */
.slash-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 12px;
  right: 12px;
  max-height: 220px;
  overflow-y: auto;
  background: var(--ink-4);
  border: 1px solid rgba(var(--accent-line-rgb), .18);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,.45);
  z-index: 30;
  padding: 6px;
}
.slash-menu[hidden] { display: none !important; }
.slash-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}
.slash-item:hover, .slash-item.active { background: rgba(var(--accent-soft-rgb),.14); }
.slash-item kbd {
  flex: none;
  min-width: 84px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  color: var(--accent-text);
  font-size: 11px;
  font-family: ui-monospace, monospace;
}
.slash-item small { color: var(--text-3); font-size: 11px; }
.composer-dock { position: relative; }

/* Web search sources and inline citations */
.search-row { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.search-row .key-input.grow { flex: 1 1 240px; }
.search-row select {
  appearance: none;
  min-width: 158px;
  padding: 8px 26px 8px 8px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.search-row select:focus { outline: 1px solid rgba(var(--accent-soft-rgb),.55); border-radius: 6px; }
.search-row select option { background: var(--ink-4); color: var(--text); }

.sources-card {
  margin-top: 12px;
  border: 1px solid rgba(var(--accent-soft-rgb), 0.16);
  border-radius: 10px;
  background: rgba(11, 20, 36, 0.55);
  overflow: hidden;
}
.sources-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  border-bottom: 1px solid rgba(var(--accent-soft-rgb), 0.12);
  color: #c0c4cb;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .02em;
}
.sources-head .sources-meta { margin-left: auto; color: var(--text-3); font-weight: 500; }
.sources-card ol { list-style: none; margin: 0; padding: 4px; display: grid; gap: 2px; }
.sources-card li a {
  display: flex;
  gap: 9px;
  padding: 8px 9px;
  border-radius: 7px;
  text-decoration: none;
  color: inherit;
}
.sources-card li a:hover { background: rgba(var(--accent-soft-rgb), 0.10); }
.src-index {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  margin-top: 1px;
  border-radius: 5px;
  background: rgba(var(--accent-soft-rgb), 0.16);
  color: #c2c6cd;
  font-size: 10.5px;
  font-weight: 700;
}
.src-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.src-title { color: var(--accent-text); font-size: 12.5px; font-weight: 550; line-height: 1.35; }
.src-domain { color: #6fd7a9; font-size: 10.5px; }
.src-snippet { color: var(--text-3); font-size: 11.5px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
a.cite {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 15px;
  height: 15px;
  margin: 0 1px;
  padding: 0 3px;
  border-radius: 4px;
  background: rgba(var(--accent-soft-rgb), 0.18);
  color: #ccd0d7;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  vertical-align: 1px;
}
a.cite:hover { background: rgba(var(--accent-soft-rgb), 0.32); color: #fff; }
@media (max-width: 600px) {
  .search-row select { min-width: 130px; }
  .sources-card ol { padding: 3px; }
}

/* Web-search thinking trace (live steps above a cited answer) */
.think-panel {
  margin: 2px 0 12px;
  border: 1px solid rgba(var(--accent-line-rgb), .14);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(8, 8, 10, .86), rgba(2, 2, 4, .6));
  overflow: hidden;
}
.think-panel.running {
  border-color: rgba(var(--accent-soft-rgb), .28);
  box-shadow: 0 0 0 1px rgba(var(--accent-soft-rgb), .05), 0 18px 44px -32px rgba(var(--accent-rgb), .45);
}
.think-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  color: #a7abb2;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.think-head::-webkit-details-marker { display: none; }
.think-head:hover { background: rgba(255, 255, 255, .02); }
.think-orb {
  display: grid;
  width: 22px;
  height: 22px;
  flex: none;
  place-items: center;
  border: 1px solid rgba(var(--accent-line-rgb), .18);
  border-radius: 7px;
  background: rgba(var(--accent-rgb), .12);
  color: var(--accent-text);
}
.think-spinner {
  width: 11px;
  height: 11px;
  border: 1.5px solid rgba(var(--accent-line-rgb), .35);
  border-top-color: var(--accent-text);
  border-radius: 50%;
  animation: think-spin .7s linear infinite;
}
@keyframes think-spin { to { transform: rotate(360deg); } }
.think-title { font-size: 12px; font-weight: 590; letter-spacing: -.01em; color: #d3d6dc; }
.think-sub {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  color: #878b93;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}
.trace-live { color: #5fe0b0; font: 600 9px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.trace-clock { color: #a8abb2; }
.trace-wave { display: inline-flex; align-items: flex-end; gap: 2px; height: 10px; }
.trace-wave i { width: 2px; height: 4px; border-radius: 2px; background: var(--accent-text); animation: trace-wave .9s ease-in-out infinite; }
.trace-wave i:nth-child(2) { height: 9px; animation-delay: .12s; }
.trace-wave i:nth-child(3) { height: 6px; animation-delay: .24s; }
@keyframes trace-wave { 50% { transform: scaleY(.45); opacity: .65; } }
.think-chev { display: inline-flex; color: #4f535b; transition: transform .18s ease; }
details.think-panel[open] .think-chev { transform: rotate(180deg); }
.think-steps {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0;
  padding: 2px 14px 12px 14px;
  list-style: none;
}
.think-steps li {
  position: relative;
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  gap: 9px;
  padding: 6px 0 6px 1px;
  font-size: 11.5px;
  color: #a8abb2;
}
.think-steps li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 20px;
  bottom: -2px;
  width: 1px;
  background: linear-gradient(180deg, rgba(var(--accent-line-rgb), .24), rgba(var(--accent-line-rgb), .05));
}
.think-dot {
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--line-3);
}
.think-steps li.done .think-dot { background: #39dca2; box-shadow: 0 0 0 3px rgba(57, 220, 162, .07); }
.think-steps li.running .think-dot { background: var(--accent-text); animation: trace-pulse 1.1s ease-in-out infinite; }
.think-steps li.error .think-dot { background: #ff8b9b; }
@keyframes trace-pulse { 50% { box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .12); } }
.think-label { color: #ececee; }
.think-body small {
  display: block;
  margin-top: 2px;
  overflow-wrap: anywhere;
  color: #787c84;
  font-size: 10px;
  line-height: 1.5;
}
.think-ms { color: #6f737b; font-size: 10px; font-variant-numeric: tabular-nums; }
.think-panel.failed .think-title { color: #ffb0bc; }
.think-panel.failed .think-sub { color: #b9828d; }
@media (prefers-reduced-motion: reduce) {
  .think-spinner, .trace-wave i, .think-steps li.running .think-dot { animation: none; }
}

/* ============================ web search switch =========================== */

/* The Web chip is a plain on/off switch; "Web on" is stated in words so the
   state is never ambiguous. */
#webChip.on {
  background: rgba(57, 220, 162, 0.12);
  border-color: rgba(57, 220, 162, 0.28);
  color: #8ff0c8;
}
#webChip.on .icon { color: #8ff0c8; }

.composer-hint .hint-web {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-right: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(57, 220, 162, 0.24);
  background: rgba(57, 220, 162, 0.1);
  color: #8ff0c8;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.composer-hint .hint-web.warn {
  border-color: rgba(255, 190, 84, 0.3);
  background: rgba(255, 190, 84, 0.1);
  color: #ffd08a;
}
.composer-hint .hint-web i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}

.web-notice {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  padding: 7px 9px 7px 10px;
  border: 1px solid rgba(255, 190, 84, 0.24);
  border-radius: 9px;
  background: rgba(255, 190, 84, 0.07);
  color: #ffd39a;
  font-size: 11.5px;
  line-height: 1.35;
}
.web-notice[hidden] { display: none; }
.web-notice .wn-icon { display: inline-flex; color: #ffc46b; }
.web-notice .wn-text { flex: 1; min-width: 140px; }
.web-notice .wn-action {
  padding: 3px 9px;
  border: 1px solid rgba(255, 196, 107, 0.36);
  border-radius: 6px;
  background: rgba(255, 196, 107, 0.14);
  color: #ffe0b5;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.16s;
}
.web-notice .wn-action:hover { background: rgba(255, 196, 107, 0.24); }
.web-notice .wn-close {
  display: inline-flex;
  padding: 2px;
  border-radius: 4px;
  color: #b9986a;
  transition: color 0.16s, background 0.16s;
}
.web-notice .wn-close:hover { color: #ffd39a; background: rgba(255, 255, 255, 0.06); }
