/* ==========================================================================
   Cocorex AI — "pro" design layer
   Loaded after style.css and overrides it. Everything visual is driven by the tokens below, so the
   dark and light themes stay consistent and a future re-skin means editing this block only.
   ========================================================================== */

:root {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;

  --bg: #0c0c0e;
  --bg-sidebar: #09090b;
  --bg-elevated: #141417;
  --bg-hover: #1b1b20;
  --bg-input: #121215;
  --bg-code: #0a0a0c;
  --border: #212126;
  --border-strong: #2e2e35;
  --text: #ececf1;
  --text-dim: #8b8b97;
  --accent: #d97757;
  --accent-text: #ffffff;
  --accent-soft: rgba(217, 119, 87, 0.12);
  --accent-ring: rgba(217, 119, 87, 0.28);
  --scrollbar-thumb: #2a2a31;
  --scrollbar-thumb-hover: #3a3a43;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 14px 44px rgba(0, 0, 0, 0.42);
  --hairline: rgba(255, 255, 255, 0.04);
}

:root[data-theme="light"] {
  --bg: #fafaf9;
  --bg-sidebar: #f3f3f1;
  --bg-elevated: #ffffff;
  --bg-hover: #ececea;
  --bg-input: #ffffff;
  --bg-code: #f6f6f4;
  --border: #e6e6e2;
  --border-strong: #d8d8d3;
  --text: #17171a;
  --text-dim: #6e6e78;
  --accent-soft: rgba(217, 119, 87, 0.1);
  --accent-ring: rgba(217, 119, 87, 0.25);
  --scrollbar-thumb: #d4d4cf;
  --scrollbar-thumb-hover: #bdbdb7;
  --shadow-md: 0 6px 22px rgba(30, 30, 40, 0.09);
  --shadow-lg: 0 14px 40px rgba(30, 30, 40, 0.14);
  --hairline: rgba(0, 0, 0, 0.04);
}

html, body, button, input, textarea, select { font-family: var(--font-sans); }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; font-feature-settings: "cv11", "ss01"; }
::selection { background: var(--accent-ring); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ----- Scrollbars ------------------------------------------------------- */
* { scrollbar-width: thin; scrollbar-color: var(--scrollbar-thumb) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); background-clip: content-box; }

/* ==========================================================================
   Sidebar
   ========================================================================== */
.sidebar { width: 276px; padding: 14px 12px; gap: 12px; background: var(--bg-sidebar); border-right: 1px solid var(--border); }
.sidebar-header { padding: 2px 4px 2px 6px; }
.sidebar-header-brand { font-size: 14.5px; font-weight: 650; letter-spacing: -0.01em; }
.sidebar-header-brand img { width: 24px; height: 24px; border-radius: 7px; }
.mode-toggle { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 11px; padding: 2px; }
.mode-toggle-btn { width: 30px; height: 26px; border-radius: 8px; }
.mode-toggle-btn.active { background: var(--bg-hover); color: var(--accent); box-shadow: inset 0 0 0 1px var(--hairline); }
.icon-btn { border-radius: 9px; }

.new-chat-btn {
  height: 42px; padding: 0 14px; border-radius: var(--r-md);
  background: var(--bg-elevated); border: 1px solid var(--border-strong);
  font-size: 14px; font-weight: 550; color: var(--text);
  box-shadow: inset 0 1px 0 var(--hairline);
}
.new-chat-btn svg { color: var(--accent); }
.new-chat-btn:hover { background: var(--bg-hover); border-color: color-mix(in srgb, var(--accent) 55%, var(--border-strong)); }

