:root {
  color-scheme: light;
  --ink: #172333;
  --muted: #718096;
  --line: #dbe3ec;
  --soft-line: #e9eef4;
  --paper: #ffffff;
  --canvas: #f5f7fb;
  --blue: #1769e0;
  --blue-dark: #1253b7;
  --coral: #ef725f;
  --mint: #dff5ea;
  --shadow: 0 22px 60px rgba(23, 35, 51, 0.09);
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  font-family: "IBM Plex Sans Thai", system-ui, sans-serif;
}

button, textarea { font: inherit; }
button { cursor: pointer; }

.shell {
  width: min(1180px, calc(100% - 48px));
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0;
  text-decoration: none;
}

.brand-mark {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  padding: 4px;
  border-radius: 7px;
  background: var(--ink);
}

.brand-mark span { width: 4px; border-radius: 3px; background: #fff; }
.brand-mark span:nth-child(1) { height: 8px; opacity: .62; }
.brand-mark span:nth-child(2) { height: 13px; opacity: .82; }
.brand-mark span:nth-child(3) { height: 16px; }

.connection-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #607186;
  font-size: 13px;
  font-weight: 500;
}

.status-dot, .chip-dot {
  width: 8px;
  height: 8px;
  display: inline-block;
  border-radius: 50%;
  background: #36ad72;
  box-shadow: 0 0 0 4px rgba(54, 173, 114, .12);
}

.connection-state.busy .status-dot { background: var(--coral); box-shadow: 0 0 0 4px rgba(239, 114, 95, .13); }
.connection-state.error .status-dot { background: #ca3b4a; box-shadow: 0 0 0 4px rgba(202, 59, 74, .12); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.auth-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--blue);
  color: #fff;
  border: 0;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(23, 105, 224, 0.25);
}

.auth-btn:hover {
  background: var(--blue-dark);
  transform: translateY(-1px);
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.user-avatar {
  font-size: 13px;
}

.user-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
}

.logout-btn:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}

.chat-layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(230px, .7fr) minmax(0, 1.55fr);
  gap: clamp(40px, 8vw, 120px);
  align-items: center;
  padding: 64px 0 52px;
}

.intro { align-self: start; padding-top: clamp(22px, 8vh, 90px); }
.eyebrow, .panel-kicker {
  margin: 0 0 18px;
  color: var(--blue);
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.6px;
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  max-width: 420px;
  margin-bottom: 22px;
  font-family: "Space Grotesk", "IBM Plex Sans Thai", sans-serif;
  font-size: clamp(39px, 4.2vw, 62px);
  line-height: 1.06;
  letter-spacing: 0;
}

h1 em { color: var(--coral); font-style: normal; }
.intro-copy { max-width: 300px; margin-bottom: 27px; color: var(--muted); font-size: 15px; line-height: 1.75; }
.model-chip {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, .6);
  color: #53647a;
  font-family: "Space Grotesk", sans-serif;
  font-size: 12px;
}
.model-chip .chip-dot { width: 6px; height: 6px; box-shadow: none; }

/* Controls Grid (Model & Thinking Effort) */
.controls-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 360px;
  margin-top: 10px;
}

.picker-label {
  display: block;
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #64748b;
  margin-bottom: 6px;
}

.select-wrap {
  position: relative;
}

.select-wrap::after {
  content: "▾";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: #64748b;
  pointer-events: none;
}

.model-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 32px 9px 12px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: all 0.15s ease;
}

.model-select:hover {
  border-color: var(--blue);
  background: #fbfcfe;
}

.model-select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(18, 83, 183, 0.1);
}

