:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --border: #e5e7eb;
  --border-soft: rgba(229, 231, 235, 0.72);
  --text: #111827;
  --muted: #6b7280;
  --primary: #6366f1;
  --primary-2: #8b5cf6;
  --danger: #dc2626;
  --shadow: 0 20px 50px -24px rgba(15, 23, 42, 0.25);
  --shadow-soft: 0 14px 32px -26px rgba(15, 23, 42, 0.16);
}

.hidden { display: none !important; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font: 14px/1.5 Inter, "Noto Sans SC", system-ui, sans-serif; height: 100%; overflow: hidden; }
button, input, select, textarea { font: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.45); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

.app-shell { height: 100vh; display: grid; grid-template-columns: 320px 1fr; background: linear-gradient(180deg, #f8faff 0%, #f5f7fb 100%); overflow: hidden; }
.sidebar { background: rgba(251,252,255,.92); backdrop-filter: blur(18px); border-right: 1px solid var(--border-soft); padding: 20px 18px; display: flex; flex-direction: column; gap: 16px; min-height: 0; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { width: 44px; height: 44px; border-radius: 14px; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; display: grid; place-items: center; font-size: 20px; font-weight: 700; }
.brand h1 { margin: 0; font-size: 18px; }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

.sidebar-section { display: grid; gap: 8px; }
.sidebar-section.grow { flex: 1 1 auto; min-height: 0; }
.section-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px;
  margin-bottom: 0;
  min-height: 20px;
}
.section-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 7px;
  border-radius: 999px;
  background: linear-gradient(180deg, #eef2ff 0%, #f5f3ff 100%);
  color: #6366f1;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid rgba(99,102,241,.12);
  line-height: 1.2;
}
.field-label { color: var(--muted); font-size: 12px; }
.key-row { display: grid; grid-template-columns: 1fr 40px; gap: 8px; }

input, select, textarea { width: 100%; border: 1px solid var(--border); border-radius: 14px; background: #fff; color: var(--text); padding: 12px 14px; outline: none; }
textarea { min-height: 108px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99,102,241,.12); }

button { border: 1px solid transparent; cursor: pointer; }
.primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; border-radius: 14px; padding: 12px 16px; font-weight: 700; box-shadow: 0 16px 32px -18px rgba(99,102,241,.55); }
.secondary { background: #fff; border-color: var(--border); color: var(--text); border-radius: 14px; padding: 11px 14px; }
.secondary:hover, .icon-btn:hover { border-color: #c7d2fe; color: var(--primary); }
.full, .ghost-full { width: 100%; }
.ghost-full { background: #eef2ff; color: var(--primary); border-radius: 14px; padding: 12px 16px; font-weight: 700; }
.icon-btn { background: #fff; border: 1px solid var(--border); border-radius: 12px; width: 40px; height: 40px; display: grid; place-items: center; }
.hint { color: var(--muted); font-size: 12px; }

.model-card { border: 1px solid var(--border); background: linear-gradient(180deg, #ffffff 0%, #fafbff 100%); border-radius: 16px; padding: 12px 14px; display: grid; gap: 4px; box-shadow: 0 10px 24px -20px rgba(15,23,42,.18); }
.model-card span { color: var(--muted); font-size: 12px; }
.conversation-list {
  display: grid;
  gap: 10px;
  overflow: auto;
  padding-right: 6px;
  align-content: start;
  flex: 1 1 auto;
  min-height: 0;
}
.conversation-item {
  position: relative;
  border: 1px solid var(--border-soft);
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
  border-radius: 18px;
  padding: 13px 14px 12px;
  cursor: pointer;
  text-align: left;
  transition: all .22s ease;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.conversation-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: transparent;
  transition: background .22s ease;
}
.conversation-item:hover {
  border-color: #c7d2fe;
  transform: translateY(-1px);
  box-shadow: 0 18px 32px -24px rgba(99,102,241,.18);
}
.conversation-item:hover::before {
  background: rgba(99,102,241,.35);
}
.conversation-item.active {
  border-color: rgba(99,102,241,.36);
  background: linear-gradient(180deg, #eef2ff 0%, #f7f4ff 100%);
  box-shadow: 0 18px 34px -22px rgba(99,102,241,.28);
}
.conversation-item.active::before {
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
}
.conversation-item .title {
  font-weight: 700;
  color: #1f2937;
  line-height: 1.35;
  font-size: 13px;
  padding-right: 8px;
}
.conversation-item .meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #6b7280;
  margin-top: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.75);
  border: 1px solid rgba(229,231,235,.8);
}

.workspace { display: grid; grid-template-rows: auto auto auto 1fr auto; height: 100vh; min-height: 0; overflow: hidden; }
.workspace-header { padding: 16px 24px 6px; display: grid; grid-template-columns: minmax(280px, 1fr) minmax(720px, auto); align-items: start; gap: 16px; }
.workspace-header h2 { margin: 0; font-size: 22px; }
.workspace-header p { margin: 4px 0 0; color: var(--muted); }
.workspace-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.workspace-toolbar {
  margin: 0 24px 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-soft);
}
.workspace-toolbar-inline {
  margin: 0;
  width: 100%;
}
.workspace-toolbar-top {
  justify-self: end;
  align-self: start;
  min-width: min(100%, 980px);
}
.workspace-toolbar-top .toolbar-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.workspace-toolbar-top .toolbar-label {
  white-space: nowrap;
}
.toolbar-group {
  display: grid;
  gap: 2px;
}
.toolbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toolbar-actions .secondary {
  padding: 9px 12px;
}
.toolbar-label {
  font-size: 12px;
  color: var(--muted);
}
.toolbar-select {
  min-width: 210px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
  box-shadow: none;
}
.toolbar-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
}

.operation-status {
  margin: 0 24px 8px;
  padding: 12px 14px;
  border: 1px solid #dbe2ff;
  background: linear-gradient(180deg, #f8faff 0%, #eef2ff 100%);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
}
.operation-status.hidden { display: none; }
.operation-status-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}
.operation-status-row strong { font-size: 14px; }
.operation-status-row span { color: var(--muted); font-size: 12px; }
.operation-progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(99,102,241,.14);
  overflow: hidden;
}
.operation-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  transition: width .25s ease;
}

.workspace-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  padding: 0 24px 12px;
  align-items: start;
  min-height: 0;
  overflow: hidden;
}
.message-stream-shell {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--border-soft);
  background: rgba(255,255,255,.76);
  border-radius: 20px;
  padding: 12px 16px 0;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}