.search-box { border-radius: var(--r-md); background: var(--bg-input); border: 1px solid var(--border); padding: 0 12px; height: 38px; }
.search-box:focus-within { background: var(--bg-input); border-color: var(--border-strong); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box input { font-size: 13.5px; }

.conv-list { gap: 1px; padding-right: 2px; margin-right: -4px; }
.conv-group {
  font-size: 11px; font-weight: 650; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--text-dim); padding: 16px 12px 6px; opacity: 0.85;
}
.conv-group:first-child { padding-top: 6px; }
.conv-item {
  position: relative; padding: 9px 12px; border-radius: 10px; font-size: 13.5px; font-weight: 450;
  color: color-mix(in srgb, var(--text) 82%, var(--text-dim));
}
.conv-item:hover { background: var(--bg-hover); color: var(--text); }
.conv-item.active { background: var(--bg-elevated); color: var(--text); font-weight: 520; box-shadow: inset 0 0 0 1px var(--border); }
.conv-item.active::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }

.profile-box { padding-top: 12px; border-top: 1px solid var(--border); }
.profile-btn { padding: 9px 10px; border-radius: var(--r-md); background: transparent; border: 1px solid transparent; }
.profile-btn:hover { background: var(--bg-elevated); border-color: var(--border); }
.avatar { width: 32px; height: 32px; font-size: 13px; background: linear-gradient(135deg, var(--accent), #b85c3d); }
.profile-name { font-size: 13.5px; font-weight: 600; }
.profile-plan { font-size: 11px; font-weight: 650; letter-spacing: 0.03em; }
.profile-plan.paid { color: var(--accent); }
.profile-menu { border-radius: var(--r-lg); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); background: var(--bg-elevated); }
.guest-box { border-radius: var(--r-md); }

/* ==========================================================================
   Top bar
   ========================================================================== */
.topbar {
  height: 54px; padding: 0 22px; gap: 10px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.topbar-icon { width: 24px; height: 24px; border-radius: 7px; }
.topbar-title { font-size: 14.5px; font-weight: 650; letter-spacing: -0.01em; }

/* ==========================================================================
   Empty state
   ========================================================================== */
.empty-state::before {
  top: 44%; width: 980px; height: 520px; max-width: 150vw;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(224, 128, 92, 0.42) 0%, rgba(217, 119, 87, 0.22) 30%, rgba(217, 119, 87, 0.08) 55%, transparent 72%);
  filter: blur(54px); opacity: 1;
  animation: heroGlowPulse 7s ease-in-out infinite;
}
/* A second, tighter and warmer core right behind the greeting, so the glow has depth. */
.empty-state::after {
  content: ""; position: absolute; top: 40%; left: 50%; width: 520px; height: 260px; transform: translate(-50%, -50%);
  background: radial-gradient(ellipse at center, rgba(255, 160, 110, 0.30) 0%, rgba(217, 119, 87, 0.12) 50%, transparent 75%);
  filter: blur(36px); pointer-events: none; z-index: 0; animation: heroGlowPulse 7s ease-in-out -2s infinite;
}
@keyframes heroGlowPulse {
  0%, 100% { opacity: 0.82; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
}
:root[data-theme="light"] .empty-state::before { background: radial-gradient(ellipse at 50% 50%, rgba(217, 119, 87, 0.34) 0%, rgba(217, 119, 87, 0.15) 32%, rgba(217, 119, 87, 0.05) 56%, transparent 74%); }
:root[data-theme="light"] .empty-state::after { background: radial-gradient(ellipse at center, rgba(255, 150, 100, 0.22) 0%, transparent 72%); }
@media (prefers-reduced-motion: reduce) { .empty-state::before, .empty-state::after { animation: none; } }

/* Logo mark above the greeting, sitting in its own soft halo. */
.empty-logo { position: relative; width: 64px; height: 64px; border-radius: 18px; margin-bottom: 20px; box-shadow: 0 0 0 1px var(--border-strong), 0 10px 40px rgba(217, 119, 87, 0.45), 0 0 80px rgba(217, 119, 87, 0.28); background: var(--bg-elevated); }
/* The composer picks up a trace of the same warmth on the welcome screen. */
.empty-state .composer-box { box-shadow: 0 18px 64px rgba(217, 119, 87, 0.16), var(--shadow-lg), inset 0 1px 0 var(--hairline); }
.empty-state .composer-box:focus-within { box-shadow: 0 0 0 4px var(--accent-soft), 0 18px 70px rgba(217, 119, 87, 0.26), var(--shadow-lg), inset 0 1px 0 var(--hairline); }
.empty-state-greeting {
  font-size: 40px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.12; margin-bottom: 30px;
  background: linear-gradient(95deg, var(--text) 0%, var(--text) 52%, var(--accent) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: none;
}
.empty-state .composer { width: 100%; max-width: 740px; padding: 0; margin: 0 auto; }

.suggestions { width: 100%; max-width: 740px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 22px; }
.suggestion-chip {
  display: flex; align-items: center; gap: 13px; padding: 14px 16px; border-radius: var(--r-lg);
  background: var(--bg-elevated); border: 1px solid var(--border); box-shadow: inset 0 1px 0 var(--hairline);
  font-size: 14px; font-weight: 520; color: var(--text); text-align: left;
}
.suggestion-icon {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); transition: background 0.2s, transform 0.2s;
}
.suggestion-label { min-width: 0; line-height: 1.3; }
.suggestion-chip:hover { background: var(--bg-hover); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.suggestion-chip:hover .suggestion-icon { background: color-mix(in srgb, var(--accent) 22%, transparent); transform: scale(1.06); }

/* ==========================================================================
   Messages
   ========================================================================== */
.messages { padding: 26px 0 10px; scroll-behavior: smooth; }
.msg-row { max-width: 800px; padding: 0 24px; margin-bottom: 30px; }

.msg-row.assistant { display: grid; grid-template-columns: 32px minmax(0, 1fr); column-gap: 14px; align-items: start; }
.msg-avatar {
  grid-column: 1; grid-row: 1 / span 2; width: 32px; height: 32px; border-radius: 10px; overflow: hidden; margin-top: 1px;
  background: var(--bg-elevated); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center;
}
.msg-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.msg-row.assistant .msg-content { grid-column: 2; min-width: 0; white-space: normal; font-size: 15.5px; line-height: 1.75; color: var(--text); }
.msg-row.assistant .msg-actions { grid-column: 2; margin-top: 8px; opacity: 0; transition: opacity 0.15s; }
.msg-row.assistant:hover .msg-actions, .msg-row.assistant .msg-actions:focus-within { opacity: 1; }
@media (hover: none) { .msg-row.assistant .msg-actions { opacity: 1; } }
.msg-action-btn { width: 30px; height: 30px; border-radius: 9px; }

.msg-row.user .msg-content {
  background: var(--bg-elevated); border: 1px solid var(--border); box-shadow: inset 0 1px 0 var(--hairline);
  border-radius: 20px 20px 6px 20px; padding: 12px 18px; max-width: 78%; font-size: 15.5px; line-height: 1.65;
}

.think-status { max-width: 800px; margin: -14px auto 28px; padding: 0 24px 0 70px; font-size: 12.5px; color: var(--text-dim); }

/* ----- Markdown typography inside replies ------------------------------- */
.msg-row.assistant .msg-content > :first-child { margin-top: 0; }
.msg-row.assistant .msg-content > :last-child { margin-bottom: 0; }
.msg-content p { margin: 0 0 14px; }
.msg-content h1, .msg-content h2, .msg-content h3, .msg-content h4 { font-weight: 650; letter-spacing: -0.015em; line-height: 1.3; margin: 1.6em 0 0.55em; color: var(--text); }
.msg-content h1 { font-size: 23px; }
.msg-content h2 { font-size: 19.5px; padding-bottom: 0.3em; border-bottom: 1px solid var(--border); }
.msg-content h3 { font-size: 17px; }
.msg-content h4 { font-size: 15.5px; color: var(--text-dim); text-transform: none; }
.msg-content ul, .msg-content ol { margin: 0 0 14px; padding-left: 1.55em; }
.msg-content li { margin: 0.32em 0; padding-left: 0.2em; }
.msg-content li > ul, .msg-content li > ol { margin: 0.3em 0 0.2em; }
.msg-content ul > li::marker { color: var(--accent); }
.msg-content ol > li::marker { color: var(--text-dim); font-weight: 650; font-variant-numeric: tabular-nums; }
.msg-content strong { font-weight: 650; color: var(--text); }
.msg-content em { font-style: italic; }
.msg-content del { color: var(--text-dim); }
.msg-content a { color: var(--accent); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 38%, transparent); transition: border-color 0.15s; }
.msg-content a:hover { border-bottom-color: var(--accent); }
.msg-content blockquote {
  margin: 0 0 16px; padding: 6px 16px; border-left: 3px solid var(--accent); border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: linear-gradient(90deg, var(--accent-soft), transparent 70%); color: color-mix(in srgb, var(--text) 82%, var(--text-dim));
}
.msg-content blockquote p:last-child { margin-bottom: 0; }
.msg-content hr { border: 0; height: 1px; background: var(--border); margin: 24px 0; }
.msg-content code {
  font-family: var(--font-mono); font-size: 0.86em; padding: 2px 6px; border-radius: 6px;
  background: var(--bg-elevated); border: 1px solid var(--border); color: color-mix(in srgb, var(--accent) 38%, var(--text));
}
.md-table-wrap { overflow-x: auto; margin: 4px 0 18px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-elevated); }
.msg-content table { width: 100%; border-collapse: collapse; font-size: 14px; }
.msg-content th { background: color-mix(in srgb, var(--bg-hover) 70%, var(--bg-elevated)); font-weight: 620; padding: 10px 14px; border-bottom: 1px solid var(--border-strong); white-space: nowrap; }
.msg-content td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.msg-content tbody tr:last-child td { border-bottom: 0; }
.msg-content tbody tr:hover td { background: var(--hairline); }

/* ----- Code blocks ------------------------------------------------------- */
.artifact-block { border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--bg-code); margin: 6px 0 18px; overflow: hidden; box-shadow: var(--shadow-md); }
.artifact-bar { padding: 8px 10px 8px 14px; background: color-mix(in srgb, var(--bg-elevated) 85%, var(--bg-code)); border-bottom: 1px solid var(--border); }
.artifact-bar-label { font-family: var(--font-mono); font-size: 11.5px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); }
.artifact-block pre { margin: 0; padding: 16px 18px; border: 0; border-radius: 0; background: transparent; max-height: 440px; }
.artifact-block pre code { font-family: var(--font-mono); font-size: 13px; line-height: 1.65; background: none; border: 0; padding: 0; color: var(--text); }
.code-copy-btn { border-radius: 8px; padding: 5px 12px; font-size: 12px; font-weight: 550; }
.artifact-open-btn { border-radius: 8px; padding: 5px 13px; font-size: 12px; font-weight: 600; }

