/* Foundry Lab — Fluent 2 inspired design system */
:root {
  --font: "Segoe UI", "Segoe UI Web (West European)", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", "Cascadia Mono", Consolas, "Courier New", monospace;
  --brand: #0F6CBD; --brand-hover: #115EA3; --brand-pressed: #0C3B5E; --brand-bg: #EBF3FC; --brand-bg2: #CFE4FA;
  --canvas: #FAFAFA; --surface: #FFFFFF; --subtle: #F5F5F5; --subtle2: #EBEBEB; --stroke: #E0E0E0; --stroke2: #D1D1D1; --stroke-strong: #BDBDBD;
  --text: #242424; --text2: #424242; --text3: #616161; --text-disabled: #BDBDBD;
  --success: #107C10; --success-bg: #F1FAF1; --danger: #C50F1F; --danger-bg: #FDF3F4; --warning: #BC4B09; --warning-bg: #FFF9F5; --info-bg: #F0F6FF;
  --purple: #5B5FC7; --purple-bg: #F0F0FA; --teal: #038387; --teal-bg: #E6F7F7;
  --radius: 4px; --radius-lg: 8px;
  --shadow2: 0 0 2px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.14);
  --shadow8: 0 0 2px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.14);
  --shadow16: 0 0 2px rgba(0,0,0,.12), 0 8px 16px rgba(0,0,0,.14);
  --shadow64: 0 0 8px rgba(0,0,0,.2), 0 32px 64px rgba(0,0,0,.24);
  --topbar-h: 48px; --nav-w: 264px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; line-height: 20px; color: var(--text); background: var(--canvas); -webkit-font-smoothing: antialiased; overflow: hidden; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
