:root {
  --bg-main: #191919;
  --bg-sidebar: #202020;
  --bg-hover: rgba(255, 255, 255, 0.055);
  --bg-active: #2c2c2c;
  --bg-user-bubble: #2c2c2c;
  --bg-composer: #252525;
  --bg-popover: #252525;
  --bg-code: #141414;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text-primary: rgba(255, 255, 255, 0.87);
  --text-secondary: rgba(255, 255, 255, 0.56);
  --text-muted: rgba(255, 255, 255, 0.38);
  --accent-blue: #2383e2;
  --accent-blue-hover: #1b74ce;
  --danger: #eb5757;
  --amber: #dfab01;
  --green: #4dab9a;
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%; background: var(--bg-main); color: var(--text-primary);
  font-family: var(--font-sans); font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
.hidden { display: none !important; }
.notion-shell { display: flex; height: 100vh; width: 100vw; background: var(--bg-main); }

.sidebar {
  width: 244px; min-width: 0; flex: 0 0 244px; background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle); display: flex; flex-direction: column;
  padding: 12px 8px 14px; overflow-y: auto; overflow-x: hidden; user-select: none;
  transition: width 260ms cubic-bezier(0.22, 1, 0.36, 1),
              flex-basis 260ms cubic-bezier(0.22, 1, 0.36, 1),
              padding 260ms cubic-bezier(0.22, 1, 0.36, 1),
              opacity 200ms ease,
              border-color 220ms ease;
}
.sidebar-inner {
  width: 228px; display: flex; flex-direction: column;
  transition: opacity 180ms ease, transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
}
.notion-shell.sidebar-collapsed .sidebar {
  width: 0; flex-basis: 0; padding-left: 0; padding-right: 0;
  border-right-color: transparent; opacity: 0; pointer-events: none;
}
.notion-shell.sidebar-collapsed .sidebar-inner {
  opacity: 0; transform: translateX(-14px);
}
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 2px 4px 8px 10px;
}
.sidebar-section-label { font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.sidebar-toggle-btn, .topbar-expand-btn {
  width: 28px; height: 28px; border-radius: 6px; border: 1px solid transparent;
  background: transparent; color: var(--text-secondary);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background 150ms ease, color 150ms ease, opacity 200ms ease, transform 220ms cubic-bezier(0.22, 1, 0.36, 1), width 220ms cubic-bezier(0.22, 1, 0.36, 1);
}
.sidebar-toggle-btn:hover, .topbar-expand-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.topbar-expand-btn {
  opacity: 0; width: 0; overflow: hidden; pointer-events: none; transform: translateX(-6px);
}
.notion-shell.sidebar-collapsed .topbar-expand-btn {
  opacity: 1; width: 28px; pointer-events: auto; transform: translateX(0);
}
.conversation-list { display: flex; flex-direction: column; gap: 2px; }
.conv-item {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 7px 8px 7px 10px;
  border: none; border-radius: 6px; background: transparent; color: var(--text-secondary);
  font-family: inherit; font-size: 14px; text-align: left; cursor: pointer; position: relative;
}
.conv-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.conv-item.active { background: var(--bg-active); color: var(--text-primary); font-weight: 500; }
.conv-icon { flex: 0 0 auto; width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; opacity: 0.85; }
.conv-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-rename-btn {
  flex: 0 0 auto; width: 22px; height: 22px; border: none; border-radius: 5px;
  background: transparent; color: var(--text-muted); display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; transition: opacity 120ms ease, background 120ms ease, color 120ms ease;
}
.conv-item:hover .conv-rename-btn,
.conv-item:focus-within .conv-rename-btn { opacity: 1; }
.conv-rename-btn:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }
.conv-rename-input {
  flex: 1 1 auto; min-width: 0; width: 100%; height: 24px; padding: 0 6px;
  border-radius: 5px; border: 1px solid var(--accent-blue); background: #181818;
  color: var(--text-primary); font-family: inherit; font-size: 13.5px; outline: none;
}
.conv-dot { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; }
.conv-dot.ready { background: var(--green); box-shadow: 0 0 0 2px rgba(77,171,154,0.2); }
.conv-dot.busy { background: var(--accent-blue); box-shadow: 0 0 0 3px rgba(35,131,226,0.25); animation: pulse 1.2s infinite; }
.conv-dot.policy-wait { background: var(--amber); box-shadow: 0 0 0 3px rgba(223,171,1,0.22); animation: pulse 1.2s infinite; }
.conv-dot.offline { background: var(--amber); opacity: 0.85; }
.conv-drag-handle {
  flex: 0 0 auto; width: 12px; height: 16px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted); opacity: 0; cursor: grab; margin-left: -4px; margin-right: -2px;
  transition: opacity 120ms ease, color 120ms ease;
}
.conv-item:hover .conv-drag-handle { opacity: 0.7; }
.conv-drag-handle:hover { opacity: 1 !important; color: var(--text-primary); }
.conv-item.dragging { opacity: 0.42; background: var(--bg-hover); }
.conv-item.drag-over-top { box-shadow: inset 0 2px 0 0 var(--accent-blue); }
.conv-item.drag-over-bottom { box-shadow: inset 0 -2px 0 0 var(--accent-blue); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.workspace { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; height: 100vh; background: var(--bg-main); }
.topbar { height: 46px; flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; padding: 0 18px; }
.topbar-spacer { flex: 1 1 auto; }
.topbar-settings-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0;
  border-radius: 7px; border: 1px solid transparent; background: transparent;
  color: var(--text-secondary); cursor: pointer;
}
.topbar-settings-btn:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); }
.topbar-settings-btn:disabled,
.topbar-settings-btn.locked {
  opacity: 0.34;
  cursor: not-allowed;
  color: var(--text-muted);
}

