/* ── MiniMax Workspace — Design System ───────────────────────────────────── */

:root {
  --bg0: #07080d;
  --bg1: #0d0f18;
  --bg2: #121520;
  --bg3: #181c2a;
  --bg4: #1e2235;
  --border: rgba(100,120,200,0.12);
  --border-hi: rgba(120,140,255,0.22);
  --glow: rgba(95,120,255,0.15);
  --v0: #5f78ff;
  --v1: #7c95ff;
  --v2: #9eb1ff;
  --cyan: #3de8c8;
  --pink: #ff5fa0;
  --amber: #ffb347;
  --green: #3dffa0;
  --red: #ff5f6d;
  --text0: #e8ecff;
  --text1: #a8b0d8;
  --text2: #6870a0;
  --text3: #3a4068;
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 260px;
  --header-h: 52px;
  --mono: 'DM Mono', monospace;
  --sans: 'DM Sans', sans-serif;
  --display: 'Syne', sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: var(--bg0); color: var(--text0); font-family: var(--sans); font-size: 14px; line-height: 1.6; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--v0); }

/* ── Layout ── */
#app { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ── */
#sidebar {
  width: var(--sidebar-w);
  background: var(--bg1);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  flex-shrink: 0;
  transition: width .25s ease;
  overflow: hidden;
  position: relative;
  z-index: 10;
}
#sidebar.collapsed { width: 56px; }

.sidebar-logo {
  padding: 14px 16px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; user-select: none;
  flex-shrink: 0;
}
.logo-mark {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--v0), var(--cyan));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-weight: 800; font-size: 12px;
  color: #fff; letter-spacing: -0.5px;
}
.logo-text {
  font-family: var(--display); font-weight: 700; font-size: 15px;
  color: var(--text0); white-space: nowrap; overflow: hidden;
  letter-spacing: -0.3px;
}
.logo-text span { color: var(--v1); }

.sidebar-section { padding: 8px 0; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.sidebar-section-label {
  font-size: 9px; font-weight: 600; letter-spacing: 1.5px;
  color: var(--text3); padding: 4px 16px 2px;
  text-transform: uppercase; white-space: nowrap; overflow: hidden;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; cursor: pointer; border-radius: 0;
  transition: background .15s; position: relative;
  overflow: hidden; white-space: nowrap;
}
.nav-item:hover { background: var(--bg3); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(95,120,255,.12), transparent);
}
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 3px; background: var(--v0); border-radius: 0 3px 3px 0;
}
.nav-icon {
  width: 28px; height: 28px; border-radius: var(--radius-sm); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; background: var(--bg3);
  transition: background .15s;
}
.nav-item.active .nav-icon { background: rgba(95,120,255,.2); }
.nav-label { font-size: 13px; font-weight: 500; color: var(--text1); white-space: nowrap; }
.nav-item.active .nav-label { color: var(--text0); }
.nav-badge {
  margin-left: auto; font-size: 9px; font-weight: 600;
  background: var(--v0); color: #fff; border-radius: 99px;
  padding: 1px 6px; white-space: nowrap;
}

/* Conversation list */
#conv-list { flex: 1; overflow-y: auto; padding: 4px 0; }
.conv-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px; cursor: pointer;
  transition: background .15s;
  overflow: hidden;
}
.conv-item:hover { background: var(--bg3); }
.conv-item.active { background: var(--bg4); }
.conv-icon { font-size: 12px; flex-shrink: 0; opacity: .6; }
.conv-title {
  font-size: 12px; color: var(--text1); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; flex: 1;
}
.conv-item.active .conv-title { color: var(--text0); }
.conv-del {
  opacity: 0; font-size: 10px; color: var(--text2); cursor: pointer;
  padding: 2px 4px; border-radius: 4px; transition: opacity .15s;
  flex-shrink: 0;
}
.conv-item:hover .conv-del { opacity: 1; }
.conv-del:hover { color: var(--red); }

/* Quota bar */
#quota-bar {
  padding: 10px 14px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.quota-label { font-size: 10px; color: var(--text2); margin-bottom: 5px; display: flex; justify-content: space-between; }
.quota-track { height: 3px; background: var(--bg4); border-radius: 99px; overflow: hidden; margin-bottom: 3px; }
.quota-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--v0), var(--cyan)); transition: width .5s; }