/* ==========================================================================
   Composer
   ========================================================================== */
.composer { max-width: 800px; padding: 0 24px; margin: 0 auto 16px; }
.composer-box {
  border-radius: var(--r-xl); background: var(--bg-elevated); border: 1px solid var(--border-strong);
  padding: 10px 10px 10px 14px; gap: 4px;
  box-shadow: var(--shadow-lg), inset 0 1px 0 var(--hairline);
}
.composer-box:focus-within { border-color: color-mix(in srgb, var(--accent) 60%, var(--border-strong)); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-lg), inset 0 1px 0 var(--hairline); }
#input { font-size: 15.5px; line-height: 1.55; padding: 9px 6px; }
.composer-icon-btn { width: 36px; height: 36px; }
.send-btn { width: 38px; height: 38px; background: var(--accent); color: var(--accent-text); box-shadow: 0 2px 10px rgba(217, 119, 87, 0.35); }
.send-btn:hover:not(:disabled) { filter: brightness(1.08); box-shadow: 0 4px 18px rgba(217, 119, 87, 0.5); }
.send-btn:disabled { opacity: 1; background: var(--bg-hover); color: var(--text-dim); box-shadow: none; }
.send-btn.is-stop { background: var(--text); color: var(--bg); box-shadow: none; }

.composer-footer { justify-content: space-between; gap: 12px; padding: 9px 8px 0; }
.composer-note { font-size: 11.5px; color: var(--text-dim); opacity: 0.85; }
.model-select-btn { gap: 5px; padding: 5px 11px; border: 1px solid var(--border); border-radius: 999px; font-size: 12px; font-weight: 600; background: transparent; }
.model-select-btn:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.model-menu { min-width: 240px; padding: 6px; border-radius: var(--r-lg); border: 1px solid var(--border-strong); background: var(--bg-elevated); box-shadow: var(--shadow-lg); }
.model-menu-item { padding: 9px 11px; border-radius: 10px; }
.model-menu-item.active { background: var(--accent-soft); }
.model-menu-group { padding: 12px 11px 5px; letter-spacing: 0.07em; }