.notice-banner {
  max-width: 760px; width: calc(100% - 32px); margin: 0 auto 8px; padding: 9px 14px;
  border-radius: 8px; background: rgba(235,87,87,0.12); border: 1px solid rgba(235,87,87,0.3);
  color: #f5a3a3; font-size: 13px;
}
.notice-banner.info { background: rgba(35,131,226,0.12); border-color: rgba(35,131,226,0.3); color: #9ecbff; }

.chat-stream { flex: 1 1 auto; overflow-y: auto; padding: 8px 20px 28px; scroll-behavior: smooth; }
.chat-stream::-webkit-scrollbar, .sidebar::-webkit-scrollbar { width: 8px; }
.chat-stream::-webkit-scrollbar-thumb, .sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }
.chat-container { max-width: 740px; margin: 0 auto; display: flex; flex-direction: column; }
.empty-state { padding: 80px 16px; text-align: center; color: var(--text-secondary); }
.empty-title { font-size: 15px; color: var(--text-secondary); }
.empty-sub { margin-top: 8px; font-size: 13px; color: var(--text-muted); }
.messages-list { display: flex; flex-direction: column; gap: 20px; }
.msg-timestamp-header { text-align: center; font-size: 12px; color: var(--text-muted); margin: 4px 0 6px; }

.msg-row.user { display: flex; flex-direction: column; align-items: flex-end; }
.user-bubble {
  max-width: 78%; padding: 10px 15px; border-radius: 16px; background: var(--bg-user-bubble);
  color: var(--text-primary); font-size: 15px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.msg-row.assistant { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }

.thinking-details { width: 100%; }
.thinking-summary {
  list-style: none; display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px;
  color: var(--text-secondary); cursor: pointer; user-select: none; padding: 3px 6px 3px 2px; border-radius: 5px;
}
.thinking-summary::-webkit-details-marker { display: none; }
.thinking-summary:hover { color: var(--text-primary); background: var(--bg-hover); }
.thinking-summary.streaming { color: var(--text-primary); }
.thinking-summary-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent-blue);
  animation: pulse 1.1s infinite; flex: 0 0 auto;
}
.thinking-chevron { display: inline-flex; transition: transform 0.16s ease; opacity: 0.8; }
.thinking-details[open] .thinking-chevron { transform: rotate(90deg); }
.thinking-body {
  margin-top: 6px; padding: 10px 14px; border-left: 2px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.025); border-radius: 0 6px 6px 0; color: var(--text-secondary);
  font-size: 13.5px; line-height: 1.62; word-break: break-word;
}
.thinking-body p { margin: 0 0 8px; }
.thinking-body p:last-child { margin-bottom: 0; }
.thinking-body ul, .thinking-body ol { padding-left: 20px; margin: 4px 0 8px; }
.thinking-body code {
  font-family: var(--font-mono); font-size: 0.86em;
  background: rgba(255,255,255,0.07); padding: 1px 4px; border-radius: 4px; color: rgba(255,255,255,0.72);
}
.thinking-sep {
  border: none; border-top: 1px dashed rgba(255,255,255,0.1); margin: 10px 0;
}

