:root {
  color-scheme: light;
  --navy: #082d3d;
  --navy-2: #0c4258;
  --accent: #079bd3;
  --accent-dark: #087da9;
  --accent-soft: #e6f6fc;
  --canvas: #f3f8fb;
  --surface: #ffffff;
  --surface-muted: #f8fbfd;
  --line: #d8e4ea;
  --line-strong: #c4d4dc;
  --text: #102a3a;
  --muted: #617887;
  --success: #09865f;
  --success-soft: #e7f7f1;
  --warning: #a86c06;
  --warning-soft: #fff5df;
  --danger: #c43d47;
  --danger-soft: #fff0f1;
  --shadow: 0 8px 24px rgba(12, 49, 67, 0.07);
  --radius: 13px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
}

* { box-sizing: border-box; }
html, body, #app { width: 100%; min-height: 100%; margin: 0; }
body { color: var(--text); background: var(--canvas); line-height: 1.45; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; }
.icon { display: block; flex: 0 0 auto; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 14px 14px; background: var(--navy); color: #d4eaf2; overflow-y: auto; z-index: 20; }
.brand { display: flex; align-items: center; gap: 11px; min-height: 56px; padding: 0 10px 15px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand__symbol { width: 38px; height: 38px; flex: 0 0 auto; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 6px 10px rgba(0,165,224,.22)); }
.brand strong, .brand small { display: block; }
.brand strong { color: #fff; font-size: 17px; letter-spacing: -.02em; }
.brand small { margin-top: 1px; color: #85bbcf; font-size: 10px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.nav { display: flex; flex: 1; flex-direction: column; gap: 4px; padding-top: 18px; }
.nav__caption { padding: 0 11px 6px; color: #709aaa; font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.nav__caption--admin { margin-top: 14px; }
.nav__item { width: 100%; min-height: 44px; display: flex; align-items: center; gap: 11px; padding: 0 12px; border: 1px solid transparent; border-radius: 11px; color: #a9c6d1; background: transparent; font-size: 13px; font-weight: 650; text-align: left; transition: .16s ease; }
.nav__item:hover { color: #fff; background: rgba(255,255,255,.055); }
.nav__item.is-active { color: #fff; border-color: rgba(43,189,239,.2); background: rgba(0,154,211,.17); box-shadow: inset 3px 0 0 #13b3ea; }
.nav__item.is-active .icon { color: #45c9f3; }
.sidebar__footer { display: flex; align-items: center; gap: 9px; margin-top: 16px; padding: 11px 11px 1px; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar__footer strong, .sidebar__footer small { display: block; }
.sidebar__footer strong { color: #d6ebf2; font-size: 12px; }
.sidebar__footer small { color: #749bab; font-size: 10px; }
.system-dot { width: 9px; height: 9px; border-radius: 50%; background: #23c78d; box-shadow: 0 0 0 4px rgba(35,199,141,.12); }

.workspace { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 12; height: 62px; display: flex; align-items: center; gap: 12px; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(10px); }
.topbar > div { min-width: 0; }
.topbar strong, .topbar span { display: block; }
.topbar strong { font-size: 14px; }
.topbar span { color: var(--muted); font-size: 11px; }
.key-button { width: 36px; height: 36px; display: grid; place-items: center; margin-left: auto; border: 1px solid #bce2f1; border-radius: 10px; color: #0075a5; background: #eaf8fd; font-size: 11px; font-weight: 800; }
.mobile-menu { display: none; border: 0; background: transparent; font-size: 22px; color: var(--text); }
.content { width: min(1640px, 100%); margin: 0 auto; padding: 26px 30px 44px; }

.page-heading { min-height: 46px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.page-heading h1 { margin: 0; font-size: clamp(25px, 2vw, 32px); line-height: 1.1; letter-spacing: -.035em; }
.kicker { margin: 0; color: #027bac; font-size: 12px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
h2 { margin: 0; font-size: 18px; letter-spacing: -.015em; }
p { margin-top: 0; }

.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 16px; border: 1px solid transparent; border-radius: 10px; font-size: 13px; font-weight: 750; transition: .15s ease; }
.button--primary { color: #fff; background: linear-gradient(145deg, var(--accent), #058bc0); box-shadow: 0 8px 18px rgba(2,148,202,.18); }
.button--primary:hover { background: var(--accent-dark); transform: translateY(-1px); }
.button--secondary { color: var(--text); border-color: var(--line-strong); background: #fff; }
.button--secondary:hover { border-color: #8ebccc; background: #f8fcfd; }
.button--wide { width: 100%; }
.text-button { margin: 12px auto 0; border: 0; color: var(--muted); background: transparent; font-size: 13px; }
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: #fff; }
.icon-button:hover { color: var(--accent-dark); border-color: #9ed3e7; }
.icon-button--danger:hover { color: var(--danger); border-color: #efb4b9; }

.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.card__header { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card__header p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.card__body { padding: 20px; }
.two-columns { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 16px; margin-top: 16px; }
.stack { display: flex; flex-direction: column; gap: 18px; }

.status-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.status-card { min-height: 104px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.status-card__top { display: flex; align-items: center; justify-content: space-between; gap: 9px; margin-bottom: 17px; color: var(--muted); font-size: 12px; }
.status-card > strong { display: block; font-size: 13px; line-height: 1.4; }
.badge { display: inline-flex; align-items: center; gap: 7px; width: max-content; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 780; white-space: nowrap; }
.badge i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--success { color: var(--success); background: var(--success-soft); }
.badge--warning { color: var(--warning); background: var(--warning-soft); }
.badge--danger { color: var(--danger); background: var(--danger-soft); }
.badge--neutral { color: #58717e; background: #edf3f6; }
.notice { display: flex; align-items: center; gap: 12px; min-height: 58px; margin-top: 14px; padding: 11px 15px; border: 1px solid; border-radius: 12px; }
.notice > .icon { width: 24px; height: 24px; }
.notice > div { flex: 1; }
.notice strong { display: block; font-size: 14px; }
.notice p { margin: 2px 0 0; font-size: 13px; color: currentColor; opacity: .86; }
.notice--success { color: #087555; border-color: #bce7d8; background: #eaf8f3; }
.notice--warning { color: #8a5b08; border-color: #f0d49b; background: #fff8e9; }
.notice--danger { color: #a9343e; border-color: #efbdc1; background: #fff2f3; }
.notice--info { color: #176b8b; border-color: #bce2ef; background: #edf9fd; }
.notice .button { margin-left: auto; }

.metric-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; margin-top: 16px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.metric-strip > div { min-height: 58px; padding: 5px 22px; border-right: 1px solid var(--line); }
.metric-strip > div:first-child { padding-left: 4px; }
.metric-strip > div:last-child { border-right: 0; }
.metric-strip span, .metric-strip strong { display: block; }
.metric-strip span { color: var(--muted); font-size: 12px; }
.metric-strip strong { margin-top: 5px; font-size: 23px; }

.steps { display: grid; gap: 20px; margin: 0; padding: 0; list-style: none; }
.steps li { display: grid; grid-template-columns: 34px 1fr; gap: 13px; align-items: start; }
.steps li > span { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; color: #057da8; background: #e6f6fc; font-size: 13px; font-weight: 800; }
.steps strong { font-size: 14px; }
.steps p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.metrics, .details { margin: 0; }
.metrics > div, .details > div { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 54px; border-bottom: 1px solid var(--line); }
.metrics > div:last-child, .details > div:last-child { border-bottom: 0; }
.metrics dt, .details dt { color: var(--muted); font-size: 13px; }
.metrics dd, .details dd { margin: 0; font-weight: 750; text-align: right; }
.metrics dd { font-size: 22px; }

.dialog-layout { height: calc(100dvh - 148px); min-height: 430px; display: grid; grid-template-columns: 320px minmax(0, 1fr); border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); overflow: hidden; }
.chat-list { min-width: 0; border-right: 1px solid var(--line); overflow-y: auto; }
.chat-list > header { position: sticky; top: 0; z-index: 2; min-height: 56px; display: flex; align-items: center; gap: 8px; padding: 0 16px; border-bottom: 1px solid var(--line); background: #fff; }
.chat-list > header span { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; color: #067da9; background: var(--accent-soft); font-size: 12px; font-weight: 800; }
.chat-list__item { position: relative; width: 100%; min-height: 92px; display: grid; grid-template-columns: 39px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 13px 13px; border: 0; border-bottom: 1px solid var(--line); color: var(--text); background: #fff; text-align: left; }
.chat-list__item:hover { background: #f8fbfd; }
.chat-list__item.is-active { background: #f1f9fc; box-shadow: inset 4px 0 0 var(--accent); }
.chat-list__item > span:nth-child(2) { min-width: 0; }
.chat-list__item strong, .chat-list__item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-list__item strong { font-size: 13px; }
.chat-list__item small { margin: 2px 0 6px; color: var(--muted); font-size: 11px; }
.chat-list__item time { color: #8396a1; font-size: 10px; }
.chat-list__item .badge { max-width: 100%; padding: 3px 8px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: #34637a; background: #e9f0f4; font-size: 12px; font-weight: 800; }
.conversation { min-width: 0; min-height: 0; height: 100%; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; background: #f6f9fb; overflow: hidden; }
.conversation__header { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 9px 16px; border-bottom: 1px solid var(--line); background: #fff; }
.conversation__header strong, .conversation__header span { display: block; }
.conversation__header strong { font-size: 14px; }
.conversation__header span { color: var(--muted); font-size: 11px; }
.conversation__actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.assistant-select { width: min(245px, 24vw); min-height: 40px; padding: 0 30px 0 10px; border: 1px solid var(--line-strong); border-radius: 10px; color: var(--text); background: #fff; font-size: 12px; outline: none; }
.assistant-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(7,155,211,.12); }
.assistant-suggestion { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid #bde4f1; background: #ecf9fd; }
.assistant-suggestion.is-hidden { display: none; }
.assistant-suggestion > div { min-width: 0; flex: 1; }
.assistant-suggestion strong, .assistant-suggestion span { display: block; }
.assistant-suggestion strong { font-size: 12px; }
.assistant-suggestion span { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.assistant-suggestion .button { min-height: 32px; padding-inline: 11px; font-size: 11px; }
.message-list { min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 15px 18px; overflow-y: auto; overscroll-behavior: contain; }
.message { width: min(72%, 680px); padding: 10px 13px 8px; border: 1px solid; border-radius: 12px; background: #fff; }
.message--customer { align-self: flex-start; border-color: #dce5ea; }
.message--ai { align-self: flex-end; border-color: #bfe5f2; background: #eaf8fd; }
.message--manager { align-self: flex-end; border-color: #f0d5b3; background: #fff6ea; }
.message__meta { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.message__meta strong { font-size: 11px; letter-spacing: .01em; }
.message__meta time { color: #8596a0; font-size: 10px; }
.message p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
.message > small { display: block; margin-top: 6px; color: var(--success); font-size: 11px; text-align: right; }
.composer { position: sticky; bottom: 0; z-index: 3; display: grid; grid-template-columns: minmax(0, 1fr) 42px; gap: 9px; padding: 9px 12px; border-top: 1px solid var(--line); background: #fff; }
.composer textarea { min-height: 42px; max-height: 110px; resize: vertical; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px; color: var(--text); background: #fff; outline: none; }
.composer textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(7,155,211,.12); }
.composer button { width: 42px; height: 42px; display: grid; place-items: center; border: 0; border-radius: 10px; color: #fff; background: var(--accent); }

.assistant-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.assistant-panel { max-width: 980px; }
.assistant-workspace { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 14px; align-items: start; }
.assistant-roster { position: sticky; top: 78px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); overflow: hidden; }
.assistant-roster__head { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.assistant-roster__head strong { font-size: 14px; }
.assistant-roster__head span { color: var(--muted); font-size: 11px; }
.assistant-roster__list { max-height: calc(100dvh - 250px); overflow-y: auto; }
.assistant-roster__item { width: 100%; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 9px; align-items: start; padding: 12px 13px; border: 0; border-bottom: 1px solid var(--line); color: var(--text); background: #fff; text-align: left; }
.assistant-roster__item:hover { background: #f7fbfd; }
.assistant-roster__item.is-active { background: #edf8fc; box-shadow: inset 3px 0 0 var(--accent); }
.assistant-roster__item > span:nth-child(2) { min-width: 0; }
.assistant-roster__item strong, .assistant-roster__item small { display: block; }
.assistant-roster__item strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.assistant-roster__item small { display: -webkit-box; margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.assistant-roster__item .badge { grid-column: 2; padding: 3px 7px; font-size: 10px; }
.assistant-avatar { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 10px; color: #0879a4; background: var(--accent-soft); font-size: 10px; font-weight: 850; }
.global-ai-control { min-height: 58px; display: flex; align-items: center; gap: 10px; padding: 11px 13px; cursor: pointer; }
.global-ai-control input { width: 17px; height: 17px; accent-color: var(--accent); }
.global-ai-control strong, .global-ai-control small { display: block; }
.global-ai-control strong { font-size: 12px; }
.global-ai-control small { margin-top: 1px; color: var(--muted); font-size: 10px; }
.assistant-editor { min-width: 0; display: grid; gap: 14px; }
.assistant-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.assistant-form-grid__wide { grid-column: 1 / -1; }
.assistant-form-grid textarea.routing-description, textarea.routing-description { min-height: 78px; }
.intent-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.intent-field legend { margin-bottom: 7px; color: #263f4d; font-size: 12px; font-weight: 750; }
.check-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.check-grid label, .assistant-access label { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-muted); font-size: 11px; cursor: pointer; }
.check-grid input, .assistant-access input { accent-color: var(--accent); }
.assistant-switches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.assistant-test { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.assistant-test textarea.input { min-height: 76px; }
.assistant-test .button { min-width: 110px; }
.assistant-test-result { margin-top: 14px; padding: 14px; border: 1px solid #bfe2ef; border-radius: 11px; background: #f2fbfe; }
.assistant-test-result__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.assistant-test-result__head span, .assistant-test-result__head strong { display: block; }
.assistant-test-result__head span { color: var(--muted); font-size: 10px; }
.assistant-test-result__head strong { margin-top: 2px; font-size: 14px; }
.assistant-test-result__route { margin: 8px 0; color: var(--muted); font-size: 11px; }
.assistant-test-result blockquote { margin: 10px 0; padding: 11px 12px; border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; background: #fff; font-size: 13px; white-space: pre-wrap; }
.assistant-test-result > small { color: var(--muted); font-size: 10px; }
.prompt-state { width: max-content; padding: 4px 8px; border-radius: 999px; color: var(--success) !important; background: var(--success-soft); }
.prompt-state.has-draft { color: var(--warning) !important; background: var(--warning-soft); }
.prompt-history { padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; }
.prompt-history summary { color: var(--accent-dark); font-size: 12px; font-weight: 750; }
.prompt-history > div { display: grid; gap: 7px; margin-top: 10px; }
.prompt-history article { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 7px; border-top: 1px solid var(--line); }
.prompt-history article strong, .prompt-history article small { display: block; }
.prompt-history article strong { font-size: 11px; }
.prompt-history article small { color: var(--muted); font-size: 10px; }
.prompt-history .button { min-height: 30px; padding-inline: 10px; font-size: 10px; }
.analytics-table { overflow-x: auto; }
.analytics-table__head, .analytics-table > div { min-width: 620px; display: grid; grid-template-columns: minmax(180px, 1fr) repeat(4, 90px); gap: 10px; align-items: center; }
.analytics-table__head { padding: 0 8px 8px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.analytics-table > div:not(.analytics-table__head) { min-height: 42px; padding: 7px 8px; border-top: 1px solid var(--line); font-size: 11px; }
.feedback-score b { color: var(--success); }
.feedback-score em { color: var(--danger); font-style: normal; }
.test-conversation { max-height: 280px; display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-muted); overflow-y: auto; }
.test-conversation__empty { padding: 24px; color: var(--muted); font-size: 11px; text-align: center; }
.test-turn { width: min(82%, 680px); padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.test-turn--assistant { align-self: flex-end; border-color: #bfe5f2; background: #eaf8fd; }
.test-turn strong { font-size: 10px; }
.test-turn p { margin: 3px 0 0; font-size: 12px; white-space: pre-wrap; }
.test-actions { display: flex; justify-content: flex-end; }
.test-sources { margin: 8px 0; font-size: 11px; }
.test-sources ul { display: grid; gap: 6px; margin: 8px 0; padding: 0; list-style: none; }
.test-sources li { padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.test-sources li strong, .test-sources li span, .test-sources li small { display: block; }
.test-sources li span, .test-sources li small { margin-top: 2px; color: var(--muted); }
.batch-test { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.batch-test > div { flex: 1; }
.batch-test strong, .batch-test span { display: block; }
.batch-test strong { font-size: 13px; }
.batch-test span { color: var(--muted); font-size: 10px; }
.batch-summary { margin-top: 10px; color: var(--success); font-size: 12px; }
.batch-summary.has-failures { color: var(--danger); }
.batch-results { display: grid; gap: 6px; margin-top: 8px; }
.batch-results article { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 9px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; }
.batch-results strong, .batch-results small { display: block; }
.batch-results strong { font-size: 11px; }
.batch-results small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.batch-mark { font-size: 9px; font-weight: 850; }
.batch-mark--pass { color: var(--success); }
.batch-mark--fail { color: var(--danger); }
.form-stack { display: flex; flex-direction: column; gap: 15px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { color: #263f4d; font-size: 12px; font-weight: 750; }
.field > small { color: var(--muted); font-size: 11px; }
.input { width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--text); background: #fff; outline: none; transition: .15s ease; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(7,155,211,.12); }
textarea.input { min-height: 150px; resize: vertical; line-height: 1.5; }
textarea.prompt-input { min-height: 190px; }
.switch { display: flex; align-items: center; gap: 11px; min-height: 56px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-muted); cursor: pointer; }
.switch > input { position: absolute; opacity: 0; pointer-events: none; }
.switch > span { position: relative; width: 42px; height: 24px; flex: 0 0 auto; border-radius: 999px; background: #aebdc4; transition: .15s ease; }
.switch > span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.18); transition: .15s ease; }
.switch > input:checked + span { background: var(--accent); }
.switch > input:checked + span::after { transform: translateX(18px); }
.switch strong, .switch small { display: block; }
.switch strong { font-size: 13px; }
.switch small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.prompt-guide { margin-top: 1px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: var(--surface-muted); }
.prompt-guide strong { display: block; color: var(--text); font-size: 12px; }
.prompt-guide ul { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 24px; margin: 7px 0 0; padding-left: 18px; font-size: 11px; }
.system-level { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-muted); }
.system-level span { color: var(--muted); font-size: 12px; }
.system-level strong { font-size: 12px; }
.system-level em { margin-left: auto; color: var(--success); font-size: 11px; font-style: normal; font-weight: 700; }
.feature-list { display: grid; gap: 18px; margin: 0; padding: 0; list-style: none; }
.feature-list li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; color: var(--success); }
.feature-list strong, .feature-list small { display: block; color: var(--text); }
.feature-list strong { font-size: 13px; }
.feature-list small { margin-top: 2px; color: var(--muted); font-size: 12px; }

.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; margin-bottom: 14px; }
.mini-stats > div { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.mini-stats span, .mini-stats strong { display: block; }
.mini-stats span { color: var(--muted); font-size: 12px; }
.mini-stats strong { margin-top: 3px; font-size: 22px; }
.document-list { display: grid; gap: 10px; }
.document-list article { min-height: 66px; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto 36px 36px; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 11px; }
.document-list article > div { min-width: 0; }
.document-list strong, .document-list small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.document-list strong { font-size: 14px; }
.document-list small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.file-icon, .channel-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; color: #0879a4; background: var(--accent-soft); font-size: 11px; font-weight: 800; }
.drop-zone { min-height: 120px; display: grid; place-items: center; align-content: center; padding: 20px; border: 1px dashed #88bed2; border-radius: 12px; color: #26718e; background: #f2fbfe; cursor: pointer; }
.drop-zone input { max-width: 100%; }
.drop-zone strong { margin-top: 8px; }
.drop-zone small { color: var(--muted); }
.document-access { min-height: 34px; padding-inline: 11px; font-size: 11px; }
.assistant-access { display: flex; flex-wrap: wrap; gap: 7px; }
.assistant-access p { width: 100%; margin: 0 0 2px; color: var(--muted); font-size: 11px; }

.channel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.channel-grid article { min-height: 64px; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 11px; }
.channel-grid strong, .channel-grid small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-grid strong { font-size: 14px; }
.channel-grid small { color: var(--muted); font-size: 12px; }

.tabs { display: flex; gap: 4px; width: max-content; max-width: 100%; margin-bottom: 14px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: #eaf1f5; overflow-x: auto; }
.tabs button { min-height: 34px; padding: 0 13px; border: 0; border-radius: 8px; color: #5b7180; background: transparent; font-size: 12px; font-weight: 730; white-space: nowrap; }
.tabs button.is-active { color: #075d7d; background: #fff; box-shadow: 0 3px 10px rgba(14,50,66,.08); }
.advanced { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }
.advanced summary { color: #0879a4; font-size: 13px; font-weight: 750; cursor: pointer; }
.advanced form { margin-top: 18px; }
.technical-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.technical-form__wide { grid-column: 1 / -1; }
.help { position: relative; width: 18px; height: 18px; display: inline-grid; place-items: center; border: 1px solid #9dcddb; border-radius: 50%; color: #087da9; font-size: 11px; font-weight: 800; cursor: help; }
.help > span { position: absolute; bottom: calc(100% + 8px); left: 50%; z-index: 10; width: 230px; padding: 10px 11px; border-radius: 9px; color: #fff; background: #173e50; font-size: 12px; font-weight: 500; line-height: 1.4; opacity: 0; visibility: hidden; transform: translateX(-50%) translateY(4px); transition: .12s ease; box-shadow: 0 8px 24px rgba(0,0,0,.16); }
.help:hover > span, .help:focus > span { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

.diagnostic-list { display: grid; gap: 12px; }
.diagnostic-list > article { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px 17px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.diagnostic-list article > div:first-child { display: flex; align-items: center; gap: 13px; color: var(--success); }
.diagnostic-list strong, .diagnostic-list small { display: block; color: var(--text); }
.diagnostic-list small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.diagnostic-list details { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 10px; }
details summary { cursor: pointer; }
pre { max-height: 360px; margin: 10px 0 0; padding: 14px; border-radius: 10px; color: #d7f2fb; background: #102f3c; font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow: auto; }
.runs { overflow-x: auto; }
.runs__head, .run > summary { min-width: 760px; display: grid; grid-template-columns: 130px 130px minmax(260px, 1fr) 80px; gap: 14px; align-items: center; }
.runs__head { padding: 0 14px 10px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.run { border-top: 1px solid var(--line); }
.run > summary { min-height: 54px; padding: 8px 12px; list-style: none; cursor: pointer; }
.run > summary::-webkit-details-marker { display: none; }
.run > summary time, .run > summary > span { font-size: 12px; }
.run > summary > strong { text-align: right; }
.run__details { padding: 0 14px 18px; }
.run__details .details { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.run__details .details > div { min-height: 58px; display: block; padding: 10px; border: 1px solid var(--line); border-radius: 9px; }
.run__details .details dd { margin-top: 4px; text-align: left; font-size: 12px; }
.run-sources { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0; padding: 0; list-style: none; }
.run-sources li { display: flex; align-items: center; gap: 7px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px; font-size: 10px; }
.run-sources span { color: var(--muted); }
.routing-feedback { display: flex; align-items: center; gap: 7px; margin-top: 10px; }
.routing-feedback > span { margin-right: auto; color: var(--muted); font-size: 11px; }
.routing-feedback .button { min-height: 30px; padding-inline: 11px; font-size: 10px; }

.empty { min-height: 280px; display: grid; place-items: center; align-content: center; padding: 30px; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); background: rgba(255,255,255,.6); text-align: center; }
.empty strong { color: var(--text); }
.empty p { margin: 5px 0 0; font-size: 13px; }
.empty--small { min-height: 150px; border: 0; background: transparent; }
.loading-card { min-height: 180px; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.spinner { width: 20px; height: 20px; border: 2px solid #cce7f0; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(4,29,40,.62); backdrop-filter: blur(4px); }
.modal { position: relative; width: min(480px, 100%); max-height: calc(100dvh - 40px); display: flex; flex-direction: column; gap: 16px; padding: 28px; border: 1px solid #cae0e9; border-radius: 18px; background: #fff; box-shadow: 0 24px 80px rgba(0,26,38,.3); overflow-y: auto; }
.modal h2 { font-size: 23px; }
.modal > p { margin: -8px 0 2px; color: var(--muted); font-size: 13px; }
.modal__close { position: absolute; top: 15px; right: 15px; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 9px; color: var(--muted); background: #f0f5f7; }
.modal__mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: #fff; background: var(--accent); font-size: 24px; }
#toast-root { position: fixed; top: 18px; right: 18px; z-index: 150; display: grid; gap: 9px; }
.toast { width: min(380px, calc(100vw - 36px)); padding: 13px 16px; border: 1px solid; border-radius: 12px; background: #fff; box-shadow: 0 12px 35px rgba(0,30,43,.18); font-size: 13px; font-weight: 650; animation: toast-in .18s ease-out; }
.toast--success { color: var(--success); border-color: #ace0ce; background: #effaf6; }
.toast--danger { color: var(--danger); border-color: #edb7bc; background: #fff2f3; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

@media (max-width: 1250px) {
  .app-shell { grid-template-columns: 220px minmax(0, 1fr); }
  .content { padding-inline: 22px; }
  .status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dialog-layout { grid-template-columns: 290px minmax(0, 1fr); }
  .two-columns, .assistant-grid { grid-template-columns: 1fr; }
  .assistant-workspace { grid-template-columns: 240px minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: -280px; width: 272px; transition: left .2s ease; box-shadow: 12px 0 30px rgba(0,0,0,.18); }
  .menu-open .sidebar { left: 0; }
  .menu-open::after { content: ""; position: fixed; inset: 0; z-index: 15; background: rgba(0,26,37,.48); }
  .mobile-menu { display: block; }
  .content { padding: 22px 18px 38px; }
  .dialog-layout { height: calc(100dvh - 142px); min-height: 480px; grid-template-columns: 1fr; grid-template-rows: minmax(130px, 32%) minmax(0, 1fr); }
  .chat-list { max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .conversation { min-height: 0; }
  .page-heading { min-height: 42px; }
  .assistant-workspace { grid-template-columns: 1fr; }
  .assistant-roster { position: static; }
  .assistant-roster__list { max-height: 260px; }
}

@media (max-width: 640px) {
  :root { font-size: 14px; }
  .topbar { height: 64px; padding: 0 15px; }
  .content { padding: 20px 12px 34px; }
  .page-heading { display: block; margin-bottom: 18px; }
  .page-heading .button { width: 100%; margin-top: 16px; }
  .status-grid, .mini-stats, .channel-grid, .technical-form, .metric-strip { grid-template-columns: 1fr; }
  .status-card { min-height: 96px; }
  .card__header, .card__body { padding: 16px; }
  .metric-strip > div { padding: 10px 4px; border-right: 0; border-bottom: 1px solid var(--line); }
  .metric-strip > div:last-child { border-bottom: 0; }
  .document-list article { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .document-list .badge { grid-column: 2; }
  .document-list .document-access { grid-column: 2; width: max-content; }
  .document-list .icon-button { grid-row: 1; }
  .message { width: 92%; }
  .conversation__header { align-items: flex-start; flex-direction: column; }
  .conversation__actions { width: 100%; align-items: stretch; flex-direction: column; }
  .conversation__header .button, .assistant-select { width: 100%; }
  .tabs { width: 100%; }
  .run__details .details { grid-template-columns: 1fr 1fr; }
  .assistant-form-grid, .assistant-switches, .assistant-test { grid-template-columns: 1fr; }
  .assistant-test .button { width: 100%; }
  .prompt-guide ul { grid-template-columns: 1fr; }
  .system-level { align-items: flex-start; flex-wrap: wrap; }
  .system-level em { width: 100%; margin-left: 0; }
  .assistant-suggestion { align-items: stretch; flex-wrap: wrap; }
  .assistant-suggestion > div { width: 100%; flex-basis: 100%; }
  .batch-test { align-items: stretch; flex-direction: column; }
  .batch-results article { grid-template-columns: 42px minmax(0, 1fr); }
  .batch-results .badge { grid-column: 2; }
}