h1 { font-size: 24px; line-height: 32px; }
h2 { font-size: 20px; line-height: 28px; }
h3 { font-size: 16px; line-height: 22px; }
h4 { font-size: 14px; line-height: 20px; }
p { margin: 0 0 8px; }
code, pre { font-family: var(--mono); font-size: 12px; }
pre { background: var(--subtle); border: 1px solid var(--stroke); border-radius: var(--radius); padding: 10px 12px; overflow: auto; margin: 0; white-space: pre-wrap; word-break: break-word; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--text); }
::selection { background: var(--brand-bg2); }
.hidden { display: none !important; }
.muted { color: var(--text3); }
.small { font-size: 12px; line-height: 16px; }
.bold { font-weight: 600; }
.mono { font-family: var(--mono); font-size: 12px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; } .mb16 { margin-bottom: 16px; } .mb24 { margin-bottom: 24px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
@media (max-width: 1100px) { .grid3, .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 800px) { .grid2, .grid3, .grid4 { grid-template-columns: 1fr; } }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clickable { cursor: pointer; }

/* ---------- login ---------- */
#login { position: fixed; inset: 0; background: linear-gradient(135deg, #0C3B5E 0%, #0F6CBD 55%, #4F9BE6 100%); display: flex; align-items: center; justify-content: center; z-index: 100; }
.login-card { width: 440px; max-width: calc(100% - 32px); background: var(--surface); border-radius: 12px; box-shadow: var(--shadow64); padding: 40px 44px 32px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-brand .logo { width: 40px; height: 40px; }
.login-brand h1 { font-size: 20px; line-height: 26px; }
.login-brand .muted { font-size: 12px; }
.login-note { margin-top: 20px; font-size: 12px; color: var(--text3); border-top: 1px solid var(--stroke); padding-top: 12px; }
.login-note b { color: var(--text2); }

/* ---------- top bar ---------- */
#app { display: flex; flex-direction: column; height: 100vh; }
.topbar { height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--stroke); display: flex; align-items: center; padding: 0 12px 0 16px; gap: 12px; flex-shrink: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; color: var(--text); cursor: pointer; }
.brand .logo { width: 24px; height: 24px; }
.brand .pill { font-size: 10px; line-height: 14px; padding: 1px 6px; border-radius: 10px; background: var(--brand-bg); color: var(--brand); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.topbar .sep { width: 1px; height: 24px; background: var(--stroke2); }
.project-switcher { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 10px; border-radius: var(--radius); cursor: pointer; max-width: 360px; }
.project-switcher:hover { background: var(--subtle); }
.project-switcher .label { font-size: 11px; line-height: 14px; color: var(--text3); }
.project-switcher .name { font-weight: 600; font-size: 13px; line-height: 16px; }
.project-switcher svg { width: 12px; height: 12px; color: var(--text3); }
.topnav { display: flex; align-items: center; gap: 4px; margin-left: auto; height: 100%; }
.topnav a { display: flex; align-items: center; height: 100%; padding: 0 12px; color: var(--text2); font-weight: 600; font-size: 14px; border-bottom: 3px solid transparent; border-top: 3px solid transparent; }
.topnav a:hover { text-decoration: none; color: var(--text); background: var(--subtle); }
.topnav a.active { color: var(--brand); border-bottom-color: var(--brand); }
.topnav a.admin { color: var(--purple); }
.usermenu { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: var(--radius); cursor: pointer; }
.usermenu:hover { background: var(--subtle); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 600; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.avatar.purple { background: var(--purple); }
.demo-banner { background: #FFF4CE; border-bottom: 1px solid #F2C94C; color: #6B4E00; padding: 6px 16px; font-size: 13px; display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* ---------- layout ---------- */
.body { display: flex; flex: 1; min-height: 0; }
.leftnav { width: var(--nav-w); background: var(--surface); border-right: 1px solid var(--stroke); overflow-y: auto; flex-shrink: 0; padding: 12px 8px; }
.leftnav .nav-title { font-size: 12px; font-weight: 600; color: var(--text3); padding: 8px 12px 4px; text-transform: uppercase; letter-spacing: .4px; }
.leftnav .nav-section { font-size: 16px; font-weight: 600; padding: 4px 12px 12px; }
.leftnav a { display: flex; align-items: center; gap: 10px; padding: 7px 12px; margin: 1px 0; border-radius: var(--radius); color: var(--text2); font-size: 14px; position: relative; }
.leftnav a:hover { background: var(--subtle); text-decoration: none; color: var(--text); }
.leftnav a.active { background: var(--subtle2); color: var(--text); font-weight: 600; }
.leftnav a.active::before { content: ""; position: absolute; left: 2px; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--brand); }
.leftnav a svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--text2); }
.leftnav a.active svg { color: var(--brand); }
.leftnav .tag { margin-left: auto; font-size: 10px; line-height: 14px; padding: 0 6px; border-radius: 8px; background: var(--purple-bg); color: var(--purple); font-weight: 600; }
.leftnav .tag.na { background: var(--subtle2); color: var(--text3); }
.content { flex: 1; min-width: 0; overflow-y: auto; }
.page { padding: 20px 28px 48px; max-width: 1480px; }
.page.wide { max-width: none; }
.page-header { margin-bottom: 20px; }
.page-header .desc { color: var(--text3); margin-top: 4px; max-width: 900px; }
.breadcrumbs { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--text3); margin-bottom: 8px; }
.breadcrumbs a { color: var(--text3); }
.breadcrumbs span.sep { color: var(--stroke-strong); }
.cmdbar { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; padding: 4px 0; margin-bottom: 12px; border-bottom: 1px solid var(--stroke); }
.cmdbar .sep { width: 1px; height: 20px; background: var(--stroke2); margin: 0 6px; }
.cmdbar .spacer { flex: 1; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--radius); border: 1px solid var(--stroke2); background: var(--surface); color: var(--text); font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .1s; }
.btn:hover { background: var(--subtle); border-color: var(--stroke-strong); }
.btn:active { background: var(--subtle2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.primary:active { background: var(--brand-pressed); }
.btn.subtle { border-color: transparent; background: transparent; font-weight: 400; color: var(--text2); }
.btn.subtle:hover { background: var(--subtle); color: var(--text); }
.btn.subtle svg { color: var(--brand); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn.sm { height: 24px; padding: 0 8px; font-size: 12px; }
.btn.lg { height: 40px; padding: 0 20px; font-size: 15px; }
.btn.icon { width: 32px; padding: 0; }
.btn.icon.sm { width: 24px; }
.btn.link { border: none; background: none; color: var(--brand); font-weight: 400; padding: 0; height: auto; }
.btn.link:hover { text-decoration: underline; background: none; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-weight: 600; font-size: 14px; }
.field label .req { color: var(--danger); margin-left: 2px; }
.field .hint { font-size: 12px; color: var(--text3); }
.field.inline { flex-direction: row; align-items: center; gap: 12px; }
.input, select.input, textarea.input { height: 32px; padding: 0 10px; border: 1px solid var(--stroke2); border-bottom-color: var(--stroke-strong); border-radius: var(--radius); background: var(--surface); width: 100%; outline: none; }
textarea.input { height: auto; min-height: 80px; padding: 6px 10px; resize: vertical; line-height: 20px; }
.input:focus { border-bottom: 2px solid var(--brand); padding-bottom: 0; }
textarea.input:focus { padding-bottom: 5px; }
.input:disabled { background: var(--subtle); color: var(--text3); }
.input.mono { font-family: var(--mono); font-size: 12px; }
select.input { padding-right: 28px; appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' fill='none' stroke='%23616161' stroke-width='1.5'/></svg>"); background-repeat: no-repeat; background-position: right 10px center; }
.checkbox { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 400; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--brand); margin: 0; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch .track { width: 40px; height: 20px; border-radius: 10px; border: 1px solid var(--stroke-strong); background: var(--surface); position: relative; transition: all .15s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--text3); transition: all .15s; }
.switch.on .track { background: var(--brand); border-color: var(--brand); }
.switch.on .track::after { left: 23px; background: #fff; }
.slider-row { display: flex; align-items: center; gap: 10px; }
.slider-row input[type=range] { flex: 1; accent-color: var(--brand); }
.slider-row .val { width: 56px; text-align: right; font-family: var(--mono); font-size: 12px; }
.search { position: relative; }
.search input { padding-left: 32px; }
.search svg { position: absolute; left: 10px; top: 8px; width: 16px; height: 16px; color: var(--text3); }
.radio-cards { display: grid; gap: 8px; }
.radio-card { border: 1px solid var(--stroke); border-radius: var(--radius-lg); padding: 10px 12px; cursor: pointer; display: flex; gap: 10px; align-items: flex-start; }
.radio-card:hover { border-color: var(--stroke-strong); background: var(--subtle); }
.radio-card.selected { border-color: var(--brand); background: var(--brand-bg); }
.radio-card .rc-title { font-weight: 600; }
.radio-card .rc-desc { font-size: 12px; color: var(--text3); }

/* ---------- cards / tables ---------- */
.card { background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--radius-lg); padding: 16px 20px; box-shadow: var(--shadow2); }
.card.pad0 { padding: 0; overflow: hidden; }
.card.clickable:hover { box-shadow: var(--shadow8); border-color: var(--stroke2); }
.card h3 { margin-bottom: 8px; }
.card .card-sub { color: var(--text3); font-size: 12px; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .v { font-size: 26px; line-height: 32px; font-weight: 600; }
.stat .l { font-size: 12px; color: var(--text3); }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 6px 16px; font-size: 13px; }
.kv .k { color: var(--text3); }
.kv .v { word-break: break-all; }
.kv .v code { white-space: normal; word-break: break-all; }
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th { text-align: left; font-weight: 600; color: var(--text3); font-size: 12px; padding: 8px 12px; border-bottom: 1px solid var(--stroke); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
table.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--subtle2); vertical-align: middle; }
table.tbl tr.clickable:hover td { background: var(--subtle); }
table.tbl tr.selected td { background: var(--brand-bg); }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .actions { white-space: nowrap; text-align: right; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; height: 20px; border-radius: 10px; font-size: 11px; font-weight: 600; background: var(--subtle2); color: var(--text2); white-space: nowrap; }
.badge.success { background: var(--success-bg); color: var(--success); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.warning { background: var(--warning-bg); color: var(--warning); }
.badge.info { background: var(--brand-bg); color: var(--brand); }
.badge.purple { background: var(--purple-bg); color: var(--purple); }
.badge.teal { background: var(--teal-bg); color: var(--teal); }
.badge.outline { background: transparent; border: 1px solid var(--stroke2); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--text3); }
.dot.success { background: var(--success); } .dot.danger { background: var(--danger); } .dot.warning { background: #F7630C; } .dot.info { background: var(--brand); }
.status-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.empty { text-align: center; padding: 48px 24px; color: var(--text3); }
.empty svg { width: 48px; height: 48px; color: var(--stroke-strong); margin-bottom: 12px; }
.empty h3 { color: var(--text); margin-bottom: 4px; }
.msgbar { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--stroke); background: var(--subtle); font-size: 13px; margin-bottom: 12px; }
.msgbar svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.msgbar.info { background: var(--info-bg); border-color: #B4D6FA; }
.msgbar.info svg { color: var(--brand); }
.msgbar.success { background: var(--success-bg); border-color: #9FD89F; }
.msgbar.success svg { color: var(--success); }
.msgbar.warning { background: var(--warning-bg); border-color: #FDCFB4; }
.msgbar.warning svg { color: var(--warning); }
.msgbar.danger { background: var(--danger-bg); border-color: #EEACB2; }
.msgbar.danger svg { color: var(--danger); }
.progress { height: 4px; background: var(--subtle2); border-radius: 2px; overflow: hidden; }
.progress > div { height: 100%; background: var(--brand); transition: width .3s; }
.progress.lg { height: 8px; border-radius: 4px; }
.bar-h { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.bar-h .track { flex: 1; height: 8px; background: var(--subtle2); border-radius: 4px; overflow: hidden; }
.bar-h .track > div { height: 100%; background: var(--brand); }
.bar-h .track > div.warn { background: #F7630C; }
.bar-h .track > div.danger { background: var(--danger); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--stroke); margin-bottom: 16px; }
.tabs button { background: none; border: none; padding: 8px 12px; font-size: 14px; font-weight: 600; color: var(--text3); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); border-bottom-color: var(--brand); }
.pivot { display: inline-flex; border: 1px solid var(--stroke2); border-radius: var(--radius); overflow: hidden; }
.pivot button { background: var(--surface); border: none; padding: 4px 12px; font-size: 13px; cursor: pointer; color: var(--text2); border-right: 1px solid var(--stroke2); }
.pivot button:last-child { border-right: none; }
.pivot button.active { background: var(--brand-bg); color: var(--brand); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 12px; border: 1px solid var(--stroke2); background: var(--surface); font-size: 12px; cursor: pointer; }
.chip.on { background: var(--brand-bg); border-color: var(--brand); color: var(--brand); font-weight: 600; }
.chip .x { cursor: pointer; opacity: .6; }
.filter-pane { width: 240px; flex-shrink: 0; }
.filter-pane h4 { margin: 12px 0 6px; font-size: 12px; text-transform: uppercase; color: var(--text3); letter-spacing: .3px; }
.filter-pane .checkbox { padding: 3px 0; font-size: 13px; }
.model-card { display: flex; flex-direction: column; gap: 8px; min-height: 170px; }
.model-card .mc-head { display: flex; align-items: center; gap: 10px; }
.model-card .mc-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; color: #fff; flex-shrink: 0; }
.model-card .mc-title { font-weight: 600; font-size: 14px; }
.model-card .mc-pub { font-size: 12px; color: var(--text3); }
.model-card .mc-desc { font-size: 12px; color: var(--text2); flex: 1; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.model-card .mc-foot { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tile { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; }
.tile .t-icon { width: 36px; height: 36px; border-radius: 8px; background: var(--brand-bg); color: var(--brand); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tile .t-icon svg { width: 18px; height: 18px; }
.tile .t-title { font-weight: 600; }
.tile .t-desc { font-size: 12px; color: var(--text3); }
.toolbar-search { width: 320px; }
.split { display: grid; grid-template-columns: 380px 1fr; gap: 0; height: 100%; }
.split .left { border-right: 1px solid var(--stroke); overflow-y: auto; background: var(--surface); }
.split .right { overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.section { border-bottom: 1px solid var(--stroke); }
.section-h { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; cursor: pointer; font-weight: 600; user-select: none; }
.section-h:hover { background: var(--subtle); }
.section-h svg { width: 14px; height: 14px; color: var(--text3); transition: transform .15s; }
.section.open .section-h svg { transform: rotate(90deg); }
.section-b { display: none; padding: 4px 16px 16px; }
.section.open .section-b { display: block; }
.section-h .count { font-size: 11px; color: var(--text3); font-weight: 400; margin-left: 6px; }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 10px; max-width: 900px; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg .bubble { padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--stroke); box-shadow: var(--shadow2); max-width: 100%; }
.msg.user .bubble { background: var(--brand-bg); border-color: var(--brand-bg2); }
.msg .bubble p:last-child { margin-bottom: 0; }
.msg .bubble pre { margin: 6px 0; }
.msg .bubble table { border-collapse: collapse; margin: 6px 0; font-size: 13px; }
.msg .bubble td, .msg .bubble th { border: 1px solid var(--stroke); padding: 4px 8px; }
.msg .bubble img { max-width: 420px; border-radius: 8px; display: block; margin: 6px 0; }
.msg .meta { font-size: 11px; color: var(--text3); margin-top: 6px; display: flex; gap: 10px; flex-wrap: wrap; }
.msg .meta a { color: var(--text3); }
.msg .who { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--subtle2); color: var(--text2); font-size: 11px; font-weight: 600; }
.msg.assistant .who { background: var(--brand); color: #fff; }
.msg.system .bubble { background: var(--warning-bg); border-color: #FDCFB4; font-size: 13px; }
.msg .steps { margin-top: 8px; font-size: 12px; }
.msg .step { border: 1px solid var(--stroke); border-radius: var(--radius); margin: 4px 0; background: var(--subtle); }
.msg .step summary { padding: 4px 8px; cursor: pointer; font-family: var(--mono); font-size: 11px; color: var(--text2); }
.msg .step pre { border: none; border-top: 1px solid var(--stroke); border-radius: 0; font-size: 11px; max-height: 240px; }
.msg .cites { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.msg .cite { font-size: 11px; padding: 1px 8px; border-radius: 10px; background: var(--subtle2); color: var(--text2); cursor: pointer; }
.msg .cite:hover { background: var(--brand-bg); color: var(--brand); }
.chat-input { border-top: 1px solid var(--stroke); padding: 12px 24px 16px; background: var(--surface); }
.chat-input .box { border: 1px solid var(--stroke2); border-radius: 8px; padding: 8px 8px 8px 12px; display: flex; gap: 8px; align-items: flex-end; background: var(--surface); }
.chat-input .box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.chat-input textarea { flex: 1; border: none; outline: none; resize: none; min-height: 24px; max-height: 160px; font-size: 14px; line-height: 20px; padding: 2px 0; }
.chat-input .attach { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.typing { display: inline-flex; gap: 3px; align-items: center; height: 20px; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--text3); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
.spinner { width: 16px; height: 16px; border: 2px solid var(--stroke2); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
.spinner.lg { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px; color: var(--text3); }

/* ---------- dialogs / panels / toasts ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 50; display: flex; align-items: center; justify-content: center; }
.dialog { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow64); width: 560px; max-width: calc(100vw - 32px); max-height: calc(100vh - 48px); display: flex; flex-direction: column; }
.dialog.lg { width: 820px; } .dialog.xl { width: 1080px; }
.dialog-h { padding: 20px 24px 8px; display: flex; align-items: center; justify-content: space-between; }
.dialog-h h2 { font-size: 20px; }
.dialog-b { padding: 8px 24px; overflow-y: auto; flex: 1; }
.dialog-f { padding: 16px 24px 20px; display: flex; gap: 8px; justify-content: flex-end; }
.overlay.panel-overlay { justify-content: flex-end; align-items: stretch; background: rgba(0,0,0,.25); }
.panel { width: 600px; max-width: 100vw; background: var(--surface); box-shadow: var(--shadow64); display: flex; flex-direction: column; height: 100%; animation: slidein .2s ease-out; }
.panel.lg { width: 860px; }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--surface); border: 1px solid var(--stroke); border-left: 4px solid var(--brand); border-radius: var(--radius); box-shadow: var(--shadow16); padding: 10px 14px; font-size: 13px; min-width: 280px; max-width: 420px; animation: slidein .2s ease-out; }
.toast.success { border-left-color: var(--success); } .toast.danger { border-left-color: var(--danger); } .toast.warning { border-left-color: var(--warning); }
.menu { position: absolute; background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--radius); box-shadow: var(--shadow16); padding: 4px; z-index: 60; min-width: 200px; }
.menu a, .menu button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 7px 10px; border: none; background: none; font-size: 14px; color: var(--text); cursor: pointer; border-radius: var(--radius); }
.menu a:hover, .menu button:hover { background: var(--subtle); text-decoration: none; }
.menu .menu-h { font-size: 11px; color: var(--text3); padding: 6px 10px 2px; text-transform: uppercase; }
.menu .menu-sep { height: 1px; background: var(--stroke); margin: 4px 0; }
.code-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.code-tabs button { border: 1px solid var(--stroke2); background: var(--surface); border-radius: 12px; padding: 2px 10px; font-size: 12px; cursor: pointer; }
.code-tabs button.active { background: var(--brand-bg); border-color: var(--brand); color: var(--brand); font-weight: 600; }
.copy-wrap { position: relative; }
.copy-wrap .btn { position: absolute; top: 6px; right: 6px; }
.trace-tree .span-row { display: grid; grid-template-columns: 1fr 260px 90px; align-items: center; gap: 8px; padding: 6px 8px; border-bottom: 1px solid var(--subtle2); font-size: 13px; cursor: pointer; }
.trace-tree .span-row:hover { background: var(--subtle); }
.trace-tree .span-row.selected { background: var(--brand-bg); }
.trace-tree .bar { height: 10px; border-radius: 2px; background: var(--brand-bg2); position: relative; }
.trace-tree .bar > div { position: absolute; top: 0; height: 100%; border-radius: 2px; background: var(--brand); }
.trace-tree .bar > div.tool { background: var(--purple); } .trace-tree .bar > div.retrieval { background: var(--teal); } .trace-tree .bar > div.guardrail { background: #F7630C; } .trace-tree .bar > div.agent { background: #107C10; } .trace-tree .bar > div.error { background: var(--danger); }
.kind { display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--brand); margin-right: 6px; }
.kind.tool { background: var(--purple); } .kind.retrieval { background: var(--teal); } .kind.guardrail { background: #F7630C; } .kind.agent { background: #107C10; } .kind.embedding { background: #8764B8; }
.chart-bars { display: flex; align-items: flex-end; gap: 4px; height: 140px; padding-top: 8px; }
.chart-bars .cb { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.chart-bars .cb .b { width: 100%; background: var(--brand); border-radius: 3px 3px 0 0; min-height: 2px; }
.chart-bars .cb .b.alt { background: var(--purple); }
.chart-bars .cb .lbl { font-size: 10px; color: var(--text3); }
.wf-step { border: 1px solid var(--stroke); border-radius: var(--radius-lg); background: var(--surface); padding: 12px 14px; display: flex; gap: 12px; align-items: flex-start; }
.wf-step .n { width: 28px; height: 28px; border-radius: 50%; background: var(--brand-bg); color: var(--brand); font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.wf-arrow { text-align: center; color: var(--text3); margin: 2px 0; }
.wf-step.approval .n { background: var(--warning-bg); color: var(--warning); }
.wf-step.parallel .n { background: var(--purple-bg); color: var(--purple); }
.timeline { border-left: 2px solid var(--stroke); margin-left: 8px; padding-left: 16px; display: flex; flex-direction: column; gap: 10px; }
.timeline .ti { position: relative; font-size: 13px; }
.timeline .ti::before { content: ""; position: absolute; left: -22px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.hero { background: linear-gradient(135deg, #0C3B5E 0%, #0F6CBD 60%, #4F9BE6 100%); color: #fff; border-radius: 12px; padding: 28px 32px; margin-bottom: 20px; }
.hero h1 { color: #fff; }
.hero p { color: rgba(255,255,255,.85); max-width: 720px; }
.hero .btn { background: #fff; border-color: #fff; color: var(--brand); }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.quick .card { cursor: pointer; }
.score { font-weight: 600; font-variant-numeric: tabular-nums; }
.score.good { color: var(--success); } .score.bad { color: var(--danger); } .score.mid { color: var(--warning); }
.json-view { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-word; background: var(--subtle); border: 1px solid var(--stroke); border-radius: var(--radius); padding: 8px 10px; max-height: 320px; overflow: auto; }
.drop { border: 2px dashed var(--stroke2); border-radius: var(--radius-lg); padding: 24px; text-align: center; color: var(--text3); cursor: pointer; }
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-bg); }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.img-grid img { width: 100%; border-radius: 8px; border: 1px solid var(--stroke); }
.yaml { font-family: var(--mono); font-size: 12px; white-space: pre; overflow: auto; background: #1F1F1F; color: #D4D4D4; border-radius: var(--radius); padding: 12px; min-height: 300px; }
.yaml .k { color: #9CDCFE; } .yaml .s { color: #CE9178; }
.playground-layout { display: grid; grid-template-columns: 340px 1fr; height: 100%; }
.playground-layout .config { border-right: 1px solid var(--stroke); overflow-y: auto; background: var(--surface); }
.playground-layout .main { display: flex; flex-direction: column; min-width: 0; }
.playground-toolbar { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-bottom: 1px solid var(--stroke); background: var(--surface); flex-wrap: wrap; }
.help { color: var(--text3); font-size: 12px; cursor: help; border-bottom: 1px dotted var(--text3); }
.notice-lab { font-size: 11px; color: var(--text3); }
.keyvalue-list { display: flex; flex-direction: column; gap: 6px; }
.keyvalue-list .row input { flex: 1; }
.top-actions { display: flex; gap: 8px; }
.compact-list { display: flex; flex-direction: column; }
.compact-list .item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--subtle2); cursor: pointer; }
.compact-list .item:hover { background: var(--subtle); }
.compact-list .item.active { background: var(--brand-bg); }
.compact-list .item .t { font-weight: 600; font-size: 13px; }
.compact-list .item .s { font-size: 11px; color: var(--text3); }
.severity { display: inline-flex; gap: 2px; }
.severity i { width: 10px; height: 10px; border-radius: 2px; background: var(--subtle2); }
.severity i.on { background: var(--danger); }
.severity i.on.low { background: #F7630C; }
.severity i.on.safe { background: var(--success); }
kbd { font-family: var(--mono); font-size: 11px; background: var(--subtle2); border: 1px solid var(--stroke2); border-bottom-width: 2px; border-radius: 3px; padding: 0 5px; }
@media (max-width: 900px) { .leftnav { display: none; } .split, .playground-layout { grid-template-columns: 1fr; } .split .left, .playground-layout .config { display: none; } .page { padding: 16px; } .topnav a { padding: 0 8px; font-size: 13px; } .project-switcher { max-width: 160px; } }