/* ── Main ── */
#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ── Header ── */
#header {
  height: var(--header-h);
  background: var(--bg1);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  flex-shrink: 0;
}
.header-title { font-family: var(--display); font-size: 15px; font-weight: 700; color: var(--text0); flex: 1; }
.model-badge {
  font-family: var(--mono); font-size: 10px; color: var(--v1);
  background: rgba(95,120,255,.12); border: 1px solid rgba(95,120,255,.2);
  padding: 3px 8px; border-radius: 99px; cursor: pointer; transition: all .15s;
}
.model-badge:hover { background: rgba(95,120,255,.2); }
.header-btn {
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  background: var(--bg3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 14px; transition: all .15s; color: var(--text1);
}
.header-btn:hover { background: var(--bg4); border-color: var(--border-hi); color: var(--text0); }

/* ── Content area ── */
#content { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.panel { display: none; flex: 1; overflow: hidden; flex-direction: column; }
.panel.active { display: flex; }

/* ── Chat Panel ── */
#messages-wrap {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 16px;
}
.msg {
  display: flex; gap: 12px; max-width: 820px;
  animation: fadeUp .25s ease;
}
@keyframes fadeUp { from { opacity:0; transform:translateY(8px) } to { opacity:1; transform:none } }
.msg.user { flex-direction: row-reverse; margin-left: auto; }
.msg-avatar {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.msg.user .msg-avatar { background: linear-gradient(135deg, var(--v0), var(--pink)); }
.msg.assistant .msg-avatar { background: linear-gradient(135deg, var(--bg4), var(--bg3)); border: 1px solid var(--border-hi); }
.msg-bubble {
  border-radius: var(--radius);
  padding: 12px 16px;
  line-height: 1.7;
  max-width: calc(100% - 50px);
}
.msg.user .msg-bubble {
  background: linear-gradient(135deg, rgba(95,120,255,.18), rgba(95,120,255,.08));
  border: 1px solid rgba(95,120,255,.2);
  color: var(--text0);
}
.msg.assistant .msg-bubble {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text0);
}
.msg-bubble p { margin-bottom: .5em; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg-bubble pre {
  background: var(--bg0); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px; overflow-x: auto;
  margin: 8px 0; font-family: var(--mono); font-size: 12px; line-height: 1.6;
}
.msg-bubble code {
  font-family: var(--mono); font-size: 12px;
  background: rgba(95,120,255,.1); border-radius: 4px; padding: 1px 5px;
}
.msg-bubble pre code { background: none; padding: 0; }
.msg-bubble h1,.msg-bubble h2,.msg-bubble h3 { font-family: var(--display); margin: .8em 0 .4em; }
.msg-bubble ul,.msg-bubble ol { padding-left: 1.4em; }
.msg-bubble table { border-collapse: collapse; width: 100%; margin: 8px 0; }
.msg-bubble th,.msg-bubble td { border: 1px solid var(--border); padding: 6px 10px; font-size: 12px; }
.msg-bubble th { background: var(--bg3); }
.msg-meta { font-size: 10px; color: var(--text2); margin-top: 5px; font-family: var(--mono); }
.msg.user .msg-meta { text-align: right; }
.thinking-badge {
  font-size: 10px; font-family: var(--mono); color: var(--v1);
  background: rgba(95,120,255,.08); border: 1px solid rgba(95,120,255,.15);
  padding: 2px 8px; border-radius: 99px; display: inline-block; margin-bottom: 6px;
}
.streaming-cursor::after {
  content: '▋'; animation: blink .7s infinite; color: var(--v1);
}
@keyframes blink { 50% { opacity:0 } }

/* Deep Think Blocks */
.think-block {
  margin: 12px 0;
  border-left: 2px solid var(--v0);
  background: linear-gradient(90deg, rgba(95,120,255,0.05), transparent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0;
  overflow: hidden;
  transition: all 0.2s ease;
}
.think-block details {
  padding: 10px 14px;
}
.think-block summary {
  font-size: 11px;
  font-weight: 600;
  color: var(--v1);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
  outline: none;
}
.think-block summary::before {
  content: "🧠";
  font-size: 13px;
  opacity: 0.8;
}
.think-block details[open] summary {
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(95,120,255,0.1);
  padding-bottom: 8px;
}
.think-block p, .think-block li, .think-block ul {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text2);
  line-height: 1.6;
}
.think-block:hover {
  border-left-color: var(--v1);
  background: linear-gradient(90deg, rgba(95,120,255,0.08), transparent);
}

/* ── Input Area ── */
#input-area {
  padding: 16px 20px 20px;
  background: var(--bg1);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.input-wrapper {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 14px; display: flex; align-items: flex-end;
  gap: 8px; padding: 10px 12px;
  transition: border-color .2s;
  position: relative;
}
.input-wrapper:focus-within { border-color: var(--border-hi); box-shadow: 0 0 0 3px var(--glow); }
#msg-input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text0); font-family: var(--sans); font-size: 14px;
  resize: none; max-height: 200px; line-height: 1.6;
}
#msg-input::placeholder { color: var(--text3); }
.send-btn {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--v0), var(--v1));
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; transition: all .15s;
  box-shadow: 0 2px 12px rgba(95,120,255,.3);
}
.send-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(95,120,255,.4); }
.send-btn:active { transform: translateY(0); }
.send-btn:disabled { opacity: .4; transform: none; }
.input-toolbar {
  display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap;
}
.tool-chip {
  font-size: 11px; color: var(--text2); background: var(--bg3);
  border: 1px solid var(--border); border-radius: 99px;
  padding: 3px 10px; cursor: pointer; transition: all .15s;
  display: flex; align-items: center; gap: 4px;
  user-select: none;
}
.tool-chip:hover { border-color: var(--border-hi); color: var(--text1); }
.tool-chip.active { border-color: var(--v0); color: var(--v1); background: rgba(95,120,255,.08); }