.conversation-panel {
  width: 100%;
  min-height: 650px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.panel-heading {
  min-height: 83px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 19px 25px;
  border-bottom: 1px solid var(--soft-line);
}
.panel-kicker { margin-bottom: 4px; color: #9aa7b7; font-size: 10px; letter-spacing: 1.3px; }
h2 { margin-bottom: 0; font-size: 21px; font-weight: 700; }
.icon-button {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #718096;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.icon-button:hover { border-color: #b7c5d5; background: #f7f9fc; color: var(--ink); }
.icon-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }

.messages {
  flex: 1;
  min-height: 390px;
  max-height: 475px;
  overflow-y: auto;
  padding: 26px 25px 22px;
  scrollbar-color: #cbd5e1 transparent;
  scrollbar-width: thin;
}
.empty-state { min-height: 340px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-icon {
  width: 45px;
  height: 45px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  border-radius: 50%;
  background: var(--mint);
  color: #2c9d6d;
  font-size: 22px;
}
.empty-state h3 { margin-bottom: 6px; font-size: 18px; }
.empty-state p { margin-bottom: 22px; color: var(--muted); font-size: 13px; }
.suggestions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.suggestions button {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: #52657c;
  font-size: 12px;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.suggestions button:hover { border-color: #9bb8df; background: #f6f9fe; color: var(--blue); }

.message { display: flex; gap: 11px; margin-bottom: 23px; animation: appear .22s ease-out; }
.message.user { justify-content: flex-end; }
.avatar { width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center; border-radius: 50%; font-family: "Space Grotesk", sans-serif; font-size: 11px; font-weight: 700; }
.message.assistant .avatar { background: var(--ink); color: #fff; }
.message.user .avatar { order: 2; background: #e8eef8; color: var(--blue); }
.bubble { max-width: min(78%, 590px); padding: 11px 14px; border-radius: 7px; font-size: 14px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.assistant .bubble { border: 1px solid var(--soft-line); background: #fbfcfe; }
.message.user .bubble { background: var(--blue); color: #fff; }
.bubble.pending::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 4px; border-radius: 50%; background: currentColor; animation: blink 1s infinite ease-in-out; }
.message.error .bubble { border-color: #f1c9c9; background: #fff7f7; color: #b63c47; }

.composer { margin: 0 20px 20px; padding: 13px 14px 10px; border: 1px solid #cfd9e5; border-radius: 7px; background: #fff; transition: border-color .15s ease, box-shadow .15s ease; }
.composer:focus-within { border-color: #83a9de; box-shadow: 0 0 0 3px rgba(23, 105, 224, .09); }
textarea { width: 100%; min-height: 34px; max-height: 130px; resize: none; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 14px; line-height: 1.55; }
textarea::placeholder { color: #a1adbc; }
.composer-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 9px; }
.hint { color: #a0acba; font-size: 11px; }
.hint-separator { padding: 0 4px; color: #cad2dc; }
.composer-actions { display: flex; align-items: center; gap: 12px; }
.char-count { color: #a0acba; font-size: 11px; white-space: nowrap; }
.send-button { min-width: 70px; height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 0; border-radius: 5px; background: var(--blue); color: #fff; font-size: 13px; font-weight: 600; transition: background .15s ease, transform .15s ease; }
.send-button:hover { background: var(--blue-dark); }
.send-button:active { transform: translateY(1px); }
.send-button:disabled { cursor: wait; opacity: .62; }
.send-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

.footer { display: flex; align-items: center; gap: 10px; padding: 0 0 23px; color: #a0acba; font-family: "Space Grotesk", sans-serif; font-size: 10px; letter-spacing: .7px; text-transform: uppercase; }
.footer-line { width: 26px; height: 1px; background: #cad3de; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@keyframes appear { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes blink { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }

@media (max-width: 820px) {
  .shell { width: min(100% - 32px, 620px); }
  .chat-layout { grid-template-columns: 1fr; gap: 32px; padding-top: 42px; }
  .intro { padding-top: 0; }
  h1 { font-size: clamp(38px, 11vw, 54px); }
  .intro-copy { max-width: 430px; }
  .conversation-panel { min-height: 620px; }
}

@media (max-width: 520px) {
  .shell { width: calc(100% - 24px); }
  .topbar { height: 70px; }
  .connection-state { font-size: 12px; }
  .chat-layout { padding: 30px 0 36px; gap: 25px; }
  .eyebrow { margin-bottom: 13px; }
  h1 { margin-bottom: 16px; font-size: 39px; }
  .intro-copy { margin-bottom: 18px; font-size: 14px; line-height: 1.6; }
  .conversation-panel { min-height: 570px; }
  .panel-heading { min-height: 76px; padding: 17px 18px; }
  .messages { min-height: 300px; padding: 21px 17px 13px; }
  .empty-state { min-height: 270px; }
  .empty-state p { max-width: 240px; line-height: 1.5; }
  .bubble { max-width: 83%; font-size: 13px; }
  .composer { margin: 0 12px 12px; padding: 11px 11px 9px; }
  .composer-footer { align-items: flex-end; }
  .hint { max-width: 128px; line-height: 1.45; }
  .char-count { display: none; }
  .footer { padding-bottom: 16px; }
}

/* =========================================================
   Antigravity Auth & Model Selector Styles
   ========================================================= */

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.auth-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  transition: all .15s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.auth-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: #f6f9fe;
}

.auth-btn-ghost {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 6px;
  text-decoration: underline;
  cursor: pointer;
}

.auth-btn-ghost:hover {
  color: #b63c47;
}

.auth-email {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-dot-online {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #36ad72;
}

.auth-badge {
  font-size: 12px;
  background: #eef2f7;
  color: #607186;
  padding: 3px 8px;
  border-radius: 4px;
}

.model-picker-container {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.picker-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.select-wrap {
  position: relative;
  max-width: 320px;
}

.model-select {
  width: 100%;
  padding: 10px 14px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  appearance: none;
  cursor: pointer;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23718096' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.model-select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 105, 224, 0.08);
}

.thought-bubble {
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  background: #f4f6fa;
  border-left: 3px solid #718096;
  font-size: 12.5px;
  line-height: 1.5;
  color: #52657c;
}

.thought-header {
  display: block;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  color: #718096;
}

.thought-body {
  font-family: inherit;
  white-space: pre-wrap;
  max-height: 200px;
  overflow-y: auto;
}

/* =========================================================
   Token Usage Bar & Session Badge
   ========================================================= */

.token-bar {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.07);
  font-size: 11.5px;
  color: #607186;
  width: 100%;
}

.token-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.token-label {
  color: #718096;
}

.token-val {
  font-weight: 600;
  color: var(--ink);
}

.token-sep {
  color: #cad2dc;
}

.token-item.cache-active .token-val {
  color: var(--blue);
}

.token-item.total .token-val {
  color: #1253b7;
}

.session-tokens-badge {
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: #52657c;
  background: #fff;
  padding: 3px 10px;
  border-radius: 5px;
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

/* =========================================================
   Coin Badge & Account Hub Modal
   ========================================================= */

.coin-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #fff9e6;
  border: 1px solid #f2e3b6;
  padding: 5px 11px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: #976b00;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.coin-amount {
  font-family: "Space Grotesk", monospace, sans-serif;
  font-weight: 700;
  color: #805b00;
}

.coin-unit {
  font-size: 11px;
  color: #b38612;
  text-transform: uppercase;
}

.account-hub-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
}

.account-hub-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: #f6f9fe;
}

.token-coin-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.token-coin-tag.own {
  background: #e8f7ee;
  color: #248a52;
  border: 1px solid #cbeed7;
}

.token-coin-tag.public {
  background: #fff5e6;
  color: #b07000;
  border: 1px solid #fce3b8;
}

/* Modal Styling */
.hub-modal-backdrop[hidden] {
  display: none !important;
}

.hub-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.hub-modal-backdrop.active,
.hub-modal-backdrop:not([hidden]) {
  display: flex;
}

.hub-modal {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
  width: 100%;
  max-width: 580px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalAppear .2s ease-out;
}

@keyframes modalAppear {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.hub-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid #eef2f6;
}

.hub-modal-header h3 {
  margin: 0 0 4px;
  font-size: 17px;
  color: var(--ink);
}

.hub-subtitle {
  margin: 0;
  font-size: 13px;
  color: #64748b;
}

.close-btn {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  font-size: 16px;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .15s ease;
  flex-shrink: 0;
}

.close-btn:hover {
  background: #fee2e2;
  border-color: #fecaca;
  color: #dc2626;
  transform: scale(1.08);
}

.hub-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.hub-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #eef2f6;
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
}

.accounts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.account-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 10px;
  background: #fbfcfe;
  border: 1px solid #e2e8f0;
  transition: all .15s ease;
}

.account-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.account-card.cooldown {
  border-color: #fed7aa;
  background: #fffaf5;
}

.account-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 0;
}

.account-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-email {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-meta {
  font-size: 12px;
  color: #64748b;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.meta-sep {
  color: #cbd5e1;
}

.status-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
}

.status-badge.idle {
  background: #e2f7ea;
  color: #16a34a;
}

.status-badge.cooldown {
  background: #ffedd5;
  color: #ea580c;
}

.account-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Switch styling */
.switch-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.switch-wrap input {
  display: none;
}

.switch-slider {
  width: 36px;
  height: 20px;
  background: #cbd5e1;
  border-radius: 20px;
  position: relative;
  transition: background .2s ease;
}

.switch-slider::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.switch-wrap input:checked + .switch-slider {
  background: var(--blue);
}

.switch-wrap input:checked + .switch-slider::after {
  transform: translateX(16px);
}

.switch-text {
  font-size: 12.5px;
  font-weight: 600;
  color: #475569;
  min-width: 44px;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
  border: 0;
  padding: 9px 18px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease;
}

.btn-primary:hover {
  background: var(--blue-dark);
}

.icon-btn {
  background: transparent;
  border: 0;
  font-size: 14px;
  cursor: pointer;
  opacity: 0.6;
  padding: 4px;
  border-radius: 4px;
  transition: opacity .15s ease;
}

.icon-btn:hover {
  opacity: 1;
}

/* =========================================================
   Markdown & Response Formatting in Agent Message Box
   ========================================================= */

.message.assistant .bubble {
  white-space: normal;
  line-height: 1.6;
}

.markdown-body {
  font-size: 14px;
  color: var(--ink);
  overflow-wrap: break-word;
}

.markdown-body h3,
.markdown-body h4,
.markdown-body h5 {
  margin: 14px 0 6px;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.3;
}

.markdown-body h3 { font-size: 17px; }
.markdown-body h4 { font-size: 15px; }
.markdown-body h5 { font-size: 14px; }

.markdown-body p,
.markdown-body p.md-p {
  margin: 0 0 10px;
}

.markdown-body p:last-child,
.markdown-body p.md-p:last-child {
  margin-bottom: 0;
}

.markdown-body strong,
.message.assistant .bubble strong,
strong,
b {
  font-weight: 700 !important;
  color: #0f172a;
}

.markdown-body em {
  font-style: italic;
}

.markdown-body ul.md-list,
.markdown-body ol.md-list {
  margin: 6px 0 10px 22px;
  padding: 0;
}

.markdown-body li {
  margin-bottom: 4px;
}

.markdown-body blockquote {
  margin: 10px 0;
  padding: 8px 14px;
  border-left: 3px solid var(--blue);
  background: #f1f6fd;
  border-radius: 0 6px 6px 0;
  color: #334155;
  font-size: 13.5px;
}

.markdown-body hr.md-hr {
  border: 0;
  height: 1px;
  background: var(--soft-line);
  margin: 14px 0;
}

.markdown-body a {
  color: var(--blue);
  text-decoration: underline;
}

.inline-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 2px 6px;
  border-radius: 4px;
  color: #c026d3;
  font-weight: 600;
}

/* Code Block Wrapper */
.code-block-wrapper {
  margin: 12px 0;
  border-radius: 8px;
  background: #0f172a;
  border: 1px solid #334155;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1e293b;
  padding: 6px 14px;
  border-bottom: 1px solid #334155;
}

.code-lang {
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #94a3b8;
  text-transform: uppercase;
}

.copy-code-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.copy-code-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.copy-code-btn.copied {
  background: #166534;
  border-color: #22c55e;
  color: #86efac;
}

.code-block-wrapper pre {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  color: #f8fafc;
  scrollbar-color: #475569 transparent;
  scrollbar-width: thin;
}

.code-block-wrapper pre code {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: transparent;
  padding: 0;
  border: 0;
}

/* Thought Bubble Styling */
.thought-bubble {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 12px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #64748b;
  transition: all 0.2s ease;
}

.thought-bubble.finished {
  opacity: 0.85;
  border-style: dashed;
}

.thought-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 11.5px;
  color: #475569;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.thought-body {
  white-space: pre-wrap;
  font-style: italic;
  max-height: 180px;
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}