.message-stream-head {
  padding-bottom: 8px;
}
.message-stream-head h3 {
  margin: 2px 0 0;
  font-size: 15px;
}
.message-list {
  padding: 4px 2px 12px 0;
  overflow: auto;
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 0;
}
.message-list > .message-card:last-child {
  margin-bottom: 0;
}
.message-card { background: var(--panel); border: 1px solid var(--border-soft); border-radius: 16px; padding: 10px 12px; box-shadow: var(--shadow-soft); max-width: min(880px, 100%); }
.message-card.user { background: linear-gradient(135deg, #eef2ff, #f5f3ff); margin-left: auto; }
.message-role { font-size: 11px; color: var(--muted); margin-bottom: 4px; font-weight: 700; letter-spacing: .02em; }
.message-content { white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.message-progress {
  margin-top: 10px;
}
.message-progress-track {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(99,102,241,.14);
}
.message-progress-bar {
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--primary-2), #7c3aed);
  background-size: 200% 100%;
  animation: progress-slide 1.2s linear infinite;
}
@keyframes progress-slide {
  0% { transform: translateX(-35%); background-position: 0% 50%; }
  100% { transform: translateX(180%); background-position: 100% 50%; }
}
.image-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 14px; }
.image-tile { border: 1px solid var(--border-soft); border-radius: 18px; overflow: hidden; background: #fff; box-shadow: var(--shadow-soft); }
.image-tile img { width: 100%; display: block; aspect-ratio: 1 / 1; object-fit: cover; cursor: zoom-in; }
.image-actions { padding: 12px; display: flex; gap: 8px; }

.composer-shell {
  position: sticky;
  bottom: 0;
  z-index: 20;
  margin: 0 16px 16px;
  border: 1px solid var(--border-soft);
  background: rgba(255,255,255,.98);
  backdrop-filter: blur(20px);
  padding: 12px;
  box-shadow: 0 -8px 30px -18px rgba(15,23,42,.12), 0 12px 26px -24px rgba(15,23,42,.12);
  border-radius: 18px;
}
.composer-shell::before {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(99,102,241,.22), transparent);
}
.composer-shell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  min-height: 0;
}
.composer-top-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  justify-content: flex-end;
}
.role-top-field {
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.field.role-top-field {
  display: flex;
  align-items: center;
  gap: 10px;
}
.role-top-field label {
  margin: 0;
  white-space: nowrap;
}
.role-top-field select {
  flex: 1;
}
.composer-shell-title .toolbar-label { display: none; }
.composer-shell-head h3 {
  margin: 0;
  font-size: 13px;
  line-height: 1.2;
}
.mode-tabs { display: flex; gap: 10px; margin-bottom: 14px; }
.mode-tabs-floating {
  align-self: center;
  padding: 3px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  box-shadow: 0 12px 24px -18px rgba(15,23,42,.18);
}
.mode-tab { border: 1px solid transparent; background: #fff; border-radius: 999px; padding: 7px 13px; font-weight: 700; color: var(--muted); }
.mode-tab.active { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; border-color: var(--primary); }
.composer-panel {
  display: none;
  gap: 8px;
  border: 1px solid var(--border-soft);
  background: linear-gradient(180deg, #ffffff 0%, #fcfcff 100%);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: none;
}
.composer-panel.active { display: grid; }
.composer-panel .field select,
.composer-panel .field input,
.composer-panel textarea {
  background: #fff;
}
.composer-panel-head.compact h3 { margin: 0; font-size: 15px; }
.composer-panel-head.compact p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.composer-grid {
  display: grid;
  gap: 10px;
  align-items: start;
}
.composer-grid-chat {
  grid-template-columns: 220px minmax(0, 1fr);
}
.composer-grid.single-column {
  grid-template-columns: 1fr;
}
.composer-grid-image {
  grid-template-columns: minmax(460px, 1fr) minmax(560px, 680px);
  align-items: end;
}
.composer-main-input {
  min-width: 0;
}
.composer-main-input textarea {
  width: 100%;
  min-height: 80px;
}
.composer-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.composer-status-inline {
  display: grid;
  gap: 2px;
}
.composer-status-inline strong {
  font-size: 13px;
  color: #1f2937;
}
.inline-hint { color: var(--muted); font-size: 12px; }
.image-controls { display: grid; grid-template-columns: 100px minmax(220px, 1fr) 220px; gap: 10px; align-items: end; }
.field { display: grid; gap: 8px; }
.field label { color: var(--muted); font-size: 12px; }
.reference-list { display: none; grid-template-columns: repeat(auto-fit, minmax(78px, 78px)); gap: 8px; }
.reference-list:not(:empty) { display: grid; margin-top: 0; padding: 0 2px 2px; }
.reference-thumb {
  position: relative;
  width: 78px;
  height: 78px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: 0 10px 20px -18px rgba(15,23,42,.2);
}
.reference-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.reference-thumb-name {
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 5px;
  padding: 3px 5px;
  border-radius: 10px;
  background: rgba(17,24,39,.62);
  color: #fff;
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prompt-panel {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #fafbff 100%);
  border-radius: 20px;
  padding: 12px;
  display: grid;
  gap: 10px;
}
.insight-panel {
  position: sticky;
  top: 0;
  border: 1px solid rgba(99,102,241,.10);
  background: linear-gradient(180deg, rgba(255,255,255,.98) 0%, #f8faff 100%);
  border-radius: 24px;
  padding: 12px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  align-content: start;
  gap: 10px;
  box-shadow: var(--shadow-soft);
  min-height: 520px;
  max-height: calc(100vh - 220px);
  overflow: hidden;
}
.rich-content h1,
.rich-content h2,
.rich-content h3,
.rich-content h4 {
  margin: 0 0 6px;
  line-height: 1.28;
}
.rich-content p {
  margin: 0 0 6px;
}
.rich-content p:last-child,
.rich-content ul:last-child,
.rich-content ol:last-child,
.rich-content blockquote:last-child,
.rich-content pre:last-child {
  margin-bottom: 0;
}
.rich-content ul,
.rich-content ol {
  margin: 0 0 6px 18px;
  padding: 0;
}
.rich-content pre {
  margin: 6px 0;
  padding: 8px 10px;
  border-radius: 12px;
  background: #0f172a;
  color: #e5eefc;
  overflow: auto;
}
.rich-content code {
  font-family: Consolas, "SFMono-Regular", monospace;
}
.rich-content :not(pre) > code {
  padding: 2px 6px;
  border-radius: 8px;
  background: #eef2ff;
  color: #4338ca;
}
.rich-content blockquote {
  margin: 6px 0;
  padding: 8px 10px;
  border-left: 3px solid #c7d2fe;
  background: #f8faff;
  border-radius: 0 12px 12px 0;
  color: #475569;
}
.rich-content .katex-display {
  margin: 6px 0;
  overflow-x: auto;
  overflow-y: hidden;
}
.insight-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: auto;
  min-height: 0;
  padding-bottom: 0;
  border-bottom: 0;
}
.insight-panel-head h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}
.insight-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(99,102,241,.08);
  color: #6366f1;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(99,102,241,.12);
}
.insight-panel-desc {
  display: none;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.idea-progress {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(99,102,241,.14);
  border-radius: 14px;
  background: linear-gradient(180deg, #f8faff 0%, #f3f5ff 100%);
}
.idea-progress.hidden { display: none; }
.preset-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.preset-select {
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 12px;
  font-size: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
}
.preset-shuffle-btn {
  padding: 7px 10px;
  border-radius: 12px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
}
.idea-progress-text {
  font-size: 12px;
  color: #6366f1;
  font-weight: 700;
}
.idea-progress-track {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(99,102,241,.14);
}
.idea-progress-bar {
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--primary-2), #7c3aed);
  background-size: 200% 100%;
  animation: progress-slide 1.2s linear infinite;
}
.prompt-grid-side {
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: auto;
  grid-template-columns: 1fr;
  align-content: start;
  grid-auto-rows: auto;
}
.prompt-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.prompt-panel-head strong {
  display: block;
  font-size: 14px;
}
.prompt-action-btn {
  padding: 6px 10px;
  border-radius: 10px;
  border-color: rgba(99,102,241,.16);
  background: linear-gradient(180deg, #ffffff 0%, #f5f3ff 100%);
  color: #4f46e5;
  font-weight: 700;
  box-shadow: 0 10px 24px -20px rgba(99,102,241,.34);
}
.prompt-action-btn:hover {
  border-color: rgba(99,102,241,.28);
  background: linear-gradient(180deg, #eef2ff 0%, #f5f3ff 100%);
  color: #4338ca;
}
.prompt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  max-height: 120px;
  overflow: auto;
  padding-right: 4px;
}
.prompt-grid.prompt-grid-side {
  height: 100%;
  max-height: none;
  grid-template-columns: 1fr;
  align-content: start;
  grid-auto-rows: auto;
}
.prompt-tag {
  text-align: left;
  padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #fcfcff 100%);
  border: 1px solid rgba(226,232,240,.95);
  color: #374151;
  line-height: 1.65;
  min-height: 0;
  font-size: 11px;
  transition: all .2s ease;
  box-shadow: 0 12px 24px -22px rgba(15,23,42,.18);
  display: grid;
  gap: 5px;
}
.prompt-tag-title {
  display: block;
  color: #4f46e5;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
}
.prompt-tag:hover {
  border-color: rgba(99,102,241,.28);
  background: linear-gradient(180deg, #f8faff 0%, #f5f3ff 100%);
  color: #312e81;
  transform: translateY(-1px);
  box-shadow: 0 20px 32px -24px rgba(99,102,241,.24);
}

.message-card .rich-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  overflow: hidden;
  border-radius: 12px;
}
.message-card .rich-content th,
.message-card .rich-content td {
  border: 1px solid var(--border-soft);
  padding: 8px 10px;
  text-align: left;
}
.message-card .rich-content th {
  background: #f8faff;
}

#chatInput,
#imagePrompt {
  min-height: 76px;
  max-height: 120px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fcfcff 100%);
}

.composer-shell.image-mode {
  padding: 10px 12px;
  border-radius: 24px;
}
.composer-shell.image-mode .role-top-field {
  display: none;
}
.composer-shell.image-mode .composer-shell-head {
  position: static;
  margin: 0 0 8px;
  min-height: 0;
}
.composer-shell.image-mode .composer-top-controls {
  width: 100%;
  justify-content: flex-end;
}
.composer-shell.image-mode .mode-tabs-floating {
  margin-left: auto;
  box-shadow: none;
}
.composer-shell.image-mode .composer-panel-head.compact {
  display: none;
}
.composer-shell.image-mode #imageComposer {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 12px;
  border-radius: 24px;
  background: #fff;
  border: 1px solid rgba(226,232,240,.95);
  box-shadow: 0 16px 38px -30px rgba(15,23,42,.18);
}
.composer-shell.image-mode #referenceList {
  max-height: 92px;
  overflow: auto;
}
.composer-shell.image-mode .composer-status-inline {
  display: none;
}
.composer-shell.image-mode #sendImageBtn {
  min-width: 88px;
}