.assistant-body { width: 100%; color: var(--text-primary); font-size: 15px; line-height: 1.68; word-break: break-word; }
.assistant-body p { margin: 0 0 10px; }
.assistant-body p:last-child { margin-bottom: 0; }
.assistant-body h1, .assistant-body h2, .assistant-body h3, .assistant-body h4 { font-weight: 600; margin: 16px 0 8px; line-height: 1.35; }
.assistant-body h1 { font-size: 1.35em; } .assistant-body h2 { font-size: 1.2em; } .assistant-body h3 { font-size: 1.08em; }
.assistant-body ul, .assistant-body ol { padding-left: 22px; margin: 6px 0 10px; }
.assistant-body li { margin: 3px 0; }
.assistant-body code { font-family: var(--font-mono); font-size: 0.88em; background: rgba(255,255,255,0.08); padding: 2px 5px; border-radius: 4px; color: #eb8c72; }
.assistant-body pre { margin: 0; padding: 12px 14px; background: var(--bg-code); border: none; border-radius: 0; overflow-x: auto; }
.assistant-body pre code { background: transparent; padding: 0; color: var(--text-primary); font-size: 13px; line-height: 1.55; }
.code-block-wrap {
  margin: 10px 0; border-radius: 9px; overflow: hidden;
  border: 1px solid var(--border-subtle); background: var(--bg-code);
}
.code-block-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 12px; background: rgba(255,255,255,0.035); border-bottom: 1px solid var(--border-subtle);
  font-size: 11.5px; color: var(--text-secondary);
}
.code-lang-label { font-family: var(--font-mono); text-transform: lowercase; opacity: 0.85; }
.code-copy-btn {
  border: 1px solid var(--border-subtle); background: rgba(255,255,255,0.04); color: var(--text-secondary);
  border-radius: 5px; padding: 2px 8px; font-size: 11.5px; font-family: inherit; cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.code-copy-btn:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); border-color: var(--border-strong); }