.attachment-chip { border-radius: var(--r-md); }
.scroll-bottom-btn { bottom: 118px; border-radius: 999px; box-shadow: var(--shadow-md); }

/* ==========================================================================
   Narrow screens
   ========================================================================== */
@media (max-width: 900px) {
  .empty-state-greeting { font-size: 30px; }
  .suggestions { grid-template-columns: 1fr; }
  .msg-row { padding: 0 16px; }
  .msg-row.assistant { grid-template-columns: 28px minmax(0, 1fr); column-gap: 10px; }
  .msg-avatar { width: 28px; height: 28px; border-radius: 9px; }
  .think-status { padding-left: 54px; }
  .composer { padding: 0 14px; }
  .composer-note { display: none; }
  .composer-footer { justify-content: flex-end; }
  .topbar { padding: 0 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .messages { scroll-behavior: auto; }
  .suggestion-chip, .suggestion-icon { transition: none; }
}

/* The conversation list is rebuilt after every message; re-running a fade-in each time made it
   flicker. Items just appear. */
.conv-item, .conv-group { animation: none; }

/* The greeting is two lines (a salutation and a question); keep the line break from the text. */
.empty-state-greeting { white-space: pre-line; }

/* On short screens the welcome block is taller than the view: let it scroll from the top instead of
   being centred off-screen behind the top bar. */
.empty-state { height: auto; min-height: 100%; justify-content: safe center; padding-top: 28px; padding-bottom: 28px; overflow: visible; overflow-x: clip; }

/* ----- Suggestion cards: title + subtitle -------------------------------- */
.suggestion-chip { padding: 15px 16px; align-items: center; }
.suggestion-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.suggestion-desc { font-size: 12.5px; font-weight: 450; color: var(--text-dim); line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggestion-chip { position: relative; overflow: hidden; }
.suggestion-chip::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.25s;
  background: radial-gradient(420px circle at 0% 0%, rgba(217, 119, 87, 0.10), transparent 60%);
}
.suggestion-chip:hover::after { opacity: 1; }

/* ----- Top bar: conversation title ------------------------------------- */
.topbar-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: min(60vw, 640px); }