/* ── Search Panel ── */
.search-header { padding: 24px 24px 0; }
.big-search {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 16px; display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  transition: border-color .2s;
}
.big-search:focus-within { border-color: var(--border-hi); box-shadow: 0 0 0 3px var(--glow); }
.big-search input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text0); font-family: var(--sans); font-size: 16px;
}
.big-search input::placeholder { color: var(--text3); }
.search-submit {
  background: linear-gradient(135deg, var(--v0), var(--cyan));
  border: none; border-radius: 9px; padding: 8px 18px;
  color: #fff; font-family: var(--display); font-weight: 700;
  font-size: 13px; cursor: pointer; transition: all .15s;
  white-space: nowrap;
}
.search-submit:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(95,120,255,.3); }

.search-results { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; gap: 20px; }
.search-left { flex: 1; }
.search-right { width: 280px; flex-shrink: 0; }
.search-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px;
  cursor: pointer; transition: all .15s;
}
.search-card:hover { border-color: var(--border-hi); background: var(--bg3); }
.search-card-title { font-size: 13px; font-weight: 600; color: var(--v1); margin-bottom: 4px; }
.search-card-snippet { font-size: 12px; color: var(--text1); line-height: 1.6; }
.search-card-url { font-size: 10px; color: var(--text2); margin-top: 5px; font-family: var(--mono); }
.ai-answer {
  background: var(--bg2); border: 1px solid rgba(95,120,255,.2);
  border-radius: var(--radius); padding: 16px;
  border-left: 3px solid var(--v0);
}
.ai-answer-label { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; font-weight: 600; color: var(--v1); margin-bottom: 8px; }

