:root {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #20242a;
    background: #f5f6f7;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; }
.topbar { height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; background: #fff; border-bottom: 1px solid #e3e5e8; }
.brand { font-weight: 700; text-decoration: none; }
.nav { display: flex; gap: 20px; align-items: center; }
.nav a, .link-button { text-decoration: none; color: #49505a; }
.inline-form { display: inline; margin: 0; }
.link-button { border: 0; background: transparent; padding: 0; font: inherit; cursor: pointer; }
.page { max-width: 1050px; margin: 0 auto; padding: 32px 24px; }
.login-card, .card { background: #fff; border: 1px solid #e1e4e8; border-radius: 14px; padding: 24px; }
.login-card { max-width: 420px; margin: 10vh auto; text-align: center; }
.stacked-form { display: grid; gap: 16px; }
.stacked-form label { display: grid; gap: 7px; text-align: left; font-weight: 600; }
input, textarea, select { width: 100%; padding: 11px 12px; border: 1px solid #cfd4da; border-radius: 9px; background: #fff; font: inherit; }
textarea { resize: vertical; }
button { padding: 9px 14px; border-radius: 9px; border: 1px solid #cfd4da; background: #fff; cursor: pointer; }
button.primary { background: #20242a; color: #fff; border-color: #20242a; }
.muted { color: #6c7480; }
.avatar { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; font-weight: 700; }
.avatar-placeholder { background: #e7eaee; color: #49505a; }
.agent-header { display: flex; gap: 16px; align-items: center; margin-bottom: 22px; }
.agent-header h1, .agent-header p { margin: 0 0 4px; }
.chat-panel { background: #fff; border: 1px solid #e1e4e8; border-radius: 14px; overflow: hidden; }
.messages { min-height: 430px; max-height: 62vh; overflow-y: auto; padding: 22px; }
.empty-state { color: #8a919b; text-align: center; padding: 120px 0; }
.message { max-width: 82%; padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; white-space: pre-wrap; }
.message.user { margin-left: auto; background: #eef0f2; }
.message.assistant { margin-right: auto; background: #f8f8f8; border: 1px solid #eceef0; }
.message-role { font-size: .78rem; font-weight: 700; color: #6c7480; margin-bottom: 6px; }
.sources { display: grid; gap: 4px; margin-top: 10px; font-size: .85rem; }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; padding: 16px; border-top: 1px solid #e5e7ea; }
.chat-form textarea { min-height: 74px; }
.skill-row { display: flex; justify-content: space-between; gap: 18px; align-items: center; padding: 14px 0; border-top: 1px solid #eceef0; }
.skill-row:first-of-type { border-top: 0; }
.badge { display: inline-block; padding: 2px 7px; border-radius: 999px; background: #e7eaee; font-size: .8rem; }
.checkbox { grid-template-columns: auto 1fr !important; align-items: center; }
.checkbox input { width: auto; }
.flash { padding: 10px 12px; border-radius: 8px; margin-bottom: 14px; background: #eef0f2; }
.flash.error { background: #f5e7e7; }
.flash.success { background: #e8f2ea; }
@media (max-width: 700px) {
    .topbar { height: auto; padding: 16px; align-items: flex-start; gap: 12px; }
    .nav { flex-wrap: wrap; justify-content: flex-end; }
    .page { padding: 22px 14px; }
    .message { max-width: 94%; }
    .chat-form { grid-template-columns: 1fr; }
}
.chat-input-stack { display: grid; gap: 8px; }
.mode-label { display: flex; gap: 8px; align-items: center; font-size: .84rem; color: #6c7480; }
.mode-label select { width: auto; min-width: 210px; padding: 7px 9px; }
.workflow-meta { margin-top: 9px; font-size: .76rem; color: #7a828d; }
.route-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.route-card { border: 1px solid #e1e4e8; border-radius: 10px; padding: 14px; display: grid; gap: 10px; }
.route-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.route-flags { font-size: .82rem; }