/* ----- "Web access" indicator in the composer footer ------------------- */
.composer-footer { align-items: center; }
.web-badge {
  display: inline-flex; align-items: center; gap: 5px; margin-left: auto; padding: 4px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; color: color-mix(in srgb, #4ade80 75%, var(--text)); cursor: default;
  background: color-mix(in srgb, #22c55e 10%, transparent); border: 1px solid color-mix(in srgb, #22c55e 22%, transparent);
}
:root[data-theme="light"] .web-badge { color: #15803d; }
.composer-note + .web-badge { margin-left: auto; }

/* ----- Status line while a tool runs ----------------------------------- */
.think-status.is-web .think-star { color: #4ade80; animation: webPulse 1.2s ease-in-out infinite; }
@keyframes webPulse { 50% { opacity: 0.35; } }

/* ----- Sources under a web-backed answer ------------------------------- */
.msg-sources { grid-column: 2; margin-top: 14px; }
.msg-sources-label {
  display: flex; align-items: center; gap: 6px; margin-bottom: 8px;
  font-size: 11.5px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim);
}
.msg-sources-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.source-card {
  display: flex; align-items: center; gap: 10px; min-width: 0; padding: 9px 11px; border-radius: var(--r-md);
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text); text-decoration: none;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.source-card:hover { background: var(--bg-hover); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); transform: translateY(-1px); }
.source-num {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; background: var(--accent-soft); color: var(--accent);
}
.source-body { display: flex; flex-direction: column; min-width: 0; }
.source-title { font-size: 12.5px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source-host { font-size: 11.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ----- Replies fade in softly ------------------------------------------ */
.msg-row { animation: msgIn 0.28s ease-out both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (max-width: 900px) {
  .msg-sources-list { grid-template-columns: 1fr 1fr; }
  .web-badge span { display: none; }
  .web-badge { padding: 5px 7px; }
}
@media (prefers-reduced-motion: reduce) {
  .msg-row, .think-status.is-web .think-star { animation: none; }
}

/* ----- Reasoning ("Thought for N s") ------------------------------------ */
.thinking-block { grid-column: 2; margin: 0 0 10px; min-width: 0; }
.thinking-block summary {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer; list-style: none; user-select: none;
  padding: 5px 11px 5px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 550; color: var(--text-dim);
  border: 1px solid var(--border); background: var(--bg-elevated); transition: color 0.15s, border-color 0.15s;
}
.thinking-block summary::-webkit-details-marker { display: none; }
.thinking-block summary:hover { color: var(--text); border-color: var(--border-strong); }
.thinking-chevron { transition: transform 0.2s; opacity: 0.7; }
.thinking-block[open] .thinking-chevron { transform: rotate(90deg); }
.thinking-block.is-live .thinking-label {
  background: linear-gradient(90deg, var(--text-dim) 0%, var(--text) 45%, var(--text-dim) 90%); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: thinkShimmer 1.6s linear infinite;
}
@keyframes thinkShimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.thinking-body {
  margin-top: 10px; padding: 4px 0 4px 14px; border-left: 2px solid var(--border-strong);
  font-size: 13.5px; line-height: 1.65; color: var(--text-dim); white-space: pre-wrap; max-height: 320px; overflow-y: auto;
}

/* ----- Answer toolbar: feedback + regenerate ---------------------------- */
.msg-action-btn.is-on { color: var(--accent); background: var(--accent-soft); }
.msg-action-btn[hidden] { display: none; }

/* ----- User messages: copy / edit under the bubble ---------------------- */
.msg-row.user { flex-direction: column; align-items: flex-end; }
.msg-row.user .msg-content { max-width: 78%; }
.user-actions { display: flex; gap: 2px; margin-top: 6px; opacity: 0; transition: opacity 0.15s; }
.msg-row.user:hover .user-actions, .user-actions:focus-within { opacity: 1; }
@media (hover: none) { .user-actions { opacity: 1; } }
.msg-row.user.editing .msg-content, .msg-row.user.editing .user-actions { display: none; }
.edit-box {
  width: min(100%, 640px); background: var(--bg-elevated); border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border-strong));
  border-radius: 18px; padding: 12px 14px 10px; box-shadow: 0 0 0 4px var(--accent-soft);
}
.edit-input {
  width: 100%; resize: none; border: 0; outline: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 15px; line-height: 1.6;
}
.edit-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.edit-actions button { padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid var(--border-strong); background: transparent; color: var(--text); }
.edit-actions .edit-send { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.edit-actions button:hover { filter: brightness(1.08); }

/* ----- Follow-up suggestions ------------------------------------------- */
.followups {
  max-width: 800px; margin: -10px auto 26px; padding: 0 24px 0 70px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 7px; animation: msgIn 0.3s ease-out both;
}
.followup-chip {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 8px 14px 8px 10px; cursor: pointer;
  border-radius: 999px; border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text);
  font-size: 13.5px; font-weight: 500; text-align: left; transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.followup-chip svg { color: var(--accent); flex-shrink: 0; }
.followup-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.followup-chip:hover { background: var(--bg-hover); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); transform: translateX(2px); }
@media (max-width: 900px) { .followups { padding-left: 54px; padding-right: 16px; } }
@media (prefers-reduced-motion: reduce) { .thinking-block.is-live .thinking-label, .followups { animation: none; } }

/* A closed mobile drawer sits just off-screen; its shadow must not bleed onto the left edge. */
@media (max-width: 900px) { .sidebar.collapsed { box-shadow: none; } }

/* Plan cards: four columns when there is room (Free / Eco / Pro / Max), struck-through old price. */
.plan-card-was { opacity: .55; font-size: .62em; font-weight: 600; margin-right: 4px; }


/* ---- Thinking depth slider (Max plans) ---- */
.depth-box {
  margin: 0 0 8px; padding: 14px 16px 12px; border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--text) 8%);
  background:
    radial-gradient(120% 160% at 0% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%),
    color-mix(in srgb, var(--text) 4%, transparent);
}
.depth-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 13.5px; }
.depth-title { display: inline-flex; align-items: center; gap: 7px; font-weight: 650; color: var(--text); letter-spacing: -0.005em; }
.depth-title::before {
  content: ""; width: 15px; height: 15px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #ff9d6c);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M12 2v4M12 18v4M2 12h4M18 12h4M5 5l2.8 2.8M16.2 16.2 19 19M19 5l-2.8 2.8M7.8 16.2 5 19'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M12 2v4M12 18v4M2 12h4M18 12h4M5 5l2.8 2.8M16.2 16.2 19 19M19 5l-2.8 2.8M7.8 16.2 5 19'/%3E%3C/svg%3E") center / contain no-repeat;
}
.depth-value {
  font-weight: 700; font-size: 12.5px; letter-spacing: 0.01em;
  background: linear-gradient(90deg, var(--accent), #ff9d6c);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.depth-slider { display: flex; align-items: center; gap: 10px; }
.depth-end { flex: none; font-size: 10.5px; font-weight: 500; color: color-mix(in srgb, var(--text) 42%, transparent); white-space: nowrap; }
.depth-slider input[type=range] {
  --fill: 0%;
  flex: 1; min-width: 80px; height: 6px; margin: 0; cursor: pointer;
  -webkit-appearance: none; appearance: none; background: transparent;
}
.depth-slider input[type=range]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 999px;
  background: linear-gradient(to right, var(--accent), #ff9d6c var(--fill), color-mix(in srgb, var(--text) 14%, transparent) var(--fill));
}
.depth-slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; margin-top: -6px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 2px solid var(--accent);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35), 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
  transition: transform 0.12s;
}
.depth-slider input[type=range]:active::-webkit-slider-thumb { transform: scale(1.12); }
.depth-slider input[type=range]::-moz-range-track { height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--text) 14%, transparent); }
.depth-slider input[type=range]::-moz-range-progress { height: 6px; border-radius: 999px; background: linear-gradient(to right, var(--accent), #ff9d6c); }
.depth-slider input[type=range]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--accent);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35), 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
.depth-ticks { display: flex; justify-content: space-between; margin: 9px 9px 0; }
.depth-ticks span {
  font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px;
  color: color-mix(in srgb, var(--text) 50%, transparent); transition: background 0.15s, color 0.15s;
}
.depth-ticks span.on { color: var(--accent-text, #fff); background: linear-gradient(90deg, var(--accent), #ff9d6c); }
@media (max-width: 640px) { .depth-end { display: none; } .depth-ticks { margin: 9px 0 0; } }

/* depth slider as a popover opened from the composer button */
#composer { position: relative; }
.depth-box { position: absolute; left: 0; right: 0; bottom: calc(100% - 4px); z-index: 30; margin: 0 0 8px; background: var(--bg, #141416); box-shadow: 0 12px 32px rgba(0,0,0,.35); animation: depthPop .16s ease-out; }
.depth-box[hidden] { display: none; }
@keyframes depthPop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.depth-btn { position: relative; }
.depth-btn.is-active, .depth-btn.is-open { color: var(--accent); }
.depth-badge { position: absolute; top: -4px; right: -6px; min-width: 18px; padding: 1px 4px; border-radius: 9px; background: var(--accent); color: var(--accent-text, #fff); font-size: 10px; font-weight: 700; line-height: 14px; text-align: center; pointer-events: none; }

/* image model menu */
.img-model-box { position: relative; display: inline-flex; }
.img-model-btn.is-open { color: var(--accent); }
.img-model-menu { position: absolute; bottom: calc(100% + 10px); right: -40px; z-index: 31; width: 270px; padding: 6px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--text) 14%, transparent); background: var(--bg, #141416); box-shadow: 0 12px 32px rgba(0,0,0,.35); animation: depthPop .16s ease-out; }
.img-model-menu[hidden] { display: none; }
.img-model-head { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px 8px; font-size: 13px; }
.img-model-head span { font-size: 11.5px; color: color-mix(in srgb, var(--text) 55%, transparent); }
.img-model-item { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px; border: 0; border-radius: 9px; background: none; color: var(--text); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; }
.img-model-item:hover:not([disabled]) { background: color-mix(in srgb, var(--text) 7%, transparent); }
.img-model-item.on { color: var(--accent); font-weight: 600; }
.img-model-item[disabled] { opacity: .5; cursor: not-allowed; }
.img-model-item em { font-style: normal; font-size: 11px; padding: 2px 7px; border-radius: 8px; border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent); color: var(--accent); white-space: nowrap; }
@media (max-width: 640px) { .img-model-menu { right: -90px; width: 250px; } }
/* lift the composer above the welcome heading while one of its popovers is open */
#composer:has(.img-model-menu:not([hidden])), #composer:has(.depth-box:not([hidden])) { z-index: 50; }
.img-model-menu { width: 310px; }
.img-model-name { display: flex; flex-direction: column; gap: 3px; }
.img-model-name small { display: flex; gap: 5px; }
.img-model-name small i { font-style: normal; font-size: 10.5px; font-weight: 500; padding: 1px 6px; border-radius: 6px; background: color-mix(in srgb, var(--text) 8%, transparent); color: color-mix(in srgb, var(--text) 65%, transparent); }
.img-model-name small i.q { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }

/* the model menu is long now: keep it inside the screen */
#modelMenu { max-height: min(62vh, 560px); overflow-y: auto; }
/* vendor logos in the model menu and on the model button */
.model-ico { width: 16px; height: 16px; flex: none; display: inline-block; vertical-align: -3px; margin-right: 8px; object-fit: contain; border-radius: 3px; }
.model-ico-mono { background: currentColor; -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat; }
.model-ico-none { background: radial-gradient(circle, color-mix(in srgb, var(--text) 45%, transparent) 30%, transparent 32%); }
#modelSelectLabel { display: inline-flex; align-items: center; }
#modelSelectLabel .model-ico { width: 14px; height: 14px; margin-right: 6px; }
.model-menu-item-name { display: flex; align-items: center; flex-wrap: nowrap; min-width: 0; white-space: nowrap; }
.model-menu-item-name .model-menu-note { margin-left: 6px; }

/* Long image model list: keep the menu inside the viewport and scroll it. */
.img-model-menu { max-height: min(460px, calc(100vh - 140px)); overflow-y: auto; overscroll-behavior: contain; }