.code-copy-btn.copied { color: var(--green); border-color: rgba(77,171,154,0.45); }
.md-hr { border: none; border-top: 1px solid var(--border-subtle); margin: 14px 0; }
.md-table-wrap {
  margin: 10px 0; width: 100%; overflow-x: auto;
  border: 1px solid var(--border-subtle); border-radius: 8px; background: rgba(255,255,255,0.02);
}
.md-table { width: 100%; border-collapse: collapse; font-size: 13.5px; line-height: 1.5; }
.md-table th, .md-table td {
  padding: 7px 11px; border-bottom: 1px solid var(--border-subtle);
  border-right: 1px solid rgba(255,255,255,0.05); text-align: left; vertical-align: top;
}
.md-table th:last-child, .md-table td:last-child { border-right: none; }
.md-table tr:last-child td { border-bottom: none; }
.md-table th { background: rgba(255,255,255,0.045); font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.md-table td { color: rgba(255,255,255,0.82); }
.thinking-step-title { font-weight: 600; color: rgba(255,255,255,0.78); margin-bottom: 4px; font-size: 13px; }

/* Session file / HTML / PDF / Media artifact cards */
.artifact-card {
  margin: 10px 0; border-radius: 11px; overflow: hidden;
  border: 1px solid var(--border-strong); background: #222222;
  box-shadow: 0 4px 16px rgba(0,0,0,0.22);
}
.artifact-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 12px; background: rgba(255,255,255,0.035); border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}
.artifact-meta { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; }
.artifact-icon {
  width: 28px; height: 28px; border-radius: 7px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(35,131,226,0.16); color: #8ec5ff; font-size: 14px;
}
.artifact-titles { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.artifact-name {
  font-size: 13.5px; font-weight: 500; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.artifact-sub { font-size: 11.5px; color: var(--text-secondary); }
.artifact-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.artifact-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px;
  border-radius: 6px; border: 1px solid var(--border-strong); background: rgba(255,255,255,0.05);
  color: var(--text-primary); font-family: inherit; font-size: 12px; font-weight: 500;
  text-decoration: none !important; cursor: pointer; transition: background 120ms ease, border-color 120ms ease;
}
.artifact-btn:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.24); color: #fff; }
.artifact-btn.primary { background: rgba(35,131,226,0.22); border-color: rgba(35,131,226,0.48); color: #9ecbff; }
.artifact-btn.primary:hover { background: rgba(35,131,226,0.36); color: #fff; }
.artifact-preview-wrap { background: #141414; position: relative; }
.artifact-iframe {
  display: block; width: 100%; height: 420px; border: none; background: #ffffff;
}
.artifact-iframe.pdf-frame { height: 480px; background: #1f1f1f; }
.artifact-video { display: block; width: 100%; max-height: 440px; background: #000; }
.artifact-audio { display: block; width: 100%; padding: 10px 12px; }
.artifact-file-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 8px 0; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: rgba(255,255,255,0.035);
}
.artifact-modal-backdrop {
  position: fixed; inset: 0; z-index: 420; background: rgba(0,0,0,0.8);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.artifact-modal {
  width: min(1160px, 94vw); height: min(860px, 90vh); background: #1e1e1e;
  border: 1px solid var(--border-strong); border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column; box-shadow: 0 24px 64px rgba(0,0,0,0.65);
}
.artifact-modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 16px; background: #252525; border-bottom: 1px solid var(--border-subtle);
}
.artifact-modal-title { font-size: 14px; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.artifact-modal-body { flex: 1 1 auto; min-height: 0; background: #141414; position: relative; }
.artifact-modal-iframe { width: 100%; height: 100%; border: none; background: #fff; }
.artifact-modal-pre {
  width: 100%; height: 100%; margin: 0; padding: 16px 20px; overflow: auto;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.6; color: var(--text-primary);
  white-space: pre-wrap; word-break: break-word; background: #141414;
}
.assistant-body blockquote { margin: 8px 0; padding: 4px 12px; border-left: 3px solid rgba(255,255,255,0.25); color: var(--text-secondary); }
.assistant-body a { color: #6ab0f3; text-decoration: underline; text-underline-offset: 2px; }

/* Notion-style inline citation favicon badges & compact link pills */
.assistant-body a.cite-badge,
.thinking-body a.cite-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin: 0 2px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.13);
  vertical-align: -3px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.85);
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}
.assistant-body a.cite-badge:hover,
.thinking-body a.cite-badge:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.28);
  transform: translateY(-0.5px);
}
.cite-badge + .cite-badge {
  margin-left: 3px;
}
.cite-favicon {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  object-fit: contain;
  display: block;
}
.cite-fallback {
  display: none;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
  color: rgba(255, 255, 255, 0.88);
}
.cite-badge.no-icon .cite-favicon {
  display: none;
}
.cite-badge.no-icon .cite-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cite-badge::after {
  content: attr(data-cite-host);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%) translateY(2px);
  padding: 3px 8px;
  border-radius: 6px;
  background: #2f2f2f;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.92);
  font-size: 11.5px;
  line-height: 1.3;
  white-space: nowrap;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.48);
  opacity: 0;
  pointer-events: none;
  z-index: 60;
  transition: opacity 120ms ease, transform 120ms ease;
}
.cite-badge:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.assistant-body a.cite-pill,
.thinking-body a.cite-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 220px;
  padding: 1px 7px 1px 5px;
  margin: 0 2px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.84);
  font-size: 12.5px;
  line-height: 1.45;
  text-decoration: none;
  vertical-align: baseline;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.assistant-body a.cite-pill:hover,