.composer-shell.image-mode .field-file input[type="file"] {
  height: 42px;
  padding: 8px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-shell.image-mode #imagePrompt {
  min-height: 76px;
  max-height: 160px;
  border: 0;
  box-shadow: none;
  padding: 4px 4px 8px;
  border-radius: 0;
  resize: none;
  background: transparent;
}
.composer-shell.image-mode #imagePrompt:focus {
  border-color: transparent;
  box-shadow: none;
}
.composer-shell.image-mode .image-controls {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
  border-top: 1px solid rgba(226,232,240,.72);
}
.composer-shell.image-mode .image-controls .field {
  gap: 4px;
}
.composer-shell.image-mode .image-controls .field:nth-child(1) {
  width: 104px;
}
.composer-shell.image-mode .image-controls .field:nth-child(2) {
  width: 190px;
}
.composer-shell.image-mode .image-controls .field-file {
  width: min(260px, 100%);
}
.composer-shell.image-mode .image-controls select,
.composer-shell.image-mode .image-controls input {
  height: 42px;
  border-radius: 999px;
  padding: 8px 14px;
}
.composer-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(226,232,240,.72);
}
.composer-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.tool-pill,
.tool-select {
  height: 36px;
  border: 1px solid var(--border);
  background: #fff;
  color: #374151;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  line-height: 1;
  box-shadow: none;
}
.tool-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  white-space: nowrap;
}
.tool-pill:hover,
.tool-select:hover {
  border-color: #c7d2fe;
  color: var(--primary);
}
.tool-select {
  width: auto;
  min-width: 92px;
  max-width: 180px;
}
.size-select {
  min-width: 150px;
}
.visually-hidden-file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.send-round {
  height: 36px;
  border-radius: 999px;
  padding: 0 18px;
  box-shadow: 0 14px 28px -18px rgba(99,102,241,.7);
}

