:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #fff;
  --surface-subtle: #f8faff;
  --border: #e3e8f2;
  --border-strong: #cbd6e8;
  --text: #1d2940;
  --muted: #64748b;
  --accent: #245ce4;
  --accent-hover: #1749c7;
  --accent-soft: #edf3ff;
  --ok: #12805e;
  --warn: #ae6900;
  --danger: #c43e4b;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(30, 55, 99, .06);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { letter-spacing: -.025em; line-height: 1.25; }
h1 { font-size: 22px; }
h2 { font-size: 20px; }
h3 { font-size: 15px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted, .optional { color: var(--muted); }
.optional { font-size: 11px; font-weight: 400; }
.mono, pre { font-family: var(--mono); }
.mono { font-size: 12px; }
.section-kicker { color: #7a8aa7; font-size: 10px; letter-spacing: .12em; font-weight: 800; }
button, .button { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent); color: #fff; padding: 10px 15px; font: inherit; font-weight: 650; line-height: 1.25; white-space: nowrap; cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s; }
button:hover, .button:hover { background: var(--accent-hover); border-color: var(--accent-hover); text-decoration: none; }
button:focus-visible, .button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #9cbdff; outline-offset: 2px; }
button:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
button.secondary, .button.secondary { background: #fff; color: #344563; border-color: var(--border-strong); }
button.secondary:hover, .button.secondary:hover { background: var(--accent-soft); border-color: #9db7f4; }
button.danger { background: #fff; border-color: #efc0c4; color: var(--danger); }
button.danger:hover { background: #fff2f3; }
button.link { background: none; border: 0; color: var(--accent); padding: 0; font-weight: 600; }
input, select, textarea { width: 100%; min-width: 0; border: 1px solid var(--border-strong); border-radius: 10px; background: #fff; color: var(--text); padding: 10px 12px; font: inherit; }
input::placeholder, textarea::placeholder { color: #95a2b6; }
textarea { resize: vertical; min-height: 72px; }
label { display: block; margin-bottom: 14px; color: #40516b; font-size: 12px; font-weight: 650; }
label input, label select, label textarea { display: block; margin-top: 6px; font-weight: 400; font-size: 14px; }
.alert, .notice { border-radius: 10px; padding: 11px 13px; font-size: 13px; margin: 0 0 16px; }
.alert { background: #fff2f3; border: 1px solid #efc0c4; color: #9a2433; }
.notice { background: #eef5ff; border: 1px solid #c5d8ff; color: #1c4d9e; }
.badge { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 999px; background: #fff; padding: 3px 9px; color: var(--muted); font-size: 11px; line-height: 1.35; font-weight: 650; white-space: nowrap; }
.badge.ok { color: var(--ok); border-color: #a9dfcd; background: #eefaf5; }
.badge.warn { color: var(--warn); border-color: #f5d59e; background: #fffaef; }
.badge.danger { color: var(--danger); border-color: #efc0c4; background: #fff2f3; }
.row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.row-actions form { margin: 0; }
.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 24px; background: radial-gradient(circle at 15% 0%, #e7efff 0, transparent 35%), var(--bg); }
.auth-card { width: min(100%, 420px); border: 1px solid var(--border); background: var(--surface); border-radius: 22px; padding: 34px; box-shadow: var(--shadow); }
.auth-card h1 { margin-bottom: 8px; }
.auth-card p { margin-bottom: 24px; }
.auth-card button { width: 100%; margin-top: 6px; }
.app-page { display: flex; flex-direction: column; min-height: 100vh; }
.chat-page { height: 100dvh; min-height: 0; overflow: hidden; }
.app-header { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; background: #fff; border-bottom: 1px solid var(--border); }
.app-header h1 { margin: 0; font-size: 17px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; color: #fff; font-weight: 800; font-size: 20px; background: linear-gradient(135deg, #235be7, #714bdf); box-shadow: 0 4px 12px rgba(36,92,228,.22); }
.brand-subtitle { display: block; color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; }
.app-main { flex: 1; min-height: 0; display: flex; }
.panel { width: min(100% - 48px, 1040px); margin: 28px auto 54px; padding: 28px; background: #fff; border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); }
.panel.narrow { max-width: 800px; }
.chat-shell { flex: 1; min-height: 0; display: grid; grid-template-columns: 258px minmax(0,1fr); grid-template-rows: minmax(0,1fr); width: 100%; }
.sidebar { display: flex; flex-direction: column; min-height: 0; background: #fff; border-right: 1px solid var(--border); }
.sidebar-head { padding: 22px 16px 16px; border-bottom: 1px solid var(--border); }
.sidebar-head button { width: 100%; margin-top: 12px; justify-content: flex-start; }
.sidebar-body { flex: 1; overflow: auto; padding: 18px 10px; }
.sidebar-label { margin: 0 10px 8px; }
.sidebar-foot { display: grid; gap: 4px; padding: 12px 10px; border-top: 1px solid var(--border); }
.sidebar-foot a { display: block; padding: 9px 10px; border-radius: 8px; color: #455671; font-weight: 600; }
.sidebar-foot a:hover { background: var(--accent-soft); text-decoration: none; color: var(--accent); }
.chat-item { display: block; margin: 2px 0; padding: 11px 12px; border: 1px solid transparent; border-radius: 10px; color: var(--text); }
.chat-item:hover { text-decoration: none; background: #f5f8ff; }
.chat-item.active { background: var(--accent-soft); border-color: #cbdcff; color: #1848b8; }
.chat-item .title { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 650; }
.chat-item .meta { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-row { display: flex; align-items: center; gap: 6px; }
.chat-row .chat-item { flex: 1; min-width: 0; }
.chat-delete { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--muted); cursor: pointer; }
.chat-delete:hover { border-color: #f0b6b6; background: #fff5f5; color: #b42318; }
.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-stage { position: relative; display: flex; flex: 1; flex-direction: column; min-height: 0; }
.chat-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 22px clamp(18px, 3.5vw, 48px) 17px; background: #fff; }
.chat-heading h2 { margin: 3px 0 2px; font-size: 21px; }
.chat-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.chat-usage { margin: 4px 0 2px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chat-title-row { display: flex; align-items: center; gap: 6px; }
.chat-title-row h2 { margin: 3px 0 2px; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; border: 1px solid var(--border); border-radius: 7px; background: #fff; color: var(--muted); cursor: pointer; }
.icon-button:hover { border-color: #cbdcff; background: #f5f8ff; color: var(--accent); }
.chat-toolbar { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; padding: 13px clamp(18px, 3.5vw, 48px); background: #fff; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.chat-toolbar label { margin: 0; }
.chat-toolbar select { height: 39px; padding: 8px 10px; }
.chat-toolbar .field { min-width: 128px; flex: 1 1 138px; }
.chat-toolbar .model-field { max-width: 195px; }
.chat-toolbar .source-field { max-width: 205px; }
.chat-toolbar .save-context { height: 39px; }
.toolbar-divider { width: 1px; height: 34px; margin: 0 4px 2px; background: var(--border); }
.context-panel { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; overflow-y: auto; padding: 24px; background: rgba(245,248,255,.84); }
.context-panel[hidden] { display: none; }
.context-card { width: min(100%, 760px); max-height: 100%; overflow-y: auto; margin: auto; padding: 24px; border: 1px solid var(--border); border-radius: 20px; background: #fff; box-shadow: var(--shadow); pointer-events: auto; }
.context-panel.welcome { background: transparent; pointer-events: none; }
.context-panel.welcome .context-card { width: min(100%, 960px); padding: 0; border: 0; background: transparent; box-shadow: none; }
.context-panel.welcome .context-editor { display: none; }
.context-panel:not(.welcome) .welcome-intro { display: none; }
.welcome-intro { margin: 0 auto; text-align: center; }
.welcome-mark { display: grid; place-items: center; width: 60px; height: 60px; margin: 0 auto; border-radius: 19px; background: #fff; color: var(--accent); font-size: 28px; box-shadow: 0 10px 30px rgba(30,55,99,.1); }
.welcome-intro h3 { margin: 18px 0 10px; font-size: clamp(26px, 3.2vw, 38px); }
.welcome-intro p { margin: 0 auto; max-width: 62ch; color: var(--muted); font-size: 14px; }
.suggestions { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin: 30px 0 22px; }
.suggestion { display: grid; justify-items: start; gap: 6px; padding: 18px; border: 1px solid var(--border); border-radius: 16px; background: #fff; color: var(--text); text-align: left; white-space: normal; font-weight: 500; box-shadow: 0 6px 20px rgba(30,55,99,.05); }
.suggestion:hover { border-color: #9db7f4; background: #fff; text-decoration: none; box-shadow: 0 10px 26px rgba(30,55,99,.09); }
.suggestion-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--accent-soft); color: var(--accent); font-size: 16px; }
.suggestion strong { font-size: 14px; font-weight: 700; }
.suggestion-text { color: var(--muted); font-size: 12px; line-height: 1.5; }
.welcome-context { display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 999px; background: #fff; box-shadow: 0 4px 14px rgba(30,55,99,.04); font-size: 12px; }
.welcome-context strong { color: #334155; font-weight: 650; }
.context-card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.context-card-head > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; }
.context-card-head strong { font-size: 13px; }
.context-card-head span { color: var(--muted); font-size: 12px; }
.context-card-head button { padding: 7px 11px; font-size: 12px; }
.context-choice { display: flex; align-items: center; gap: 12px; }
.context-choice > span { flex: 0 0 58px; color: #50617b; font-size: 12px; font-weight: 700; }
.segmented { display: inline-flex; min-width: 0; padding: 3px; gap: 3px; border: 1px solid var(--border); border-radius: 11px; background: #f5f7fc; }
.segmented button { min-height: 32px; padding: 6px 11px; border: 0; border-radius: 8px; background: transparent; color: #586982; font-size: 12px; box-shadow: none; }
.segmented button:hover { background: #e8efff; color: #1b4bb9; }
.segmented button[aria-pressed="true"] { background: #fff; color: #1e55ce; box-shadow: 0 1px 5px rgba(30,55,99,.13); }
.context-company-fields { display: grid; grid-template-columns: minmax(190px, 1fr) minmax(260px, 1fr); align-items: end; gap: 10px 16px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.context-company-fields[hidden], #sales-fields[hidden] { display: none; }
.context-company-fields label { margin: 0; }
.context-company-fields select { height: 39px; }
.context-company-fields .select2-selection--single { height: 39px; border: 1px solid var(--border-strong); border-radius: 9px; }
.context-company-fields .select2-selection__rendered { line-height: 37px !important; }
.context-company-fields .select2-selection__arrow { height: 37px !important; }
.messages { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; padding: 26px clamp(18px, 3.5vw, 48px) 32px; }
.approval-tray { flex: none; max-height: min(42vh, 420px); overflow-y: auto; padding: 12px clamp(18px, 3.5vw, 48px); background: #fffaf1; border-bottom: 1px solid #f0d19a; }
.approval-tray[hidden] { display: none; }
.message { width: min(100%, 820px); }
.message.user { align-self: flex-end; width: min(78%, 680px); }
.message .role { margin-bottom: 6px; color: #7a8aa7; font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.message.user .role { text-align: right; }
.bubble { border: 1px solid var(--border); border-radius: 14px; background: #fff; padding: 15px 17px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; box-shadow: 0 2px 8px rgba(30,55,99,.025); }
.message.assistant .bubble { white-space: normal; }
.message.assistant .bubble > :first-child { margin-top: 0; }
.message.assistant .bubble > :last-child { margin-bottom: 0; }
.message.assistant .bubble p, .message.assistant .bubble ul, .message.assistant .bubble ol { margin: 0 0 12px; }
.message.assistant .bubble table { display: block; max-width: 100%; overflow-x: auto; margin: 12px 0; white-space: nowrap; }
.message.assistant .bubble th, .message.assistant .bubble td { padding: 7px 10px; border: 1px solid var(--border); text-transform: none; letter-spacing: normal; font-size: 13px; }
.message.assistant .bubble pre { white-space: pre; overflow-x: auto; }
.message.assistant .bubble :not(pre) > code { padding: 2px 4px; border-radius: 4px; background: var(--surface-subtle); font-family: var(--mono); font-size: .9em; }
.message.assistant .bubble a { color: var(--accent); text-decoration: underline; }
.message.user .bubble { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 8px 20px rgba(36,92,228,.18); }
.message.user .role { display: none; }
.message-meta { margin-top: 7px; color: #8794a8; font-size: 11px; }
.message.user .message-meta { text-align: right; }
.assistant-heading { display: flex; align-items: center; gap: 9px; margin: 0 0 8px; padding: 0 2px; }
.assistant-mark { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid #d7e5ff; border-radius: 50%; background: #fff; color: var(--accent); font-size: 14px; font-weight: 800; box-shadow: 0 2px 8px rgba(30,55,99,.06); }
.assistant-heading > div { display: grid; gap: 1px; }
.assistant-heading strong { color: #334155; font-size: 12px; }
.assistant-eyebrow { color: #5280d5; font-size: 9px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.message.assistant .bubble { padding: 13px 15px; }
.message.assistant .answer-content { min-width: 0; overflow-wrap: anywhere; }
.message.assistant .answer-content:empty { display: none; }
.message.assistant .reasoning-card, .message.assistant .tool-history { width: 100%; margin: 0 0 12px; padding: 0; overflow: hidden; border-color: #dce3ee; box-shadow: none; }
.message.assistant .reasoning-card > summary, .message.assistant .tool-history > summary { padding: 8px 11px; background: #f8fafc; color: #53647c; font-size: 11px; }
.message.assistant .reasoning-content { max-height: 240px; overflow-y: auto; padding: 9px 11px; border-top: 1px solid #e7ecf4; background: #fbfcff; color: #64748b; white-space: normal; line-height: 1.55; }
.message.assistant .reasoning-content > :first-child { margin-top: 0; }
.message.assistant .reasoning-content > :last-child { margin-bottom: 0; }
.message.assistant .tool-activity { max-height: 280px; overflow-y: auto; padding: 4px 10px 8px; }
.message.assistant .tool-activity .tool-card { width: 100%; margin: 8px 0; }
.message.system { align-self: center; width: min(100%, 620px); }
.message.system .role { display: none; }
.message.system .bubble { text-align: center; background: #f7f9fd; color: var(--muted); border-style: dashed; font-size: 12px; padding: 10px 14px; }
.composer { background: #fff; border-top: 1px solid var(--border); padding: 14px clamp(18px, 3.5vw, 48px) 16px; }
.composer-inner { width: min(100%, 900px); margin: auto; }
.composer-row { display: flex; align-items: flex-end; gap: 10px; padding: 8px 8px 8px 12px; border: 1px solid var(--border-strong); border-radius: 24px; background: #fff; box-shadow: 0 6px 22px rgba(30,55,99,.07); }
.composer-row:focus-within { border-color: #7da5ff; box-shadow: 0 0 0 3px #e7efff; }
.composer-row textarea { flex: 1; width: auto; min-height: 34px; max-height: 180px; padding: 7px 0; border: 0; background: transparent; resize: none; overflow-y: auto; box-shadow: none; }
.composer-row textarea:focus-visible { outline: 0; }
.composer-row .context-trigger { flex: none; max-width: 180px; min-height: 36px; padding: 6px 12px; border-color: var(--border-strong); border-radius: 999px; background: #fff; color: #344563; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.composer-row .context-trigger:hover { background: var(--accent-soft); border-color: #9db7f4; }
.composer-model { flex: none; margin: 0; }
.composer-model select { width: auto; max-width: min(30vw, 230px); height: 36px; margin: 0; padding: 6px 10px; border-color: var(--border-strong); border-radius: 999px; font-size: 12px; }
.composer-row .send-button { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; min-height: 40px; padding: 0; border-radius: 50%; }
.composer-row .send-button.stopping { background: #b42318; border-color: #b42318; }
.composer-row .send-button.stopping:hover { background: #971a12; }
.composer-row .send-button svg { display: block; }
.composer-note { display: flex; justify-content: space-between; gap: 14px; margin-top: 8px; color: #8794a8; font-size: 11px; }
.tool-card { width: min(100%, 820px); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 11px; background: #fff; padding: 0; font-size: 12px; }
.tool-card[open] { padding-bottom: 12px; }
.tool-card > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; cursor: pointer; list-style: none; }
.tool-card > summary::-webkit-details-marker { display: none; }
.tool-card > summary::before { content: '▸'; color: var(--muted); font-size: 10px; }
.tool-card[open] > summary::before { content: '▾'; }
.tool-card.pending { border-left-color: #e7a634; }
.tool-card.error { border-left-color: var(--danger); }
.tool-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tool-name { font-family: var(--mono); font-size: 12px; font-weight: 650; }
.tool-duration { color: var(--muted); font-size: 11px; }
.tool-body { display: grid; gap: 10px; padding: 0 12px; }
.tool-block { display: grid; gap: 4px; }
.tool-block-label { color: var(--muted); font-size: 11px; font-weight: 600; }
.tool-args, .tool-sql, .tool-result { max-height: 260px; overflow: auto; }
.tool-sql { border-left: 3px solid #cbdcff; color: #1f3a66; }
.tool-result.error { color: var(--danger); }
.tool-card pre, pre { max-width: 100%; overflow: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-subtle); padding: 10px; font-size: 11px; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.assistant-loading { display: flex; align-items: center; gap: 8px; margin: 2px 0 8px; color: var(--muted); font-size: 12px; }
.loading-dots { display: inline-flex; gap: 3px; }
.loading-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: .35; animation: harness-pulse 1.2s infinite ease-in-out; }
.loading-dots span:nth-child(2) { animation-delay: .18s; }
.loading-dots span:nth-child(3) { animation-delay: .36s; }
@keyframes harness-pulse { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
.approval-card { width: min(100%, 820px); border: 1px solid #f0d19a; background: #fff; border-radius: 12px; padding: 16px; }
.approval-card dl { display: grid; grid-template-columns: 145px 1fr; gap: 5px 10px; font-size: 12px; }
.approval-card dt { color: var(--muted); }
.approval-card dd { margin: 0; overflow-wrap: anywhere; }
.approval-actions { display: flex; gap: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
th { color: #64748b; background: var(--surface-subtle); font-size: 11px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
fieldset { border: 1px solid var(--border); border-radius: 14px; padding: 20px; margin: 24px 0 0; }
legend { padding: 0 8px; color: #40516b; font-size: 13px; font-weight: 750; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
@media (max-width: 1080px) { .toolbar-divider { display: none; } .chat-toolbar .field { max-width: none; } }
@media (max-width: 760px) {
  .app-header { min-height: 60px; padding: 10px 15px; }
  .chat-shell { display: flex; flex-direction: column; height: calc(100dvh - 60px); }
  .sidebar { flex: none; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 13px; border: 0; }
  .sidebar-head button { width: auto; margin: 0; padding: 7px 10px; }
  .sidebar-body { max-height: 51px; padding: 3px 12px 7px; overflow: auto hidden; }
  .sidebar-label, .sidebar-foot { display: none; }
  #chat-list { display: flex; gap: 6px; }
  .chat-item { min-width: 130px; max-width: 190px; padding: 6px 9px; }
  .chat-item .meta { display: none; }
  .chat-main { flex: 1; }
  .chat-heading { padding: 10px 15px; }
  .chat-heading h2 { font-size: 17px; }
  .chat-heading p { display: none; }
  .context-panel { padding: 16px; }
  .context-card { padding: 18px; }
  .welcome-intro h3 { font-size: 24px; }
  .suggestions { grid-template-columns: 1fr; margin: 22px 0 18px; }
  .context-card-head { align-items: center; }
  .context-company-fields { grid-template-columns: 1fr; }
  .context-choice { flex-wrap: wrap; gap: 5px; }
  .context-choice > span { flex-basis: 100%; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; white-space: normal; }
  .chat-toolbar { gap: 8px; padding: 9px 14px; max-height: 134px; overflow-y: auto; }
  .chat-toolbar .field { flex: 1 1 42%; min-width: 115px; }
  .chat-toolbar .save-context { flex: 1 1 100%; }
  .messages { padding: 16px; gap: 15px; }
  .message.user { width: min(90%, 620px); }
  .composer { padding: 10px 14px 14px; }
  .composer-note span:last-child { display: none; }
  .composer-row { flex-wrap: wrap; border-radius: 20px; }
  .composer-row textarea { flex: 1 1 100%; order: -1; padding: 8px 2px; }
  .composer-model select { max-width: min(52vw, 210px); }
  .panel { width: min(100% - 24px, 1040px); margin: 12px auto 24px; padding: 18px; }
  .app-header h1 { font-size: 15px; }
}
.reasoning-card, .tool-history { width: min(100%, 820px); border: 1px solid var(--border); border-radius: 11px; background: #fff; padding: 10px 14px; color: #455671; font-size: 12px; }
.reasoning-card summary, .tool-history summary { cursor: pointer; font-weight: 700; color: #334766; }
.reasoning-content { padding: 10px 2px 2px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); }
.tool-history-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 2px; border-top: 1px solid var(--border); }
.tool-history-row:first-of-type { margin-top: 8px; }
#connections-root > .muted, #mcp-root > .muted { max-width: 70ch; margin-bottom: 22px; }
#server-list { display: grid; gap: 12px; }
#server-list .tool-card { width: 100%; }
#connections-root table { margin: 20px 0; }
.connector-card { box-shadow: 0 3px 16px rgba(30,55,99,.04); }
.connector-card .tool-head { margin-bottom: 10px; }
.connector-card .mcp-bearer-token { margin: 10px 0; max-width: 420px; }
.connector-card ul { margin: 10px 0; padding-left: 20px; color: #51617a; }
.connector-card li { padding: 3px 0; }
.table-scroll { width: 100%; overflow-x: auto; }
#connections-root fieldset { scroll-margin-top: 20px; }
.text-button { padding: 0; border: 0; background: transparent; color: var(--accent); font-size: 12px; box-shadow: none; }
.text-button:hover { text-decoration: underline; background: transparent; }
.chat-toolbar .select2-container { min-width: 0; }
.chat-toolbar .select2-selection--single, .mysql-editor .select2-selection--single { height: 39px; border: 1px solid var(--border-strong); border-radius: 9px; }
.chat-toolbar .select2-selection__rendered, .mysql-editor .select2-selection__rendered { line-height: 37px !important; }
.chat-toolbar .select2-selection__arrow, .mysql-editor .select2-selection__arrow { height: 37px !important; }
.select2-dropdown { border-color: var(--border-strong); box-shadow: 0 12px 24px rgba(30,55,99,.1); }
.settings-shell, .mysql-shell { width: min(100% - 48px, 1240px); margin: 34px auto 70px; }
.settings-intro, .mysql-intro, .mysql-list-head, .settings-section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.settings-intro, .mysql-intro { margin-bottom: 24px; }
.settings-setup { margin: 0 0 20px; scroll-margin-top: 18px; }
.settings-setup[hidden] { display: none; }
.settings-setup summary { cursor: pointer; font-weight: 750; }
.settings-setup p { margin: 10px 0; }
.settings-setup ol { margin: 12px 0; padding-left: 21px; }
.settings-setup li { margin: 10px 0; }
.settings-setup pre { margin: 7px 0; background: #fff; }
.settings-intro h2, .mysql-intro h2 { margin: 5px 0 8px; font-size: 26px; }
.settings-intro p, .mysql-intro p { margin: 0; max-width: 75ch; }
.settings-providers { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.settings-provider, .settings-models, .mysql-list, .mysql-editor { background: #fff; border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 7px 24px rgba(30,55,99,.045); }
.settings-provider { padding: 22px; min-width: 0; }
.settings-provider h2, .settings-models h2 { margin: 0 0 5px; font-size: 19px; }
.settings-provider p, .settings-models p { margin: 0; font-size: 12px; }
.settings-key-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 20px 0; }
.settings-key-row input { flex: 1 1 170px; margin: 0; }
.settings-catalog { border-top: 1px solid var(--border); padding-top: 18px; }
.settings-catalog > input { width: 100%; margin-bottom: 8px; }
.settings-candidates { max-height: 330px; overflow-y: auto; margin-top: 12px; }
.settings-candidate, .settings-model-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.settings-candidate > div, .settings-model-row > div:first-child { min-width: 0; overflow-wrap: anywhere; }
.settings-candidate small, .settings-model-row small { display: block; color: var(--muted); margin-top: 3px; }
.settings-models { padding: 24px; margin-top: 20px; }
.usage-panel { display: grid; gap: 14px; margin-top: 16px; }
.usage-window { display: grid; gap: 6px; }
.usage-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; }
.usage-label { font-weight: 600; }
.usage-bar { height: 8px; border-radius: 999px; background: #eef1f6; overflow: hidden; }
.usage-bar span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.usage-bar span.warn { background: #e7a634; }
.usage-bar span.danger { background: #b42318; }
.usage-note, .usage-fetched { color: var(--muted); font-size: 11px; }
.message-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 5px; }
.artifact-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.artifact-chip { display: inline-flex; align-items: baseline; gap: 8px; padding: 6px 11px; border: 1px solid #cbdcff; border-radius: 10px; background: #f5f8ff; color: var(--accent); font-size: 12px; text-decoration: none; }
.artifact-chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.artifact-chip .artifact-name { font-weight: 600; }
.artifact-chip .artifact-meta { color: var(--muted); font-size: 11px; }
.copy-button { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border: 1px solid var(--border); border-radius: 999px; background: #fff; color: var(--muted); font-size: 11px; cursor: pointer; }
.copy-button:hover { border-color: #cbdcff; background: #f5f8ff; color: var(--accent); }
.copy-button.copied { border-color: #b7e0c4; background: #f2fbf5; color: #1b7f43; }
.copy-button.danger { border-color: #f0b6b6; background: #fff5f5; color: #b42318; }
.settings-model-group { margin-top: 20px; }
.settings-model-group h3 { margin-bottom: 8px; }
.model-order { width: 72px; }
.mysql-list { padding: 22px; }
.mysql-list-head { align-items: center; }
.mysql-list-head h3 { margin: 0; }
.mysql-list-head input { width: min(100%, 330px); }
.mysql-shell table { margin: 18px 0 0 !important; }
.mysql-shell th:last-child, .mysql-shell td:last-child { min-width: 205px; }
.mysql-shell td .row-actions { flex-wrap: wrap; }
.mysql-shell .host-cell { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mysql-test-state { display: block; margin-top: 5px; color: var(--muted); }
.mysql-editor { padding: 26px; margin-top: 22px; }
.mysql-editor h3 { margin: 16px 0 8px; font-size: 14px; color: #344461; }
.mysql-editor .grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.mysql-editor .select2-container { margin-top: 6px; }
@media (max-width: 760px) {
  .settings-shell, .mysql-shell { width: min(100% - 24px, 1240px); margin: 18px auto 36px; }
  .settings-intro, .mysql-intro, .mysql-list-head { flex-direction: column; }
  .mysql-list-head input { width: 100%; }
  .settings-model-row { align-items: flex-start; flex-direction: column; }
  .settings-model-row .row-actions { flex-wrap: wrap; }
  .mysql-list { padding: 14px; }
  .mysql-editor { padding: 18px; }
}
