:root {
  --ink: #172033;
  --muted: #718096;
  --line: #e5eaf1;
  --panel: #f7f9fc;
  --brand: #3759db;
  --brand-dark: #2946bc;
  --accent: #9bf2d0;
  --danger: #d94a5a;
  --research-width: 350px;
  --shadow: 0 22px 60px rgba(26, 39, 72, .12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #eef2f8;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; background: linear-gradient(135deg, #17234c, #3b59d4 72%); }
.auth-copy { color: white; padding: clamp(48px, 8vw, 120px); display: flex; flex-direction: column; justify-content: center; background: radial-gradient(circle at 20% 20%, rgba(155,242,208,.25), transparent 30%); }
.brand-mark { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; font-weight: 900; background: var(--accent); color: #183a43; box-shadow: 0 12px 28px rgba(9, 31, 61, .22); }
.brand-mark.small { width: 36px; height: 36px; border-radius: 11px; font-size: 12px; }
.eyebrow { font-size: 11px; letter-spacing: .16em; font-weight: 800; text-transform: uppercase; margin: 24px 0 10px; opacity: .75; }
.auth-copy h1 { font-size: clamp(42px, 6vw, 78px); line-height: .98; letter-spacing: -.055em; margin: 0 0 28px; }
.auth-copy > p:not(.eyebrow) { max-width: 620px; font-size: 18px; line-height: 1.7; opacity: .82; }
.feature-pills { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.feature-pills span { padding: 9px 14px; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; background: rgba(255,255,255,.08); }
.auth-card { align-self: center; justify-self: center; width: min(440px, 88%); background: white; border-radius: 26px; padding: 34px; box-shadow: var(--shadow); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 12px; background: var(--panel); margin-bottom: 28px; }
.tab { border: 0; background: transparent; color: var(--muted); padding: 12px; border-radius: 9px; font-weight: 700; }
.tab.active { background: white; color: var(--ink); box-shadow: 0 4px 14px rgba(32,43,68,.08); }
.auth-form { display: grid; gap: 17px; }
label { color: #44506a; font-size: 13px; font-weight: 700; }
input, textarea { width: 100%; margin-top: 7px; border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; color: var(--ink); background: white; outline: none; transition: .2s; }
input:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(55,89,219,.1); }
.primary, .send-button { border: 0; color: white; background: var(--brand); border-radius: 11px; padding: 12px 18px; font-weight: 800; }
.primary:hover, .send-button:hover { background: var(--brand-dark); }
.primary:disabled, .send-button:disabled, .ghost-button:disabled { cursor: not-allowed; opacity: .5; }
.wide { width: 100%; margin-top: 8px; }
.hint { font-size: 12px; color: var(--muted); margin: -8px 0 0; line-height: 1.5; }
.form-error { color: var(--danger); background: #fff1f2; padding: 11px 12px; border-radius: 9px; font-size: 13px; }
.studio { height: 100vh; min-height: 0; display: grid; grid-template-columns: 232px 300px minmax(0, 1fr) var(--research-width); background: white; overflow: hidden; transition: grid-template-columns .2s ease; }
.studio.panel-collapsed { grid-template-columns: 232px 300px minmax(0, 1fr) 0; }
.workspace-rail { background: #17213c; color: #dfe6f7; padding: 18px 14px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.rail-brand { display: flex; align-items: center; gap: 11px; padding: 0 7px 21px; }
.rail-section-title { display: flex; align-items: center; justify-content: space-between; margin: 8px 7px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: #8290ad; }
.icon-button { display: inline-grid; place-items: center; border: 0; width: 32px; height: 32px; border-radius: 9px; background: transparent; color: inherit; }
.icon-button:hover { background: rgba(125,143,183,.15); }
.icon-button.danger { color: var(--danger); }
.workspace-list, .conversation-list, .file-list { display: grid; grid-auto-rows: max-content; align-content: start; gap: 5px; min-height: 0; overflow-y: auto; }
.workspace-list { flex: 1 1 auto; }
.workspace-item, .conversation-item { width: 100%; text-align: left; border: 0; border-radius: 10px; padding: 11px 12px; color: inherit; background: transparent; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workspace-item:hover, .workspace-item.active { background: rgba(124,148,211,.18); }
.workspace-item.active { color: white; box-shadow: inset 3px 0 var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
body.i18n-pending { visibility: hidden; }
.language-switcher { display: block; margin: 10px 5px 0; }
.language-switcher select { width: 100%; border: 1px solid rgba(255,255,255,.14); border-radius: 9px; padding: 7px 9px; background: rgba(125,143,183,.12); color: #dfe6f7; font: inherit; font-size: 12px; }
.language-switcher select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.profile-card { border-top: 1px solid rgba(255,255,255,.1); padding: 15px 5px 0; display: grid; grid-template-columns: 38px 1fr 32px; gap: 9px; align-items: center; }
.profile-card small { display: block; color: #8492af; max-width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: #405891; color: white; font-weight: 800; }
.conversation-panel { background: var(--panel); border-right: 1px solid var(--line); padding: 20px 15px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.conversation-panel header { display: flex; justify-content: space-between; align-items: flex-start; padding: 0 5px 12px; }
.conversation-panel header .eyebrow { margin: 0 0 5px; color: var(--muted); }
.conversation-panel h2, .chat-header h2 { margin: 0; font-size: 17px; }
.new-chat-button { border: 1px solid #d9e0ee; background: white; color: var(--brand); border-radius: 10px; padding: 11px 12px; font-weight: 800; text-align: left; margin-bottom: 12px; }
.conversation-list { flex: 1 1 auto; min-height: 0; }
.conversation-item { color: #515d75; display: flex; align-items: center; gap: 8px; }
.conversation-title-text { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-run-badge { flex: 0 0 auto; display: inline-grid; place-items: center; }
.conversation-run-badge .spinner { width: 12px; height: 12px; border-width: 1.5px; }
.conversation-run-badge.unread { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px rgba(55,89,219,.12); }
.conversation-item:hover, .conversation-item.active { background: #e8edf7; color: var(--ink); }
.new-chat-button:disabled { cursor: wait; opacity: .6; }
.file-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 6px; align-items: center; padding: 8px; border-radius: 9px; background: white; border: 1px solid var(--line); }
.file-thumbnail { width: 34px; height: 34px; border-radius: 7px; object-fit: cover; background: #eef2f7; }
.file-row button.file-name { min-width: 0; border: 0; background: transparent; text-align: left; overflow: hidden; }
.file-name strong, .file-name small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.file-name small { color: var(--muted); }
.chat-panel { width: 100%; height: 100%; min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; position: relative; background: #fff; overflow: hidden; }
.chat-header { height: 72px; padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.chat-header-actions { display: flex; align-items: center; gap: 8px; }
.chat-header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #2dc98c; margin-right: 6px; }
.ghost-button { border: 1px solid var(--line); color: #55627a; background: white; border-radius: 9px; padding: 9px 13px; font-weight: 700; }
.header-menu-button { width: 40px; height: 40px; border: 1px solid var(--line); color: #55627a; background: white; }
.header-menu-button:hover { color: var(--brand); border-color: #c9d3ef; background: #f6f8ff; }
.header-menu-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.empty-state { align-self: center; justify-self: center; min-width: 0; min-height: 0; max-width: 720px; padding: 32px; text-align: center; overflow-y: auto; }
.orb { width: 74px; height: 74px; display: grid; place-items: center; margin: auto; border-radius: 24px; color: white; font-weight: 900; font-size: 26px; background: linear-gradient(145deg, #3356dc, #7b53d8); box-shadow: 0 18px 38px rgba(55,89,219,.25); }
.empty-state h2 { font-size: 30px; letter-spacing: -.03em; margin-bottom: 10px; }
.empty-state p { color: var(--muted); }
.suggestions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 28px; }
.suggestions button { border: 1px solid var(--line); background: white; color: #4d5971; text-align: left; border-radius: 12px; padding: 13px; line-height: 1.4; }
.suggestions button:hover { border-color: var(--brand); color: var(--brand); }
.message-list { width: 100%; height: 100%; min-width: 0; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 28px clamp(20px, 7vw, 100px); }
.conversation-loading { min-height: min(440px, 65vh); display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 13px; }
.conversation-loading .spinner { width: 18px; height: 18px; }
.conversation-load-error { width: min(520px, 100%); margin: 60px auto; display: grid; gap: 5px; padding: 15px 17px; border: 1px solid #f0cbd0; border-radius: 12px; background: #fff5f6; color: #8f3946; font-size: 13px; }
.conversation-load-error span { color: #a75864; overflow-wrap: anywhere; }
.message { width: 100%; min-width: 0;  margin: 0 auto 25px; display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: start; gap: 12px; }
.message.user { grid-template-columns: 1fr; justify-items: end; }
.user-message-content { width: fit-content; max-width: 75%; min-width: 0; display: flex; flex-direction: column; align-items: flex-end; }
.message.user .message-body { width: fit-content; max-width: 100%; overflow-wrap: anywhere; background: #edf1ff; border-radius: 16px 16px 3px 16px; padding: 13px 16px; }
.message-attachments { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 6px; max-width: 100%; margin-bottom: 7px; }
.message-attachment { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: min(360px, 100%); padding: 6px 10px; border: 1px solid #dce3f2; border-radius: 10px; background: #fff; color: #52617b; font: inherit; font-size: 12px; line-height: 1.3; box-shadow: 0 2px 8px rgba(43,55,85,.05); }
button.message-attachment { cursor: pointer; }
button.message-attachment:hover { border-color: #9cace1; color: var(--brand); background: #f8faff; }
.message-attachment > span:last-child { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.message-attachment.missing { color: var(--muted); background: #f7f8fb; }
.message-artifacts { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.message-artifacts:empty { display: none; }
.message-artifact { display: flex; align-items: center; gap: 10px; min-width: 220px; max-width: min(420px, 100%); padding: 10px 12px; border: 1px solid #d9e1f2; border-radius: 12px; background: linear-gradient(135deg, #fff, #f7f9ff); color: #35425a; text-align: left; box-shadow: 0 4px 12px rgba(43,55,85,.06); cursor: pointer; }
.message-artifact:hover { border-color: #91a5e7; background: #f5f8ff; color: var(--brand); }
.message-artifact-icon { width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center; border-radius: 9px; background: #e9eeff; color: var(--brand); font-size: 17px; font-weight: 800; }
.message-artifact-meta { min-width: 0; display: grid; gap: 2px; }
.message-artifact-meta strong, .message-artifact-meta small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.message-artifact-meta strong { font-size: 13px; }
.message-artifact-meta small { color: var(--muted); font-size: 11px; font-weight: 500; }
.message-content, .message.assistant .message-body { min-width: 0; }
.message.assistant .message-body { line-height: 1.68; color: #344057; overflow-wrap: anywhere; }
.markdown-content > :first-child { margin-top: 0 !important; }
.markdown-content > :last-child { margin-bottom: 0 !important; }
.markdown-content p { margin: 0 0 12px; }
.markdown-content h1, .markdown-content h2, .markdown-content h3, .markdown-content h4, .markdown-content h5, .markdown-content h6 { color: #27334b; line-height: 1.3; letter-spacing: -.015em; margin: 25px 0 10px; }
.markdown-content h1 { font-size: 24px; }.markdown-content h2 { font-size: 21px; }.markdown-content h3 { font-size: 18px; }.markdown-content h4, .markdown-content h5, .markdown-content h6 { font-size: 16px; }
.markdown-content ul, .markdown-content ol { margin: 8px 0 15px; padding-left: 25px; }
.markdown-content li { margin: 5px 0; padding-left: 2px; }
.markdown-content li::marker { color: #7180a1; }
.markdown-content blockquote { margin: 16px 0; padding: 10px 15px; border-left: 3px solid #6f87e8; border-radius: 0 10px 10px 0; background: #f5f7fd; color: #536079; }
.markdown-content blockquote > :last-child { margin-bottom: 0; }
.markdown-content hr { height: 1px; margin: 22px 0; border: 0; background: var(--line); }
.markdown-content a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.markdown-content img { display: block; max-width: 100%; height: auto; margin: 14px 0; border-radius: 12px; }
.markdown-content :not(pre) > code { padding: 2px 6px; border: 1px solid #e1e6ef; border-radius: 6px; background: #f4f6fa; color: #c23865; font:  .88em/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.markdown-content > table { display: block; width: 100%; max-width: 100%; overflow-x: auto; }
.table-scroll { width: 100%; max-width: 100%; margin: 16px 0; overflow-x: auto; border: 1px solid #dfe5ef; border-radius: 12px; background: white; scrollbar-width: thin; }
.markdown-content table { width: 100%; border-spacing: 0; border-collapse: separate; font-size: 15px; line-height: 1.55; }
.markdown-content th, .markdown-content td { min-width: 110px; padding: 12px 14px; border-right: 1px solid #e7ebf2; border-bottom: 1px solid #e7ebf2; text-align: left; vertical-align: top; }
.markdown-content th:last-child, .markdown-content td:last-child { border-right: 0; }
.markdown-content tbody tr:last-child td { border-bottom: 0; }
.markdown-content th { position: sticky; top: 0; z-index: 1; background: #f4f6fa; color: #344057; font-weight: 800; white-space: nowrap; }
.markdown-content tbody tr:nth-child(even) { background: #fafbfe; }
.markdown-content pre { max-width: 100%; margin: 16px 0; overflow: auto; border-radius: 11px; background: #f6f8fa; color: #253047; scrollbar-width: thin; }
.markdown-content pre code { display: block; padding: 16px; background: transparent; font: 12.5px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre; overflow-wrap: normal; }
.code-shell { max-width: 100%; margin: 16px 0; overflow: hidden; border: 1px solid #dfe4ed; border-radius: 12px; background: #f6f8fa; }
.code-shell pre { margin: 0; border-radius: 0; }
.code-header { height: 38px; display: flex; align-items: center; justify-content: space-between; padding: 0 8px 0 13px; border-bottom: 1px solid #e1e6ee; background: #edf1f6; color: #67738a; font: 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-transform: lowercase; }
.code-header button { border: 0; border-radius: 7px; padding: 6px 9px; background: white; color: #536079; font: 11px/1.1 Inter, ui-sans-serif, system-ui, sans-serif; box-shadow: 0 1px 4px rgba(31,45,78,.08); }
.code-header button:hover { color: var(--brand); }
.diagram-card { max-width: 100%; margin: 17px 0; overflow: hidden; border: 1px solid #dfe5ef; border-radius: 13px; background: #fbfcff; }
.diagram-header { padding: 9px 13px; border-bottom: 1px solid #e5e9f1; color: #66738a; background: #f3f6fa; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.diagram-stage { max-width: 100%; padding: 18px; overflow: auto; text-align: center; }
.diagram-stage svg { display: block; max-width: 100%; height: auto; margin: auto; }
.diagram-error .diagram-header { color: var(--danger); }.diagram-error .diagram-stage { text-align: left; white-space: pre; font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #6d3941; }
.diagram-unavailable { border: 1px solid #f0cbd0; }
.message-avatar { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: #243b85; color: white; font-size: 11px; font-weight: 900; }
.message-activity { min-height: 24px; margin: 4px 0 8px; color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.message-activity.error, .message-activity.cancelled { color: var(--danger); }
.status-error { width: 17px; height: 17px; display: inline-grid; place-items: center; border-radius: 50%; background: #fff0f2; color: var(--danger); font-size: 11px; font-weight: 900; }
.message-sources { min-width: 0; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 8px; }
.message-sources > strong { color: #657087; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.message-source-links { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 5px; overflow: visible; padding-bottom: 2px; }
.message-source-link { display: block; min-width: 0; max-width: 100%; padding: 1px 0; color: var(--brand) !important; font-size: 13px; line-height: 1.45; white-space: normal; overflow-wrap: anywhere; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.message-source-link:hover { color: var(--brand-dark) !important; }
.message-source-expand { justify-self: start; border: 0; padding: 3px 0; background: transparent; color: #64728d; font-size: 12px; font-weight: 750; text-decoration: underline; text-underline-offset: 3px; }
.message-source-expand:hover { color: var(--brand); }
.forecast-card { border: 1px solid #dfe5f2; border-radius: 15px; padding: 16px; margin: 14px 0; background: #fbfcff; }
.forecast-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.scenario { border-radius: 11px; padding: 12px; background: white; border: 1px solid var(--line); }
.scenario strong { font-size: 22px; display: block; margin: 4px 0; }
.scenario.bullish { border-top: 3px solid #22b982; }.scenario.bearish { border-top: 3px solid #e75b6b; }.scenario.neutral { border-top: 3px solid #e2a73a; }
.citation-card, .artifact-card { border-left: 3px solid var(--brand); background: #f5f7fd; padding: 10px 12px; margin: 8px 0; border-radius: 0 9px 9px 0; font-size: 13px; }
.spinner { width: 15px; height: 15px; border: 2px solid #dbe1ed; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.composer { min-width: 0; margin: 0 clamp(18px, 6vw, 90px) 24px; border: 1px solid #dbe1ec; border-radius: 16px; padding: 10px 12px; box-shadow: 0 12px 32px rgba(31,45,78,.08); background: white; position: relative; transition: border-color .15s ease, box-shadow .15s ease; }
.composer.file-drag-active { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(55,89,219,.12), 0 12px 32px rgba(31,45,78,.08); }
.composer.file-drag-active::after { content: attr(data-drop-hint); position: absolute; z-index: 5; inset: 5px; display: grid; place-items: center; border: 1px dashed #8da2ee; border-radius: 12px; background: rgba(245,248,255,.96); color: var(--brand); font-size: 13px; font-weight: 800; pointer-events: none; }
.composer.files-pending .send-button, .send-button:disabled { cursor: wait; opacity: .55; }
.composer textarea { border: 0; box-shadow: none; resize: none; max-height: 180px; margin: 0; padding: 7px; }
.composer-actions { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11px; }
.composer-actions span { flex: 1; }
.send-button { padding: 9px 14px; }
.selected-files { display: flex; gap: 6px; flex-wrap: wrap; }
.selected-chip { min-width: 0; max-width: 260px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid #dbe1ee; border-radius: 999px; padding: 5px 7px 5px 9px; font-size: 11px; background: #f5f7fc; }
.selected-chip > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.selected-chip > img { width: 24px; height: 24px; margin-left: -4px; border-radius: 6px; object-fit: cover; }
.selected-chip small { flex: 0 0 auto; color: #8a6a22; }
.selected-chip.pending::before, .selected-chip.queued::before, .selected-chip.parsing::before { content: ""; flex: 0 0 auto; width: 9px; height: 9px; border: 1.5px solid #c9d1e1; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
.selected-chip.error { border-color: #efc8ce; background: #fff4f5; }.selected-chip.error small { color: var(--danger); }
.selected-chip button { flex: 0 0 auto; width: 18px; height: 18px; display: grid; place-items: center; border: 0; border-radius: 50%; padding: 0; background: transparent; color: #7d899e; line-height: 1; }
.selected-chip button:hover { background: #e2e7f0; color: var(--danger); }
.research-panel { min-width: 0; min-height: 0; border-left: 1px solid var(--line); background: #f8f9fc; display: grid; grid-template-rows: auto auto minmax(0, 1fr); overflow: hidden; opacity: 1; visibility: visible; transition: opacity .18s ease, transform .2s ease; }
.panel-collapsed .research-panel { opacity: 0; visibility: hidden; pointer-events: none; }
.research-header { min-width: 0; padding: 15px 16px 12px; display: flex; align-items: center; justify-content: space-between; }
.research-header .eyebrow { margin: 0 0 3px; color: var(--muted); }
.research-header h2 { margin: 0; font-size: 17px; }
.research-tabs { margin: 0 14px 10px; padding: 3px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-radius: 10px; background: #e9edf5; overflow-x: auto; }
.research-tab { border: 0; border-radius: 8px; padding: 8px 4px; background: transparent; color: var(--muted); font-size: 10.5px; font-weight: 800; white-space: nowrap; }
.research-tab.active { background: white; color: var(--ink); box-shadow: 0 3px 10px rgba(31,45,78,.08); }
.research-content { min-width: 0; min-height: 0; overflow-y: auto; padding: 6px 14px 18px; }
.panel-empty { margin: 8px 0 14px; padding: 12px; border: 1px dashed #d9dfeb; border-radius: 10px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.panel-empty.compact { margin: 0; padding: 9px 10px; }
.progress-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.progress-item { min-width: 0; display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; align-items: start; padding: 8px 7px; border-radius: 9px; color: #59657c; font-size: 12px; }
.progress-item:hover { background: #eef2f8; }
.progress-marker { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; border: 1px solid #cfd7e6; color: #7a879e; font-size: 10px; font-weight: 900; }
.progress-item.running .progress-marker { border: 2px solid #dbe1ed; border-top-color: var(--brand); animation: spin .8s linear infinite; color: transparent; }
.progress-item.ok .progress-marker { color: white; border-color: #24b982; background: #24b982; }
.progress-item.degraded .progress-marker { color: #725610; border-color: #e4bf59; background: #fff2bd; }
.progress-item.error .progress-marker { color: white; border-color: var(--danger); background: var(--danger); }
.progress-copy { min-width: 0; }
.progress-copy strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 750; color: #344057; }
.progress-copy small { display: block; margin-top: 2px; color: var(--muted); }
.research-sources-head { margin: 17px 2px 8px; display: flex; align-items: center; justify-content: space-between; color: #4e5a72; font-size: 12px; }
.research-sources-head span { min-width: 22px; padding: 2px 7px; border-radius: 999px; text-align: center; background: #e8edf7; color: var(--muted); }
.research-source-list { min-width: 0; display: grid; gap: 4px; }
.research-source-link { display: block; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 8px 9px; border-radius: 8px; color: #4f5d76; background: white; border: 1px solid var(--line); font-size: 12px; text-decoration: none; }
.research-source-link:hover { color: var(--brand); border-color: #b9c6ed; }
.files-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 12px; color: #4e5a72; font-size: 12px; }
.toolbar-actions { display: flex; align-items: center; gap: 5px; }
.upload-button { flex: 0 0 auto; border: 1px solid #d5ddec; border-radius: 8px; padding: 7px 9px; background: white; color: var(--brand); font-size: 11px; font-weight: 800; cursor: pointer; }
.panel-list, .pending-action-list { display: grid; gap: 8px; }
.panel-card, .confirmation-card { min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: 11px; background: white; }
.panel-card-head { min-width: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.panel-card-title { min-width: 0; display: grid; gap: 3px; }
.panel-card-head strong { min-width: 0; overflow-wrap: anywhere; font-size: 12px; }
.panel-card .job-resource-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-card p, .confirmation-card p { max-height: 6.2em; margin: 7px 0; overflow: hidden; color: #5d6980; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.panel-card p.job-error, .compact-row .job-error { color: var(--danger); }
.panel-card small, .confirmation-card small { color: var(--muted); font-size: 10.5px; }
.muted-card { opacity: .65; }
.status-badge { flex: 0 0 auto; padding: 3px 6px; border-radius: 999px; background: #eef2f7; color: #68758c; font-size: 9.5px; font-weight: 800; }
.status-badge.processing, .status-badge.active { color: #13795b; background: #e5f8f0; }
.status-badge.error { color: #a53443; background: #ffebee; }
.status-badge.queued, .status-badge.draft, .status-badge.pending_verification { color: #8b6716; background: #fff6dc; }
.progress-bar { height: 5px; margin: 9px 0 7px; overflow: hidden; border-radius: 999px; background: #edf1f6; }
.progress-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #3759db, #6f8df4); }
.inline-actions, .connection-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 8px; }
.text-button { border: 0; padding: 2px 0; background: transparent; color: var(--brand); font-size: 11px; font-weight: 750; }
.text-button.danger { color: var(--danger); }
.primary-text { color: #13795b; }
.confirmation-card { border-color: #e5d6a8; background: #fffdf5; }
.confirmation-card > strong { color: #725610; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.compact-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.compact-row small { grid-column: 1 / -1; color: var(--muted); }
.toast { position: fixed; z-index: 50; right: 22px; top: 20px; max-width: 380px; color: white; background: #202b45; border-radius: 10px; padding: 12px 15px; box-shadow: var(--shadow); }
dialog { width: min(520px, 92vw); border: 0; border-radius: 18px; padding: 0; box-shadow: var(--shadow); }
dialog[open] { animation: dialog-enter .12s ease-out; }
dialog::backdrop { background: rgba(19,29,51,.45); }
dialog form > header, dialog form > footer { display: flex; justify-content: space-between; align-items: center; padding: 17px 20px; border-bottom: 1px solid var(--line); }
dialog form > footer { border: 0; border-top: 1px solid var(--line); justify-content: flex-end; gap: 9px; }
dialog h3 { margin: 0; }.picker-list { max-height: 55vh; overflow-y: auto; padding: 14px 20px; }.picker-row { display: flex; gap: 10px; padding: 9px 0; }.picker-row input { width: auto; margin: 0; }
.wide-dialog { width: min(720px, 94vw); max-height: 90vh; }
.admin-dialog { width: min(1040px, 96vw); max-height: 92vh; }
.wide-dialog > form, .admin-dialog > form { max-height: inherit; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.dialog-body { position: relative; min-height: 0; padding: 18px 20px; overflow-y: auto; display: grid; gap: 16px; }
.dialog-body.is-loading { min-height: 180px; overflow: hidden; }
.dialog-body.is-loading > * { opacity: .22; pointer-events: none; }
.dialog-body.is-loading::before { content: ""; position: absolute; z-index: 2; left: 50%; top: calc(50% - 15px); width: 24px; height: 24px; margin: -12px; border: 2px solid #d9e1f3; border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
.dialog-body.is-loading::after { content: attr(data-loading-text); position: absolute; z-index: 2; left: 20px; right: 20px; top: calc(50% + 17px); color: var(--muted); font-size: 12px; font-weight: 700; text-align: center; }
.dialog-body fieldset { min-width: 0; margin: 0; padding: 13px; border: 1px solid var(--line); border-radius: 12px; }
.dialog-body legend { padding: 0 6px; color: #48546b; font-size: 12px; font-weight: 800; }
.dialog-hint { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.capability-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 14px; }
.check-row, .toggle-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.check-row input, .toggle-row input { flex: 0 0 auto; width: auto; margin: 0; }
.check-row span, .toggle-row span { min-width: 0; font-size: 12px; }
.toggle-row { justify-content: space-between; border-bottom: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.connection-actions { margin: 0; }
.admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.admin-grid section { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.admin-grid h4 { margin: 0 0 12px; }
.admin-jobs { grid-column: 1 / -1; }
.mobile-only, .mobile-conversation-backdrop { display: none; }
@keyframes dialog-enter { from { opacity: 0; transform: translateY(5px) scale(.99); } to { opacity: 1; transform: none; } }
@media (max-width: 1350px) { .studio { grid-template-columns: 80px 280px minmax(0, 1fr) 320px; }.studio.panel-collapsed { grid-template-columns: 80px 280px minmax(0, 1fr) 0; }.rail-brand strong, .profile-card > div:not(.avatar), .rail-section-title span { display: none; }.workspace-item { font-size: 0; text-align: center; }.workspace-item::first-letter { font-size: 14px; }.workspace-rail { align-items: stretch; }.profile-card { grid-template-columns: 38px 32px; } }
@media (max-width: 1080px) { .studio, .studio.panel-collapsed { position: relative; grid-template-columns: 80px 270px minmax(0, 1fr); }.research-panel { position: absolute; z-index: 20; top: 0; right: 0; width: min(410px, calc(100vw - 80px)); height: 100%; box-shadow: -18px 0 42px rgba(23,32,51,.16); }.panel-collapsed .research-panel { transform: translateX(100%); }.chat-header { padding-inline: 16px; } }
@media (max-width: 760px) {
  html, body { width: 100%; max-width: 100%; height: 100%; min-height: 100%; overflow: hidden; overscroll-behavior: none; }
  .auth-shell { width: 100%; height: 100dvh; min-height: 0; grid-template-columns: 1fr; overflow-y: auto; }
  .auth-copy { display: none; }
  .studio, .studio.panel-collapsed { width: 100%; max-width: 100%; min-width: 0; height: 100dvh; min-height: 100dvh; max-height: 100dvh; grid-template-columns: minmax(0, 1fr); overflow: hidden; }
  .workspace-rail { display: none; }
  .chat-panel { width: 100%; max-width: 100%; min-width: 0; height: 100%; min-height: 0; }
  .chat-header {
    position: sticky;
    z-index: 12;
    top: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: auto;
    min-height: calc(64px + env(safe-area-inset-top));
    padding: calc(10px + env(safe-area-inset-top))
      calc(14px + env(safe-area-inset-right))
      10px
      calc(14px + env(safe-area-inset-left));
    flex: 0 0 auto;
    overflow: hidden;
    background: #fff;
  }
  .chat-header > div:first-of-type { min-width: 0; flex: 1 1 auto; padding-inline: 8px; overflow: hidden; }
  .chat-header h2 { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .chat-header-actions { min-width: 0; flex: 0 0 auto; }
  .chat-header-actions #workspace-settings-button,
  .chat-header-actions #connections-button,
  .chat-header-actions #admin-button { display: none; }
  .mobile-only { display: inline-grid; flex: 0 0 32px; }
  .conversation-panel {
    display: flex;
    position: absolute;
    z-index: 31;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(86vw, 340px);
    height: 100%;
    padding: calc(20px + env(safe-area-inset-top)) 15px calc(20px + env(safe-area-inset-bottom));
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-105%);
    transition: transform .22s ease, visibility .22s;
    box-shadow: 18px 0 42px rgba(23,32,51,.2);
  }
  .studio.mobile-conversations-open .conversation-panel {
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
  }
  .mobile-conversation-backdrop:not([hidden]) {
    display: block;
    position: absolute;
    z-index: 30;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
    padding: 0;
    background: rgba(23,32,51,.34);
  }
  .suggestions { grid-template-columns: 1fr; }
  .message-list {
    max-width: 100%;
    padding: 20px
      calc(15px + env(safe-area-inset-right))
      20px
      calc(15px + env(safe-area-inset-left));
    scrollbar-gutter: auto;
  }
  .user-message-content { max-width: 90%; }
  .composer {
    max-width: 100%;
    margin: 0
      calc(12px + env(safe-area-inset-right))
      max(14px, env(safe-area-inset-bottom))
      calc(12px + env(safe-area-inset-left));
  }
  .composer-actions, .composer-actions span { min-width: 0; }
  .research-panel { width: min(96vw, 410px); height: 100%; padding-bottom: env(safe-area-inset-bottom); }
  .message-sources { grid-template-columns: 1fr; }
  .forecast-grid { grid-template-columns: 1fr; }
  .capability-grid, .form-grid, .admin-grid { grid-template-columns: 1fr; }
  .admin-jobs { grid-column: 1; }
}