.thinking-body a.cite-pill:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.26);
  color: #fff;
}
.cite-pill-favicon {
  width: 13px;
  height: 13px;
  border-radius: 2.5px;
  object-fit: contain;
  flex: 0 0 auto;
  display: block;
}
.cite-pill-fallback {
  display: none;
  width: 13px;
  height: 13px;
  border-radius: 2.5px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 9.5px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.cite-pill.no-icon .cite-pill-favicon { display: none; }
.cite-pill.no-icon .cite-pill-fallback { display: inline-flex; }
.cite-pill-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* User & assistant inline image previews (Notion-style, no filename clutter) */
.msg-row.user { gap: 6px; }
.user-img-gallery {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 78%;
}
.assistant-img-gallery {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
  max-width: 100%;
}
.msg-img-card {
  display: block;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  line-height: 0;
  cursor: zoom-in;
  transition: transform 140ms ease, border-color 140ms ease;
}
.msg-img-card:hover {
  border-color: rgba(255, 255, 255, 0.28);
  transform: scale(1.01);
}
.msg-img {
  display: block;
  max-width: 260px;
  max-height: 260px;
  width: auto;
  height: auto;
  object-fit: cover;
}
.user-img-gallery.multi .msg-img,
.assistant-img-gallery.multi .msg-img {
  width: 150px;
  height: 150px;
  object-fit: cover;
}
.msg-file-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.msg-file-chips.only {
  margin-top: 0;
}
.msg-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 240px;
  padding: 3px 9px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
a.msg-file-chip:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* Fullscreen click-to-zoom image lightbox */
.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0, 0, 0, 0.84);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  cursor: zoom-out;
}
.img-lightbox img {
  max-width: 92vw;
  max-height: 90vh;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65);
  object-fit: contain;
  cursor: default;
}

.live-thinking { display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; font-size: 13.5px; color: var(--text-secondary); }
.thinking-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-blue); animation: pulse 1.1s infinite; }

.composer-wrap { flex: 0 0 auto; padding: 6px 20px 20px; }
.composer-box {
  max-width: 740px; margin: 0 auto; background: var(--bg-composer); border: 1px solid var(--border-subtle);
  border-radius: 18px; padding: 12px 14px 10px; display: flex; flex-direction: column; gap: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}
.composer-box:focus-within { border-color: rgba(255,255,255,0.18); }
.composer-box.locked {
  opacity: 0.62; border-color: rgba(255,255,255,0.06); cursor: not-allowed;
}
.composer-box.locked .composer-input,
.composer-box.locked .icon-btn {
  cursor: not-allowed;
}
.composer-box.drag-over {
  border-color: var(--accent-blue);
  background: rgba(35, 131, 226, 0.09);
  box-shadow: 0 0 0 2px rgba(35, 131, 226, 0.25), 0 4px 20px rgba(0, 0, 0, 0.25);
}
.attachment-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-top: 2px; }
.att-img-card {
  position: relative; width: 72px; height: 72px; flex: 0 0 auto;
  border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
}
.att-img-thumb {
  width: 100%; height: 100%; object-fit: cover; border-radius: 11px; display: block;
}
.att-img-remove {
  position: absolute; top: -7px; right: -7px; width: 20px; height: 20px;
  border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(24, 24, 24, 0.94); color: rgba(255, 255, 255, 0.9);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; line-height: 1; cursor: pointer; padding: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  transition: background 120ms ease, transform 120ms ease;
}
.att-img-remove:hover { background: #383838; color: #fff; transform: scale(1.06); }
.att-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 220px; padding: 6px 10px;
  border-radius: 10px; background: rgba(255,255,255,0.07); border: 1px solid var(--border-subtle); font-size: 12.5px;
}
.att-chip-thumb { width: 22px; height: 22px; object-fit: cover; border-radius: 4px; }
.att-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-chip-remove { border: none; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; }
.composer-input {
  width: 100%; min-height: 28px; max-height: 180px; resize: none; border: none; outline: none;
  background: transparent; color: var(--text-primary); font-family: inherit; font-size: 15px; line-height: 1.5; overflow-y: auto;
}
.composer-input::placeholder { color: var(--text-muted); }
.composer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.composer-left, .composer-right { display: flex; align-items: center; gap: 8px; }
.plus-menu-anchor { position: relative; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 50%; border: none; background: transparent;
  color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon-btn:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.plus-menu {
  position: absolute; left: 0; bottom: 38px; min-width: 180px; padding: 5px; border-radius: 10px;
  background: var(--bg-popover); border: 1px solid var(--border-strong); box-shadow: 0 12px 32px rgba(0,0,0,0.45); z-index: 50;
}
.plus-menu-item {
  width: 100%; display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: none;
  border-radius: 7px; background: transparent; color: var(--text-primary); font-family: inherit; font-size: 13.5px; cursor: pointer; text-align: left;
}
.plus-menu-item:hover { background: var(--bg-hover); }

.readonly-model-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 8px;
  color: var(--text-secondary); font-size: 13px; user-select: none; cursor: default; opacity: 0.85;
}