#sendChatBtn,
#sendImageBtn {
  min-width: 140px;
}

.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .42); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 1000; }
.modal.hidden { display: none; }
.modal-card, .preview-card { width: min(720px, 96vw); background: #fff; border-radius: 24px; border: 1px solid rgba(99,102,241,.12); box-shadow: 0 30px 80px -24px rgba(0,0,0,.32); padding: 24px; }
.auth-card { max-width: 520px; }
.modal-head { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.modal-head h3 { margin: 0; font-size: 20px; }
.modal-head p { margin: 6px 0 0; color: var(--muted); }
.modal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

.preview-card { width: auto; max-width: 96vw; max-height: 92vh; padding: 16px; position: relative; }
.preview-card img { max-width: min(1200px, 92vw); max-height: 86vh; display: block; border-radius: 16px; }
.preview-close { position: absolute; top: 12px; right: 12px; background: rgba(255,255,255,.95); }

.toast { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.96); background: rgba(255,255,255,.98); border: 1px solid rgba(99,102,241,.16); border-radius: 22px; padding: 18px 22px; display: flex; gap: 12px; align-items: center; min-width: min(86vw, 340px); max-width: min(92vw, 520px); box-shadow: 0 24px 60px -18px rgba(0,0,0,.24); z-index: 1200; }
.toast.hidden { display: none; }
.toast-icon { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #eef2ff; color: var(--primary); font-weight: 700; flex: 0 0 auto; }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--border); }
  .workspace-header { grid-template-columns: 1fr; }
  .conversation-list { max-height: 220px; }
  .workspace-main { grid-template-columns: 1fr; }
  .insight-panel { position: static; min-height: 320px; max-height: none; }
  .message-stream-shell { min-height: 420px; }
  .prompt-grid-side { max-height: 220px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
}

@media (max-width: 768px) {
  .workspace-header { padding-left: 16px; padding-right: 16px; }
  .workspace-main { padding-left: 16px; padding-right: 16px; }
  .operation-status { margin-left: 16px; margin-right: 16px; }
  .workspace-toolbar { margin-left: 16px; margin-right: 16px; }
  .composer-shell { margin-left: 12px; margin-right: 12px; margin-bottom: 12px; }
  .image-controls, .modal-grid, .composer-grid-chat, .composer-grid-image { grid-template-columns: 1fr; }
  .composer-actions { flex-direction: column; align-items: stretch; }
  .composer-shell-head { flex-direction: column; align-items: stretch; }
  .workspace-toolbar-top .toolbar-group,
  .role-top-field { align-items: stretch; flex-direction: column; gap: 6px; }
  .composer-top-controls { margin-left: 0; width: 100%; flex-direction: column; align-items: stretch; }
  .toolbar-actions { margin-left: 0; width: 100%; justify-content: flex-end; }
  .toolbar-select { min-width: 0; width: 100%; }
  .toolbar-divider { display: none; }
  .message-card { max-width: 100%; }
  .insight-panel-head {
    flex-direction: column;
    align-items: stretch;
  }
  .insight-panel-desc {
    display: block;
    max-width: none;
    white-space: normal;
  }
  .prompt-action-btn {
    width: 100%;
  }
}