/* ── Office / Editor Panel ── */
.office-layout { display: flex; flex: 1; overflow: hidden; }
.doc-sidebar {
  width: 220px; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0;
  background: var(--bg1);
}
.doc-sidebar-header { padding: 12px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.doc-sidebar-header span { font-size: 11px; font-weight: 600; color: var(--text2); letter-spacing: .5px; }
.doc-list { flex: 1; overflow-y: auto; padding: 6px 0; }
.doc-item {
  padding: 8px 14px; cursor: pointer; transition: background .15s;
  display: flex; align-items: center; gap: 8px;
}
.doc-item:hover { background: var(--bg3); }
.doc-item.active { background: var(--bg4); }
.doc-item-name { font-size: 12px; color: var(--text1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-item.active .doc-item-name { color: var(--text0); }
.editor-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.editor-toolbar {
  padding: 8px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
  background: var(--bg1); flex-shrink: 0;
}
.editor-toolbar-btn {
  height: 26px; padding: 0 10px; border-radius: var(--radius-sm);
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text1); font-size: 11px; cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.editor-toolbar-btn:hover { border-color: var(--v0); color: var(--v1); }
.editor-title-bar {
  padding: 10px 20px; border-bottom: 1px solid var(--border);
  background: var(--bg1); flex-shrink: 0;
}
.editor-title-bar input {
  background: none; border: none; outline: none;
  font-family: var(--display); font-size: 20px; font-weight: 700;
  color: var(--text0); width: 100%;
}
.editor-title-bar input::placeholder { color: var(--text3); }
#editor {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; gap: 0;
}
#editor-input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text0); font-family: var(--mono); font-size: 13px;
  resize: none; line-height: 1.8; padding: 0;
}
#editor-preview { flex: 1; overflow-y: auto; padding: 0 20px; display: none; border-left: 1px solid var(--border); }
#editor-preview.show { display: block; }

/* ── Image Lab ── */
.image-lab { display: flex; flex: 1; overflow: hidden; }
.image-controls {
  width: 300px; flex-shrink: 0; border-right: 1px solid var(--border);
  padding: 20px; display: flex; flex-direction: column; gap: 14px;
  overflow-y: auto; background: var(--bg1);
}
.image-gallery { flex: 1; overflow-y: auto; padding: 20px; }
.gallery-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.gallery-item {
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); aspect-ratio: 1;
  cursor: pointer; transition: all .2s; position: relative;
  background: var(--bg2);
}
.gallery-item:hover { border-color: var(--border-hi); transform: scale(1.01); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-item-overlay {
  position: absolute; inset: 0; background: linear-gradient(0deg, rgba(0,0,0,.7) 0%, transparent 50%);
  display: flex; align-items: flex-end; padding: 10px;
  opacity: 0; transition: opacity .15s;
}
.gallery-item:hover .gallery-item-overlay { opacity: 1; }
.gallery-item-caption { font-size: 10px; color: #fff; line-height: 1.4; }

/* ── Voice / TTS ── */
.voice-panel { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.voice-voices {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px;
}
.voice-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px; cursor: pointer;
  transition: all .15s; text-align: center;
}
.voice-card:hover { border-color: var(--border-hi); }
.voice-card.active { border-color: var(--v0); background: rgba(95,120,255,.08); }
.voice-card-icon { font-size: 24px; margin-bottom: 6px; }
.voice-card-name { font-size: 12px; font-weight: 600; color: var(--text1); }
.voice-card.active .voice-card-name { color: var(--v1); }
.voice-card-desc { font-size: 10px; color: var(--text2); }
.audio-player {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
audio { width: 100%; height: 36px; }

/* ── Music / Video ── */
.media-gen { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.job-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
}
.job-status {
  width: 8px; height: 8px; border-radius: 99px; flex-shrink: 0;
}
.job-status.pending,.job-status.processing { background: var(--amber); animation: pulse 1s infinite; }
.job-status.complete { background: var(--green); }
.job-status.error { background: var(--red); }
@keyframes pulse { 50% { opacity:.4 } }
.job-info { flex: 1; overflow: hidden; }
.job-title { font-size: 12px; font-weight: 600; color: var(--text0); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-meta { font-size: 10px; color: var(--text2); font-family: var(--mono); }
.job-action { font-size: 11px; color: var(--v1); cursor: pointer; white-space: nowrap; text-decoration: none; }
.job-action:hover { text-decoration: underline; }

/* ── Agent Panel ── */
.agent-panel { display: flex; flex: 1; overflow: hidden; }
.agent-left { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.agent-log { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.agent-event {
  border-radius: var(--radius); padding: 10px 14px;
  animation: fadeUp .2s ease;
  border-left: 3px solid transparent;
}
.agent-event.start { background: rgba(95,120,255,.08); border-left-color: var(--v0); }
.agent-event.step { background: var(--bg2); border-left-color: var(--text3); }
.agent-event.tool_call { background: rgba(61,232,200,.06); border-left-color: var(--cyan); }
.agent-event.tool_result { background: rgba(61,255,160,.05); border-left-color: var(--green); }
.agent-event.complete { background: rgba(61,255,160,.08); border-left-color: var(--green); }
.agent-event.error { background: rgba(255,95,109,.08); border-left-color: var(--red); }
.agent-event-type { font-size: 9px; letter-spacing: 1px; text-transform: uppercase; font-weight: 600; margin-bottom: 4px; }
.agent-event.start .agent-event-type { color: var(--v1); }
.agent-event.tool_call .agent-event-type { color: var(--cyan); }
.agent-event.tool_result .agent-event-type { color: var(--green); }
.agent-event.complete .agent-event-type { color: var(--green); }
.agent-event.error .agent-event-type { color: var(--red); }
.agent-event-body { font-size: 12px; color: var(--text1); line-height: 1.6; }
.agent-event-body pre { background: var(--bg0); border-radius: 6px; padding: 8px; overflow-x: auto; font-size: 11px; font-family: var(--mono); margin-top: 5px; }
.agent-sidebar {
  width: 280px; border-left: 1px solid var(--border);
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
  overflow-y: auto; background: var(--bg1); flex-shrink: 0;
}

/* ── Settings ── */
.settings-panel { flex: 1; overflow-y: auto; padding: 32px; }
.settings-section {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.settings-section h3 {
  font-family: var(--display); font-size: 14px; font-weight: 700;
  color: var(--text0); margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}

/* ── Form elements ── */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 11px; font-weight: 600; color: var(--text2); letter-spacing: .3px; }
.field-input, .field-textarea, .field-select {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 12px;
  color: var(--text0); font-family: var(--sans); font-size: 13px;
  outline: none; transition: border-color .15s; width: 100%;
}
.field-input:focus, .field-textarea:focus, .field-select:focus {
  border-color: var(--border-hi); box-shadow: 0 0 0 2px var(--glow);
}
.field-textarea { resize: vertical; min-height: 80px; }
.field-select { appearance: none; cursor: pointer; }
.btn-primary {
  background: linear-gradient(135deg, var(--v0), var(--v1));
  border: none; border-radius: var(--radius-sm); padding: 9px 18px;
  color: #fff; font-family: var(--display); font-weight: 700;
  font-size: 13px; cursor: pointer; transition: all .15s;
  display: flex; align-items: center; gap: 6px;
  box-shadow: 0 2px 12px rgba(95,120,255,.25);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(95,120,255,.35); }
.btn-primary:active { transform: none; }
.btn-secondary {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 16px;
  color: var(--text1); font-size: 13px; cursor: pointer;
  transition: all .15s;
}
.btn-secondary:hover { border-color: var(--border-hi); color: var(--text0); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.help-text { font-size: 11px; color: var(--text2); line-height: 1.5; }

/* ── Empty state ── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; gap: 14px; padding: 40px; text-align: center;
}
.empty-icon { font-size: 48px; opacity: .3; }
.empty-title { font-family: var(--display); font-size: 18px; font-weight: 700; color: var(--text1); }
.empty-desc { font-size: 13px; color: var(--text2); max-width: 360px; line-height: 1.7; }

/* ── Quick prompts ── */
.quick-prompts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-width: 540px; width: 100%; }
.quick-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
  cursor: pointer; transition: all .15s; text-align: left;
}
.quick-card:hover { border-color: var(--border-hi); background: var(--bg3); }
.quick-card-title { font-size: 12px; font-weight: 600; color: var(--text0); margin-bottom: 3px; }
.quick-card-desc { font-size: 11px; color: var(--text2); line-height: 1.5; }

/* ── Loading spinner ── */
.spinner {
  width: 18px; height: 18px; border: 2px solid var(--border);
  border-top-color: var(--v0); border-radius: 50%;
  animation: spin .6s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg) } }

/* ── Toast ── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 16px;
  font-size: 13px; color: var(--text0);
  animation: slideIn .25s ease;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  display: flex; align-items: center; gap: 8px;
  max-width: 320px;
}
.toast.success { border-color: rgba(61,255,160,.3); }
.toast.error { border-color: rgba(255,95,109,.3); }
@keyframes slideIn { from { opacity:0; transform:translateX(20px) } to { opacity:1; transform:none } }

/* ── Drag-to-upload ── */
.drop-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 24px; text-align: center; cursor: pointer;
  transition: all .2s;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--v0); background: rgba(95,120,255,.05);
}
.drop-zone p { font-size: 12px; color: var(--text2); }

/* ── Model selector modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; backdrop-filter: blur(4px);
}
.modal {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 16px; padding: 24px; width: 360px;
  animation: fadeUp .2s ease;
}
.modal h3 { font-family: var(--display); font-size: 16px; margin-bottom: 16px; }
.modal-close { float: right; cursor: pointer; color: var(--text2); font-size: 18px; }
.model-option {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background .15s;
  border: 1px solid transparent; margin-bottom: 6px;
}
.model-option:hover { background: var(--bg3); }
.model-option.selected { border-color: var(--v0); background: rgba(95,120,255,.08); }
.model-option-dot { width: 10px; height: 10px; border-radius: 50%; }
.model-option-name { font-size: 13px; font-weight: 600; color: var(--text0); }
.model-option-desc { font-size: 11px; color: var(--text2); }

/* ── Sidebar toggle ── */
.sidebar-toggle {
  position: absolute; right: -13px; top: 50%;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 10px; z-index: 20;
  transform: translateY(-50%);
  transition: all .15s;
}
.sidebar-toggle:hover { background: var(--bg4); border-color: var(--border-hi); }

/* ── Responsive ── */
@media (max-width: 768px) {
  :root { --sidebar-w: 240px; }
  #sidebar { position: absolute; z-index: 100; height: 100%; }
  #sidebar.collapsed { transform: translateX(-100%); width: var(--sidebar-w); }
  .search-results { flex-direction: column; }
  .search-right { width: 100%; }
  .image-controls { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
  .image-lab { flex-direction: column; }
}