.send-btn {
  min-width: 30px; height: 30px; border-radius: 999px; border: none; background: var(--accent-blue);
  color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 4px; cursor: pointer;
  padding: 0; transition: background 0.15s ease, opacity 0.15s ease; font-family: inherit;
}
.send-btn:hover:not(:disabled) { background: var(--accent-blue-hover); }
.send-btn:disabled { background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.35); cursor: not-allowed; }
.send-btn.queue-mode {
  width: auto; padding: 0 11px; background: rgba(35,131,226,0.22);
  border: 1px solid rgba(35,131,226,0.52); color: #9ecbff; font-size: 12.5px; font-weight: 600;
}
.send-btn.queue-mode:hover:not(:disabled) {
  background: rgba(35,131,226,0.36); border-color: rgba(35,131,226,0.75); color: #fff;
}
.send-btn.queue-mode:disabled {
  background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.12); color: rgba(255,255,255,0.32);
}
.send-btn-label { white-space: nowrap; }

.turn-status-panel {
  max-width: 740px; margin: 0 auto 8px; display: flex; flex-direction: column; gap: 6px;
}
.policy-wait-banner {
  padding: 8px 13px; border-radius: 10px; display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; line-height: 1.4; font-variant-numeric: tabular-nums;
  background: rgba(223,171,1,0.11); border: 1px solid rgba(223,171,1,0.32); color: #f5d87a;
}
.policy-wait-banner.executing {
  background: rgba(35,131,226,0.12); border-color: rgba(35,131,226,0.34); color: #9ecbff;
}
.policy-wait-dot {
  width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto;
  animation: pulse 1.1s infinite;
}
.queued-list-box {
  padding: 8px 12px; border-radius: 10px; background: rgba(35,131,226,0.08);
  border: 1px solid rgba(35,131,226,0.26); display: flex; flex-direction: column; gap: 6px;
}
.queued-list-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 12px; color: #9ecbff; font-weight: 500;
}
.queue-cancel-all-btn {
  border: none; background: transparent; color: rgba(255,255,255,0.62); font-family: inherit;
  font-size: 12px; cursor: pointer; padding: 2px 6px; border-radius: 5px;
}
.queue-cancel-all-btn:hover:not(:disabled) { background: rgba(255,255,255,0.08); color: #fff; }
.queue-cancel-all-btn:disabled { opacity: 0.45; cursor: wait; }
.queued-list-items { display: flex; flex-direction: column; gap: 5px; }
.queued-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px;
  background: rgba(255,255,255,0.045); border: 1px solid rgba(255,255,255,0.07); font-size: 13px;
}
.queued-item-index {
  flex: 0 0 auto; font-size: 11px; font-weight: 600; color: #8ec5ff;
  background: rgba(35,131,226,0.18); padding: 1px 6px; border-radius: 999px;
}
.queued-item-text {
  flex: 1 1 auto; min-width: 0; color: var(--text-primary); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.queued-item-cancel {
  flex: 0 0 auto; border: none; background: transparent; color: var(--text-secondary);
  font-family: inherit; font-size: 12px; cursor: pointer; padding: 2px 7px; border-radius: 5px;
}
.queued-item-cancel:hover:not(:disabled) { background: rgba(235,87,87,0.18); color: #ffb3b3; }
.queued-item-cancel:disabled { opacity: 0.45; cursor: wait; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65); display: flex;
  align-items: center; justify-content: center; z-index: 200; padding: 20px;
}
.settings-modal {
  width: 100%; max-width: 580px; background: #202020; border: 1px solid var(--border-strong);
  border-radius: 14px; box-shadow: 0 24px 64px rgba(0,0,0,0.6); overflow: visible;
}
.settings-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border-subtle); }
.settings-title-group { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.settings-breadcrumb { color: var(--text-secondary); }
.settings-sep { color: var(--text-muted); }
.settings-title-group h2 { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.settings-header-actions { display: flex; align-items: center; gap: 8px; }
.save-btn {
  height: 30px; padding: 0 14px; border: none; border-radius: 6px; background: var(--accent-blue);
  color: #fff; font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.save-btn:hover:not(:disabled) { background: var(--accent-blue-hover); }
.save-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.modal-close-btn { width: 28px; height: 28px; border: none; border-radius: 6px; background: transparent; color: var(--text-secondary); font-size: 14px; cursor: pointer; }
.modal-close-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.settings-body { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.settings-card { background: #252525; border: 1px solid var(--border-subtle); border-radius: 10px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--border-subtle); }
.settings-row:last-child { border-bottom: none; }
.settings-row-info { display: flex; flex-direction: column; gap: 2px; }
.settings-row-label { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.settings-row-desc { font-size: 12px; color: var(--text-secondary); }

.dropdown-wrap { position: relative; }
.notion-select-trigger {
  min-width: 170px; height: 32px; padding: 0 10px; border-radius: 6px;
  border: 1px solid var(--border-strong); background: #2b2b2b; color: var(--text-primary);
  font-family: inherit; font-size: 13.5px; display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer;
}
.notion-select-trigger:hover { background: #323232; }
.notion-dropdown-menu {
  position: absolute; right: 0; top: 38px; width: 268px; max-height: 320px; overflow-y: auto;
  padding: 6px; border-radius: 10px; background: #262626; border: 1px solid var(--border-strong);
  box-shadow: 0 16px 40px rgba(0,0,0,0.55); z-index: 300;
}
.model-group-header { font-size: 11px; font-weight: 600; color: var(--text-muted); padding: 8px 8px 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.model-option-btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 9px; border: none; border-radius: 6px; background: transparent; color: var(--text-primary);
  font-family: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
}
.model-option-btn:hover { background: var(--bg-hover); }
.model-option-left { display: flex; flex-direction: column; gap: 1px; }
.model-option-title { display: inline-flex; align-items: center; gap: 6px; }
.model-badge { font-size: 10.5px; padding: 1px 5px; border-radius: 4px; background: rgba(35,131,226,0.2); color: #7cc0ff; }
.model-option-sub { font-size: 11.5px; color: var(--text-secondary); }

.effort-segmented { display: inline-flex; gap: 4px; background: #1c1c1c; padding: 3px; border-radius: 7px; border: 1px solid var(--border-subtle); }
.effort-pill { border: none; border-radius: 5px; padding: 5px 10px; background: transparent; color: var(--text-secondary); font-family: inherit; font-size: 12.5px; cursor: pointer; }
.effort-pill:hover { color: var(--text-primary); }
.effort-pill.active { background: #333333; color: var(--text-primary); font-weight: 600; }

.locked-toggle-wrap { display: inline-flex; align-items: center; gap: 10px; }
.lock-tag { font-size: 12px; color: var(--text-muted); }
.notion-switch {
  width: 36px; height: 20px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: #3a3a3a; position: relative; padding: 0; cursor: not-allowed; opacity: 0.65;
}
.notion-switch-thumb { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: rgba(255,255,255,0.72); }

.settings-hint { padding: 9px 12px; border-radius: 8px; background: rgba(223,171,1,0.12); border: 1px solid rgba(223,171,1,0.28); color: #f3d266; font-size: 12.5px; }
.settings-feedback { padding: 9px 12px; border-radius: 8px; font-size: 12.5px; }
.settings-feedback.ok { background: rgba(77,171,154,0.14); border: 1px solid rgba(77,171,154,0.3); color: #7ee0ce; }
.settings-feedback.err { background: rgba(235,87,87,0.14); border: 1px solid rgba(235,87,87,0.3); color: #f5a3a3; }

@media (max-width: 760px) { .sidebar { width: 190px; min-width: 190px; } }
